diff --git a/sonic_platform_base/psu_base.py b/sonic_platform_base/psu_base.py index 63b1a7ef27ff..98aebec8ef00 100644 --- a/sonic_platform_base/psu_base.py +++ b/sonic_platform_base/psu_base.py @@ -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): """ diff --git a/tests/psu_base_test.py b/tests/psu_base_test.py new file mode 100644 index 000000000000..6c1e079eb29a --- /dev/null +++ b/tests/psu_base_test.py @@ -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