Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions sonic_platform_base/sonic_xcvr/api/public/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,8 @@ def get_transceiver_threshold_info(self):
}

def get_rx_los(self):
if not self.get_rx_los_support():
return ["N/A" for _ in range(self.NUM_CHANNELS)]
rx_los = self.xcvr_eeprom.read(consts.RX_LOS_FIELD)
if rx_los is None:
return None
Expand Down Expand Up @@ -269,6 +271,8 @@ def get_voltage(self):
return float("{:.3f}".format(voltage))

def get_tx_bias(self):
if not self.get_tx_bias_support():
return ["N/A" for _ in range(self.NUM_CHANNELS)]
tx_bias = self.xcvr_eeprom.read(consts.TX_BIAS_FIELD)
if tx_bias is None:
return None
Expand Down Expand Up @@ -342,10 +346,10 @@ def get_voltage_support(self):
return not self.is_copper()

def get_rx_los_support(self):
return True
return not self.is_copper()

def get_tx_bias_support(self):
return True
return not self.is_copper()

def get_tx_fault_support(self):
return self.xcvr_eeprom.read(consts.TX_FAULT_SUPPORT_FIELD)
Expand Down
8 changes: 6 additions & 2 deletions sonic_platform_base/sonic_xcvr/api/public/sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,8 @@ def get_transceiver_threshold_info(self):
}

def get_rx_los(self):
if not self.get_rx_los_support():
return ["N/A" for _ in range(self.NUM_CHANNELS)]
rx_los = self.xcvr_eeprom.read(consts.RX_LOS_FIELD)
if rx_los is None:
return None
Expand Down Expand Up @@ -287,6 +289,8 @@ def get_voltage(self):
return float("{:.3f}".format(voltage))

def get_tx_bias(self):
if not self.get_tx_bias_support():
return ["N/A" for _ in range(self.NUM_CHANNELS)]
tx_bias = self.xcvr_eeprom.read(consts.TX_BIAS_FIELD)
if tx_bias is None:
return None
Expand Down Expand Up @@ -395,10 +399,10 @@ def get_voltage_support(self):
return self._voltage_support

def get_rx_los_support(self):
return True
return not self.is_copper()

def get_tx_bias_support(self):
return True
return not self.is_copper()

def get_tx_fault_support(self):
return self.xcvr_eeprom.read(consts.TX_FAULT_SUPPORT_FIELD)
Expand Down
5 changes: 4 additions & 1 deletion tests/sonic_xcvr/test_sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,14 @@ def test_is_copper(self):
def test_simulate_copper(self):
with patch.object(self.api, 'is_copper', return_value=True):
assert self.api.get_rx_power() == ['N/A'] * self.api.NUM_CHANNELS
assert self.api.get_tx_bias() == ['N/A'] * self.api.NUM_CHANNELS
assert self.api.get_rx_los() == ['N/A'] * self.api.NUM_CHANNELS
assert self.api.get_module_temperature() == 'N/A'
assert self.api.get_voltage() == 'N/A'
assert not self.api.get_tx_power_support()
assert not self.api.get_rx_power_support()
assert not self.api.get_rx_power_support()
assert not self.api.get_tx_bias_support()
assert not self.api.get_rx_los_support()
assert not self.api.get_temperature_support()
assert not self.api.get_voltage_support()

Expand Down
5 changes: 4 additions & 1 deletion tests/sonic_xcvr/test_sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,12 @@ def test_is_copper(self):
def test_simulate_copper(self):
with patch.object(self.api, 'is_copper', return_value=True):
assert self.api.get_rx_power() == ['N/A'] * self.api.NUM_CHANNELS
assert self.api.get_tx_bias() == ['N/A'] * self.api.NUM_CHANNELS
assert self.api.get_rx_los() == ['N/A'] * self.api.NUM_CHANNELS
assert not self.api.get_tx_power_support()
assert not self.api.get_rx_power_support()
assert not self.api.get_rx_power_support()
assert not self.api.get_tx_bias_support()
assert not self.api.get_rx_los_support()
assert not self.api.get_temperature_support()
assert not self.api.get_voltage_support()

Expand Down
Loading