Skip to content

CLI support for SmartSwitch PMON #3271

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
merged 181 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from 177 commits
Commits
Show all changes
181 commits
Select commit Hold shift + click to select a range
11cc04d
CLI support for SmartSwitch PMON
rameshraghupathy Apr 14, 2024
02df0ea
imad minor fixes
rameshraghupathy Apr 16, 2024
e0e4700
Did some cleanup for backward compatibility
rameshraghupathy Apr 27, 2024
0a8fc5a
removed the column wrapping
rameshraghupathy Apr 27, 2024
6d61faa
Made it backward compatible and removed textwrap and added ut to PR
rameshraghupathy Apr 28, 2024
8d95dae
1. There was a duplication of part of a function and that has been
rameshraghupathy May 1, 2024
5c1b666
reboot_cause and system_health are obtained directly from chassisStateDB
rameshraghupathy May 8, 2024
fe4a8cf
The expected and result are the same but the test is throwing an error,
rameshraghupathy May 8, 2024
f896438
Let us get the build going and then look into the test mockup
rameshraghupathy May 9, 2024
9d6c093
Implemented as per the pmon hld, also made some improvements in the
rameshraghupathy May 10, 2024
0904515
Fixed the key for CHASSIS_MODULE_INFO_TABLE entries
rameshraghupathy May 15, 2024
ccc380b
Fixed "show reboot-cause all" and "show reboot-cause history all"
rameshraghupathy May 16, 2024
a8fa81d
Addressing review comments
rameshraghupathy May 31, 2024
1cf96a0
Checking if the test issue still exists
rameshraghupathy May 31, 2024
64fd559
Resolving SA errors triggered due to reboot_cause_test
rameshraghupathy Jun 1, 2024
d202e1c
Resolved pre-commit issues
rameshraghupathy Jun 7, 2024
b8c92ae
Resolved pre-commit issues
rameshraghupathy Jun 7, 2024
9986f7b
Improving coverage
rameshraghupathy Jun 7, 2024
0dc52f6
Fixed SA related warnings
rameshraghupathy Jun 7, 2024
93df26d
Did some cleanup
rameshraghupathy Jun 7, 2024
7a2aaf4
Minor improvements and fixes
rameshraghupathy Jun 7, 2024
26f9b8a
Adding tests for system health
rameshraghupathy Jun 7, 2024
3a592f8
Adding more system health related tests
rameshraghupathy Jun 7, 2024
71472a8
Fixed a minor issue
rameshraghupathy Jun 7, 2024
fd8bd6b
Fixed long line SA issue
rameshraghupathy Jun 7, 2024
5b15bc4
Trying to please SA
rameshraghupathy Jun 7, 2024
b35c987
Trying to improve coverage
rameshraghupathy Jun 7, 2024
ee10649
import mock
rameshraghupathy Jun 8, 2024
27546a6
Fixed a typo
rameshraghupathy Jun 8, 2024
883e35c
mocking DB
rameshraghupathy Jun 8, 2024
713ffa2
Fixed syntax issues
rameshraghupathy Jun 8, 2024
62fc3d0
DB mock fix
rameshraghupathy Jun 8, 2024
ecb2ecc
removed unused import
rameshraghupathy Jun 8, 2024
e2eb660
creating ut for dpu state
rameshraghupathy Jun 8, 2024
ef87cb5
Improving coverage
rameshraghupathy Jun 8, 2024
53c2277
Fixed a typo
rameshraghupathy Jun 8, 2024
fb989e4
Adjusted the reboot-cause key as per the updated hld
rameshraghupathy Jun 13, 2024
8ea7960
Added fix to gracefully handle sytem health DB keys not present case
rameshraghupathy Jun 30, 2024
76de68a
Addressed minor review comments
rameshraghupathy Jul 9, 2024
a08e0cb
Addressed review comments. Commented out system-health support until
rameshraghupathy Jul 29, 2024
766b303
Resolved minor issues and SA failures
rameshraghupathy Jul 29, 2024
c474940
Added role to PORT table in config_db. Using role to differentiate
rameshraghupathy Aug 31, 2024
1910163
Resolving pre-commit check error related to line > 120
rameshraghupathy Aug 31, 2024
851dc78
Trying to avoid pre-commit issues
rameshraghupathy Aug 31, 2024
cb54b73
Testing SA and precommit checks
rameshraghupathy Aug 31, 2024
4dfb5f8
Making it backward compatible
rameshraghupathy Aug 31, 2024
6941baf
Resolving column size and whitespace issue
rameshraghupathy Sep 1, 2024
f3c8e36
Working on SA issue
rameshraghupathy Sep 1, 2024
6d7d539
Testing SA and UT
rameshraghupathy Sep 1, 2024
433bc50
Added 2 spaces before inline comment
rameshraghupathy Sep 1, 2024
3ddcc9c
Merge branch 'sonic-net:master' into master
rameshraghupathy Sep 1, 2024
95da5c0
Enabling "show system-health dpu" cli alone. The rest of the dpu health
rameshraghupathy Sep 4, 2024
627dd5e
Fixed SA issues
rameshraghupathy Sep 4, 2024
934e6ef
Adde new line at EOF
rameshraghupathy Sep 4, 2024
64d06ec
Enabling the UT for the CLI "show system-health dpu"
rameshraghupathy Sep 4, 2024
4870a86
Resolved SA issues
rameshraghupathy Sep 4, 2024
fed3f67
Resolved a SA issue
rameshraghupathy Sep 4, 2024
68b6416
Added smartswitch specific "reboot-cause" and "reboot-cause history" CLI
rameshraghupathy Sep 24, 2024
d229307
Removed the phase:2 related system-health cli extensions as a seperate
rameshraghupathy Sep 24, 2024
78e71c5
Using smartswitch qualifier for the clie extensions
rameshraghupathy Sep 28, 2024
d7fbe9d
Fixed SA issues
rameshraghupathy Sep 28, 2024
313a9d2
mocking device_info for test cases
rameshraghupathy Sep 28, 2024
0ea1227
import patch in tests
rameshraghupathy Sep 28, 2024
f5f88bb
Debugging test failure
rameshraghupathy Sep 28, 2024
62817ea
Fixing SA issues
rameshraghupathy Sep 28, 2024
9fb005d
fixing sa issues
rameshraghupathy Sep 28, 2024
7c8c5d7
Debugging sa issues
rameshraghupathy Sep 28, 2024
b5b068b
trying to resolve sa issues
rameshraghupathy Sep 28, 2024
25259cb
fixed indentation
rameshraghupathy Sep 28, 2024
808e7b4
debugging
rameshraghupathy Sep 28, 2024
7eb8304
debugging
rameshraghupathy Sep 28, 2024
44bed5c
debugging
rameshraghupathy Sep 28, 2024
d7fd0ce
debugging
rameshraghupathy Sep 28, 2024
b0e51f8
Debugging
rameshraghupathy Sep 29, 2024
ed742fc
debugging
rameshraghupathy Sep 29, 2024
11f48f3
debugging
rameshraghupathy Sep 29, 2024
402887d
Debugging
rameshraghupathy Sep 29, 2024
8db11f3
Debugging
rameshraghupathy Sep 29, 2024
2ab48b5
Debuggingg
rameshraghupathy Sep 29, 2024
e843fff
Debugging
rameshraghupathy Sep 29, 2024
9ba21d2
Debugging
rameshraghupathy Sep 29, 2024
738634d
Debugging
rameshraghupathy Sep 29, 2024
c491687
Debugging
rameshraghupathy Sep 29, 2024
ee3f927
Debugging
rameshraghupathy Sep 29, 2024
d47a431
Debugging
rameshraghupathy Sep 29, 2024
04c520e
Debugging
rameshraghupathy Sep 29, 2024
c5abc01
Debugging
rameshraghupathy Sep 29, 2024
6ab7742
Debugging
rameshraghupathy Sep 29, 2024
4299ac3
Debugging
rameshraghupathy Sep 29, 2024
d30ead7
Debugging
rameshraghupathy Sep 29, 2024
a07e8c0
Debugging
rameshraghupathy Sep 29, 2024
a2cece6
Debugging
rameshraghupathy Sep 29, 2024
e2b65af
Debugging
rameshraghupathy Sep 29, 2024
53909f0
Debugging
rameshraghupathy Sep 29, 2024
9849436
Debugging
rameshraghupathy Sep 29, 2024
02152e3
Debuggingg
rameshraghupathy Sep 29, 2024
a75a4d3
Debugging
rameshraghupathy Sep 29, 2024
f8a1f57
Debugging
rameshraghupathy Sep 29, 2024
29000c3
Debugging
rameshraghupathy Sep 29, 2024
e273a16
Debugging
rameshraghupathy Sep 29, 2024
d720cf6
Debugging
rameshraghupathy Sep 29, 2024
c6040b3
Debugging
rameshraghupathy Sep 29, 2024
864c96c
Debugging
rameshraghupathy Sep 29, 2024
8580f76
Debugging
rameshraghupathy Sep 29, 2024
f4942b7
Debugging
rameshraghupathy Sep 29, 2024
3e44844
Debugging
rameshraghupathy Sep 29, 2024
e7355b0
Debugging
rameshraghupathy Sep 30, 2024
b132f90
Debugging
rameshraghupathy Sep 30, 2024
781270a
Debugging
rameshraghupathy Sep 30, 2024
2e8813b
Debugging
rameshraghupathy Sep 30, 2024
6cba5ed
Removing the test to build an image
rameshraghupathy Sep 30, 2024
5db0bc2
Removed mock import
rameshraghupathy Sep 30, 2024
807529f
Improving coverage
rameshraghupathy Sep 30, 2024
885b168
pleasing SA
rameshraghupathy Sep 30, 2024
b6efa8c
Fixing tests for design changes as per review comments
rameshraghupathy Sep 30, 2024
4c26a25
Resolving test failure
rameshraghupathy Sep 30, 2024
ed3d24b
fixed indentation
rameshraghupathy Sep 30, 2024
68a9efe
cleaned up the test case
rameshraghupathy Oct 1, 2024
d09d58f
Addressed review comments in Command-Reference.md and trying to improve
rameshraghupathy Oct 1, 2024
c217c18
Improving coverage
rameshraghupathy Oct 1, 2024
df87438
Fixed a test issue
rameshraghupathy Oct 1, 2024
2dfc2b5
Addressed review comments
rameshraghupathy Oct 7, 2024
c261b0c
Addressed review comment. Reading DPUs list from config_db.json
rameshraghupathy Oct 8, 2024
ab200bc
Improving coverage
rameshraghupathy Oct 8, 2024
5e36792
Resolved SA error
rameshraghupathy Oct 8, 2024
4a43780
Trying to improve coverage. Also, reading from platform.json
rameshraghupathy Oct 8, 2024
8b2c9cb
adding json import in the test
rameshraghupathy Oct 8, 2024
155ba3f
Fixed a test failure
rameshraghupathy Oct 8, 2024
e8c8b42
Fixed SA error
rameshraghupathy Oct 8, 2024
9601177
Exercising the new function in test
rameshraghupathy Oct 9, 2024
9713bf7
Removed a blank line
rameshraghupathy Oct 9, 2024
fdf8569
fixing mock issue
rameshraghupathy Oct 9, 2024
4b30138
Trying a different approach
rameshraghupathy Oct 9, 2024
e725add
working on coverage
rameshraghupathy Oct 9, 2024
d2e7590
debugging
rameshraghupathy Oct 9, 2024
3e1fc12
debugging
rameshraghupathy Oct 9, 2024
51dce03
Debugging
rameshraghupathy Oct 9, 2024
a016ead
Increasing coverage
rameshraghupathy Oct 9, 2024
041fad6
improving coverage
rameshraghupathy Oct 9, 2024
5c85cf4
Adjusting the show cli implementation to align with the reboot-cause
rameshraghupathy Oct 23, 2024
1b3fabb
Fixing a minor issue
rameshraghupathy Oct 23, 2024
9a0225b
Removed ID column from the "show system-health dpu DPUx" cli as per t…
rameshraghupathy Oct 25, 2024
8f191d6
Addressed default dpu admin status for dark-mode and seamless migration
rameshraghupathy Oct 29, 2024
523a42c
Resolving SA issue
rameshraghupathy Oct 29, 2024
a90b878
Resolved a typo
rameshraghupathy Oct 30, 2024
594a9dc
Added checks to see if module_name is valid in the "config chassis
rameshraghupathy Nov 20, 2024
79666d1
Fixed white space issues
rameshraghupathy Nov 20, 2024
9bb29e3
Cleaned unwanted import
rameshraghupathy Nov 20, 2024
63d5f9f
Fixed build issues
rameshraghupathy Nov 20, 2024
1255ee6
missedout the fixes in a couple of files
rameshraghupathy Nov 20, 2024
d630304
With the recent code the app_db multi_asic.PORT_ROLE is Dpc for DPU
rameshraghupathy Nov 26, 2024
933c04e
As the port role issue is no longer seen in smartswitch, cleaning up the
rameshraghupathy Nov 26, 2024
5a4c7fd
Using the verbose define for TYPE_DPC in the CLI, if there is a specific
rameshraghupathy Nov 26, 2024
989fa80
Reverting intfutil_test.py
rameshraghupathy Nov 26, 2024
00df371
Using the common API to get_dpu_list
rameshraghupathy Dec 4, 2024
48c8419
Removed unused import json
rameshraghupathy Dec 4, 2024
be8d747
Addressed review comments
rameshraghupathy Dec 6, 2024
0764a34
Did some minor cleanp
rameshraghupathy Dec 6, 2024
54cfbab
Fix: SA error
rameshraghupathy Dec 6, 2024
00c0ee0
Addressed review comments
rameshraghupathy Dec 27, 2024
b43f72b
Addressed review comments
rameshraghupathy Dec 27, 2024
ec47fa2
Addressed review comments
rameshraghupathy Dec 27, 2024
8432ed8
Addressed review comments
rameshraghupathy Dec 27, 2024
df2517b
Addressed review comments
rameshraghupathy Dec 27, 2024
d30b4fb
Addressed review comments
rameshraghupathy Dec 27, 2024
3274de0
Addressed review comments
rameshraghupathy Dec 27, 2024
c53685f
Addressed review comments
rameshraghupathy Dec 27, 2024
2b77e74
Addressed review comments
rameshraghupathy Dec 27, 2024
d46bf3a
Addressed review comments
rameshraghupathy Dec 27, 2024
513f21d
Addressed review comments
rameshraghupathy Dec 28, 2024
8da07e1
Addressed review comments
rameshraghupathy Dec 28, 2024
6796e67
Addressed review comments
rameshraghupathy Dec 28, 2024
e89daf7
Addressed review comments
rameshraghupathy Dec 28, 2024
2ccb4c3
Addressed review comments
rameshraghupathy Dec 28, 2024
d0f02f7
Addressed review comments
rameshraghupathy Dec 28, 2024
8b86eee
Addressed review comments
rameshraghupathy Dec 28, 2024
4ed816f
Addressed review comments
rameshraghupathy Dec 28, 2024
ea76bf3
Addressed review comments
rameshraghupathy Jan 6, 2025
3c3a500
Added fix for issue:21372 - Device name column shows NPU instead of m…
rameshraghupathy Jan 12, 2025
3837515
Added fix for issue:21372 - Fixing the device name colum in the cli o…
rameshraghupathy Jan 13, 2025
9d94a9a
Added a few review comments
rameshraghupathy Jan 23, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 24 additions & 6 deletions config/chassis_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import subprocess
import utilities_common.cli as clicommon
from utilities_common.chassis import is_smartswitch, get_all_dpus

