diff --git a/sonic_platform_base/module_base.py b/sonic_platform_base/module_base.py index a474000b3..a9fa1a226 100644 --- a/sonic_platform_base/module_base.py +++ b/sonic_platform_base/module_base.py @@ -71,6 +71,20 @@ class ModuleBase(device_base.DeviceBase): # Module reboot type to reboot SMART SWITCH MODULE_REBOOT_SMARTSWITCH = "SMARTSWITCH" + # Possible midplane down reasons for SmartSwitch. + MIDPLANE_DOWN_REASON_POWER_LOSS = "Power Loss" + MIDPLANE_DOWN_REASON_THERMAL_OVERLOAD_CPU = "Thermal Overload: CPU" + MIDPLANE_DOWN_REASON_THERMAL_OVERLOAD_ASIC = "Thermal Overload: ASIC" + MIDPLANE_DOWN_REASON_THERMAL_OVERLOAD_OTHER = "Thermal Overload: Other" + MIDPLANE_DOWN_REASON_INSUFFICIENT_FAN_SPEED = "Insufficient Fan Speed" + MIDPLANE_DOWN_REASON_WATCHDOG = "Watchdog" + MIDPLANE_DOWN_REASON_HARDWARE_OTHER = "Hardware - Other" + MIDPLANE_DOWN_REASON_HARDWARE_BIOS = "BIOS" + MIDPLANE_DOWN_REASON_HARDWARE_CPU = "CPU" + MIDPLANE_DOWN_REASON_HARDWARE_BUTTON = "Push button" + MIDPLANE_DOWN_REASON_HARDWARE_RESET_FROM_ASIC = "Reset from ASIC" + MIDPLANE_DOWN_REASON_NON_HARDWARE = "Non-Hardware" + def __init__(self): # List of ComponentBase-derived objects representing all components # available on the module @@ -1097,6 +1111,19 @@ def get_midplane_ip(self): """ raise NotImplementedError + def get_midplane_down_reason(self): + """ + Retrieves the midplane down reason. + + Returns: + A tuple (string, string) where the first element is a string + containing the midplane down reason. This string must + be one of the predefined strings in this class. If the first + string is "MIDPLANE_DOWN_REASON_HARDWARE_OTHER", the second string can be + used to pass a description of the midplane down reason. + """ + raise NotImplementedError + def is_midplane_reachable(self): """ Retrieves the reachability status of the module from the Supervisor or diff --git a/tests/module_base_test.py b/tests/module_base_test.py index 17ec65da5..21fde9c48 100644 --- a/tests/module_base_test.py +++ b/tests/module_base_test.py @@ -39,7 +39,7 @@ def teardown_method(self): @pytest.mark.parametrize( "method_name", ["get_dpu_id", "get_reboot_cause", "get_state_info", "get_pci_bus_info", "pci_detach", "pci_reattach", - "do_power_cycle"], + "do_power_cycle", "get_midplane_down_reason"], ) def test_not_implemented_methods_raise(self, method_name): with pytest.raises(NotImplementedError):