Skip to content

Commit

Permalink
fix merge
Browse files Browse the repository at this point in the history
  • Loading branch information
monrog2 committed Aug 12, 2024
1 parent 40c47e8 commit 46d254c
Showing 1 changed file with 1 addition and 105 deletions.
106 changes: 1 addition & 105 deletions aci-preupgrade-validation-script.py
Original file line number Diff line number Diff line change
Expand Up @@ -3417,6 +3417,7 @@ def subnet_scope_check(index, total_checks, cversion, **kwargs):
print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result


def rtmap_comm_match_defect_check(index, total_checks, tversion, **kwargs):
title = 'Route-map Community Match Defect'
result = PASS
Expand Down Expand Up @@ -3635,111 +3636,6 @@ def static_route_overlap_check(index, total_checks, cversion, tversion, **kwargs
return result


def unsupported_fec_configuration_ex_check(index, total_checks, sw_cversion, tversion, **kwargs):
title = 'Unsupported FEC Configuration For N9K-C93180YC-EX'
result = PASS
msg = ''
headers = ["Pod ID", "Node ID", "Switch Model", "Interface", "FEC Mode"]
data = []
recommended_action = 'Nexus C93180YC-EX switches do not support IEEE-RS-FEC or CONS16-RS-FEC mode. Misconfigured ports will be hardware disabled upon upgrade. Remove unsupported FEC configuration prior to upgrade.'
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#unsupported-fec-configuration-for-n9k-c93180yc-ex'
print_title(title, index, total_checks)

if not tversion:
print_result(title, MANUAL, "Target version not supplied. Skipping.")
return MANUAL

if sw_cversion.older_than('5.0(1a)') and tversion.newer_than("5.0(1a)"):
api = 'topSystem.json'
api += '?rsp-subtree=children&rsp-subtree-class=l1PhysIf,eqptCh'
api += '&rsp-subtree-filter=or(eq(l1PhysIf.fecMode,"ieee-rs-fec"),eq(l1PhysIf.fecMode,"cons16-rs-fec"),eq(eqptCh.model,"N9K-C93180YC-EX"))'
api += '&rsp-subtree-include=required'
topSystems = icurl('class', api)
for topSystem in topSystems:
model = None
l1PhysIfs = []
for child in topSystem['topSystem']['children']:
if child.get("eqptCh"):
model = child['eqptCh']['attributes']['model']
elif child.get("l1PhysIf"):
interface = child['l1PhysIf']['attributes']['id']
fecMode = child['l1PhysIf']['attributes']['fecMode']
l1PhysIfs.append({"interface":interface,"fecMode":fecMode})
if model and l1PhysIfs:
pod_id = topSystem['topSystem']['attributes']['podId']
node_id = topSystem['topSystem']['attributes']['id']
for l1PhysIf in l1PhysIfs:
data.append([pod_id,node_id,model,l1PhysIf['interface'],l1PhysIf['fecMode']])
if data:
result = FAIL_O

print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result


def static_route_overlap_check(index, total_checks, cversion, tversion, **kwargs):
title = 'L3out /32 Static Route and BD Subnet Overlap'
result = PASS
msg = ''
headers = ['L3out', '/32 Static Route', 'BD', 'BD Subnet']
data = []
recommended_action = 'Change /32 static route design or target a fixed version'
doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#l3out-32-overlap-with-bd-subnet'
print_title(title, index, total_checks)
iproute_regex = r'uni/tn-(?P<tenant>[^/]+)/out-(?P<l3out>[^/]+)/lnodep-(?P<nodeprofile>[^/]+)/rsnodeL3OutAtt-\[topology/pod-(?P<pod>[^/]+)/node-(?P<node>\d{3,4})\]/rt-\[(?P<addr>[^/]+)/(?P<netmask>\d{1,2})\]'
# bd_regex = r'uni/tn-(?P<tenant>[^/]+)/BD-(?P<bd>[^/]+)/rsctx'
bd_subnet_regex = r'uni/tn-(?P<tenant>[^/]+)/BD-(?P<bd>[^/]+)/subnet-\[(?P<subnet>[^/]+/\d{2})\]'

if (cversion.older_than("5.2(6e)") and tversion.newer_than("5.0(1a)") and tversion.older_than("5.2(6e)") ):
slash32filter = 'ipRouteP.json?query-target-filter=and(wcard(ipRouteP.dn,"/32"))'
staticRoutes = icurl('class', slash32filter)
if staticRoutes:
staticroute_vrf = icurl('class', 'l3extRsEctx.json')
staticR_to_vrf = {}
for staticRoute in staticRoutes:
staticroute_array = re.search(iproute_regex, staticRoute['ipRouteP']['attributes']['dn'])
l3out_dn = 'uni/tn-' + staticroute_array.group("tenant") + '/out-' + staticroute_array.group("l3out")+ '/rsectx'

for l3outCtx in staticroute_vrf:
l3outCtx_Vrf = {}
if l3outCtx['l3extRsEctx']['attributes']['dn'] == l3out_dn:
l3outCtx_Vrf['vrf'] = l3outCtx['l3extRsEctx']['attributes']['tDn']
l3outCtx_Vrf['l3out'] = l3outCtx['l3extRsEctx']['attributes']['dn'].replace('/rsectx', '')
staticR_to_vrf[staticroute_array.group("addr")] = l3outCtx_Vrf


bds_in_vrf = icurl('class', 'fvRsCtx.json')
vrf_to_bd = {}
for bd_ref in bds_in_vrf:
vrf_name = bd_ref['fvRsCtx']['attributes']['tDn']
bd_list = vrf_to_bd.get(vrf_name, [])
bd_name = bd_ref['fvRsCtx']['attributes']['dn'].replace('/rsctx','')
bd_list.append(bd_name)
vrf_to_bd[vrf_name] = bd_list

subnets_in_bd = icurl('class', 'fvSubnet.json')
bd_to_subnet = {}
for subnet in subnets_in_bd:
bd_subnet_re = re.search(bd_subnet_regex, subnet['fvSubnet']['attributes']['dn'])
if bd_subnet_re:
bd_dn = 'uni/tn-' + bd_subnet_re.group("tenant") + '/BD-' + bd_subnet_re.group("bd")
subnet_list = bd_to_subnet.get(bd_dn, [])
subnet_list.append(bd_subnet_re.group("subnet"))
bd_to_subnet[bd_dn] = subnet_list

for static_route, info in staticR_to_vrf.items():
for bd in vrf_to_bd[info['vrf']]:
for subnet in bd_to_subnet[bd]:
if IPAddress.ip_in_subnet(static_route, subnet):
data.append([info['l3out'], static_route, bd, subnet])

if data:
result = FAIL_O

print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url)
return result


def validate_32_64_bit_image_check(index, total_checks, tversion, **kwargs):
title = '32 and 64-Bit Firmware Image for Switches'
result = PASS
Expand Down

0 comments on commit 46d254c

Please sign in to comment.