TIMEOUT_SECS = 10

Expand All @@ -27,7 +28,10 @@ def get_config_module_state(db, chassis_module_name):
config_db = db.cfgdb
fvs = config_db.get_entry('CHASSIS_MODULE', chassis_module_name)
if not fvs:
return 'up'
if is_smartswitch():
return 'down'
else:
return 'up'
else:
return fvs['admin_status']

Expand Down Expand Up @@ -102,16 +106,21 @@ def fabric_module_set_admin_status(db, chassis_module_name, state):
#
@modules.command('shutdown')
@clicommon.pass_db
@click.argument('chassis_module_name', metavar='<module_name>', required=True)
@click.argument('chassis_module_name',
metavar='<module_name>',
required=True,
type=click.Choice(get_all_dpus(), case_sensitive=False) if is_smartswitch() else str
)
def shutdown_chassis_module(db, chassis_module_name):
"""Chassis-module shutdown of module"""
config_db = db.cfgdb
ctx = click.get_current_context()

if not chassis_module_name.startswith("SUPERVISOR") and \
not chassis_module_name.startswith("LINE-CARD") and \
not chassis_module_name.startswith("FABRIC-CARD"):
ctx.fail("'module_name' has to begin with 'SUPERVISOR', 'LINE-CARD' or 'FABRIC-CARD'")
not chassis_module_name.startswith("FABRIC-CARD") and \
Copy link
Contributor

