diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 0e76f947b839..28972f858919 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -359,7 +359,7 @@ def get_error_info_from_sdk_error_type(self): Returns: tuple: (error state, error description) """ - error_type = utils.read_int_from_file(f'/sys/module/sx_core/asic0/module{self.sdk_index}/temperature/statuserror', default=-1) + error_type = utils.read_int_from_file(f'/sys/module/sx_core/asic0/module{self.sdk_index}/statuserror', default=-1) sfp_state_bits = NvidiaSFPCommon.SDK_ERRORS_TO_ERROR_BITS.get(error_type) if sfp_state_bits is None: logger.log_error(f"Unrecognized error {error_type} detected on SFP {self.sdk_index}") @@ -678,7 +678,9 @@ def get_error_description(self): if self.is_sw_control(): api = self.get_xcvr_api() return api.get_error_description() if api else None - except: + except NotImplementedError: + return 'Not supported' + except Exception: return self.SFP_STATUS_INITIALIZING oper_status, error_code = self._get_module_info(self.sdk_index) diff --git a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py index fecfadc1d93c..147f14a1f105 100644 --- a/platform/mellanox/mlnx-platform-api/tests/test_sfp.py +++ b/platform/mellanox/mlnx-platform-api/tests/test_sfp.py @@ -94,6 +94,10 @@ def test_sfp_get_error_status(self, mock_get_error_code, mock_control): mock_control.side_effect = RuntimeError('') description = sfp.get_error_description() assert description == 'Initializing' + + mock_control.side_effect = NotImplementedError('') + description = sfp.get_error_description() + assert description == 'Not supported' @mock.patch('sonic_platform.sfp.SFP._get_page_and_page_offset') @mock.patch('sonic_platform.sfp.SFP._is_write_protected')