From 5e8b2558f72cbf6a9ee62067afa0f00dd7175f13 Mon Sep 17 00:00:00 2001 From: Priyanka Date: Tue, 30 Jun 2026 18:35:23 +0530 Subject: [PATCH] Resolved conflicts --- aci-preupgrade-validation-script.py | 61 ++++++++++++++ docs/docs/validations.md | 14 +++- .../fabricNode_N9K-C9508.json | 13 +++ .../fabricNode_one.json | 13 +++ .../fabricNode_two.json | 24 ++++++ .../procMemUsage_lt32gb.json | 11 +++ ...st_n9k_c93180yc_fx3_switch_memory_check.py | 82 +++++++++++++++++++ 7 files changed, 217 insertions(+), 1 deletion(-) create mode 100644 tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_N9K-C9508.json create mode 100644 tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_one.json create mode 100644 tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_two.json create mode 100644 tests/checks/n9k_c93180yc_fx3_switch_memory_check/procMemUsage_lt32gb.json create mode 100644 tests/checks/n9k_c93180yc_fx3_switch_memory_check/test_n9k_c93180yc_fx3_switch_memory_check.py diff --git a/aci-preupgrade-validation-script.py b/aci-preupgrade-validation-script.py index a3ca8539..667ec421 100644 --- a/aci-preupgrade-validation-script.py +++ b/aci-preupgrade-validation-script.py @@ -6532,6 +6532,66 @@ def wred_affected_model_check(tversion, fabric_nodes, **kwargs): return Result(result=NA, msg="No affected Fabric module found.") +@check_wrapper(check_title='N9K-C93180YC-FX3 Switch Memory Less Than 32GB') +def n9k_c93180yc_fx3_switch_memory_check(fabric_nodes, **kwargs): + result = PASS + headers = ["NodeId", "Name", "Model", "Memory Detected (GB)"] + data = [] + recommended_action = 'Increase the switch memory to at least 32GB on affected N9K-C93180YC-FX3.' + doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#n9k-c93180yc-fx3-switch-memory-less-than-32gb' + min_memory_kb = 32 * 1000 * 1000 + msg = '' + + affected_nodes = [ + node for node in fabric_nodes + if node['fabricNode']['attributes']['model'] == 'N9K-C93180YC-FX3' + ] + + if not affected_nodes: + result = NA + msg = 'No N9K-C93180YC-FX3 switches found. Skipping.' + else: + node_ids = [node['fabricNode']['attributes']['id'] for node in affected_nodes] + node_filter = 'or({})'.format(','.join( + 'wcard(procMemUsage.dn,"node-{}/")'.format(nid) for nid in node_ids + )) + query = 'procMemUsage.json?query-target-filter=and({},wcard(procMemUsage.dn,"memusage-sup"),lt(procMemUsage.Total,"{}"))'.format( + node_filter, min_memory_kb + ) + proc_mem_mos = icurl('class', query) + + node_id_to_attrs = { + node['fabricNode']['attributes']['id']: node['fabricNode']['attributes'] + for node in affected_nodes + } + + for memory_mo in proc_mem_mos: + attrs = memory_mo['procMemUsage']['attributes'] + dn_match = re.search(node_regex, attrs['dn']) + if not dn_match: + continue + node_id = dn_match.group('node') + if node_id not in node_id_to_attrs: + continue + memory_in_gb = round(int(attrs['Total']) / 1000000, 2) + result = FAIL_O + data.append([ + node_id, + node_id_to_attrs[node_id]['name'], + node_id_to_attrs[node_id]['model'], + memory_in_gb, + ]) + + if data: + msg = ( + 'N9K-C93180YC-FX3 requires a minimum of 32GB RAM for proper operation in ACI mode. ' + 'One or more switches with less than 32GB of memory may experience service instability. ' + 'Upgrade the switch memory to at least 32GB.' + ) + + return Result(result=result, msg=msg, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) + + # ---- Script Execution ---- @@ -6705,6 +6765,7 @@ class CheckManager: inband_management_policy_misconfig_check, bgpProto_timer_policy_already_existing_check, wred_affected_model_check, + n9k_c93180yc_fx3_switch_memory_check, ] ssh_checks = [ # General diff --git a/docs/docs/validations.md b/docs/docs/validations.md index 76e9c140..8c88d796 100644 --- a/docs/docs/validations.md +++ b/docs/docs/validations.md @@ -205,6 +205,7 @@ Items | Defect | This Script [Inband Management Policy Misconfiguration][d33]| CSCwd40071 | :white_check_mark: | :no_entry_sign: [BgpProto timer policy already existing][d34] | CSCwt78235 | :white_check_mark: | :no_entry_sign: [WRED with Affected FM Models][d35] | CSCwt50713 | :white_check_mark: | :no_entry_sign: +[N9K-C93180YC-FX3 Switch Memory Less Than 32GB][d36] | CSCwm42741 | :white_check_mark: | :no_entry_sign: [d1]: #ep-announce-compatibility [d2]: #eventmgr-db-size-defect-susceptibility @@ -241,6 +242,7 @@ Items | Defect | This Script [d33]: #inband-management-policy-misconfiguration [d34]: #bgpProto-timer-policy-already-existing [d35]: #wred-with-affected-fm-models +[d36]: #n9k-c93180yc-fx3-switch-memory-less-than-32gb ## General Check Details @@ -2819,6 +2821,15 @@ To avoid this issue, disable WRED on the affected nodes or upgrade to a release This bug [CSCwt78235][71] validates `F0467` faults where `changeSet` contains 'bgpProt-policy-already-existing'. The fault indicates conflicting BGP protocol timer policy under an L3Outs deployed in same vrf under same node. If this fault is not resolved, l3out will not be programmed properly in the leaf after the clean reboot or the upgrade. +### N9K-C93180YC-FX3 Switch Memory Less Than 32GB + +This check applies to N9K-C93180YC-FX3 switches only. It checks whether the switch has less than 32GB of memory. The minimum RAM requirement for the N9K-C93180YC-FX3 to operate properly in ACI mode is 32GB. This check is not version dependent and runs for all upgrade versions. + +[CSCwm42741][74] tracks this issue. N9K-C93180YC-FX3 switches running in ACI mode with less than 32GB of memory will not perform well and are at risk of service instability. With fix of CSCwm42741, a critical fault F4680 (`eqpt-low-memory-device`) is raised on affected switches. + +If any N9K-C93180YC-FX3 switch is flagged by this check, upgrade the switch memory to at least 32GB before proceeding with the upgrade. + + [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 @@ -2892,4 +2903,5 @@ This bug [CSCwt78235][71] validates `F0467` faults where `changeSet` contains 'b [70]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCvo27498 [71]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwt78235 [72]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwt50713 -[73]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwo74485 \ No newline at end of file +[73]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwo74485 +[74]: https://bst.cloudapps.cisco.com/bugsearch/bug/CSCwm42741 \ No newline at end of file diff --git a/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_N9K-C9508.json b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_N9K-C9508.json new file mode 100644 index 00000000..a82341a4 --- /dev/null +++ b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_N9K-C9508.json @@ -0,0 +1,13 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-201", + "id": "201", + "name": "leaf201", + "model": "N9K-C9508", + "role": "leaf" + } + } + } +] \ No newline at end of file diff --git a/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_one.json b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_one.json new file mode 100644 index 00000000..74a31ad3 --- /dev/null +++ b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_one.json @@ -0,0 +1,13 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-101", + "id": "101", + "name": "leaf101", + "model": "N9K-C93180YC-FX3", + "role": "leaf" + } + } + } +] \ No newline at end of file diff --git a/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_two.json b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_two.json new file mode 100644 index 00000000..fad02898 --- /dev/null +++ b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_two.json @@ -0,0 +1,24 @@ +[ + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-101", + "id": "101", + "name": "leaf101", + "model": "N9K-C93180YC-FX3", + "role": "leaf" + } + } + }, + { + "fabricNode": { + "attributes": { + "dn": "topology/pod-1/node-102", + "id": "102", + "name": "leaf102", + "model": "N9K-C9364C", + "role": "leaf" + } + } + } +] \ No newline at end of file diff --git a/tests/checks/n9k_c93180yc_fx3_switch_memory_check/procMemUsage_lt32gb.json b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/procMemUsage_lt32gb.json new file mode 100644 index 00000000..5f50d60d --- /dev/null +++ b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/procMemUsage_lt32gb.json @@ -0,0 +1,11 @@ +[ + { + "procMemUsage": { + "attributes": { + "dn": "topology/pod-1/node-101/sys/procmem/memusage-sup", + "Modname": "sup", + "Total": "16000000" + } + } + } +] diff --git a/tests/checks/n9k_c93180yc_fx3_switch_memory_check/test_n9k_c93180yc_fx3_switch_memory_check.py b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/test_n9k_c93180yc_fx3_switch_memory_check.py new file mode 100644 index 00000000..45f46006 --- /dev/null +++ b/tests/checks/n9k_c93180yc_fx3_switch_memory_check/test_n9k_c93180yc_fx3_switch_memory_check.py @@ -0,0 +1,82 @@ +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__)) + +test_function = "n9k_c93180yc_fx3_switch_memory_check" + +# icurl queries - filtered by affected node IDs and memory threshold +proc_mem_query_node101 = 'procMemUsage.json?query-target-filter=and(or(wcard(procMemUsage.dn,"node-101/")),wcard(procMemUsage.dn,"memusage-sup"),lt(procMemUsage.Total,"32000000"))' + + +@pytest.mark.parametrize( + "fabric_nodes, icurl_outputs, expected_result, expected_msg, expected_data", + [ + # No nodes returned + ( + [], + {}, + script.NA, + 'No N9K-C93180YC-FX3 switches found. Skipping.', + [], + ), + # Non-N9K-C93180YC-FX3 node (N9K-C9508) + ( + read_data(dir, "fabricNode_N9K-C9508.json"), + {}, + script.NA, + 'No N9K-C93180YC-FX3 switches found. Skipping.', + [], + ), + # N9K-C93180YC-FX3 node with >=32GB memory - API returns empty (filtered by lt) + ( + read_data(dir, "fabricNode_one.json"), + { + proc_mem_query_node101: [], + }, + script.PASS, + '', + [], + ), + # Multiple nodes, only N9K-C93180YC-FX3 checked, all >=32GB - API returns empty + ( + read_data(dir, "fabricNode_two.json"), + { + proc_mem_query_node101: [], + }, + script.PASS, + '', + [], + ), + # N9K-C93180YC-FX3 node with <32GB memory (fail case) + ( + read_data(dir, "fabricNode_one.json"), + { + proc_mem_query_node101: read_data(dir, "procMemUsage_lt32gb.json"), + }, + script.FAIL_O, + ( + 'N9K-C93180YC-FX3 requires a minimum of 32GB RAM for proper operation in ACI mode. ' + 'One or more switches with less than 32GB of memory may experience service instability. ' + 'Upgrade the switch memory to at least 32GB.' + ), + [["101", "leaf101", "N9K-C93180YC-FX3", 16.0]], + ), + ], +) +def test_logic(run_check, mock_icurl, fabric_nodes, expected_result, expected_msg, expected_data): + result = run_check( + fabric_nodes=fabric_nodes, + ) + assert result.result == expected_result + assert result.msg == expected_msg + if result.data: + assert result.data == expected_data + else: + assert result.unformatted_data == expected_data \ No newline at end of file