@gpunathilell gpunathilell Oct 15, 2024

Choose a reason for hiding this comment

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

We need to perform additional validation to check if the chassis_module_name is actually present (or is an actual valid module name) or not, if user executes config chassis modules startup DPU5 on a system which does not have DPU5, this will cause crash in chassisd for the SmartSwitchConfigManagerTask in chassisd preventing further startup or shutdown calls (even though output of the command would be Starting up chassis module DPU1 or Shutting down chassis module DPU1 the only operation which is performed is addition/removal from the CONFIG_DB )

Copy link
Contributor Author

@rameshraghupathy rameshraghupathy Nov 20, 2024

Choose a reason for hiding this comment

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

not chassis_module_name.startswith("DPU"):
ctx.fail("'module_name' has to begin with 'SUPERVISOR', 'LINE-CARD', 'FABRIC-CARD', 'DPU'")

# To avoid duplicate operation
if get_config_module_state(db, chassis_module_name) == 'down':
Expand All @@ -130,7 +139,11 @@ def shutdown_chassis_module(db, chassis_module_name):
#
@modules.command('startup')
@clicommon.pass_db
@click.argument('chassis_module_name', metavar='<module_name>', required=True)
@click.argument('chassis_module_name',
metavar='<module_name>',
required=True,
type=click.Choice(get_all_dpus(), case_sensitive=False) if is_smartswitch() else str
)
def startup_chassis_module(db, chassis_module_name):
"""Chassis-module startup of module"""
config_db = db.cfgdb
Expand All @@ -142,7 +155,12 @@ def startup_chassis_module(db, chassis_module_name):
return

