Skip to content

Commit

Permalink
Fix abbrv name for OSFP (sonic-net#36)
Browse files Browse the repository at this point in the history
There was a problem with the abbreviated type name fetching if the xcvr
was OSFP. This commit fixes the issue.
  • Loading branch information
zzhiyuan authored and jleveque committed Jul 10, 2019
1 parent f19c061 commit 96188fc
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sonic_sfp/sfputilbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -747,14 +747,20 @@ def get_transceiver_info_dict(self, port_num):
else:
return None

sfp_type_abbrv_name_raw = self._read_eeprom_specific_bytes(sysfsfile_eeprom, (offset + OSFP_TYPE_OFFSET), XCVR_TYPE_WIDTH)
if sfp_type_abbrv_name_raw is not None:
sfp_type_abbrv_name = sfpi_obj.parse_sfp_type_abbrv_name(sfp_type_abbrv_name_raw, 0)
else:
return None

try:
sysfsfile_eeprom.close()
except IOError:
print("Error: closing sysfs file %s" % file_path)
return None

transceiver_info_dict['type'] = sfp_type_data['data']['type']['value']
transceiver_info_dict['type_abbrv_name'] = sfp_type_data['data']['type_abbrv_name']['value']
transceiver_info_dict['type_abbrv_name'] = sfp_type_abbrv_name['data']['type_abbrv_name']['value']
transceiver_info_dict['manufacturename'] = sfp_vendor_name_data['data']['Vendor Name']['value']
transceiver_info_dict['modelname'] = sfp_vendor_pn_data['data']['Vendor PN']['value']
transceiver_info_dict['hardwarerev'] = sfp_vendor_rev_data['data']['Vendor Rev']['value']
Expand Down

0 comments on commit 96188fc

Please sign in to comment.