-
Notifications
You must be signed in to change notification settings - Fork 817
Fix show int transceiver EEPROM crash for for Backplane cartridge + enhance EEPROM CLI output #4020
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
Merged
prgeor
merged 5 commits into
sonic-net:master
from
mihirpat1:backplane-cartridge-eeprom-crash-enhance-output
Aug 13, 2025
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
56889b3
Fix show int transceiver EEPROM crash for for Backplane cartridge + e…
mihirpat1 a6f2fd5
Fixed SA warning
mihirpat1 45ca698
Added None check for sfp_firmware_info_dict
mihirpat1 55b048f
Added is_transceiver_c_cmis
mihirpat1 331ccbe
Added new line before get_data_map_sort_key
mihirpat1 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,7 +28,7 @@ | |
| ) | ||
| from utilities_common.sfp_helper import covert_application_advertisement_to_output_string | ||
| from utilities_common.sfp_helper import QSFP_DATA_MAP | ||
| from utilities_common.sfp_helper import is_transceiver_cmis | ||
| from utilities_common.sfp_helper import is_transceiver_cmis, get_data_map_sort_key | ||
| from tabulate import tabulate | ||
| from utilities_common.general import load_db_config | ||
|
|
||
|
|
@@ -338,8 +338,10 @@ def convert_sfp_info_to_output_string(sfp_info_dict): | |
| output = '' | ||
| is_sfp_cmis = is_transceiver_cmis(sfp_info_dict) | ||
| if is_sfp_cmis: | ||
| sorted_qsfp_data_map_keys = sorted(QSFP_DD_DATA_MAP, key=QSFP_DD_DATA_MAP.get) | ||
| for key in sorted_qsfp_data_map_keys: | ||
| # Use the utility function with the local QSFP_DD_DATA_MAP for CMIS transceivers | ||
| get_sort_key = get_data_map_sort_key(sfp_info_dict, QSFP_DD_DATA_MAP) | ||
| sorted_qsfp_dd_info_keys = sorted(sfp_info_dict.keys(), key=get_sort_key) | ||
| for key in sorted_qsfp_dd_info_keys: | ||
| if key == 'cable_type': | ||
| output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length']) | ||
| elif key == 'cable_length': | ||
|
|
@@ -355,14 +357,15 @@ def convert_sfp_info_to_output_string(sfp_info_dict): | |
| elif key == 'application_advertisement': | ||
| output += covert_application_advertisement_to_output_string(indent, sfp_info_dict) | ||
| else: | ||
| try: | ||
| output += '{}{}: {}\n'.format(indent, QSFP_DD_DATA_MAP[key], sfp_info_dict[key]) | ||
| except (KeyError, ValueError) as e: | ||
| output += '{}{}: N/A\n'.format(indent, QSFP_DD_DATA_MAP[key]) | ||
| # For both known and unknown keys, use the data map display name if available | ||
| display_name = QSFP_DD_DATA_MAP.get(key, key) # Use data_map name if available, otherwise use key | ||
| output += '{}{}: {}\n'.format(indent, display_name, sfp_info_dict.get(key, 'N/A')) | ||
mihirpat1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| else: | ||
| sorted_qsfp_data_map_keys = sorted(QSFP_DATA_MAP, key=QSFP_DATA_MAP.get) | ||
| for key in sorted_qsfp_data_map_keys: | ||
| # Use the utility function with QSFP_DATA_MAP for non-CMIS transceivers | ||
| get_sort_key = get_data_map_sort_key(sfp_info_dict, QSFP_DATA_MAP) | ||
| sorted_qsfp_info_keys = sorted(sfp_info_dict.keys(), key=get_sort_key) | ||
| for key in sorted_qsfp_info_keys: | ||
| if key == 'cable_type': | ||
| output += '{}{}: {}\n'.format(indent, sfp_info_dict['cable_type'], sfp_info_dict['cable_length']) | ||
| elif key == 'cable_length': | ||
|
|
@@ -379,7 +382,9 @@ def convert_sfp_info_to_output_string(sfp_info_dict): | |
| except ValueError as e: | ||
| output += '{}N/A\n'.format((indent * 2)) | ||
| else: | ||
| output += '{}{}: {}\n'.format(indent, QSFP_DATA_MAP[key], sfp_info_dict[key]) | ||
| # For both known and unknown keys, use the data map display name if available | ||
| display_name = QSFP_DATA_MAP.get(key, key) # Use data_map name if available, otherwise use key | ||
mihirpat1 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| output += '{}{}: {}\n'.format(indent, display_name, sfp_info_dict.get(key, 'N/A')) | ||
|
|
||
| return output | ||
|
|
||
|
|
||
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.