Skip to content

Commit b70e759

Browse files
authored
support new reboot-cause (sonic-net#277)
- Description Add some new reboot causes to cover followinging scenarios: BIOS - In case the BIOS upgrade process ended with failure and cause the switch to reset. CPU - Reset is initiated by SW on the CPU. it could be that SW encountered some catastrophic situation like a memory leak, eventually, the kernel reset the whole switch. Push button - Reset by pushing the reset button Reset from ASIC - Reset which is caused by ASIC. Motivation and Context Add more reboot causes to cover more scenarios. - How Has This Been Tested? UT is added with the code change. Run community reboot test to see the reboot cause checker can pass. Signed-off-by: Kebo Liu <[email protected]>
1 parent 01512ec commit b70e759

File tree

2 files changed

+22
-0
lines changed

2 files changed

+22
-0
lines changed

sonic_platform_base/chassis_base.py

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ class ChassisBase(device_base.DeviceBase):
2424
REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED = "Insufficient Fan Speed"
2525
REBOOT_CAUSE_WATCHDOG = "Watchdog"
2626
REBOOT_CAUSE_HARDWARE_OTHER = "Hardware - Other"
27+
REBOOT_CAUSE_HARDWARE_BIOS = "BIOS"
28+
REBOOT_CAUSE_HARDWARE_CPU = "CPU"
29+
REBOOT_CAUSE_HARDWARE_BUTTON = "Push button"
30+
REBOOT_CAUSE_HARDWARE_RESET_FROM_ASIC = "Reset from ASIC"
2731
REBOOT_CAUSE_NON_HARDWARE = "Non-Hardware"
2832

2933
def __init__(self):

tests/chassis_base_test.py

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from sonic_platform_base.chassis_base import ChassisBase
2+
3+
class TestChassisBase:
4+
5+
def test_reboot_cause(self):
6+
chassis = ChassisBase()
7+
assert(chassis.REBOOT_CAUSE_POWER_LOSS == "Power Loss")
8+
assert(chassis.REBOOT_CAUSE_THERMAL_OVERLOAD_CPU == "Thermal Overload: CPU")
9+
assert(chassis.REBOOT_CAUSE_THERMAL_OVERLOAD_ASIC == "Thermal Overload: ASIC")
10+
assert(chassis.REBOOT_CAUSE_THERMAL_OVERLOAD_OTHER == "Thermal Overload: Other")
11+
assert(chassis.REBOOT_CAUSE_INSUFFICIENT_FAN_SPEED == "Insufficient Fan Speed")
12+
assert(chassis.REBOOT_CAUSE_WATCHDOG == "Watchdog")
13+
assert(chassis.REBOOT_CAUSE_HARDWARE_OTHER == "Hardware - Other")
14+
assert(chassis.REBOOT_CAUSE_HARDWARE_BIOS == "BIOS")
15+
assert(chassis.REBOOT_CAUSE_HARDWARE_CPU == "CPU")
16+
assert(chassis.REBOOT_CAUSE_HARDWARE_BUTTON == "Push button")
17+
assert(chassis.REBOOT_CAUSE_HARDWARE_RESET_FROM_ASIC == "Reset from ASIC")
18+
assert(chassis.REBOOT_CAUSE_NON_HARDWARE == "Non-Hardware")

0 commit comments

Comments
 (0)