[sfputil] Gracefully handle improper 'specification_compliance' field #1741
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.
Signed-off-by: Prince George [email protected]
What I did
Gracefully handle improper 'specification_compliance' field
How I did it
The 'specification_compliance' field of transceiver info is expected to be a string representation of a dictionary. However, there is a chance, upon some kind of platform issue that a vendor's platform API returns something like 'N/A'. In this case, sfpshow would crash. Rather than crash, sfpshow should handle this gracefully and output 'N/A' instead.
How to verify it
Run "sfputil show eeprom -d" on a device where the 'specification_compliance' field of transceiver info is not a string representation of a dictionary.
Previous command output (if the output of a command-line utility has changed)
N/A -- sfputil would crash
New command output (if the output of a command-line utility has changed)
Ethernet0: SFP EEPROM detected
Application Advertisement: N/A
Connector: N/A
Encoding: N/A
Extended Identifier: N/A
Extended RateSelect Compliance: N/A
Identifier: N/A
N/A: N/A
Nominal Bit Rate(100Mbs): N/A
Specification compliance:
N/A
Vendor Date Code(YYYY-MM-DD Lot): N/A
Vendor Name: N/A
Vendor OUI: N/A
Vendor PN: N/A
Vendor Rev: N/A
Vendor SN: N/A