From bea68f43e98be4839e8f9bb11f045a14a64ab0d6 Mon Sep 17 00:00:00 2001 From: Pradchaya Phucharoen Date: Wed, 9 Oct 2019 08:03:01 +0700 Subject: [PATCH] [sfputilbase] Fix xcvr and sfpshow crash with OSFP (#63) * fix xcvr crash when read OSFP DOM threshold * fix sfpshow crash when trying to decodes OSFP's specification_compliance --- sonic_platform_base/sonic_sfp/sfputilbase.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sonic_platform_base/sonic_sfp/sfputilbase.py b/sonic_platform_base/sonic_sfp/sfputilbase.py index a4492ce69dfa..34b739c60a19 100644 --- a/sonic_platform_base/sonic_sfp/sfputilbase.py +++ b/sonic_platform_base/sonic_sfp/sfputilbase.py @@ -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: @@ -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