From 4271899359b1a1e7c88529eb645847548b2a76c8 Mon Sep 17 00:00:00 2001 From: Welkin <48639332+welkin-he@users.noreply.github.com> Date: Wed, 8 May 2024 22:53:15 +1000 Subject: [PATCH] welkin-issue-79 (#82) * Rebase welkin-issue-79 on master * Apply suggestions from code review * Add version, Use fabricNode, Add pytest --------- Co-authored-by: takishida <38262981+takishida@users.noreply.github.com> Co-authored-by: tkishida --- aci-preupgrade-validation-script.py | 38 +++++++++++++- docs/docs/validations.md | 19 ++++++- .../fabricNode_FX3H.json | 26 ++++++++++ .../fabricNode_FX3P.json | 26 ++++++++++ .../fabricNode_FX3P3H.json | 50 +++++++++++++++++++ ..._n9k_c93108tc_fx3p_interface_down_check.py | 50 +++++++++++++++++++ 6 files changed, 206 insertions(+), 3 deletions(-) create mode 100644 tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3H.json create mode 100644 tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P.json create mode 100644 tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P3H.json create mode 100644 tests/n9k_c93108tc_fx3p_interface_down_check/test_n9k_c93108tc_fx3p_interface_down_check.py diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index 43ce05f..3e16eb5 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -3160,6 +3160,42 @@ def fabric_dpp_check(index, total_checks, tversion, **kwargs): return result +def n9k_c93108tc_fx3p_interface_down_check(index, total_checks, tversion, **kwargs): + title = 'N9K-C93108TC-FX3P/FX3H Interface Down' + result = PASS + msg = '' + headers = ["Node ID", "Node Name", "Product ID"] + data = [] + recommended_action = 'Change the target version to the fixed version of CSCwh81430' + doc_url = 'https://www.cisco.com/c/en/us/support/docs/field-notices/740/fn74085.html' + print_title(title, index, total_checks) + + if not tversion: + print_result(title, MANUAL, "Target version not supplied. Skipping.") + return MANUAL + + if ( + tversion.older_than("5.2(8h)") + or tversion.same_as("5.3(1d)") + or (tversion.major1 == "6" and tversion.older_than("6.0(4a)")) + ): + api = 'fabricNode.json' + api += '?query-target-filter=or(' + api += 'eq(fabricNode.model,"N9K-C93108TC-FX3P"),' + api += 'eq(fabricNode.model,"N9K-C93108TC-FX3H"))' + nodes = icurl('class', api) + for node in nodes: + nodeid = node["fabricNode"]["attributes"]["id"] + name = node["fabricNode"]["attributes"]["name"] + pid = node["fabricNode"]["attributes"]["model"] + data.append([nodeid, name, pid]) + + if data: + result = FAIL_O + 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') @@ -3250,7 +3286,7 @@ def fabric_dpp_check(index, total_checks, tversion, **kwargs): sup_a_high_memory_check, vmm_active_uplinks_check, fabric_dpp_check, - + n9k_c93108tc_fx3p_interface_down_check, ] summary = {PASS: 0, FAIL_O: 0, FAIL_UF: 0, ERROR: 0, MANUAL: 0, POST: 0, NA: 0, 'TOTAL': len(checks)} for idx, check in enumerate(checks): diff --git a/docs/docs/validations.md b/docs/docs/validations.md index f5f0e9e..979427d 100644 --- a/docs/docs/validations.md +++ b/docs/docs/validations.md @@ -145,7 +145,8 @@ Items | Defect | This Script [Spine SUP HW Revision Check][d9] | CSCwb86706 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: [SUP-A/A+ High Memory Usage][d10] | CSCwh39489 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: [VMM Uplink Container with empty Actives][d11] | CSCvr96408 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: -[CoS 3 with Dynamic Packet Prioritization][d12] | CSCwf05073 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: +[CoS 3 with Dynamic Packet Prioritization][d12] | CSCwf05073 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: +[N9K-C93108TC-FX3P/FX3H Interface Down][d13] | CSCwh81430 | :white_check_mark: | :no_entry_sign: |:no_entry_sign: [d1]: #ep-announce-compatibility [d2]: #eventmgr-db-size @@ -159,7 +160,7 @@ Items | Defect | This Script [d10]: #sup-aa-high-memory-usage [d11]: #vmm-uplink-container-with-empty-actives [d12]: #cos-3-with-dynamic-packet-prioritization - +[d13]: #n9k-c93108tc-fx3pfx3h-interface-down ## General Check Details @@ -1712,6 +1713,19 @@ The example shows a correctly defined `fvUplinkOrderCont`, with uplinks under th userdom : :all:common: ``` + +### N9K-C93108TC-FX3P/FX3H Interface Down + +Due to the defect CSCwh81430, some RJ45 interfaces on Cisco Nexus N9K-C93108TC-FX3P and N9K-C93108TC-FX3H Switches might not come up, even when connected. + +This issue can be triggered by a switch reload that occurs for any reason, including a software upgrade, software reset, system crash, or the power being turned up or down. + +The problem is related only to the front-panel interfaces Ethernet 1/1- 1/48. Optical ports Ethernet 1/49 - 54 and MGMT0 port are not affected. + +Because of this, the target version of your upgrade must be a version with a fix of CSCwh81430 when your fabric includes those switches mentioned above. See the Field Notice [FN74085][20] for details. + + + [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 @@ -1732,3 +1746,4 @@ The example shows a correctly defined `fvUplinkOrderCont`, with uplinks under th [17]: https://www.cisco.com/c/en/us/td/docs/dcn/aci/apic/6x/release-notes/cisco-apic-release-notes-605.html [18]: https://www.cisco.com/c/en/us/td/docs/switches/datacenter/aci/apic/sw/kb/cisco-mini-aci-fabric.html#Cisco_Task_in_List_GUI.dita_2d9ca023-714c-4341-9112-d96a7a598ee6 [19]: https://www.cisco.com/c/en/us/td/docs/dcn/aci/apic/5x/security-configuration/cisco-apic-security-configuration-guide-release-52x/https-access-52x.html +[20]: https://www.cisco.com/c/en/us/support/docs/field-notices/740/fn74085.html diff --git a/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3H.json b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3H.json new file mode 100644 index 0000000..f1bdd0b --- /dev/null +++ b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3H.json @@ -0,0 +1,26 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-2/node-113", + "fabricSt": "active", + "id": "113", + "model": "N9K-C93108TC-FX3H", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf113" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-2/node-114", + "fabricSt": "active", + "id": "114", + "model": "N9K-C93108TC-FX3H", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf114" + } + } + } +] diff --git a/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P.json b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P.json new file mode 100644 index 0000000..39538a0 --- /dev/null +++ b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P.json @@ -0,0 +1,26 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-102", + "fabricSt": "active", + "id": "101", + "model": "N9K-C93108TC-FX3P", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf101" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-102", + "fabricSt": "active", + "id": "102", + "model": "N9K-C93108TC-FX3P", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf102" + } + } + } +] diff --git a/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P3H.json b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P3H.json new file mode 100644 index 0000000..b9d7780 --- /dev/null +++ b/tests/n9k_c93108tc_fx3p_interface_down_check/fabricNode_FX3P3H.json @@ -0,0 +1,50 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-102", + "fabricSt": "active", + "id": "101", + "model": "N9K-C93108TC-FX3P", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf101" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-102", + "fabricSt": "active", + "id": "102", + "model": "N9K-C93108TC-FX3P", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf102" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-2/node-113", + "fabricSt": "active", + "id": "113", + "model": "N9K-C93108TC-FX3H", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf113" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-2/node-114", + "fabricSt": "active", + "id": "114", + "model": "N9K-C93108TC-FX3H", + "monPolDn": "uni/fabric/monfab-default", + "name": "leaf114" + } + } + } +] diff --git a/tests/n9k_c93108tc_fx3p_interface_down_check/test_n9k_c93108tc_fx3p_interface_down_check.py b/tests/n9k_c93108tc_fx3p_interface_down_check/test_n9k_c93108tc_fx3p_interface_down_check.py new file mode 100644 index 0000000..2c35bff --- /dev/null +++ b/tests/n9k_c93108tc_fx3p_interface_down_check/test_n9k_c93108tc_fx3p_interface_down_check.py @@ -0,0 +1,50 @@ +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 +api = 'fabricNode.json?query-target-filter=or(eq(fabricNode.model,"N9K-C93108TC-FX3P"),eq(fabricNode.model,"N9K-C93108TC-FX3H"))' + + +@pytest.mark.parametrize( + "icurl_outputs, tversion, expected_result", + [ + # Version not supplied + ({api: []}, None, script.MANUAL), + # Version not affected + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.2(8h)", script.PASS), + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.3(2b)", script.PASS), + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "6.0(4c)", script.PASS), + # Affected version, no FX3P or FX3H + ({api: []}, "5.2(8g)", script.PASS), + ({api: []}, "5.3(1d)", script.PASS), + ({api: []}, "6.0(2h)", script.PASS), + # Affected version, FX3P + ({api: read_data(dir, "fabricNode_FX3P.json")}, "5.2(8g)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3P.json")}, "5.3(1d)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3P.json")}, "6.0(2h)", script.FAIL_O), + # Affected version, FX3H + ({api: read_data(dir, "fabricNode_FX3H.json")}, "5.2(8g)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3H.json")}, "5.3(1d)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3H.json")}, "6.0(2h)", script.FAIL_O), + # Affected version, FX3P and FX3H + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.2(8g)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "5.3(1d)", script.FAIL_O), + ({api: read_data(dir, "fabricNode_FX3P3H.json")}, "6.0(2h)", script.FAIL_O), + ], +) +def test_logic(mock_icurl, tversion, expected_result): + result = script.n9k_c93108tc_fx3p_interface_down_check( + 1, + 1, + script.AciVersion(tversion) if tversion else None, + ) + assert result == expected_result