From 1a5889ade72677c5f61f706e0334484a41cae563 Mon Sep 17 00:00:00 2001 From: Vadym Hlushko <62022266+vadymhlushko-mlnx@users.noreply.github.com> Date: Tue, 20 Dec 2022 10:05:45 +0200 Subject: [PATCH] [SFP] Change logging severity when failed to read EEPROM (#13011) - Why I did it In order to prevent the sonic-mgmt/tests/platform_tests/sfp/test_sfputil.py test failing on the log analyzer step. The mentioned test is performing the sfputil reset EthernetX for every interface on the SONiC switch, this action will flap the SFP device status (INSTERTED -> REMOVED -> INSTERTED). The SONiC XCVRD daemon will catch this SFP device status change (because it is monitoring the presence status of the cable). To judge the cable presence status, currently, we are still leveraging to read the first bytes of the EEPROM, and the EEPROM could be not ready at some moment and the SONiC XCVRD daemon will print the error log to Syslog: ERR pmon#xcvrd: Error! Unable to read data for 'xx' port, page 'xx' offset 128, rc = 1, err msg: Sending access register - How I did it Change logging severity from ERR to WARNING - How to verify it Run the sonic-mgmt/tests/platform_tests/sfp/test_sfputil.py OR much faster way to run the next script on the switch: #!/bin/bash START=0 END=248 for (( intf=$START; intf<=$END; intf+=8)) do sfputil reset Ethernet"${intf}" done sfputil show presence --- platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py index 2ca37fcefd..5f2ca310f3 100644 --- a/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py +++ b/platform/mellanox/mlnx-platform-api/sonic_platform/sfp.py @@ -345,7 +345,7 @@ class SFP(NvidiaSFPCommon): raise IOError(f'errno = {os.strerror(ctypes.get_errno())}') except (OSError, IOError) as e: if log_on_error: - logger.log_error(f'Failed to read sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, \ + logger.log_warning(f'Failed to read sfp={self.sdk_index} EEPROM page={page}, page_offset={page_offset}, \ size={num_bytes}, offset={offset}, error = {e}') return None