-
Notifications
You must be signed in to change notification settings - Fork 48
Add N9300 switch memory check #370
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
monrog2
merged 1 commit into
datacenter:v4.2.0-dev
from
Priyanka-Patil14:feature/n9300-switch-memory-check
Jul 1, 2026
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_N9K-C9508.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [ | ||
| { | ||
| "fabricNode": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-201", | ||
| "id": "201", | ||
| "name": "leaf201", | ||
| "model": "N9K-C9508", | ||
| "role": "leaf" | ||
| } | ||
| } | ||
| } | ||
| ] | ||
13 changes: 13 additions & 0 deletions
13
tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_one.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| [ | ||
| { | ||
| "fabricNode": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-101", | ||
| "id": "101", | ||
| "name": "leaf101", | ||
| "model": "N9K-C93180YC-FX3", | ||
| "role": "leaf" | ||
| } | ||
| } | ||
| } | ||
| ] |
24 changes: 24 additions & 0 deletions
24
tests/checks/n9k_c93180yc_fx3_switch_memory_check/fabricNode_two.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
| } | ||
| } | ||
| } | ||
| ] |
11 changes: 11 additions & 0 deletions
11
tests/checks/n9k_c93180yc_fx3_switch_memory_check/procMemUsage_lt32gb.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| [ | ||
| { | ||
| "procMemUsage": { | ||
| "attributes": { | ||
| "dn": "topology/pod-1/node-101/sys/procmem/memusage-sup", | ||
| "Modname": "sup", | ||
| "Total": "16000000" | ||
| } | ||
| } | ||
| } | ||
| ] |
82 changes: 82 additions & 0 deletions
82
.../checks/n9k_c93180yc_fx3_switch_memory_check/test_n9k_c93180yc_fx3_switch_memory_check.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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( | ||
|
Priyanka-Patil14 marked this conversation as resolved.
|
||
| "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 | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.