Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 12 additions & 2 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -5008,22 +5008,32 @@ def access_untagged_check(**kwargs):
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations#access-untagged-port-config'

faultInsts = icurl('class', 'faultInst.json?&query-target-filter=wcard(faultInst.changeSet,"native-or-untagged-encap-failure")')
fault_dn_regex = r"topology/pod-(?P<podid>\d+)/node-(?P<nodeid>[^/]+)/[^/]+/[^/]+/uni/epp/fv-\[uni/tn-(?P<tenant>[^/]+)/ap-(?P<app_profile>[^/]+)/epg-(?P<epg_name>[^/]+)\]/[^/]+/stpathatt-\[(?P<port>.+)\]/nwissues/fault-F0467"
fault_dn_regex = (
r"^topology/pod-(?P<podid>\d+)/node-\d+/[^/]+/[^/]+/"
r"uni/epp/fv-\[uni/tn-(?P<tenant>[^/]+)/ap-(?P<app_profile>[^/]+)/"
r"epg-(?P<epg_name>[^\]]+)\]/node-(?P<nodeid>\d+)/"
r"(?P<fex>ext)?stpathatt-\[(?P<port>[^\]]+)\]"
r"(?:-extchid-(?P<fexid>\d+))?/nwissues/fault-F0467$"
)

if faultInsts:
fc = faultInsts[0]['faultInst']['attributes']['code']
for faultInst in faultInsts:
m = re.search(fault_dn_regex, faultInst['faultInst']['attributes']['dn'])
if m and bool(m.group('fex')) != bool(m.group('fexid')):
m = None
if m:
podid = m.group('podid')
nodeid = m.group('nodeid')
port = m.group('port')
if m.group('fexid'):
port = '{} on FEX {}'.format(port, m.group('fexid'))
tenant = m.group('tenant')
app_profile = m.group('app_profile')
epg_name = m.group('epg_name')
data.append([fc, podid, nodeid, port, tenant, app_profile, epg_name, recommended_action])
else:
unformatted_data.append(fc, faultInst['faultInst']['attributes']['descr'], recommended_action)
unformatted_data.append([fc, faultInst['faultInst']['attributes']['descr'], recommended_action])

if not data and not unformatted_data:
result = PASS
Expand Down
20 changes: 20 additions & 0 deletions tests/checks/access_untagged_check/faultInst_PATH_VARIANTS.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[
{
"faultInst": {
"attributes": {
"code": "F0467",
"descr": "Configuration failed for uni/tn-TENANT-A/ap-APP-A/epg-EPG-A node 101 eth1/10 due to Only One Native or Untagged Encap Allowed on Interface, debug message: ",
"dn": "topology/pod-1/node-101/local/svc-policyelem-id-0/uni/epp/fv-[uni/tn-TENANT-A/ap-APP-A/epg-EPG-A]/node-101/stpathatt-[eth1/10]/nwissues/fault-F0467"
}
}
},
{
"faultInst": {
"attributes": {
"code": "F0467",
"descr": "Configuration failed for uni/tn-TENANT-B/ap-APP-B/epg-EPG-B node 102 eth1/20 on FEX 110 due to Only One Native or Untagged Encap Allowed on Interface, debug message: ",
"dn": "topology/pod-2/node-102/local/svc-policyelem-id-0/uni/epp/fv-[uni/tn-TENANT-B/ap-APP-B/epg-EPG-B]/node-102/extstpathatt-[eth1/20]-extchid-110/nwissues/fault-F0467"
}
}
}
]
11 changes: 11 additions & 0 deletions tests/checks/access_untagged_check/faultInst_UNFORMATTED.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[
{
"faultInst": {
"attributes": {
"code": "F0467",
"descr": "Configuration failed for a synthetic attachment due to Only One Native or Untagged Encap Allowed on Interface, debug message: ",
"dn": "topology/pod-1/node-101/local/svc-policyelem-id-0/uni/epp/fv-[uni/tn-TENANT-C/ap-APP-C/epg-EPG-C]/node-101/unknownpathatt-[PATH-C]/nwissues/fault-F0467"
}
}
}
]
35 changes: 35 additions & 0 deletions tests/checks/access_untagged_check/test_access_untagged_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,38 @@
def test_logic(run_check, mock_icurl, expected_result):
result = run_check()
assert result.result == expected_result


def test_standard_and_fex_path_details(run_check, mock_icurl, icurl_outputs):
icurl_outputs[faultInsts] = read_data(dir, "faultInst_PATH_VARIANTS.json")
recommended_action = (
"Resolve the conflict by removing this config or other configs using this port "
"in Access(untagged) or native mode."
)

result = run_check()

assert result.result == script.FAIL_O
assert result.data == [
["F0467", "1", "101", "eth1/10", "TENANT-A", "APP-A", "EPG-A", recommended_action],
["F0467", "2", "102", "eth1/20 on FEX 110", "TENANT-B", "APP-B", "EPG-B", recommended_action],
]
assert result.unformatted_data == []


def test_unrecognized_dn_uses_unformatted_details(run_check, mock_icurl, icurl_outputs):
icurl_outputs[faultInsts] = read_data(dir, "faultInst_UNFORMATTED.json")
description = (
"Configuration failed for a synthetic attachment due to Only One Native or "
"Untagged Encap Allowed on Interface, debug message: "
)
recommended_action = (
"Resolve the conflict by removing this config or other configs using this port "
"in Access(untagged) or native mode."
)

result = run_check()

assert result.result == script.FAIL_O
assert result.data == []
assert result.unformatted_data == [["F0467", description, recommended_action]]
Loading