Skip to content

Add N9300 switch memory check#370

Open
Priyanka-Patil14 wants to merge 5 commits intodatacenter:masterfrom
Priyanka-Patil14:feature/n9300-switch-memory-check
Open

Add N9300 switch memory check#370
Priyanka-Patil14 wants to merge 5 commits intodatacenter:masterfrom
Priyanka-Patil14:feature/n9300-switch-memory-check

Conversation

@Priyanka-Patil14
Copy link

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.

Copy link

@Harinadh-Saladi Harinadh-Saladi left a comment

Choose a reason for hiding this comment

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

Pls address the comments

[ISIS DTEPs Byte Size][d27] | CSCwp15375 | :white_check_mark: | :no_entry_sign:
[Policydist configpushShardCont Crash][d28] | CSCwp95515 | :white_check_mark: | :no_entry_sign:
[Auto Firmware Update on Switch Discovery][d29] | CSCwe83941 | :white_check_mark: | :no_entry_sign:
[N9300 Switch Memory][d30] | - | :white_check_mark: | :no_entry_sign:

Choose a reason for hiding this comment

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

Pls add bug id, it's missing.

Copy link
Author

Choose a reason for hiding this comment

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

This check is implemented as a general readiness check for N9300-series memory requirements, not tied to a specific CSC bug.


### N9300 Switch Memory

This check applies only when the target upgrade version is 6.1. It reviews `procMemUsage` for N9300-series switches and flags nodes with less than 24GB memory installed.

Choose a reason for hiding this comment

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

Pls add the description at the end of the last check. Also, pls mention that this check applies for N9300 series, along with version.

Copy link
Author

Choose a reason for hiding this comment

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

Moved the N9300 description to the end of the check details section and updated the text to clearly mention applicability to N9300-series switches along with the version scope.

# Target version missing
(
read_data(dir, "fabricNode_one.json"),
{

Choose a reason for hiding this comment

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

Pls remove target version missing case. It's not required, it will be taken care by the main script.

Copy link
Author

Choose a reason for hiding this comment

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

removed target-version-missing case from this check as requested.

doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#n9300-switch-memory'
min_memory_kb = 24 * 1024 * 1024

if not tversion:

Choose a reason for hiding this comment

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

Pls remove this condition as target version missing check is already taken care by the script.

Copy link
Author

Choose a reason for hiding this comment

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

Removed target-version-missing handling from this check as requested.

result = PASS
headers = ["NodeId", "Name", "Model", "Memory Detected (GB)"]
data = []
recommended_action = 'Increase the switch memory to at least 24GB before proceeding with the Cisco ACI software upgrade.'
Copy link

@asraf-khan asraf-khan Mar 23, 2026

Choose a reason for hiding this comment

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

Just provide recommended_action with what to do. No need to mention about upgrade.

Copy link
Author

Choose a reason for hiding this comment

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

Updated the recommended_action to only state what to do, and removed upgrade-specific wording.


### N9300 Switch Memory

This check applies only when the target upgrade version is 6.1. It reviews `procMemUsage` for N9300-series switches and flags nodes with less than 24GB memory installed.

Choose a reason for hiding this comment

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

Pls add about impact of the issue.

Copy link
Author

Choose a reason for hiding this comment

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

Added the impact detail in the docs.

@asraf-khan
Copy link

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

@Priyanka-Patil14
Copy link
Author

Memory_Check_logs.docx

Uploaded the logs.

if tversion.major_version != '6.1':
return Result(result=NA, msg=VER_NOT_AFFECTED)

proc_mem_query = 'procMemUsage.json'

Choose a reason for hiding this comment

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

No need to use as seperate variable. directly use on icurl as query is small.

Copy link
Author

Choose a reason for hiding this comment

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

Updated as suggested. Removed the separate variable and used the query directly in the icurl call.

total_kb = int(total)
except ValueError:
continue

Choose a reason for hiding this comment

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

Please check if this try except necessary ?
if so we need to error and update the result accordingly.

Copy link
Author

Choose a reason for hiding this comment

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

Checked this. The try/except is needed, and I updated the code to return an ERROR with details when parsing fails.

continue
dn_match = re.search(node_regex, mem_dn)
if not dn_match:
continue

Choose a reason for hiding this comment

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

without dn_match & total_kb value not set where we are capturing for particular node/switch ?

is it valid to continue the check ? please check once.

Copy link
Author

Choose a reason for hiding this comment

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

Checked this case, it is not valid to continue when affected node data is missing. Updated the check to return ERROR and include the node details.

node_id = node['fabricNode']['attributes']['id']
total_kb = node_total_kb.get(node_id)
if total_kb is None:
continue

Choose a reason for hiding this comment

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

without total_kb value not set where we are capturing same for particular node/switch ?

data should be updated and appended accordingly and handle the result.

Copy link
Author

Choose a reason for hiding this comment

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

Updated this part.

memory_in_gb,
])

if result == PASS:

Choose a reason for hiding this comment

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

Please handle for ERROR and FAIL_O result cases.

Copy link
Author

Choose a reason for hiding this comment

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

Updated. ERROR and FAIL_O cases are now handled explicitly in the check result flow.

])

if result == PASS:
return Result(result=result)

Choose a reason for hiding this comment

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

Not required for PASS result case as we are returning result at the end.

Copy link
Author

Choose a reason for hiding this comment

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

Updated.



@check_wrapper(check_title='N9300 Switch Memory')
def n9300_switch_memory_check(tversion, fabric_nodes, **kwargs):

Choose a reason for hiding this comment

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

Add general check at the bottom if it's completely new function as yesterday.

Copy link
Author

Choose a reason for hiding this comment

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

Moved it to the bottom as requested.

@asraf-khan
Copy link

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

)

if result == FAIL_O:
return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url)

Choose a reason for hiding this comment

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

this "return Result" should be common at bottom.

only based on condition validation, update "result" variable as FAIL_O or ERROR.

refer other function for reference.

Copy link
Author

Choose a reason for hiding this comment

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

Updated "return Result()" at the bottom, with conditions checks updating "result" variable as FAIL_O or ERROR."

@Priyanka-Patil14
Copy link
Author

Priyanka-Patil14 commented Mar 24, 2026

@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.

node_id,
node['fabricNode']['attributes'].get('name', ''),
node['fabricNode']['attributes'].get('model', ''),
memory_in_gb,

Choose a reason for hiding this comment

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

directly compute "memory_in_gb" using formula inside the if condition to avoid all time compute which is not required.

Copy link
Author

Choose a reason for hiding this comment

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

Moved "memory_in_gb" calculation inside the "if total_kb < min_memory_kb" block.

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.

3 participants