Skip to content
Open
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
27 changes: 27 additions & 0 deletions sonic_platform_base/module_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/module_base_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading