Skip to content

Commit 10837a2

Browse files
authored
add set get uid led api (sonic-net#369)
* add set get uid led api * add test case to improve coverage
1 parent fc5d5f0 commit 10837a2

2 files changed

Lines changed: 45 additions & 0 deletions

File tree

sonic_platform_base/chassis_base.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,33 @@ def get_status_led(self):
546546
"""
547547
raise NotImplementedError
548548

549+
##############################################
550+
# System LED methods
551+
##############################################
552+
553+
def set_uid_led(self, color):
554+
"""
555+
Sets the state of the system UID LED
556+
557+
Args:
558+
color: A string representing the color with which to set the
559+
system UID LED
560+
561+
Returns:
562+
bool: True if system LED state is set successfully, False if not
563+
"""
564+
raise NotImplementedError
565+
566+
def get_uid_led(self):
567+
"""
568+
Gets the state of the system UID LED
569+
570+
Returns:
571+
A string, one of the valid LED color strings which could be vendor
572+
specified.
573+
"""
574+
raise NotImplementedError
575+
549576
##############################################
550577
# Other methods
551578
##############################################

tests/chassis_base_test.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,21 @@ def test_reboot_cause(self):
1616
assert(chassis.REBOOT_CAUSE_HARDWARE_BUTTON == "Push button")
1717
assert(chassis.REBOOT_CAUSE_HARDWARE_RESET_FROM_ASIC == "Reset from ASIC")
1818
assert(chassis.REBOOT_CAUSE_NON_HARDWARE == "Non-Hardware")
19+
20+
def test_chassis_base(self):
21+
chassis = ChassisBase()
22+
not_implemented_methods = [
23+
[chassis.get_uid_led],
24+
[chassis.set_uid_led, "COLOR"],
25+
]
26+
27+
for method in not_implemented_methods:
28+
exception_raised = False
29+
try:
30+
func = method[0]
31+
args = method[1:]
32+
func(*args)
33+
except NotImplementedError:
34+
exception_raised = True
35+
36+
assert exception_raised

0 commit comments

Comments
 (0)