Skip to content
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

[show platform summary] Add chassis hardware info to platform summary and version #1624

Merged
merged 13 commits into from
Jun 4, 2021

Conversation

alexrallen
Copy link
Contributor

DEPENDS ON sonic-net/sonic-buildimage#7652 DO NOT MERGE WITHOUT

What I did

I added chassis model number, serial number, and hardware revision to the commands show platform summary and show version

How I did it

I refactored and modified the existing get_hw_info_dict() function to make calls to STATE_DB and get the chassis information populated by sonic-net/sonic-platform-daemons#183 script.

The new refactored versions of get_hw_info_dict() are added here sonic-net/sonic-buildimage#7652

How to verify it

Run show platform summary and show version and verify that following fields are populated:

  • Serial Number
  • Model Number
  • Hardware Rev

Previous command output (if the output of a command-line utility has changed)

Previous output for show version (example run on Mellanox MSN2700)

SONiC Software Version: SONiC.202012.74-59cae24e
Distribution: Debian 10.9
Kernel: 4.19.0-12-2-amd64
Build commit: 59cae24e
Build date: Wed Apr 28 07:35:32 UTC 2021
Built by: johnar@jenkins-worker-1

Platform: x86_64-mlnx_msn2700-r0
HwSKU: Mellanox-SN2700
ASIC: mellanox
ASIC Count: 1
Serial Number: MT1623X09522
Uptime: 15:21:47 up 10:27,  2 users,  load average: 2.29, 2.69, 2.68

Docker images:
REPOSITORY                    TAG                  IMAGE ID            SIZE
docker-syncd-mlnx             202012.74-59cae24e   5550823089ae        665MB
docker-syncd-mlnx             latest               5550823089ae        665MB
docker-teamd                  202012.74-59cae24e   7de136e8e8e8        410MB
docker-teamd                  latest               7de136e8e8e8        410MB
docker-nat                    202012.74-59cae24e   02ab418f2434        413MB
docker-nat                    latest               02ab418f2434        413MB
docker-router-advertiser      202012.74-59cae24e   9e6114a80f74        400MB
docker-router-advertiser      latest               9e6114a80f74        400MB
docker-platform-monitor       202012.74-59cae24e   e559a10095cd        691MB
docker-platform-monitor       latest               e559a10095cd        691MB
docker-lldp                   202012.74-59cae24e   7e271e7a4528        440MB
docker-lldp                   latest               7e271e7a4528        440MB
docker-database               202012.74-59cae24e   3231c2b690ab        400MB
docker-database               latest               3231c2b690ab        400MB
docker-orchagent              202012.74-59cae24e   ede2c8f72aed        429MB
docker-orchagent              latest               ede2c8f72aed        429MB
docker-snmp                   202012.74-59cae24e   52ed10642661        441MB
docker-snmp                   latest               52ed10642661        441MB
docker-sonic-telemetry        202012.74-59cae24e   a21ce94d4d11        490MB
docker-sonic-telemetry        latest               a21ce94d4d11        490MB
docker-dhcp-relay             202012.74-59cae24e   2b0d0905cd67        407MB
docker-dhcp-relay             latest               2b0d0905cd67        407MB
docker-sonic-mgmt-framework   202012.74-59cae24e   18b35d7d34e4        619MB
docker-sonic-mgmt-framework   latest               18b35d7d34e4        619MB
docker-fpm-frr                202012.74-59cae24e   4685e0764319        429MB
docker-fpm-frr                latest               4685e0764319        429MB
docker-sflow                  202012.74-59cae24e   e6fed87a0155        411MB
docker-sflow                  latest               e6fed87a0155        411MB

Previous output for show platform summary (example run on Mellanox MSN2700)

Platform: x86_64-mlnx_msn2700-r0
HwSKU: Mellanox-SN2700
ASIC: mellanox
ASIC Count: 1

New command output (if the output of a command-line utility has changed)

New output for show version (example run on Mellanox MSN2700)

admin@sonic:~$ show version

