diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index 790d0e74..f229a7b8 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -5157,6 +5157,55 @@ def stale_pcons_ra_mo_check(index, total_checks, cversion, tversion, **kwargs): return result +def isis_database_byte_check(index, total_checks, tversion, **kwargs): + title = 'ISIS DTEPs Byte Size' + result = PASS + msg = '' + headers = ["ISIS DTEPs Byte Size", "ISIS DTEPs"] + data = [] + recommended_action = 'Upgrade to a version with the fix for CSCwp15375. Current target version is affected.' + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#isis-dteps-byte-size' + print_title(title, index, total_checks) + + if not tversion: + print_result(title, MANUAL, "Target version not supplied. Skipping.") + return MANUAL + + if tversion.newer_than("6.1(1a)") and tversion.older_than("6.1(3g)"): + isisDTEp_api = 'isisDTEp.json' + isisDTEp_api += '?query-target-filter=eq(isisDTEp.role,"spine")' + + isisDTEps = icurl('class', isisDTEp_api) + + physical_ids = set() + proxy_acast_ids = set() + + for entry in isisDTEps: + dtep_type = entry['isisDTEp']['attributes']['type'] + dtep_id = entry['isisDTEp']['attributes']['id'] + + if dtep_type == "physical": + physical_ids.add(dtep_id) + elif "physical,proxy-acast" in dtep_type: + proxy_acast_ids.add(dtep_id) + + for physical_id in physical_ids: + combined_dteps = ",".join([physical_id] + list(proxy_acast_ids)) + total_bytes = len(combined_dteps) + + if total_bytes > 57: + result = FAIL_O + data.append([total_bytes, combined_dteps]) + break + + else: + print_result(title, NA, "Target version not affected") + return NA + + print_result(title, result, msg, headers, data, recommended_action=recommended_action, doc_url=doc_url) + return result + + if __name__ == "__main__": prints(' ==== %s%s, Script Version %s ====\n' % (ts, tz, SCRIPT_VERSION)) prints('!!!! Check https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script for Latest Release !!!!\n') @@ -5273,6 +5322,7 @@ def stale_pcons_ra_mo_check(index, total_checks, cversion, tversion, **kwargs): standby_sup_sync_check, observer_db_size_check, stale_pcons_ra_mo_check, + isis_database_byte_check, ] summary = {PASS: 0, FAIL_O: 0, FAIL_UF: 0, ERROR: 0, MANUAL: 0, POST: 0, NA: 0, 'TOTAL': len(checks)} diff --git a/docs/docs/validations.md b/docs/docs/validations.md index 4c36b81f..41dc02be 100644 --- a/docs/docs/validations.md +++ b/docs/docs/validations.md @@ -185,6 +185,8 @@ Items | Defect | This Script [Standby Sup Image Sync][d24] | CSCwi66348 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: [Observer Database Size][d25] | CSCvw45531 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: [Stale pconsRA Object][d26] | CSCwp22212 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: +[ISIS DTEPs Byte Size][d27] | CSCwp15375 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: + [d1]: #ep-announce-compatibility [d2]: #eventmgr-db-size-defect-susceptibility @@ -212,6 +214,7 @@ Items | Defect | This Script [d24]: #standby-sup-image-sync [d25]: #observer-database-size [d26]: #stale-pconsra-object +[d27]: #isis-dteps-byte-size ## General Check Details @@ -2549,6 +2552,23 @@ Due to [CSCwp22212][57], the existence of stale pconsRA objects within an ACI fa TAC must be engaged to cleanup these objects, as they require root access. +### ISIS DTEPs Byte Size + +Due to [CSCwp15375][58], running a `show` command that dumps out the ISIS Link State Database under certain conditions, such as `show isis database detail vrf all`, will result in a switch crash. + +As Switch Tech Support generation includes ISIS show command output, Tech Support generation will also result in a switch crash under the same conditions. + +The specific conditions leading to the crash are: + +1. The ACI software version is 6.1(1f), 6.1(2f), 6.1(2g), or 6.1(3f) +2. For any spine; The `isisDTEp` address + `PROXY-ACAST-MAC` address + `PROXY-ACAST-V4` address + `PROXY-ACAST-V6` address equals 58 bytes or more + +Do not upgrade to any affected ACI software release if this check fails. + +!!! note + Nexus Dashboard Insights (NDI) integration can cause ACI tech support generation to happen automatically as part of the bug scan feature. + + [0]: https://github.com/datacenter/ACI-Pre-Upgrade-Validation-Script [1]: https://www.cisco.com/c/dam/en/us/td/docs/Website/datacenter/apicmatrix/index.html [2]: https://www.cisco.com/c/en/us/support/switches/nexus-9000-series-switches/products-release-notes-list.html @@ -2606,4 +2626,5 @@ TAC must be engaged to cleanup these objects, as they require root access. [54]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCvt47850 [55]: https://www.cisco.com/c/en/us/products/collateral/cloud-systems-management/application-policy-infrastructure-controller-apic/eol-apic-virtual-edge-pod-pb.html [56]: https://www.cisco.com/c/en/us/td/docs/dcn/whitepapers/cisco-aci-virtual-edge-migration.html -[57]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwp22212 \ No newline at end of file +[57]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwp22212 +[58]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwp15375 diff --git a/tests/isis_database_byte_check/isisDTEp_NEG.json b/tests/isis_database_byte_check/isisDTEp_NEG.json new file mode 100644 index 00000000..b73a62f2 --- /dev/null +++ b/tests/isis_database_byte_check/isisDTEp_NEG.json @@ -0,0 +1,422 @@ +[ + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.66]", + "encapt": "unknown", + "id": "10.0.128.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.65]", + "encapt": "unknown", + "id": "10.0.128.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.66]", + "encapt": "unknown", + "id": "10.0.128.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.65]", + "encapt": "unknown", + "id": "10.0.128.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.66]", + "encapt": "unknown", + "id": "10.0.128.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.65]", + "encapt": "unknown", + "id": "10.0.128.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.66]", + "encapt": "unknown", + "id": "10.0.128.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.65]", + "encapt": "unknown", + "id": "10.0.128.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-202/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.65]", + "encapt": "unknown", + "id": "10.0.128.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-202/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-202/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-202/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-201/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.66]", + "encapt": "unknown", + "id": "10.0.184.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-201/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.65]", + "encapt": "unknown", + "id": "10.0.184.65", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-201/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.128.66]", + "encapt": "unknown", + "id": "10.0.128.66", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-201/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[10.0.184.64]", + "encapt": "unknown", + "id": "10.0.184.64", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + } +] \ No newline at end of file diff --git a/tests/isis_database_byte_check/isisDTEp_POS.json b/tests/isis_database_byte_check/isisDTEp_POS.json new file mode 100644 index 00000000..529d8a60 --- /dev/null +++ b/tests/isis_database_byte_check/isisDTEp_POS.json @@ -0,0 +1,242 @@ +[ + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.129]", + "encapt": "unknown", + "id": "100.100.100.129", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.194]", + "encapt": "unknown", + "id": "100.100.100.194", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.192]", + "encapt": "unknown", + "id": "100.100.100.192", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-101/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.193]", + "encapt": "unknown", + "id": "100.100.100.193", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.194]", + "encapt": "unknown", + "id": "100.100.100.194", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.129]", + "encapt": "unknown", + "id": "100.100.100.129", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.192]", + "encapt": "unknown", + "id": "100.100.100.192", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-102/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.193]", + "encapt": "unknown", + "id": "100.100.100.193", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.129]", + "encapt": "unknown", + "id": "100.100.100.129", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.194]", + "encapt": "unknown", + "id": "100.100.100.194", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.192]", + "encapt": "unknown", + "id": "100.100.100.192", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-104/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.193]", + "encapt": "unknown", + "id": "100.100.100.193", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.194]", + "encapt": "unknown", + "id": "100.100.100.194", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-mac" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.129]", + "encapt": "unknown", + "id": "100.100.100.129", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.192]", + "encapt": "unknown", + "id": "100.100.100.192", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v4" + } + } + }, + { + "isisDTEp": { + "attributes": { + "childAction": "", + "dn": "topology/pod-1/node-103/sys/isis/inst-default/dom-overlay-1/lvl-l1/db-dtep/dtep-[100.100.100.193]", + "encapt": "unknown", + "id": "100.100.100.193", + "modTs": "never", + "name": "default", + "role": "spine", + "status": "", + "type": "physical,proxy-acast-v6" + } + } + } +] \ No newline at end of file diff --git a/tests/isis_database_byte_check/test_isis_database_byte_check.py b/tests/isis_database_byte_check/test_isis_database_byte_check.py new file mode 100644 index 00000000..39003bab --- /dev/null +++ b/tests/isis_database_byte_check/test_isis_database_byte_check.py @@ -0,0 +1,81 @@ +import os +import pytest +import logging +import importlib +from helpers.utils import read_data + +script = importlib.import_module("aci-preupgrade-validation-script") + +log = logging.getLogger(__name__) +dir = os.path.dirname(os.path.abspath(__file__)) + +# icurl queries +isisDTEp_api = 'isisDTEp.json' +isisDTEp_api += '?query-target-filter=eq(isisDTEp.role,"spine")' + +@pytest.mark.parametrize( + "icurl_outputs, tversion, expected_result", + [ + + # MANUAL cases + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + None, + script.MANUAL, + ), + # Failure cases + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + "6.0(1f)", + script.NA, + ), + + # Failure cases + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + "6.1(1f)", + script.FAIL_O, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + "6.1(2f)", + script.FAIL_O, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + "6.1(2g)", + script.FAIL_O, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_POS.json")}, + "6.1(3f)", + script.FAIL_O, + ), + + # Pass cases + ( + {isisDTEp_api: read_data(dir, "isisDTEp_NEG.json")}, + "6.1(1f)", + script.PASS, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_NEG.json")}, + "6.1(2f)", + script.PASS, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_NEG.json")}, + "6.1(2g)", + script.PASS, + ), + ( + {isisDTEp_api: read_data(dir, "isisDTEp_NEG.json")}, + "6.1(3f)", + script.PASS, + ) + ] +) +def test_logic(mock_icurl, tversion, expected_result): + tversion = script.AciVersion(tversion) if tversion else None + result = script.isis_database_byte_check(1, 1, tversion) + assert result == expected_result