[sonic-py-common] Add platform and chassis info methods to device_info#6
Closed
alexrallen wants to merge 4 commits intomasterfrom
Closed
[sonic-py-common] Add platform and chassis info methods to device_info#6alexrallen wants to merge 4 commits intomasterfrom
alexrallen wants to merge 4 commits intomasterfrom
Conversation
|
It looks good to me, but could you please add unit test case for your change? |
Owner
Author
|
@keboliu @Junchao-Mellanox I have updated the unit test for the existing |
keboliu
approved these changes
May 18, 2021
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.
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 summaryandshow versioncommands.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. This is also utilized by sonic-utilities which is added by alexrallen/sonic-utilities#3How 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. If alexrallen/sonic-platform-daemons#3 has not been merged then
get_chassis_info()is expected to return an empty dictionary.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)