Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 18 additions & 11 deletions device/nokia/armhf-nokia_ixs7215_52x-r0/plugins/led_control.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ def __init__(self):
self._initDefaultConfig()

def _initDefaultConfig(self):
# For the D1 box the port leds are controlled by Trident3 LED program
# The fan tray leds will be managed with the new thermalctl daemon / chassis class based API
# leaving only the system leds to be done old style
# The fan tray leds and system led managed by new chassis class API
# leaving only a couple other front panel leds to be done old style
DBG_PRINT("starting system leds")
self._initSystemLed()
DBG_PRINT(" led done")
Expand Down Expand Up @@ -77,31 +76,39 @@ def _initSystemLed(self):
while True:
# Front Panel FAN Panel LED setting in register 0x08
if (self.chassis.get_fan(0).get_status() == self.chassis.get_fan(1).get_status() == True):
if oldfan != 0x1:
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
if (os.path.isfile("/sys/class/gpio/fanLedAmber/value")):
if oldfan != 0x1:
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
oldfan = 0x1
else:
oldfan = 0xf
else:
if oldfan != 0x0:
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
if (os.path.isfile("/sys/class/gpio/fanLedGreen/value")):
if oldfan != 0x0:
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
oldfan = 0x0
else:
oldfan = 0xf

# Front Panel PSU Panel LED setting in register 0x09
if (self.chassis.get_psu(0).get_status() == self.chassis.get_psu(1).get_status() == True):
if oldpsu != 0x1:
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
if (os.path.isfile("/sys/class/gpio/psuLedAmber/value")):
if oldpsu != 0x1:
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
oldpsu = 0x1
else:
oldpsu = 0xf
else:
if oldpsu != 0x0:
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
if (os.path.isfile("/sys/class/gpio/psuLedGreen/value")):
if oldpsu != 0x0:
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 0)
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
oldpsu = 0x0
else:
oldpsu = 0xf
time.sleep(6)

# Helper method to map SONiC port name to index
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,6 @@ def __init__(self, index, sfp_type, eeprom_path, port_i2c_map):
self.dom_tx_power_supported = False
self.calibration = 0

self._dom_capability_detect()

def __convert_string_to_num(self, value_str):
if "-inf" in value_str:
return 'N/A'
Expand Down Expand Up @@ -402,6 +400,7 @@ def get_transceiver_bulk_status(self):

if self.sfp_type == SFP_TYPE:

self._dom_capability_detect()
if not self.dom_supported:
return transceiver_dom_info_dict

Expand Down Expand Up @@ -487,6 +486,7 @@ def get_transceiver_threshold_info(self):

offset = SFP_MODULE_ADDRA2_OFFSET

self._dom_capability_detect()
if not self.dom_supported:
return transceiver_dom_threshold_info_dict

Expand Down Expand Up @@ -533,6 +533,7 @@ def get_reset_status(self):
Returns:
A Boolean, True if reset enabled, False if disabled
"""
self._dom_capability_detect()
if not self.dom_supported:
return False
if self.sfp_type == COPPER_TYPE:
Expand Down Expand Up @@ -710,6 +711,7 @@ def get_rx_power(self):
if sfpd_obj is None:
return None

self._dom_capability_detect()
if self.dom_supported:
sfpd_obj._calibration_type = self.calibration

Expand Down Expand Up @@ -747,6 +749,7 @@ def get_tx_power(self):
if sfpd_obj is None:
return None

self._dom_capability_detect()
if self.dom_supported:
sfpd_obj._calibration_type = self.calibration

Expand Down