Skip to content

Commit

Permalink
[Mellanox] Initialize system LED color to green for 201911 (#4743)
Browse files Browse the repository at this point in the history
* [Mellanox] Initialize system LED color to green for 201911

* Rename variable to make it more readable
  • Loading branch information
Junchao-Mellanox committed Jun 16, 2020
1 parent 50f4e7d commit 62690f5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions platform/mellanox/mlnx-platform-api/sonic_platform/chassis.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
# Global logger class instance
logger = Logger()

# System LED system fs definitions for 201911 branch only
SYSTEM_STATUS_LED_GREEN_FILE = '/run/hw-management/led/led_status_green'
LED_ON = '1'

# magic code defnition for port number, qsfp port position of each hwsku
# port_position_tuple = (PORT_START, QSFP_PORT_START, PORT_END, PORT_IN_BLOCK, EEPROM_OFFSET)
hwsku_dict_port = {'ACS-MSN2010': 3, 'ACS-MSN2100': 1, 'ACS-MSN2410': 2, 'ACS-MSN2700': 0, 'Mellanox-SN2700': 0, 'Mellanox-SN2700-D48C8': 0, 'LS-SN2700':0, 'ACS-MSN2740': 0, 'ACS-MSN3700': 0, 'ACS-MSN3700C': 0, 'ACS-MSN3800': 4, 'Mellanox-SN3800-D112C8': 4, 'ACS-MSN4700': 0, 'ACS-MSN3420': 5, 'ACS-MSN4600C': 4}
Expand All @@ -73,6 +77,7 @@ def __init__(self):
self.sfp_module_initialized = False
self.sfp_event_initialized = False
self.reboot_cause_initialized = False
self.initialize_system_led()
logger.log_info("Chassis loaded successfully")


Expand Down Expand Up @@ -472,3 +477,14 @@ def get_thermal_manager(self):
from .thermal_manager import ThermalManager
return ThermalManager

def initialize_system_led(self):
"""
Init system LED color to green.
This is for 201911 branch only
"""
try:
with open(SYSTEM_STATUS_LED_GREEN_FILE, 'w') as f:
f.write(LED_ON)
except:
pass

0 comments on commit 62690f5

Please sign in to comment.