Skip to content

Commit

Permalink
Added error log messages in case platform_chassis is None
Browse files Browse the repository at this point in the history
  • Loading branch information
tshalvi committed Dec 5, 2023
1 parent ad72149 commit 4014a6e
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sonic-xcvrd/xcvrd/xcvrd_utilities/media_settings_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ def get_lane_speed_key(physical_port, port_speed, lane_count):
host_electrical_interface_id = appl_adv_dict[app_id].get('host_electrical_interface_id')
if host_electrical_interface_id:
lane_speed_key = LANE_SPEED_KEY_PREFIX + host_electrical_interface_id.split()[0]
else:
helper_logger.log_error("Unable to derive lane_speed_key because platform_chassis is None")

return lane_speed_key

Expand Down Expand Up @@ -83,6 +85,8 @@ def get_media_settings_key(physical_port, transceiver_dict, port_speed, lane_cou
media_compliance_dict = ast.literal_eval(media_compliance_dict_str)
if sup_compliance_str in media_compliance_dict:
media_compliance_code = media_compliance_dict[sup_compliance_str]
else:
helper_logger.log_error("Unable to derive media_key.media_compliance_code because platform_chassis is None")
except ValueError as e:
helper_logger.log_error("Invalid value for port {} 'specification_compliance': {}".format(physical_port, media_compliance_dict_str))

Expand All @@ -102,6 +106,8 @@ def get_media_settings_key(physical_port, transceiver_dict, port_speed, lane_cou
else:
if media_len != 0:
media_key += '-' + str(media_len) + 'M'
else:
helper_logger.log_error("Unable to derive media_key.media_len because platform_chassis is None")
else:
media_key += '-' + '*'

Expand Down

0 comments on commit 4014a6e

Please sign in to comment.