click.echo("Starting up chassis module {}".format(chassis_module_name))
config_db.set_entry('CHASSIS_MODULE', chassis_module_name, None)
if is_smartswitch():
fvs = {'admin_status': 'up'}
config_db.set_entry('CHASSIS_MODULE', chassis_module_name, fvs)
else:
config_db.set_entry('CHASSIS_MODULE', chassis_module_name, None)

if chassis_module_name.startswith("FABRIC-CARD"):
if not check_config_module_state_with_timeout(ctx, db, chassis_module_name, 'up'):
fabric_module_set_admin_status(db, chassis_module_name, 'up')
92 changes: 92 additions & 0 deletions doc/Command-Reference.md
Copy link
Contributor

Choose a reason for hiding this comment

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

@rameshraghupathy in all these sample examples can you specify where the CLI is being executed. NPU or in the DPU host.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor Added samples, in missing places

Original file line number Diff line number Diff line change
Expand Up @@ -713,6 +713,32 @@ This command displays the cause of the previous reboot
User issued reboot command [User: admin, Time: Mon Mar 25 01:02:03 UTC 2019]
```

```
Note: The CLI extensions shown in this block are applicable only to smartswitch platforms. When these extensions are used on a regular switch the extension will be ignored and the output will be the same irrespective of the options.

