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
20 changes: 20 additions & 0 deletions sonic_platform_base/psu_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,26 @@ def get_maximum_supplied_power(self):
"""
raise NotImplementedError

def get_psu_power_warning_suppress_threshold(self):
"""
Retrieve the warning suppress threshold of the power on this PSU
The value can be volatile, so the caller should call the API each time it is used.

Returns:
A float number, the warning suppress threshold of the PSU in watts.
"""
raise NotImplementedError

def get_psu_power_critical_threshold(self):
"""
Retrieve the critical threshold of the power on this PSU
The value can be volatile, so the caller should call the API each time it is used.

Returns:
A float number, the critical threshold of the PSU in watts.
"""
raise NotImplementedError

@classmethod
def get_status_master_led(cls):
"""
Expand Down
3 changes: 3 additions & 0 deletions sonic_platform_base/sonic_xcvr/api/public/c_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -911,6 +911,9 @@ def get_transceiver_pm(self):
trans_pm['cfo_avg'] = PM_dict['rx_cfo_avg']
trans_pm['cfo_min'] = PM_dict['rx_cfo_min']
trans_pm['cfo_max'] = PM_dict['rx_cfo_max']
trans_pm['evm_avg'] = PM_dict['rx_evm_avg']
trans_pm['evm_min'] = PM_dict['rx_evm_min']
trans_pm['evm_max'] = PM_dict['rx_evm_max']
trans_pm['soproc_avg'] = PM_dict['rx_soproc_avg']
trans_pm['soproc_min'] = PM_dict['rx_soproc_min']
trans_pm['soproc_max'] = PM_dict['rx_soproc_max']
Expand Down
5 changes: 4 additions & 1 deletion sonic_platform_base/sonic_xcvr/api/public/cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,10 @@ def get_transceiver_bulk_status(self):
try:
bulk_status['laser_temperature'] = laser_temp_dict['monitor value']
bulk_status['prefec_ber'] = self.vdm_dict['Pre-FEC BER Average Media Input'][1][0]
bulk_status['postfec_ber'] = self.vdm_dict['Errored Frames Average Media Input'][1][0]
bulk_status['postfec_ber_min'] = self.vdm_dict['Errored Frames Minimum Media Input'][1][0]
bulk_status['postfec_ber_max'] = self.vdm_dict['Errored Frames Maximum Media Input'][1][0]
bulk_status['postfec_ber_avg'] = self.vdm_dict['Errored Frames Average Media Input'][1][0]
bulk_status['postfec_curr_val'] = self.vdm_dict['Errored Frames Current Value Media Input'][1][0]
except (KeyError, TypeError):
pass
return bulk_status
Expand Down
29 changes: 29 additions & 0 deletions tests/psu_base_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from sonic_platform_base.psu_base import PsuBase

class TestPsuBase:

def test_psu_base(self):
psu = PsuBase()
not_implemented_methods = [
psu.get_voltage,
psu.get_current,
psu.get_power,
psu.get_powergood_status,
psu.get_temperature,
psu.get_temperature_high_threshold,
psu.get_voltage_high_threshold,
psu.get_voltage_low_threshold,
psu.get_maximum_supplied_power,
psu.get_psu_power_warning_suppress_threshold,
psu.get_psu_power_critical_threshold,
psu.get_input_voltage,
psu.get_input_current]

for method in not_implemented_methods:
exception_raised = False
try:
method()
except NotImplementedError:
exception_raised = True

assert exception_raised
2 changes: 2 additions & 0 deletions tests/sonic_xcvr/test_ccmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,7 @@ def test_get_transceiver_status(self, get_transceiver_status_func, mock_response
'rx_osnr_avg': 28, 'rx_osnr_min': 26, 'rx_osnr_max': 30,
'rx_esnr_avg': 17, 'rx_esnr_min': 15, 'rx_esnr_max': 18,
'rx_cfo_avg': 200, 'rx_cfo_min': 150, 'rx_cfo_max': 250,
'rx_evm_avg': 15, 'rx_evm_min': 13, 'rx_evm_max': 18,
'tx_power_avg': -10, 'tx_power_min': -9.5, 'tx_power_max': -10.5,
'rx_power_avg': -8, 'rx_power_min': -7, 'rx_power_max': -9,
'rx_sigpwr_avg': -8, 'rx_sigpwr_min': -7, 'rx_sigpwr_max': -9,
Expand All @@ -599,6 +600,7 @@ def test_get_transceiver_status(self, get_transceiver_status_func, mock_response
'osnr_avg': 28, 'osnr_min': 26, 'osnr_max': 30,
'esnr_avg': 17, 'esnr_min': 15, 'esnr_max': 18,
'cfo_avg': 200, 'cfo_min': 150, 'cfo_max': 250,
'evm_avg': 15, 'evm_min': 13, 'evm_max': 18,
'tx_power_avg': -10, 'tx_power_min': -9.5, 'tx_power_max': -10.5,
'rx_tot_power_avg': -8, 'rx_tot_power_min': -7, 'rx_tot_power_max': -9,
'rx_sig_power_avg': -8, 'rx_sig_power_min': -7, 'rx_sig_power_max': -9,
Expand Down
8 changes: 7 additions & 1 deletion tests/sonic_xcvr/test_cmis.py
Original file line number Diff line number Diff line change
Expand Up @@ -1231,7 +1231,10 @@ def test_get_transceiver_info(self, mock_response, expected):
{'monitor value': 40},
{
'Pre-FEC BER Average Media Input':{1:[0.001, 0.0125, 0, 0.01, 0, False, False, False, False]},
'Errored Frames Minimum Media Input':{1:[0, 1, 0, 1, 0, False, False, False, False]},
'Errored Frames Maximum Media Input':{1:[0, 1, 0, 1, 0, False, False, False, False]},
'Errored Frames Average Media Input':{1:[0, 1, 0, 1, 0, False, False, False, False]},
'Errored Frames Current Value Media Input':{1:[0, 1, 0, 1, 0, False, False, False, False]},
}
],
{
Expand All @@ -1250,7 +1253,10 @@ def test_get_transceiver_info(self, mock_response, expected):
'tx_disabled_channel': 0,
'laser_temperature': 40,
'prefec_ber': 0.001,
'postfec_ber': 0,
'postfec_ber_min': 0,
'postfec_ber_max': 0,
'postfec_ber_avg': 0,
'postfec_curr_val': 0,
}
),
(
Expand Down