SONiC Software Version: SONiC.master_debugging.0-9f24b609
Distribution: Debian 10.9
Kernel: 4.19.0-12-2-amd64
Build commit: 9f24b609
Build date: Fri Apr 30 14:25:07 UTC 2021
Built by: arallen@r-build-sonic06

Platform: x86_64-mlnx_msn2700-r0
HwSKU: Mellanox-SN2700
ASIC: mellanox
ASIC Count: 1
Serial Number: MT1822K07815
Model Number: MSN2700-CS2FO
Hardware Rev: A1
Uptime: 14:40:15 up 3 min,  1 user,  load average: 1.26, 1.45, 0.66

Docker images:
REPOSITORY                    TAG                           IMAGE ID            SIZE
docker-platform-monitor       latest                        25eeef9cd044        692MB
docker-platform-monitor       master_debugging.0-9f24b609   25eeef9cd044        692MB
docker-syncd-mlnx             latest                        ac8e7da3f256        665MB
docker-syncd-mlnx             master_debugging.0-9f24b609   ac8e7da3f256        665MB
docker-sflow                  latest                        ba260dbaf2ed        412MB
docker-sflow                  master_debugging.0-9f24b609   ba260dbaf2ed        412MB
docker-snmp                   latest                        e0edd7585de1        441MB
docker-snmp                   master_debugging.0-9f24b609   e0edd7585de1        441MB
docker-dhcp-relay             latest                        1884e80a3342        407MB
docker-dhcp-relay             master_debugging.0-9f24b609   1884e80a3342        407MB
docker-teamd                  latest                        ebfacefde68e        411MB
docker-teamd                  master_debugging.0-9f24b609   ebfacefde68e        411MB
docker-nat                    latest                        413d85b6a0ea        414MB
docker-nat                    master_debugging.0-9f24b609   413d85b6a0ea        414MB
docker-router-advertiser      latest                        aeb413b0f1f0        400MB
docker-router-advertiser      master_debugging.0-9f24b609   aeb413b0f1f0        400MB
docker-lldp                   latest                        117730f901e7        440MB
docker-lldp                   master_debugging.0-9f24b609   117730f901e7        440MB
docker-database               latest                        399ba6b1a398        400MB
docker-database               master_debugging.0-9f24b609   399ba6b1a398        400MB
docker-sonic-mgmt-framework   latest                        be25c6c41871        619MB
docker-sonic-mgmt-framework   master_debugging.0-9f24b609   be25c6c41871        619MB
docker-orchagent              latest                        0472c0f05efa        429MB
docker-orchagent              master_debugging.0-9f24b609   0472c0f05efa        429MB
docker-macsec                 latest                        dcae9f883026        414MB
docker-macsec                 master_debugging.0-9f24b609   dcae9f883026        414MB
docker-sonic-telemetry        latest                        a28909569592        489MB
docker-sonic-telemetry        master_debugging.0-9f24b609   a28909569592        489MB
docker-fpm-frr                latest                        a5d6de3fb526        429MB
docker-fpm-frr                master_debugging.0-9f24b609   a5d6de3fb526        429MB

New output for show platform summary (example run on Mellanox MSN2700)

admin@sonic:~$ show platform summary
Platform: x86_64-mlnx_msn2700-r0
HwSKU: Mellanox-SN2700
ASIC: mellanox
ASIC Count: 1
Serial Number: MT1822K07815
Model Number: MSN2700-CS2FO
Hardware Rev: A1

@lgtm-com
Copy link

lgtm-com bot commented May 19, 2021

This pull request introduces 3 alerts when merging 750259d into 00bd0ce - view on LGTM.com

new alerts:

  • 2 for Unused import
  • 1 for Except block handles 'BaseException'

@alexrallen
Copy link
Contributor Author

FYI Build failure is due to the dependency mentioned in the PR body.

@lgtm-com
Copy link

lgtm-com bot commented May 19, 2021

This pull request introduces 1 alert when merging 089ed37 into 00bd0ce - view on LGTM.com

new alerts:

  • 1 for Unused import

Copy link
Collaborator

@liat-grozovik liat-grozovik left a comment