CLI Extensions Applicable to Smartswtich
- show reboot-cause all
- show reboot-cause history all
- show reboot-cause history DPUx
```
**show reboot-cause all**

This command displays the cause of the previous reboot for the Switch and the DPUs for which the midplane interfaces are up.

- Usage:
```
show reboot-cause all
```

- Example:
Copy link
Contributor

Choose a reason for hiding this comment

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

@rameshraghupathy please also capture the CLI output specifically when run inside DPU (even though its same as fixed chassis)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor Added the CLI output when run on DPU

```
root@MtFuji:~$ show reboot-cause all
Copy link
Contributor

Choose a reason for hiding this comment

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

@rameshraghupathy This will list the DPUs that are in admin shut?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. This will show the "show reboot-cause" output of the DPUs that are admin UP.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

@rameshraghupathy is this still true? With new design change, NPU can still find the last reboot cause of the DPU irrespective of its ADMIN state.

Copy link
Contributor

Choose a reason for hiding this comment

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

@rameshraghupathy could you address Prince comment?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@prgeor With the new design NPU can still find the last reboot cause of the DPU irrespective of its ADMIN state.
@vvolam Done

Device Name Cause Time User
-------- ------------------- ---------- ------ ------
NPU 2024_07_24_20_43_22 Power Loss N/A N/A
DPU2 2024_07_24_20_43_22 Software causes (Reboot) N/A N/A
DPU1 2024_07_24_20_43_22 Software causes (Reboot) N/A N/A
```
**show reboot-cause history**

This command displays the history of the previous reboots up to 10 entry
Expand All @@ -733,6 +759,42 @@ This command displays the history of the previous reboots up to 10 entry
2020_10_09_04_53_58 warm-reboot Fri Oct 9 04:51:47 UTC 2020 admin
```

