[nokia]: IXS7215:fix for dynamic changes reading DOM and LED (#6136)
clean up corner condition when SDK reset and SFP's move Co-authored-by: Carl Keene <keene@nokia.com>
This commit is contained in:
parent
77afb8e54d
commit
2cd236cece
@ -37,9 +37,8 @@ class LedControl(LedControlBase):
|
|||||||
self._initDefaultConfig()
|
self._initDefaultConfig()
|
||||||
|
|
||||||
def _initDefaultConfig(self):
|
def _initDefaultConfig(self):
|
||||||
# For the D1 box the port leds are controlled by Trident3 LED program
|
# The fan tray leds and system led managed by new chassis class API
|
||||||
# The fan tray leds will be managed with the new thermalctl daemon / chassis class based API
|
# leaving only a couple other front panel leds to be done old style
|
||||||
# leaving only the system leds to be done old style
|
|
||||||
DBG_PRINT("starting system leds")
|
DBG_PRINT("starting system leds")
|
||||||
self._initSystemLed()
|
self._initSystemLed()
|
||||||
DBG_PRINT(" led done")
|
DBG_PRINT(" led done")
|
||||||
@ -77,31 +76,39 @@ class LedControl(LedControlBase):
|
|||||||
while True:
|
while True:
|
||||||
# Front Panel FAN Panel LED setting in register 0x08
|
# 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 (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/fanLedAmber/value", 0)
|
||||||
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
|
self._set_i2c_register("/sys/class/gpio/fanLedGreen/value", 1)
|
||||||
oldfan = 0x1
|
oldfan = 0x1
|
||||||
|
else:
|
||||||
|
oldfan = 0xf
|
||||||
else:
|
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/fanLedGreen/value", 0)
|
||||||
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
|
self._set_i2c_register("/sys/class/gpio/fanLedAmber/value", 1)
|
||||||
oldfan = 0x0
|
oldfan = 0x0
|
||||||
|
else:
|
||||||
|
oldfan = 0xf
|
||||||
|
|
||||||
# Front Panel PSU Panel LED setting in register 0x09
|
# 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 (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/psuLedAmber/value", 0)
|
||||||
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
|
self._set_i2c_register("/sys/class/gpio/psuLedGreen/value", 1)
|
||||||
oldpsu = 0x1
|
oldpsu = 0x1
|
||||||
|
else:
|
||||||
|
oldpsu = 0xf
|
||||||
else:
|
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/psuLedGreen/value", 0)
|
||||||
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
|
self._set_i2c_register("/sys/class/gpio/psuLedAmber/value", 1)
|
||||||
oldpsu = 0x0
|
oldpsu = 0x0
|
||||||
|
else:
|
||||||
|
oldpsu = 0xf
|
||||||
time.sleep(6)
|
time.sleep(6)
|
||||||
|
|
||||||
# Helper method to map SONiC port name to index
|
# Helper method to map SONiC port name to index
|
||||||
|
@ -166,8 +166,6 @@ class Sfp(SfpBase):
|
|||||||
self.dom_tx_power_supported = False
|
self.dom_tx_power_supported = False
|
||||||
self.calibration = 0
|
self.calibration = 0
|
||||||
|
|
||||||
self._dom_capability_detect()
|
|
||||||
|
|
||||||
def __convert_string_to_num(self, value_str):
|
def __convert_string_to_num(self, value_str):
|
||||||
if "-inf" in value_str:
|
if "-inf" in value_str:
|
||||||
return 'N/A'
|
return 'N/A'
|
||||||
@ -402,6 +400,7 @@ class Sfp(SfpBase):
|
|||||||
|
|
||||||
if self.sfp_type == SFP_TYPE:
|
if self.sfp_type == SFP_TYPE:
|
||||||
|
|
||||||
|
self._dom_capability_detect()
|
||||||
if not self.dom_supported:
|
if not self.dom_supported:
|
||||||
return transceiver_dom_info_dict
|
return transceiver_dom_info_dict
|
||||||
|
|
||||||
@ -487,6 +486,7 @@ class Sfp(SfpBase):
|
|||||||
|
|
||||||
offset = SFP_MODULE_ADDRA2_OFFSET
|
offset = SFP_MODULE_ADDRA2_OFFSET
|
||||||
|
|
||||||
|
self._dom_capability_detect()
|
||||||
if not self.dom_supported:
|
if not self.dom_supported:
|
||||||
return transceiver_dom_threshold_info_dict
|
return transceiver_dom_threshold_info_dict
|
||||||
|
|
||||||
@ -533,6 +533,7 @@ class Sfp(SfpBase):
|
|||||||
Returns:
|
Returns:
|
||||||
A Boolean, True if reset enabled, False if disabled
|
A Boolean, True if reset enabled, False if disabled
|
||||||
"""
|
"""
|
||||||
|
self._dom_capability_detect()
|
||||||
if not self.dom_supported:
|
if not self.dom_supported:
|
||||||
return False
|
return False
|
||||||
if self.sfp_type == COPPER_TYPE:
|
if self.sfp_type == COPPER_TYPE:
|
||||||
@ -710,6 +711,7 @@ class Sfp(SfpBase):
|
|||||||
if sfpd_obj is None:
|
if sfpd_obj is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
self._dom_capability_detect()
|
||||||
if self.dom_supported:
|
if self.dom_supported:
|
||||||
sfpd_obj._calibration_type = self.calibration
|
sfpd_obj._calibration_type = self.calibration
|
||||||
|
|
||||||
@ -747,6 +749,7 @@ class Sfp(SfpBase):
|
|||||||
if sfpd_obj is None:
|
if sfpd_obj is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
|
self._dom_capability_detect()
|
||||||
if self.dom_supported:
|
if self.dom_supported:
|
||||||
sfpd_obj._calibration_type = self.calibration
|
sfpd_obj._calibration_type = self.calibration
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user