From 70b01f611dc7ca4959fce92e33b51f2b5b71cec6 Mon Sep 17 00:00:00 2001 From: Junchao-Mellanox Date: Thu, 9 Nov 2023 08:40:37 +0200 Subject: [PATCH] Implement is_copper for SFP --- sonic_platform_base/sonic_xcvr/api/public/sff8472.py | 3 +++ tests/sonic_xcvr/test_sff8472.py | 1 + 2 files changed, 4 insertions(+) diff --git a/sonic_platform_base/sonic_xcvr/api/public/sff8472.py b/sonic_platform_base/sonic_xcvr/api/public/sff8472.py index 36e458d3a..9fe40a16e 100644 --- a/sonic_platform_base/sonic_xcvr/api/public/sff8472.py +++ b/sonic_platform_base/sonic_xcvr/api/public/sff8472.py @@ -295,3 +295,6 @@ def get_lpmode_support(self): def get_power_override_support(self): return False + + def is_copper(self): + return self.xcvr_eeprom.read(consts.SFP_CABLE_TECH_FIELD) == 'Passive Cable' diff --git a/tests/sonic_xcvr/test_sff8472.py b/tests/sonic_xcvr/test_sff8472.py index a1d8c1a2c..c11db8fcd 100644 --- a/tests/sonic_xcvr/test_sff8472.py +++ b/tests/sonic_xcvr/test_sff8472.py @@ -55,6 +55,7 @@ def test_api(self): self.api.get_transceiver_thresholds_support() self.api.get_lpmode_support() self.api.get_power_override_support() + self.api.is_copper() def test_temp(self): temp_field = self.mem_map.get_field(consts.TEMPERATURE_FIELD)