Choose a reason for hiding this comment

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

LGTM but I believe you also need to update the command reference guide as commands' output was changed.

@liat-grozovik
Copy link
Collaborator

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@liat-grozovik
Copy link
Collaborator

@robocoder99 can you please confirm that the below failure is because dependent PR is not yet merged?
AttributeError: <module 'sonic_py_common.device_info' from '/usr/local/lib/python3.7/dist-packages/sonic_py_common/device_info.py'> does not have the attribute 'get_platform_info'

@alexrallen
Copy link
Contributor Author

@liat-grozovik I can confirm that.

@jleveque
Copy link
Contributor

jleveque commented Jun 1, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jleveque
Copy link
Contributor

jleveque commented Jun 2, 2021

/azp run

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jleveque jleveque merged commit 25e17de into sonic-net:master Jun 4, 2021
gitsabari pushed a commit to gitsabari/sonic-utilities that referenced this pull request Jun 15, 2021
… and version (sonic-net#1624)

#### What I did
I added chassis model number, serial number, and hardware revision to the commands `show platform summary` and `show version`

#### How I did it
I refactored and modified the existing `get_hw_info_dict()` function to make calls to STATE_DB and get the chassis information populated by sonic-net/sonic-platform-daemons#183 script. 

The new refactored versions of `get_hw_info_dict()` are added here sonic-net/sonic-buildimage#7652
if chassis_info.get(k, '') in failed_vals:
if platform_chassis is None:
import platform
platform_chassis = sonic_platform.platform.Platform().get_chassis()
Copy link
Contributor

Choose a reason for hiding this comment

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

This get_chassis() trying to call Eeprom() to retrieve EEPROM details but failed due to permission error to access Eeprom details via sysfs by a non-root user for many platforms.

We can suppress this error by adding a root user check in Eeprom() to return "N/A" instead of throwing a permission error exception when non-root user trying to access Eeprom() API.
But consequence is that until PMON comes up to fill the DB with EEPROM details, show version will display serial number, hwsku, etc as "None" since Eeprom() is not accessible by non-root users.

This consequence is a day 1 behavior, but not seen earlier because previously we retrieve the Eeprom details by deliberately calling "decode-syseeprom" with sudo privileges even in non-root user environment in code.

raphaelt-nvidia pushed a commit to raphaelt-nvidia/sonic-utilities that referenced this pull request Aug 10, 2021
… and version (sonic-net#1624)

#### What I did
I added chassis model number, serial number, and hardware revision to the commands `show platform summary` and `show version`

#### How I did it
I refactored and modified the existing `get_hw_info_dict()` function to make calls to STATE_DB and get the chassis information populated by sonic-net/sonic-platform-daemons#183 script. 

The new refactored versions of `get_hw_info_dict()` are added here sonic-net/sonic-buildimage#7652
@yxieca
Copy link
Contributor

yxieca commented Jul 6, 2022

@alexrallen can you create separate PR for 202012 branch?

alexrallen added a commit to alexrallen/sonic-utilities that referenced this pull request Jul 6, 2022
… and version (sonic-net#1624)

I added chassis model number, serial number, and hardware revision to the commands `show platform summary` and `show version`

I refactored and modified the existing `get_hw_info_dict()` function to make calls to STATE_DB and get the chassis information populated by sonic-net/sonic-platform-daemons#183 script.

The new refactored versions of `get_hw_info_dict()` are added here sonic-net/sonic-buildimage#7652
@liuh-80
Copy link
Contributor

liuh-80 commented Feb 2, 2023

202012 branch PR closed: #2259

alexrallen commented on Jul 8, 2022
NOTE: Tests are failing because requisite PRs are not backported.

@liuh-80 liuh-80 added Cherry Pick PR created_202012 Label for a manually cherry-pick PR created for 202012 cherry-pick conflict PR. and removed Request for 202012 Branch Included in 202012 Branch labels Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Cherry Pick Conflict_202012 Cherry Pick PR created_202012 Label for a manually cherry-pick PR created for 202012 cherry-pick conflict PR. Enhancement show
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants