[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:
carl-nokia 2020-12-11 10:35:24 -05:00 committed by GitHub
parent 77afb8e54d
commit 2cd236cece
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 13 deletions

View File

@ -37,9 +37,8 @@ class LedControl(LedControlBase):
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")
@ -77,31 +76,39 @@ class LedControl(LedControlBase):
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 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:
if oldfan != 0x0:
oldfan = 0xf
else:
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 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:
if oldpsu != 0x0:
oldpsu = 0xf
else:
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

View File

@ -166,8 +166,6 @@ class Sfp(SfpBase):
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'
@ -402,6 +400,7 @@ class Sfp(SfpBase):
if self.sfp_type == SFP_TYPE:
self._dom_capability_detect()
if not self.dom_supported:
return transceiver_dom_info_dict
@ -487,6 +486,7 @@ class Sfp(SfpBase):
offset = SFP_MODULE_ADDRA2_OFFSET
self._dom_capability_detect()
if not self.dom_supported:
return transceiver_dom_threshold_info_dict
@ -533,6 +533,7 @@ class Sfp(SfpBase):
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:
@ -710,6 +711,7 @@ class Sfp(SfpBase):
if sfpd_obj is None:
return None
self._dom_capability_detect()
if self.dom_supported:
sfpd_obj._calibration_type = self.calibration
@ -747,6 +749,7 @@ class Sfp(SfpBase):
if sfpd_obj is None:
return None
self._dom_capability_detect()
if self.dom_supported:
sfpd_obj._calibration_type = self.calibration