Add N9300 switch memory check#370
Add N9300 switch memory check#370Priyanka-Patil14 wants to merge 5 commits intodatacenter:masterfrom
Conversation
| [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: |
There was a problem hiding this comment.
This check is implemented as a general readiness check for N9300-series memory requirements, not tied to a specific CSC bug.
docs/docs/validations.md
Outdated
|
|
||
| ### 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. |
There was a problem hiding this comment.
Pls add the description at the end of the last check. Also, pls mention that this check applies for N9300 series, along with version.
There was a problem hiding this comment.
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"), | ||
| { |
There was a problem hiding this comment.
Pls remove target version missing case. It's not required, it will be taken care by the main script.
There was a problem hiding this comment.
removed target-version-missing case from this check as requested.
aci-preupgrade-validation-script.py
Outdated
| doc_url = 'https://datacenter.github.io/ACI-Pre-Upgrade-Validation-Script/validations/#n9300-switch-memory' | ||
| min_memory_kb = 24 * 1024 * 1024 | ||
|
|
||
| if not tversion: |
There was a problem hiding this comment.
Pls remove this condition as target version missing check is already taken care by the script.
There was a problem hiding this comment.
Removed target-version-missing handling from this check as requested.
aci-preupgrade-validation-script.py
Outdated
| 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.' |
There was a problem hiding this comment.
Just provide recommended_action with what to do. No need to mention about upgrade.
There was a problem hiding this comment.
Updated the recommended_action to only state what to do, and removed upgrade-specific wording.
docs/docs/validations.md
Outdated
|
|
||
| ### 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. |
There was a problem hiding this comment.
Pls add about impact of the issue.
There was a problem hiding this comment.
Added the impact detail in the docs.
|
@Priyanka-Patil14 please attach test result from APIC for possible scenario's |
|
Uploaded the logs. |
aci-preupgrade-validation-script.py
Outdated
| if tversion.major_version != '6.1': | ||
| return Result(result=NA, msg=VER_NOT_AFFECTED) | ||
|
|
||
| proc_mem_query = 'procMemUsage.json' |
There was a problem hiding this comment.
No need to use as seperate variable. directly use on icurl as query is small.
There was a problem hiding this comment.
Updated as suggested. Removed the separate variable and used the query directly in the icurl call.
aci-preupgrade-validation-script.py
Outdated
| total_kb = int(total) | ||
| except ValueError: | ||
| continue | ||
|
|
There was a problem hiding this comment.
Please check if this try except necessary ?
if so we need to error and update the result accordingly.
There was a problem hiding this comment.
Checked this. The try/except is needed, and I updated the code to return an ERROR with details when parsing fails.
aci-preupgrade-validation-script.py
Outdated
| continue | ||
| dn_match = re.search(node_regex, mem_dn) | ||
| if not dn_match: | ||
| continue |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
aci-preupgrade-validation-script.py
Outdated
| node_id = node['fabricNode']['attributes']['id'] | ||
| total_kb = node_total_kb.get(node_id) | ||
| if total_kb is None: | ||
| continue |
There was a problem hiding this comment.
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.
aci-preupgrade-validation-script.py
Outdated
| memory_in_gb, | ||
| ]) | ||
|
|
||
| if result == PASS: |
There was a problem hiding this comment.
Please handle for ERROR and FAIL_O result cases.
There was a problem hiding this comment.
Updated. ERROR and FAIL_O cases are now handled explicitly in the check result flow.
aci-preupgrade-validation-script.py
Outdated
| ]) | ||
|
|
||
| if result == PASS: | ||
| return Result(result=result) |
There was a problem hiding this comment.
Not required for PASS result case as we are returning result at the end.
aci-preupgrade-validation-script.py
Outdated
|
|
||
|
|
||
| @check_wrapper(check_title='N9300 Switch Memory') | ||
| def n9300_switch_memory_check(tversion, fabric_nodes, **kwargs): |
There was a problem hiding this comment.
Add general check at the bottom if it's completely new function as yesterday.
There was a problem hiding this comment.
Moved it to the bottom as requested.
|
@Priyanka-Patil14 can you please provide updated script output from APIC and error handling cases? |
aci-preupgrade-validation-script.py
Outdated
| ) | ||
|
|
||
| if result == FAIL_O: | ||
| return Result(result=result, headers=headers, data=data, recommended_action=recommended_action, doc_url=doc_url) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Updated "return Result()" at the bottom, with conditions checks updating "result" variable as FAIL_O or ERROR."
MemoryCheck_Logs.txt Uploaded the logs. Please review it. |
aci-preupgrade-validation-script.py
Outdated
| node_id, | ||
| node['fabricNode']['attributes'].get('name', ''), | ||
| node['fabricNode']['attributes'].get('model', ''), | ||
| memory_in_gb, |
There was a problem hiding this comment.
directly compute "memory_in_gb" using formula inside the if condition to avoid all time compute which is not required.
There was a problem hiding this comment.
Moved "memory_in_gb" calculation inside the "if total_kb < min_memory_kb" block.
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
n9300_switch_memory_checkinaci-preupgrade-validation-script.pydocs/docs/validations.mdtests/checks/n9300_switch_memory_24g_check/Check Behavior
MANUALif target version is missingN/Aif target version is not 6.1N/Aif no N9300 switches are presentFAIL_Ofor N9300 nodes with memory< 24 GBPASSwhen 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 -qResult:
7 passed in 0.11sNo failures observed.