I recently encountered CSCvi72804 which will cause unsuppress-able faults that are auto-generated if you have used a fabric id value other than "1". Apparently, I need mental help and couldn't just let it go so I ended up writing a script to help me suppress these faults. According to TAC, my only other options were to upgrade my ACI fabric to 3.2 or wipe the whole production datacenter and build it with a fabric id value of "1". No thanks for those other options.
This script will put your fault suppression inside the Fabric tab's monitoring policy. If you want it elsewhere, you will need to modify the script to reference/create a "FaultTarget" object that lives under the other type of policy.
The only other things you might need to change if you are attempting to suppress another fault are in the static variable section of the script. These values affect where the GUI will store the fault suppression policies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Environment Python 2.7 Windows 10 | |
#APIC 3.1(2o) | |
from cobra.mit.request import ConfigRequest | |
from cobra.internal.codec.jsoncodec import toJSONStr | |
from cobra.model.mon import FabricTarget | |
from cobra.model.fault import SevAsnP | |
#Import custom login module | |
import aci_auth | |
# Suppress HTTP Warnings | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
##########STATIC VARIABLES################ | |
APIC_URL = 'https://APIC_URL' | |
FAULT_TARGET_PARENT_DN = "uni/fabric/monfab-default" | |
FAULT_TARGET_SCOPE = "dhcpClientIf" | |
FAULT_CODE = "F2543" | |
FAULT_NAME = "fltDhcpClientInvalidConfiguration" | |
FAULT_DESC = "Added with script to suppress faults from CSCvi72804" | |
########################################## | |
#URL for APIC server | |
#Load creds for APIC server | |
creds = open('../creds/creds.txt','r') | |
username = creds.readline().strip() | |
password = creds.readline().strip() | |
#Auth and login | |
moDir = aci_auth.aci_login(APIC_URL, username, password) | |
#Use an existing FabricTarget scope to contain our custom fault suppression | |
fabricTarget_obj = FabricTarget(FAULT_TARGET_PARENT_DN,scope=FAULT_TARGET_SCOPE) | |
sevAsnP_obj = SevAsnP(fabricTarget_obj.dn,code=FAULT_CODE,name=FAULT_NAME,initial='squelched',descr=FAULT_DESC) | |
print "\n",toJSONStr(sevAsnP_obj,includeAllProps=True) | |
#Commit individually | |
config_req = ConfigRequest() | |
config_req.addMo(fabricTarget_obj) | |
config_req.addMo(sevAsnP_obj) | |
#Commit | |
moDir.commit(config_req) | |
#Logout | |
aci_auth.aci_logout(moDir) | |
print "DONE" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/Python27/python | |
#Environment Python 2.7 Windows 10 ACI 2.3(1f) | |
#Simple module for ACI login and logout | |
from cobra.mit.access import MoDirectory | |
from cobra.mit.session import LoginSession | |
# Suppress HTTPS Warnings | |
import urllib3 | |
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning) | |
def aci_login(apic_url, username, password): | |
#Create login session and actually login | |
loginSession = LoginSession(apic_url, username, password) | |
moDir = MoDirectory(loginSession) | |
moDir.login() | |
return moDir | |
def aci_logout(moDir): | |
#Logout | |
moDir.logout() |