[Mellanox] [202012] Allow user to set LED to orange (#9514)
Backport https://github.com/Azure/sonic-buildimage/pull/9259 to 202012 #### Why I did it Nvidia platform API does not support set LED to orange. #### How I did it Allow user to set LED to orange #### How to verify it Manual test
This commit is contained in:
parent
0226140e9c
commit
0197855d5d
@ -41,6 +41,17 @@ class Led(object):
|
|||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
with open(led_path, 'w') as led:
|
||||||
|
led.write(Led.LED_ON)
|
||||||
|
status = True
|
||||||
|
elif color == Led.STATUS_LED_COLOR_ORANGE:
|
||||||
|
if Led.STATUS_LED_COLOR_ORANGE in led_cap_list:
|
||||||
|
led_path = self.get_orange_led_path()
|
||||||
|
elif Led.STATUS_LED_COLOR_RED in led_cap_list:
|
||||||
|
led_path = self.get_red_led_path()
|
||||||
|
else:
|
||||||
|
return False
|
||||||
|
|
||||||
with open(led_path, 'w') as led:
|
with open(led_path, 'w') as led:
|
||||||
led.write(Led.LED_ON)
|
led.write(Led.LED_ON)
|
||||||
status = True
|
status = True
|
||||||
@ -158,7 +169,7 @@ class Led(object):
|
|||||||
cap_list = set(caps.split())
|
cap_list = set(caps.split())
|
||||||
except (ValueError, IOError):
|
except (ValueError, IOError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return cap_list
|
return cap_list
|
||||||
|
|
||||||
def get_green_led_path(self):
|
def get_green_led_path(self):
|
||||||
@ -191,7 +202,7 @@ class Led(object):
|
|||||||
def get_led_cap_path(self):
|
def get_led_cap_path(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class FanLed(Led):
|
class FanLed(Led):
|
||||||
LED_PATH = "/var/run/hw-management/led/"
|
LED_PATH = "/var/run/hw-management/led/"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user