Skip to content
Merged
Show file tree
Hide file tree
Changes from 7 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
4 changes: 3 additions & 1 deletion sonic_platform_base/sonic_xcvr/api/public/sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,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 @@ -345,7 +347,7 @@ def get_rx_los_support(self):
return True

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
4 changes: 3 additions & 1 deletion sonic_platform_base/sonic_xcvr/api/public/sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,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 @@ -398,7 +400,7 @@ def get_rx_los_support(self):
return True
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@az-pz @mihirpat1 fix get_rx_los_support() ?

Copy link
Copy Markdown
Contributor Author

@az-pz az-pz Jul 29, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor , get_rx_los_support function is only being used in cmis.py and sff8472.py . In sff8436.py and sff8636.py, they are just defined but not used anywhere in the module. I guess we don't have to fix get_rx_los_support for sff8436.py and sff8472.py.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@prgeor @mihirpat1 , I have added the fix for get_rx_los_support and get_rx_los. I have also tested it and added the result to the PR description.


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
3 changes: 1 addition & 2 deletions tests/sonic_xcvr/test_sff8436.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ 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_module_temperature() == 'N/A'
assert self.api.get_voltage() == 'N/A'
assert not self.api.get_tx_power_support()
Expand Down Expand Up @@ -263,5 +264,3 @@ def test_get_transceiver_dom_real_value(self, mock_response, expected):
self.api.get_rx_power_support.return_value = mock_response[10]
result = self.api.get_transceiver_dom_real_value()
assert result == expected


2 changes: 1 addition & 1 deletion tests/sonic_xcvr/test_sff8636.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ 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 not self.api.get_tx_power_support()
assert not self.api.get_rx_power_support()
assert not self.api.get_rx_power_support()
Expand Down Expand Up @@ -298,4 +299,3 @@ def test_get_transceiver_dom_real_value(self, mock_response, expected):
self.api.get_rx_power_support.return_value = mock_response[10]
result = self.api.get_transceiver_dom_real_value()
assert result == expected

Loading