Skip to content

Add N9300 switch memory check#370

Open
Priyanka-Patil14 wants to merge 22 commits into
datacenter:v4.2.0-devfrom
Priyanka-Patil14:feature/n9300-switch-memory-check
Open

Add N9300 switch memory check#370
Priyanka-Patil14 wants to merge 22 commits into
datacenter:v4.2.0-devfrom
Priyanka-Patil14:feature/n9300-switch-memory-check

Conversation

@Priyanka-Patil14

Copy link
Copy Markdown

Summary

This PR adds a new validation check: N9300 Switch Memory.

The check runs only when the target upgrade version is 6.1 and validates that N9300-series switches have at least 24 GB memory before upgrade.

What Changed

  • Added n9300_switch_memory_check in aci-preupgrade-validation-script.py
  • Added validation documentation in docs/docs/validations.md
  • Added dedicated unit tests and test data under:
    • tests/checks/n9300_switch_memory_24g_check/

Check Behavior

  • Returns MANUAL if target version is missing
  • Returns N/A if target version is not 6.1
  • Returns N/A if no N9300 switches are present
  • Returns FAIL_O for N9300 nodes with memory < 24 GB
  • Returns PASS when all applicable N9300 nodes have >= 24 GB

##Test Validation
Executed:
pytest tests/checks/n9300_switch_memory_24g_check/test_n9300_switch_memory_24g_check.py -q

Result:
7 passed in 0.11s

No failures observed.

@Harinadh-Saladi Harinadh-Saladi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pls address the comments

Comment thread docs/docs/validations.md Outdated
Comment thread docs/docs/validations.md Outdated
Comment thread tests/checks/n9300_switch_memory_24g_check/test_n9300_switch_memory_24g_check.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread docs/docs/validations.md Outdated
@asraf-khan

Copy link
Copy Markdown
Contributor

@Priyanka-Patil14 please attach test result from APIC for possible scenario's

@Priyanka-Patil14

Copy link
Copy Markdown
Author

Memory_Check_logs.docx

Uploaded the logs.

Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
@asraf-khan

Copy link
Copy Markdown
Contributor

@Priyanka-Patil14 can you please provide updated script output from APIC and error handling cases?

Comment thread aci-preupgrade-validation-script.py Outdated
@Priyanka-Patil14

Priyanka-Patil14 commented Mar 24, 2026

Copy link
Copy Markdown
Author

@Priyanka-Patil14 can you please provide updated script output from APIC and error handling cases?

MemoryCheck_Logs.txt
APIC_Output_Logs.txt

Uploaded the logs. Please review it.

Comment thread aci-preupgrade-validation-script.py
@Priyanka-Patil14 Priyanka-Patil14 changed the base branch from master to v4.1.0-dev April 9, 2026 10:44
Comment thread aci-preupgrade-validation-script.py Outdated

@kahande kahande left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved.

@Priyanka-Patil14

Copy link
Copy Markdown
Author

Attached pytest and full script run logs as requested.
FullRun_MemoryCheck_Logs.txt
MemoryCheck_32Gb_Pytest_logs.txt

Comment thread docs/docs/validations.md Outdated
Comment thread docs/docs/validations.md Outdated
Comment thread docs/docs/validations.md Outdated
Comment thread aci-preupgrade-validation-script.py Outdated
@Priyanka-Patil14 Priyanka-Patil14 changed the base branch from v4.1.0-dev to v4.2.0-dev May 25, 2026 04:52
@Priyanka-Patil14 Priyanka-Patil14 force-pushed the feature/n9300-switch-memory-check branch 2 times, most recently from bac2092 to 8197e54 Compare May 25, 2026 06:43
@Priyanka-Patil14 Priyanka-Patil14 force-pushed the feature/n9300-switch-memory-check branch from 8197e54 to d7d4289 Compare May 25, 2026 07:13
Comment thread aci-preupgrade-validation-script.py Outdated
Comment thread docs/docs/validations.md
Comment thread docs/docs/validations.md Outdated
Comment thread docs/docs/validations.md Outdated
Comment thread aci-preupgrade-validation-script.py
@Priyanka-Patil14

Copy link
Copy Markdown
Author

@lovkeshsharma702 lovkeshsharma702 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

intigrated test completed with no fault.

Comment thread docs/docs/validations.md Outdated

Impact: Running an N9K-C93180YC-FX3 switch with less than 32GB memory can lead to memory pressure and increase the risk of service instability.

If any N9K-C93180YC-FX3 switch is flagged by this check, upgrade the switch memory to at least 32GB.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dig into the TME doc on this one, we should align messaging on script to match external docs, not introduce contradictions to obfuscation.

if doc needs to be made clear to address on proactive failure notice, then do it.

goal should be to link that doc or bug back to the check.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reference back to CSCwm42741

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to bug section

Comment thread aci-preupgrade-validation-script.py Outdated
result = NA
msg = 'No N9K-C93180YC-FX3 switches found. Skipping.'
else:
proc_mem_mos = icurl('class', 'procMemUsage.json')

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use API ?query-target-filter=lt(procMemUsage.total,"<32gigs>") logic to reduce the churn.

alternatively, the icurl function could be updated to take in a node specifier in the URI:
/api/node-xxx/class/procMemUsage...

Comment thread aci-preupgrade-validation-script.py Outdated
Comment on lines +6456 to +6497
missing_nodes = []

for node in affected_nodes:
node_id = node['fabricNode']['attributes']['id']
total_kb = node_total_kb.get(node_id)
if total_kb is None:
missing_nodes.append([
node_id,
node['fabricNode']['attributes']['name'],
node['fabricNode']['attributes']['model'],
])
continue

if total_kb < min_memory_kb:
memory_in_gb = round(total_kb / 1000000, 2)
result = MANUAL
data.append([
node_id,
node['fabricNode']['attributes']['name'],
node['fabricNode']['attributes']['model'],
memory_in_gb,
])

if missing_nodes and data:
result = MANUAL
msg = (
'Some N9K-C93180YC-FX3 nodes have insufficient memory and others are missing '
'procMemUsage data. Please manually verify the memory on all affected nodes.\n'
'Nodes with insufficient memory: {}\n'
'Nodes with missing data: {}'.format(
', '.join(str(row[0]) for row in data),
', '.join(str(row[0]) for row in missing_nodes),
)
)
headers = ['NodeId', 'Name', 'Model', 'Memory Detected (GB)']
data = data + [row + ['N/A'] for row in missing_nodes]
elif missing_nodes:
result = ERROR
msg = 'Missing procMemUsage data for one or more affected N9K-C93180YC-FX3 nodes.'
headers = ['NodeId', 'Name', 'Model']
data = missing_nodes
recommended_action = ''

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In what scenario do we see missing nodes? impication is that either fabricNode or procMemUsage is not being returned for a switch actively in the fabric.

if this was seen in testing, file the behavior as a bug and keep the logic with that explanation. If not, I don't know of any scenario where we would expect missing nodes for the sake of flagging them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants