Skip to content

Commit

Permalink
Merge pull request sonic-net#833 from pjaipakdee19/seastone2_get_fan_led
Browse files Browse the repository at this point in the history
Initialize get_status_led function for fan led.
  • Loading branch information
Wirut Getbamrung authored Jun 30, 2020
2 parents db29029 + eb2732a commit 7bc13b8
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions device/celestica/x86_64-cel_seastone_2-r0/sonic_platform/fan.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,34 @@ def get_speed_tolerance(self):

# return False

def get_status_led(self):
"""
Gets the state of the fan status LED
Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings above
Note:
STATUS_LED_COLOR_GREEN = "green"
STATUS_LED_COLOR_AMBER = "amber"
STATUS_LED_COLOR_RED = "red"
STATUS_LED_COLOR_OFF = "off"
"""

status_led = self.STATUS_LED_COLOR_OFF
f_name = inspect.stack()[0][3]
config = self._config.get(f_name)

if self.is_psu_fan:
# Not support
return self.STATUS_LED_COLOR_OFF
elif self.get_presence():
if config.get('oper_type') == Common.OPER_IMPI:
full_cmd = config['template'].format(config['command'][self.fan_index])
status, result = self._api_common.run_command(full_cmd)
status_led = eval(config['formula'].format(result))

return status_led

# def set_status_led(self, color):
# """
# Sets the state of the fan module status LED
Expand Down

0 comments on commit 7bc13b8

Please sign in to comment.