Skip to content

Commit

Permalink
[sfputilbase] Fix xcvr and sfpshow crash with OSFP (sonic-net#63)
Browse files Browse the repository at this point in the history
* fix xcvr crash when read OSFP DOM threshold
* fix sfpshow crash when trying to decodes OSFP's specification_compliance
  • Loading branch information
pphuchar authored and jleveque committed Oct 9, 2019
1 parent cc2dac5 commit bea68f4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions sonic_platform_base/sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@ def get_transceiver_info_dict(self, port_num):
transceiver_info_dict['ext_rateselect_compliance'] = 'N/A'
transceiver_info_dict['cable_type'] = 'N/A'
transceiver_info_dict['cable_length'] = 'N/A'
transceiver_info_dict['specification_compliance'] = 'N/A'
transceiver_info_dict['specification_compliance'] = '{}'
transceiver_info_dict['nominal_bit_rate'] = 'N/A'

else:
Expand Down Expand Up @@ -1103,7 +1103,11 @@ def get_transceiver_dom_threshold_info_dict(self, port_num):
]
transceiver_dom_threshold_info_dict = dict.fromkeys(dom_info_dict_keys, 'N/A')

if port_num in self.qsfp_ports:
if port_num in self.osfp_ports:
# Below part is added to avoid fail xcvrd, shall be implemented later
return transceiver_dom_threshold_info_dict

elif port_num in self.qsfp_ports:
file_path = self._get_port_eeprom_path(port_num, self.IDENTITY_EEPROM_ADDR)
if not self._sfp_eeprom_present(file_path, 0):
return None
Expand Down

0 comments on commit bea68f4

Please sign in to comment.