Use get() to fetch default value from dictionary for port admin_status #286
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: anamehra anamehra@cisco.com
Description
port if the same is not set in config db file. Use get() function to
prevent crashes and set the default status to 'down'.
Motivation and Context
xcvrd crash is observed during boot on multi-asic chassis system.
The crash is reported in sonic-net/sonic-buildimage#11707
On debugging the issue, found that at the point of the crash, the data being used is from config db.
It was observed that the Ethernet ports, which are not configured for admin_state field explicitly in the config is causing the crash. This is a valid config as admin_status is not a mandatory field and is considerd by default 'down' if missing in port config in config db file.
for example, the Ethernet31 is configured for a far-end, and has this field populated while Ethernet32, as was not being used, has this field missing.
closes sonic-net/sonic-buildimage#11707
How Has This Been Tested?
Loaded image on single and multi-asic system. Tested for normal boot. No crash observed.
Additional Information (Optional)