[Platform API][SFP] Log warnings, don't fail test if newly-added xcvr info fields missing #3120
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.
Description of PR
Summary: Log warnings, don't fail test if newly-added xcvr info fields missing in
test_get_transceiver_info
SFP platform API testFixes: #2983
Type of change
Approach
What is the motivation for this PR?
Some vendors currently use their own SFP EEPROM parsing logic instead of using common logic in the sonic-platform-common repo. Thus, when a new field is added in the common code, if a vendor does not utilize the common code but rather implements their own parsing logic, their parser will not provide this field until the vendor adds logic to do so.
We are planning to refactor the sonic_sfp code in sonic-platform-common in hopes of making it easier for vendors to utilize the common code and move away from using their own parsers. Until then, this patch prevents the test case from failing if recently-added fields are not present, and instead logs warning messages, which should alert the vendor that they need to parse the new field(s).
How did you do it?
Remove recently-added fields from list of expected keys and add to a new list of newly-added keys. If keys in the newly-added list aren't present, log warnings to alert the vendor that they need to update their parser (or preferably use the common parser).
How did you verify/test it?
Tested against an S6100. Test case passes and the following logs are seen: