|
34 | 34 | import os |
35 | 35 | import re |
36 | 36 |
|
37 | | -SCRIPT_VERSION = "v2.5.0" |
| 37 | +SCRIPT_VERSION = "v2.6.0" |
38 | 38 | DONE = 'DONE' |
39 | 39 | PASS = 'PASS' |
40 | 40 | FAIL_O = 'FAIL - OUTAGE WARNING!!' |
@@ -5250,6 +5250,111 @@ def ave_eol_check(index, total_checks, tversion, **kwargs): |
5250 | 5250 | return result |
5251 | 5251 |
|
5252 | 5252 |
|
| 5253 | +def stale_pcons_ra_mo_check(index, total_checks, cversion, tversion, **kwargs): |
| 5254 | + title = 'Stale pconsRA Objects' |
| 5255 | + result = PASS |
| 5256 | + msg = '' |
| 5257 | + headers = ["Stale pconsRA DN", "Non-Existing DN"] |
| 5258 | + |
| 5259 | + data = [] |
| 5260 | + recommended_action = 'Contact Cisco TAC to delete stale pconsRA before upgrading' |
| 5261 | + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#stale-pconsra-object' |
| 5262 | + print_title(title, index, total_checks) |
| 5263 | + |
| 5264 | + if not tversion: |
| 5265 | + print_result(title, MANUAL, "Target version not supplied. Skipping.") |
| 5266 | + return MANUAL |
| 5267 | + |
| 5268 | + if cversion.older_than("6.0(3d)") and tversion.newer_than("6.0(3c)") and tversion.older_than("6.1(4a)"): |
| 5269 | + pcons_rssubtreedep_api = 'pconsRsSubtreeDep.json?query-target-filter=wcard(pconsRsSubtreeDep.tDn,"/instdn-")' |
| 5270 | + pcons_rssubtreedep_mo = icurl('class', pcons_rssubtreedep_api) |
| 5271 | + pcons_inst_dn_reg = r'registry/class-\d+/instdn-\[(?P<policy_dn>.+?)\]/ra' |
| 5272 | + pcons_ra_dn_reg = r'(?P<pcons_ra_dn>.+?)/p...-\[' |
| 5273 | + |
| 5274 | + pcons_ra_set = set() |
| 5275 | + policy_dn_set = set() |
| 5276 | + |
| 5277 | + for mo in pcons_rssubtreedep_mo: |
| 5278 | + pcons_rssubtreedep_tdn = mo['pconsRsSubtreeDep']['attributes']['tDn'] |
| 5279 | + instdn_found = re.search(pcons_inst_dn_reg, pcons_rssubtreedep_tdn) |
| 5280 | + radn_found = re.search(pcons_ra_dn_reg, pcons_rssubtreedep_tdn) |
| 5281 | + if instdn_found and radn_found: |
| 5282 | + pcons_ra_dn = radn_found.group('pcons_ra_dn') |
| 5283 | + policy_dn = instdn_found.group('policy_dn') |
| 5284 | + if pcons_ra_dn not in pcons_ra_set: |
| 5285 | + pcons_ra_set.add(pcons_ra_dn) |
| 5286 | + if policy_dn not in policy_dn_set: |
| 5287 | + policy_dn_set.add(policy_dn) |
| 5288 | + |
| 5289 | + for policy_dn in policy_dn_set: |
| 5290 | + policy_dn_api = policy_dn + '.json' |
| 5291 | + policy_dn_mo = icurl('mo', policy_dn_api) |
| 5292 | + if not policy_dn_mo: |
| 5293 | + for pcons_ra_dn in pcons_ra_set: |
| 5294 | + if policy_dn in pcons_ra_dn: |
| 5295 | + pcons_ra_api = pcons_ra_dn + '.json' |
| 5296 | + pcons_ra_dn_mo = icurl('mo', pcons_ra_api) |
| 5297 | + if pcons_ra_dn_mo: |
| 5298 | + data.append([pcons_ra_dn, policy_dn]) |
| 5299 | + else: |
| 5300 | + print_result(title, NA, "Target version not supplied or not applicable. Skipping.") |
| 5301 | + return NA |
| 5302 | + |
| 5303 | + if data: |
| 5304 | + result = FAIL_O |
| 5305 | + print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url) |
| 5306 | + return result |
| 5307 | + |
| 5308 | + |
| 5309 | +def isis_database_byte_check(index, total_checks, tversion, **kwargs): |
| 5310 | + title = 'ISIS DTEPs Byte Size' |
| 5311 | + result = PASS |
| 5312 | + msg = '' |
| 5313 | + headers = ["ISIS DTEPs Byte Size", "ISIS DTEPs"] |
| 5314 | + data = [] |
| 5315 | + recommended_action = 'Upgrade to a version with the fix for CSCwp15375. Current target version is affected.' |
| 5316 | + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#isis-dteps-byte-size' |
| 5317 | + print_title(title, index, total_checks) |
| 5318 | + |
| 5319 | + if not tversion: |
| 5320 | + print_result(title, MANUAL, "Target version not supplied. Skipping.") |
| 5321 | + return MANUAL |
| 5322 | + |
| 5323 | + if tversion.newer_than("6.1(1a)") and tversion.older_than("6.1(3g)"): |
| 5324 | + isisDTEp_api = 'isisDTEp.json' |
| 5325 | + isisDTEp_api += '?query-target-filter=eq(isisDTEp.role,"spine")' |
| 5326 | + |
| 5327 | + isisDTEps = icurl('class', isisDTEp_api) |
| 5328 | + |
| 5329 | + physical_ids = set() |
| 5330 | + proxy_acast_ids = set() |
| 5331 | + |
| 5332 | + for entry in isisDTEps: |
| 5333 | + dtep_type = entry['isisDTEp']['attributes']['type'] |
| 5334 | + dtep_id = entry['isisDTEp']['attributes']['id'] |
| 5335 | + |
| 5336 | + if dtep_type == "physical": |
| 5337 | + physical_ids.add(dtep_id) |
| 5338 | + elif "physical,proxy-acast" in dtep_type: |
| 5339 | + proxy_acast_ids.add(dtep_id) |
| 5340 | + |
| 5341 | + for physical_id in physical_ids: |
| 5342 | + combined_dteps = ",".join([physical_id] + list(proxy_acast_ids)) |
| 5343 | + total_bytes = len(combined_dteps) |
| 5344 | + |
| 5345 | + if total_bytes > 57: |
| 5346 | + result = FAIL_O |
| 5347 | + data.append([total_bytes, combined_dteps]) |
| 5348 | + break |
| 5349 | + |
| 5350 | + else: |
| 5351 | + print_result(title, NA, "Target version not affected") |
| 5352 | + return NA |
| 5353 | + |
| 5354 | + print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url) |
| 5355 | + return result |
| 5356 | + |
| 5357 | + |
5253 | 5358 | # ---- Script Execution ---- |
5254 | 5359 |
|
5255 | 5360 | def parse_args(args): |
@@ -5390,6 +5495,8 @@ def get_checks(is_puv, debug_func): |
5390 | 5495 | n9408_model_check, |
5391 | 5496 | pbr_high_scale_check, |
5392 | 5497 | standby_sup_sync_check, |
| 5498 | + stale_pcons_ra_mo_check, |
| 5499 | + isis_database_byte_check, |
5393 | 5500 |
|
5394 | 5501 | ] |
5395 | 5502 | conn_checks = [ |
|
0 commit comments