Skip to content

Commit 7bc13b8

Browse files
author
Wirut Getbamrung
authored
Merge pull request sonic-net#833 from pjaipakdee19/seastone2_get_fan_led
Initialize get_status_led function for fan led.
2 parents db29029 + eb2732a commit 7bc13b8

File tree

1 file changed

+28
-0
lines changed
  • device/celestica/x86_64-cel_seastone_2-r0/sonic_platform

1 file changed

+28
-0
lines changed

device/celestica/x86_64-cel_seastone_2-r0/sonic_platform/fan.py

+28
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,34 @@ def get_speed_tolerance(self):
156156

157157
# return False
158158

159+
def get_status_led(self):
160+
"""
161+
Gets the state of the fan status LED
162+
Returns:
163+
A string, one of the predefined STATUS_LED_COLOR_* strings above
164+
165+
Note:
166+
STATUS_LED_COLOR_GREEN = "green"
167+
STATUS_LED_COLOR_AMBER = "amber"
168+
STATUS_LED_COLOR_RED = "red"
169+
STATUS_LED_COLOR_OFF = "off"
170+
"""
171+
172+
status_led = self.STATUS_LED_COLOR_OFF
173+
f_name = inspect.stack()[0][3]
174+
config = self._config.get(f_name)
175+
176+
if self.is_psu_fan:
177+
# Not support
178+
return self.STATUS_LED_COLOR_OFF
179+
elif self.get_presence():
180+
if config.get('oper_type') == Common.OPER_IMPI:
181+
full_cmd = config['template'].format(config['command'][self.fan_index])
182+
status, result = self._api_common.run_command(full_cmd)
183+
status_led = eval(config['formula'].format(result))
184+
185+
return status_led
186+
159187
# def set_status_led(self, color):
160188
# """
161189
# Sets the state of the fan module status LED

0 commit comments

Comments
 (0)