-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[sonic-py-common] Add platform and chassis info methods to device_info #7652
Conversation
This pull request introduces 1 alert when merging a305336 into c646257 - view on LGTM.com new alerts:
|
This comment has been minimized.
This comment has been minimized.
This is expected. The block of code calling this makes a redis db call which from my experience right now can return a plethora of errors (if the whole service is down, timeout etc.), I want this to nicely handle that situation and simply return the dictionary with as many values as it was able to successfully retrieve. Handling of not having this information is done by the caller. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
This pull request introduces 1 alert when merging 9f92c74 into 9930e73 - view on LGTM.com new alerts:
|
Please fix LGTM alert. |
Did you see my earlier comment about the LGTM alert? |
If you need to catch all exceptions, please use |
Here's a little bit more about the difference: https://stackoverflow.com/a/18982754 |
Thats very interesting, I was not aware of that distinction. Thanks! |
I wasn't either until we began using the LGTM plugin. :) |
/azpw run |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
… and version (#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
… 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
sonic-net#7652) #### Why I did it These methods were added to make some convenient platform and chassis information methods accessible through sonic-py-common. These methods were refactored from sonic-utilities and are used in the `show platform summary` and `show version` commands. #### How I did it There are two methods, one is `get_platform_info()` which simply calls local methods to collect useful platform information into a dictionary format, this came directly from sonic-utilities.
… 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
… 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
#7652) #### Why I did it These methods were added to make some convenient platform and chassis information methods accessible through sonic-py-common. These methods were refactored from sonic-utilities and are used in the `show platform summary` and `show version` commands. #### How I did it There are two methods, one is `get_platform_info()` which simply calls local methods to collect useful platform information into a dictionary format, this came directly from sonic-utilities.
Related work items: sonic-net#90, sonic-net#282, sonic-net#7652, sonic-net#11220, sonic-net#11333, sonic-net#11358, sonic-net#11359, sonic-net#11371, sonic-net#11383, sonic-net#11386, sonic-net#11391, sonic-net#11398, sonic-net#11400, sonic-net#11406, sonic-net#11414, sonic-net#11421, sonic-net#11422, sonic-net#11427, sonic-net#11448, sonic-net#11451
… and version (#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
Why I did it
These methods were added to make some convenient platform and chassis information methods accessible through sonic-py-common. These methods were refactored from sonic-utilities and are used in the
show platform summary
andshow version
commands.How I did it
There are two methods, one is
get_platform_info()
which simply calls local methods to collect useful platform information into a dictionary format, this came directly from sonic-utilities.The other method is
get_chassis_info()
which retrieves the chassis model, serial number, and hardware revision from the STATE_DB directly.How to verify it
Open a python3 interpreter and enter the following lines
For different platforms these values will be different, simply check if they are successfully populated (Not empty or N/A). If it says "Not Provided" this means that the requested information is not encoded into the DMI of the switch.
Description for the changelog
[sonic-py-common] Add platform and chassis info methods to device_info
A picture of a cute animal (not mandatory but encouraged)