From c011c730590640d0381a5e043e21b105a2d8766f Mon Sep 17 00:00:00 2001 From: zzhiyuan Date: Tue, 20 Aug 2019 11:08:19 -0700 Subject: [PATCH] [xcvrd] Fix crashing due to missing fields of some module types (#54) From SFF-8436 regarding cable length fields: "A value of zero means that the Module does not support (this mode) or that the length information must be determined from the Module technology." It is possible that all cable length fields in eeprom are 0, and this would lead to xcvrd crashing due to fetching of this data. Fallback is added in this case. --- sonic_platform_base/sonic_sfp/sfputilbase.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sonic_platform_base/sonic_sfp/sfputilbase.py b/sonic_platform_base/sonic_sfp/sfputilbase.py index 0a99858249c5..a4492ce69dfa 100644 --- a/sonic_platform_base/sonic_sfp/sfputilbase.py +++ b/sonic_platform_base/sonic_sfp/sfputilbase.py @@ -876,6 +876,8 @@ def get_transceiver_info_dict(self, port_num): transceiver_info_dict['encoding'] = sfp_interface_bulk_data['data']['EncodingCodes']['value'] transceiver_info_dict['ext_identifier'] = sfp_interface_bulk_data['data']['Extended Identifier']['value'] transceiver_info_dict['ext_rateselect_compliance'] = sfp_interface_bulk_data['data']['RateIdentifier']['value'] + transceiver_info_dict['cable_type'] = "Unknown" + transceiver_info_dict['cable_length'] = "Unknown" if sfp_type == 'QSFP': for key in qsfp_cable_length_tup: if key in sfp_interface_bulk_data['data']: