[action] [PR:4572] [cli]: Add DPU recovery CLI commands for SmartSwitch#4597
Open
mssonicbld wants to merge 1 commit into
Open
[action] [PR:4572] [cli]: Add DPU recovery CLI commands for SmartSwitch#4597mssonicbld wants to merge 1 commit into
mssonicbld wants to merge 1 commit into
Conversation
#### What I did Added CLI support for DPU recovery monitoring on SmartSwitch platforms as specified in the [Enhance DPU Robustness HLD](sonic-net/SONiC#2310): 1. Extended `show chassis modules status` with a `Ready-Status` column on SmartSwitch platforms. 2. Added new `show chassis modules recovery` command to expose detailed DPU recovery state. #### How I did it - Modified `show/chassis_modules.py`: - On SmartSwitch, the `status` command now connects to `CHASSIS_STATE_DB` and reads `ready_status` from `DPU_STATE|DPU<N>` for each module, appending it as a new column. - Added a new `recovery` subcommand that reads `ready_status`, `recovery_status`, `reset_count`, `last_down_time`, and `last_ready_time` from `CHASSIS_STATE_DB: DPU_STATE|DPU<N>`. - The `recovery` command is gated to SmartSwitch platforms only. - Added unit tests in `tests/chassis_modules_test.py`: - `TestChassisModulesRecovery` class with 7 test cases covering all DPUs, single DPU filter, non-SmartSwitch guard, no-data scenario, Ready-Status in status command, unrecoverable DPU display, and missing fields handling. #### How to verify it ```bash # On a SmartSwitch platform: show chassis modules status # Should now include a "Ready-Status" column show chassis modules recovery # Should display DPU recovery details # Run unit tests: cd src/sonic-utilities python3 -m pytest tests/chassis_modules_test.py::TestChassisModulesRecovery -v ``` #### Previous command output (if the output of a command-line utility has changed) ``` admin@sonic:~$ show chassis modules status Name Description Physical-Slot Oper-Status Admin-Status Serial ------ ------------- --------------- ------------- -------------- -------- DPU0 <DPU Sku> N/A Online up <serial> DPU1 <DPU Sku> N/A Online up <serial> ``` #### New command output (if the output of a command-line utility has changed) ``` admin@sonic:~$ show chassis modules status Name Description Physical-Slot Oper-Status Admin-Status Serial Ready-Status ------ ------------- --------------- ------------- -------------- -------- -------------- DPU0 <DPU Sku> N/A Online up <serial> true DPU1 <DPU Sku> N/A Online up <serial> true admin@sonic:~$ show chassis modules recovery Name Ready-Status Recovery-Status Reset-Count Last-Down-Time Last-Ready-Time ------ -------------- ----------------- ------------- ------------------------------- ------------------------------- DPU0 true recoverable 0 Fri May 29 09:26:33 PM UTC 2026 Fri May 29 09:26:52 PM UTC 2026 DPU1 true recoverable 0 Fri May 29 09:26:33 PM UTC 2026 Fri May 29 09:26:52 PM UTC 2026 DPU2 true recoverable 0 Fri May 29 09:26:33 PM UTC 2026 Fri May 29 09:26:52 PM UTC 2026 ``` Signed-off-by: Sonic Build Admin <sonicbld@microsoft.com>
Collaborator
Author
|
Original PR: #4572 |
Collaborator
Author
|
/azp run |
|
Azure Pipelines successfully started running 1 pipeline(s). |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What I did
Added CLI support for DPU recovery monitoring on SmartSwitch platforms as specified in the Enhance DPU Robustness HLD:
show chassis modules statuswith aReady-Statuscolumn on SmartSwitch platforms.show chassis modules recoverycommand to expose detailed DPU recovery state.How I did it
Modified
show/chassis_modules.py:statuscommand now connects toCHASSIS_STATE_DBand readsready_statusfromDPU_STATE|DPU<N>for each module, appending it as a new column.recoverysubcommand that readsready_status,recovery_status,reset_count,last_down_time, andlast_ready_timefromCHASSIS_STATE_DB: DPU_STATE|DPU<N>.recoverycommand is gated to SmartSwitch platforms only.Added unit tests in
tests/chassis_modules_test.py:TestChassisModulesRecoveryclass with 7 test cases covering all DPUs, single DPU filter, non-SmartSwitch guard, no-data scenario, Ready-Status in status command, unrecoverable DPU display, and missing fields handling.How to verify it
Previous command output (if the output of a command-line utility has changed)
New command output (if the output of a command-line utility has changed)
Signed-off-by: Sonic Build Admin sonicbld@microsoft.com