**show reboot-cause history all**

This command displays the history of the previous reboots up to 10 entry of the Switch and the DPUs for which the midplane interfaces are up.

- Usage:
```
show reboot-cause history all
```

- Example:
```
root@MtFuji:~# show reboot-cause history all
Device Name Cause Time User Comment
-------- ------------------- ----------------------------------------- ------------------------------- ------ -------
NPU 2024_07_23_23_06_57 Kernel Panic Tue Jul 23 11:02:27 PM UTC 2024 N/A N/A
NPU 2024_07_23_11_21_32 Power Loss N/A N/A Unknown
```

**show reboot-cause history DPU1**

This command displays the history of the previous reboots up to 10 entry of DPU1. If DPU1 is powered down then there won't be any data in the DB and the "show reboot-cause history DPU1" output will be blank.

- Usage:
```
show reboot-cause history DPU1
```

- Example:
```
root@MtFuji:~# show reboot-cause history DPU1
Device Name Cause Time User Comment
-------- ------ ----------------------------------------- ------ ------ ---------
DPU1 DPU1 Software causes (Hardware watchdog reset) N/A N/A N/A
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add sample outputs for system-health as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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



**show uptime**

This command displays the current system uptime
Expand Down Expand Up @@ -11165,6 +11227,36 @@ In addition, displays a list of all current 'Services' and 'Hardware' being moni
psu.voltage Ignored Device
```

