From 0678aa5324f4ccbae8137821144b0e57662abcde Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Tue, 8 Mar 2022 10:03:34 +0000 Subject: [PATCH 1/2] Fix sfp review comments Signed-off-by: Stephen Sun --- .../mlnx-platform-api/sonic_platform/sfp.py | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 7866735721e6..5c43ae3d9e7b 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -2424,24 +2424,23 @@ def get_transceiver_info(self): application_advertisement |1*255VCHAR |supported applications advertisement ================================================================================ """ - transceiver_info_dict = {} - + transceiver_info_keys = ['manufacturer', + 'model', + 'vendor_rev', + 'serial', + 'vendor_oui', + 'vendor_date', + 'connector', + 'encoding', + 'ext_identifier', + 'ext_rateselect_compliance', + 'cable_type', + 'cable_length', + 'specification_compliance', + 'nominal_bit_rate', + 'application_advertisement'] + transceiver_info_dict = dict.fromkeys(transceiver_info_keys, 'N/A') transceiver_info_dict['type'] = self.sfp_type - transceiver_info_dict['manufacturer'] = 'N/A' - transceiver_info_dict['model'] = 'N/A' - transceiver_info_dict['vendor_rev'] = 'N/A' - transceiver_info_dict['serial'] = 'N/A' - transceiver_info_dict['vendor_oui'] = 'N/A' - transceiver_info_dict['vendor_date'] = 'N/A' - transceiver_info_dict['connector'] = 'N/A' - transceiver_info_dict['encoding'] = 'N/A' - transceiver_info_dict['ext_identifier'] = 'N/A' - 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['nominal_bit_rate'] = 'N/A' - transceiver_info_dict['application_advertisement'] = 'N/A' return transceiver_info_dict From e7fc51d5d9d69544cc01fe9ef828c37726b82b97 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Wed, 9 Mar 2022 07:28:03 +0000 Subject: [PATCH 2/2] Fix comments in ComponentBIOS Signed-off-by: Stephen Sun --- .../mlnx-platform-api/sonic_platform/chassis.py | 11 +++++------ .../mlnx-platform-api/sonic_platform/device_data.py | 9 +++++++++ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py index 1866a4359d37..d5e5bf8d7166 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py @@ -527,14 +527,13 @@ def initialize_components(self): return if not self._component_list: # Initialize component list - from .component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD, ComponentBIOSSN2201 + from .component import ComponentONIE, ComponentSSD, ComponentBIOS, ComponentCPLD self._component_list.append(ComponentONIE()) self._component_list.append(ComponentSSD()) - # Upgrading BIOS is not supported on SN2201 - if DeviceDataManager.get_platform_name() not in ['x86_64-nvidia_sn2201-r0']: - self._component_list.append(ComponentBIOS()) - else: - self._component_list.append(ComponentBIOSSN2201()) + biosComponent = DeviceDataManager.get_bios_component() + if not biosComponent: + biosComponent = ComponentBIOS() + self._component_list.append(biosComponent) self._component_list.extend(ComponentCPLD.get_component_list()) def get_num_components(self): diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py index b4610fe045f0..a029f08fb8bf 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/device_data.py @@ -263,3 +263,12 @@ def get_linecard_max_port_count(cls): if not sfp_data: return 0 return sfp_data.get('max_port_per_line_card', 0) + + @classmethod + def get_bios_component(cls): + if cls.get_platform_name() in ['x86_64-nvidia_sn2201-r0']: + from .component import ComponentBIOSSN2201 + # For SN2201, special chass is required for handle BIOS + # Currently, only fetching BIOS version is supported + return ComponentBIOSSN2201() + return None