**show system-health dpu <option>**

This is a smartswitch specific cli. This cli shows the midplane, control plane and data plane health of the DPU modules in the smartswitch.

This can take two forms of "<option>" 1. DPU module name (ex: DPU0) 2. all, which will list all the DPUs in the smartswitch

- Usage:
```
show system-health dpu DPU0
```

- Example:
```
root@MtFuji-dut:/home/cisco# show system-health dpu DPU0
Name Oper-Status State-Detail State-Value Time Reason
------ ------------- ----------------------- ------------- ------------------------------- ------------------------------------------------------------------------------------
DPU0 Online dpu_midplane_link_state up Mon Dec 23 05:12:17 PM UTC 2024
dpu_control_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 All containers are up and running, host-ethlink-status: Uplink1/1 is UP
dpu_data_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 DPU container named polaris is running, pdsagent running : OK, pciemgrd running : OK

root@MtFuji-dut:/home/cisco# show system-health dpu all
Name Oper-Status State-Detail State-Value Time Reason
------ ------------- ----------------------- ------------- ------------------------------- ------------------------------------------------------------------------------------
DPU0 Online dpu_midplane_link_state up Mon Dec 23 05:12:17 PM UTC 2024
dpu_control_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 All containers are up and running, host-ethlink-status: Uplink1/1 is UP
dpu_data_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 DPU container named polaris is running, pdsagent running : OK, pciemgrd running : OK
DPU1 Online dpu_midplane_link_state up Mon Dec 23 05:12:17 PM UTC 2024
dpu_control_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 All containers are up and running, host-ethlink-status: Uplink1/1 is UP
dpu_data_plane_state up Mon Dec 23 05:12:17 PM UTC 2024 DPU container named polaris is running, pdsagent running : OK, pciemgrd running : OK

Go Back To [Beginning of the document](#) or [Beginning of this section](#System-Health)

## VLAN & FDB
Expand Down
12 changes: 8 additions & 4 deletions show/chassis_modules.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
from natsort import natsorted
from tabulate import tabulate
from swsscommon.swsscommon import SonicV2Connector
from utilities_common.chassis import is_smartswitch

import utilities_common.cli as clicommon
from sonic_py_common import multi_asic
Expand Down Expand Up @@ -40,11 +41,11 @@ def status(db, chassis_module_name):
state_db = SonicV2Connector(host="127.0.0.1")
state_db.connect(state_db.STATE_DB)

key_pattern = '*'
key_pattern = CHASSIS_MODULE_INFO_TABLE + '|*'
if chassis_module_name:
key_pattern = '|' + chassis_module_name
key_pattern = CHASSIS_MODULE_INFO_TABLE + '|' + chassis_module_name

keys = state_db.keys(state_db.STATE_DB, CHASSIS_MODULE_INFO_TABLE + key_pattern)
keys = state_db.keys(state_db.STATE_DB, key_pattern)
if not keys:
print('Key {} not found in {} table'.format(key_pattern, CHASSIS_MODULE_INFO_TABLE))
return
Expand All @@ -62,7 +63,10 @@ def status(db, chassis_module_name):
oper_status = data_dict[CHASSIS_MODULE_INFO_OPERSTATUS_FIELD]
serial = data_dict[CHASSIS_MODULE_INFO_SERIAL_FIELD]

admin_status = 'up'
if is_smartswitch():
admin_status = 'down'
else:
admin_status = 'up'
config_data = chassis_cfg_table.get(key_list[1])
if config_data is not None:
admin_status = config_data.get(CHASSIS_MODULE_INFO_ADMINSTATUS_FIELD)
Expand Down
Loading
Loading