[DellEMC]: S6100, S6000 - Platform API fixes (#6073)

- Change return type of SFP methods to match specification in sonic_platform_common/sfp_base.py
- Use init methods of base classes to initialize common instance variables
- Handle negative timeout values in S6100's watchdog ‘arm’ method
- Return appropriate values for 'get_target_speed', 'set_status_led' to avoid false warnings
This commit is contained in:
Arun Saravanan Balachandran 2020-12-01 18:43:41 +00:00 committed by GitHub
parent 9265022502
commit 165cae73ab
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 113 additions and 177 deletions

View File

@ -155,7 +155,7 @@ class Fan(FanBase):
string: The name of the Fan string: The name of the Fan
""" """
if not self.is_psu_fan: if not self.is_psu_fan:
return "Fan{}".format(self.index) return "FanTray{}-Fan1".format(self.index)
else: else:
return "PSU{} Fan".format(self.index) return "PSU{} Fan".format(self.index)
@ -213,7 +213,7 @@ class Fan(FanBase):
status = False status = False
fan_speed = self._get_i2c_register(self.get_fan_speed_reg) fan_speed = self._get_i2c_register(self.get_fan_speed_reg)
if (fan_speed != 'ERR'): if (fan_speed != 'ERR'):
if (int(fan_speed) > 14000): if (int(fan_speed) > 1000):
status = True status = True
return status return status
@ -337,4 +337,5 @@ class Fan(FanBase):
An integer, the percentage of full fan speed, in the range 0 An integer, the percentage of full fan speed, in the range 0
(off) to 100 (full speed) (off) to 100 (full speed)
""" """
return 79 # Fan speeds are controlled by fancontrol.sh
return self.get_speed()

View File

@ -8,7 +8,6 @@
############################################################################# #############################################################################
try: try:
import os
from sonic_platform_base.platform_base import PlatformBase from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis from sonic_platform.chassis import Chassis
except ImportError as e: except ImportError as e:

View File

@ -26,6 +26,7 @@ class Psu(PsuBase):
I2C_DIR = "/sys/class/i2c-adapter/" I2C_DIR = "/sys/class/i2c-adapter/"
def __init__(self, psu_index): def __init__(self, psu_index):
PsuBase.__init__(self)
# PSU is 1-based in DellEMC platforms # PSU is 1-based in DellEMC platforms
self.index = psu_index + 1 self.index = psu_index + 1
self.psu_presence_reg = "psu{}_prs".format(psu_index) self.psu_presence_reg = "psu{}_prs".format(psu_index)
@ -52,10 +53,6 @@ class Psu(PsuBase):
self.eeprom = Eeprom(is_psu=True, psu_index=self.index) self.eeprom = Eeprom(is_psu=True, psu_index=self.index)
# Overriding _fan_list class variable defined in PsuBase, to
# make it unique per Psu object
self._fan_list = []
self._fan_list.append(Fan(self.index, psu_fan=True, dependency=self)) self._fan_list.append(Fan(self.index, psu_fan=True, dependency=self))
def _get_cpld_register(self, reg_name): def _get_cpld_register(self, reg_name):
@ -109,9 +106,9 @@ class Psu(PsuBase):
power_reg = glob.glob(self.psu_power_reg) power_reg = glob.glob(self.psu_power_reg)
if len(voltage_reg) and len(current_reg) and len(power_reg): if len(voltage_reg) and len(current_reg) and len(power_reg):
self.psu_voltage_reg = voltage_reg_path[0] self.psu_voltage_reg = voltage_reg[0]
self.psu_current_reg = current_reg_path[0] self.psu_current_reg = current_reg[0]
self.psu_power_reg = power_reg_path[0] self.psu_power_reg = power_reg[0]
self.is_driver_initialized = True self.is_driver_initialized = True
def get_name(self): def get_name(self):

View File

@ -9,9 +9,8 @@
############################################################################# #############################################################################
try: try:
import os import re
import time import time
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sfp_base import SfpBase
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom
@ -44,7 +43,8 @@ info_dict_keys = ['type', 'hardware_rev', 'serial',
'manufacturer', 'model', 'connector', 'manufacturer', 'model', 'connector',
'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'encoding', 'ext_identifier', 'ext_rateselect_compliance',
'cable_type', 'cable_length', 'nominal_bit_rate', 'cable_type', 'cable_length', 'nominal_bit_rate',
'specification_compliance', 'type_abbrv_name','vendor_date', 'vendor_oui'] 'specification_compliance', 'type_abbrv_name', 'vendor_date',
'vendor_oui', 'application_advertisement']
dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status',
'power_lpmode', 'tx_disable', 'tx_disable_channel', 'power_lpmode', 'tx_disable', 'tx_disable_channel',
@ -169,6 +169,14 @@ class Sfp(SfpBase):
return eeprom_data return eeprom_data
def _strip_unit_from_str(self, value_str):
match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str)
if match:
for value in match.groups():
if value is not None:
return float(value)
return None
def get_transceiver_info(self): def get_transceiver_info(self):
""" """
@ -487,115 +495,94 @@ class Sfp(SfpBase):
""" """
Retrieves the RX LOS (lost-of-signal) status of SFP Retrieves the RX LOS (lost-of-signal) status of SFP
""" """
rx_los = None
rx_los_list = [] rx_los_list = []
rx_los_data = self._get_eeprom_data('rx_los') rx_los_data = self._get_eeprom_data('rx_los')
if (rx_los_data is not None): if (rx_los_data is not None):
rx_los = rx_los_data['data']['Rx1LOS']['value'] rx_los = rx_los_data['data']['Rx1LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx2LOS']['value'] rx_los = rx_los_data['data']['Rx2LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx3LOS']['value'] rx_los = rx_los_data['data']['Rx3LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx4LOS']['value'] rx_los = rx_los_data['data']['Rx4LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
if (rx_los_list[0] and rx_los_list[1] return rx_los_list
and rx_los_list[2] and rx_los_list[3]):
rx_los = True
else:
rx_los = False
return rx_los
def get_tx_fault(self): def get_tx_fault(self):
""" """
Retrieves the TX fault status of SFP Retrieves the TX fault status of SFP
""" """
tx_fault = None
tx_fault_list = [] tx_fault_list = []
tx_fault_data = self._get_eeprom_data('tx_fault') tx_fault_data = self._get_eeprom_data('tx_fault')
if (tx_fault_data is not None): if (tx_fault_data is not None):
tx_fault = tx_fault_data['data']['Tx1Fault']['value'] tx_fault = tx_fault_data['data']['Tx1Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx2Fault']['value'] tx_fault = tx_fault_data['data']['Tx2Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx3Fault']['value'] tx_fault = tx_fault_data['data']['Tx3Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx4Fault']['value'] tx_fault = tx_fault_data['data']['Tx4Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
if (tx_fault_list[0] and tx_fault_list[1] return tx_fault_list
and tx_fault_list[2] and tx_fault_list[3]):
tx_fault = True
else:
tx_fault = False
return tx_fault
def get_tx_disable(self): def get_tx_disable(self):
""" """
Retrieves the tx_disable status of this SFP Retrieves the tx_disable status of this SFP
""" """
tx_disable = None
tx_disable_list = [] tx_disable_list = []
tx_disable_data = self._get_eeprom_data('tx_disable') tx_disable_data = self._get_eeprom_data('tx_disable')
if (tx_disable_data is not None): if (tx_disable_data is not None):
tx_disable = tx_disable_data['data']['Tx1Disable']['value'] tx_disable = tx_disable_data['data']['Tx1Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx2Disable']['value'] tx_disable = tx_disable_data['data']['Tx2Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx3Disable']['value'] tx_disable = tx_disable_data['data']['Tx3Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx4Disable']['value'] tx_disable = tx_disable_data['data']['Tx4Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
if (tx_disable_list[0] and tx_disable_list[1] return tx_disable_list
and tx_disable_list[2] and tx_disable_list[3]):
tx_disable = True
else:
tx_disable = False
return tx_disable
def get_tx_disable_channel(self): def get_tx_disable_channel(self):
""" """
@ -607,22 +594,22 @@ class Sfp(SfpBase):
tx_disable_data = self._get_eeprom_data('tx_disable') tx_disable_data = self._get_eeprom_data('tx_disable')
if (tx_disable_data is not None): if (tx_disable_data is not None):
tx_disable = tx_disable_data['data']['Tx1Disable']['value'] tx_disable = tx_disable_data['data']['Tx1Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx2Disable']['value'] tx_disable = tx_disable_data['data']['Tx2Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx3Disable']['value'] tx_disable = tx_disable_data['data']['Tx3Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx4Disable']['value'] tx_disable = tx_disable_data['data']['Tx4Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
@ -674,7 +661,7 @@ class Sfp(SfpBase):
power_override_data = self._get_eeprom_data('power_override') power_override_data = self._get_eeprom_data('power_override')
if (power_override_data is not None): if (power_override_data is not None):
power_override = power_override_data['data']['PowerOverRide']['value'] power_override = power_override_data['data']['PowerOverRide']['value']
if (power_override is 'On'): if (power_override == 'On'):
power_override_state = True power_override_state = True
else: else:
power_override_state = False power_override_state = False
@ -689,7 +676,7 @@ class Sfp(SfpBase):
temperature_data = self._get_eeprom_data('Temperature') temperature_data = self._get_eeprom_data('Temperature')
if (temperature_data is not None): if (temperature_data is not None):
temperature = temperature_data['data']['Temperature']['value'] temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value'])
return temperature return temperature
@ -701,7 +688,7 @@ class Sfp(SfpBase):
voltage_data = self._get_eeprom_data('Voltage') voltage_data = self._get_eeprom_data('Voltage')
if (voltage_data is not None): if (voltage_data is not None):
voltage = voltage_data['data']['Vcc']['value'] voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value'])
return voltage return voltage
@ -709,19 +696,14 @@ class Sfp(SfpBase):
""" """
Retrieves the TX bias current of this SFP Retrieves the TX bias current of this SFP
""" """
tx_bias = None
tx_bias_list = [] tx_bias_list = []
tx_bias_data = self._get_eeprom_data('ChannelMonitor') tx_bias_data = self._get_eeprom_data('ChannelMonitor')
if (tx_bias_data is not None): if (tx_bias_data is not None):
tx_bias = tx_bias_data['data']['TX1Bias']['value'] tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value']))
tx_bias_list.append(tx_bias) tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX2Bias']['value']))
tx_bias = tx_bias_data['data']['TX2Bias']['value'] tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX3Bias']['value']))
tx_bias_list.append(tx_bias) tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value']))
tx_bias = tx_bias_data['data']['TX3Bias']['value']
tx_bias_list.append(tx_bias)
tx_bias = tx_bias_data['data']['TX4Bias']['value']
tx_bias_list.append(tx_bias)
return tx_bias_list return tx_bias_list
@ -729,19 +711,14 @@ class Sfp(SfpBase):
""" """
Retrieves the received optical power for this SFP Retrieves the received optical power for this SFP
""" """
rx_power = None
rx_power_list = [] rx_power_list = []
rx_power_data = self._get_eeprom_data('ChannelMonitor') rx_power_data = self._get_eeprom_data('ChannelMonitor')
if (rx_power_data is not None): if (rx_power_data is not None):
rx_power = rx_power_data['data']['RX1Power']['value'] rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value']))
rx_power_list.append(rx_power) rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX2Power']['value']))
rx_power = rx_power_data['data']['RX2Power']['value'] rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX3Power']['value']))
rx_power_list.append(rx_power) rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value']))
rx_power = rx_power_data['data']['RX3Power']['value']
rx_power_list.append(rx_power)
rx_power = rx_power_data['data']['RX4Power']['value']
rx_power_list.append(rx_power)
return rx_power_list return rx_power_list
@ -750,13 +727,12 @@ class Sfp(SfpBase):
""" """
Retrieves the TX power of this SFP Retrieves the TX power of this SFP
""" """
tx_power = None
tx_power_list = [] tx_power_list = []
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
return tx_power_list return tx_power_list
@ -854,12 +830,6 @@ class Sfp(SfpBase):
""" """
return False return False
def tx_disable_channel(self, channel, disable):
"""
Sets the tx_disable for specified SFP channels
"""
return False
def set_power_override(self, power_override, power_set): def set_power_override(self, power_override, power_set):
""" """
Sets SFP power level using power_override and power_set Sets SFP power level using power_override and power_set

View File

@ -72,6 +72,11 @@ class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
tlv_index += eeprom[tlv_index+1] + 2 tlv_index += eeprom[tlv_index+1] + 2
if self.is_module:
# In S6100, individual modules doesn't have MAC address
mac_code = "0x%02X" % self._TLV_CODE_MAC_BASE
self.eeprom_tlv_dict[mac_code] = '00:00:00:00:00:00'
def serial_number_str(self): def serial_number_str(self):
(is_valid, results) = self.get_tlv_field( (is_valid, results) = self.get_tlv_field(
self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER)

View File

@ -230,8 +230,8 @@ class Fan(FanBase):
bool: True if set success, False if fail. bool: True if set success, False if fail.
""" """
# Leds are controlled by Smart-fussion FPGA. # Leds are controlled by Smart-fussion FPGA.
status = False # Return True to avoid thermalctld alarm.
return status return True
def get_status_led(self): def get_status_led(self):
""" """
@ -259,6 +259,8 @@ class Fan(FanBase):
An integer, the percentage of full fan speed, in the range 0 (off) An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed) to 100 (full speed)
""" """
return 0 # Fan speeds are controlled by Smart-fussion FPGA.
# Return current speed to avoid false thermalctld alarm.
return self.get_speed()

View File

@ -51,6 +51,7 @@ class Module(ModuleBase):
} }
def __init__(self, module_index): def __init__(self, module_index):
ModuleBase.__init__(self)
# Modules are 1-based in DellEMC platforms # Modules are 1-based in DellEMC platforms
self.index = module_index + 1 self.index = module_index + 1
self.port_start = (self.index - 1) * 16 self.port_start = (self.index - 1) * 16
@ -61,11 +62,6 @@ class Module(ModuleBase):
self.iom_status_reg = "iom_status" self.iom_status_reg = "iom_status"
self.iom_presence_reg = "iom_presence" self.iom_presence_reg = "iom_presence"
# Overriding _component_list and _sfp_list class variables defined in
# ModuleBase, to make them unique per Module object
self._component_list = []
self._sfp_list = []
component = Component(is_module=True, iom_index=self.index, component = Component(is_module=True, iom_index=self.index,
i2c_line=self.port_i2c_line) i2c_line=self.port_i2c_line)
self._component_list.append(component) self._component_list.append(component)

View File

@ -8,7 +8,6 @@
############################################################################# #############################################################################
try: try:
import os
from sonic_platform_base.platform_base import PlatformBase from sonic_platform_base.platform_base import PlatformBase
from sonic_platform.chassis import Chassis from sonic_platform.chassis import Chassis
except ImportError as e: except ImportError as e:

View File

@ -25,6 +25,7 @@ class Psu(PsuBase):
MAILBOX_DIR = HWMON_DIR + HWMON_NODE MAILBOX_DIR = HWMON_DIR + HWMON_NODE
def __init__(self, psu_index): def __init__(self, psu_index):
PsuBase.__init__(self)
# PSU is 1-based in DellEMC platforms # PSU is 1-based in DellEMC platforms
self.index = psu_index + 1 self.index = psu_index + 1
self.psu_presence_reg = "psu{}_presence".format(self.index) self.psu_presence_reg = "psu{}_presence".format(self.index)
@ -38,10 +39,6 @@ class Psu(PsuBase):
self.psu_current_reg = "curr702_input" self.psu_current_reg = "curr702_input"
self.psu_power_reg = "power4_input" self.psu_power_reg = "power4_input"
# Overriding _fan_list class variable defined in PsuBase, to
# make it unique per Psu object
self._fan_list = []
# Passing True to specify it is a PSU fan # Passing True to specify it is a PSU fan
psu_fan = Fan(fan_index=self.index, psu_fan=True) psu_fan = Fan(fan_index=self.index, psu_fan=True)
self._fan_list.append(psu_fan) self._fan_list.append(psu_fan)

View File

@ -9,9 +9,8 @@
############################################################################# #############################################################################
try: try:
import os import re
import time import time
from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform_base.sfp_base import SfpBase from sonic_platform_base.sfp_base import SfpBase
from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId from sonic_platform_base.sonic_sfp.sff8436 import sff8436InterfaceId
from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom from sonic_platform_base.sonic_sfp.sff8436 import sff8436Dom
@ -44,7 +43,8 @@ info_dict_keys = ['type', 'hardware_rev', 'serial',
'manufacturer', 'model', 'connector', 'manufacturer', 'model', 'connector',
'encoding', 'ext_identifier', 'ext_rateselect_compliance', 'encoding', 'ext_identifier', 'ext_rateselect_compliance',
'cable_type', 'cable_length', 'nominal_bit_rate', 'cable_type', 'cable_length', 'nominal_bit_rate',
'specification_compliance', 'vendor_date', 'vendor_oui'] 'specification_compliance', 'vendor_date', 'vendor_oui',
'application_advertisement']
dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status', dom_dict_keys = ['rx_los', 'tx_fault', 'reset_status',
'power_lpmode', 'tx_disable', 'tx_disable_channel', 'power_lpmode', 'tx_disable', 'tx_disable_channel',
@ -168,6 +168,15 @@ class Sfp(SfpBase):
return eeprom_data return eeprom_data
def _strip_unit_from_str(self, value_str):
match = re.match(r'(.*)C$|(.*)Volts$|(.*)mA$|(.*)dBm$', value_str)
if match:
for value in match.groups():
if value is not None:
return float(value)
return None
def get_transceiver_info(self): def get_transceiver_info(self):
""" """
Retrieves transceiver info of this SFP Retrieves transceiver info of this SFP
@ -492,115 +501,94 @@ class Sfp(SfpBase):
""" """
Retrieves the RX LOS (lost-of-signal) status of SFP Retrieves the RX LOS (lost-of-signal) status of SFP
""" """
rx_los = None
rx_los_list = [] rx_los_list = []
rx_los_data = self._get_eeprom_data('rx_los') rx_los_data = self._get_eeprom_data('rx_los')
if (rx_los_data is not None): if (rx_los_data is not None):
rx_los = rx_los_data['data']['Rx1LOS']['value'] rx_los = rx_los_data['data']['Rx1LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx2LOS']['value'] rx_los = rx_los_data['data']['Rx2LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx3LOS']['value'] rx_los = rx_los_data['data']['Rx3LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
rx_los = rx_los_data['data']['Rx4LOS']['value'] rx_los = rx_los_data['data']['Rx4LOS']['value']
if (rx_los is 'On'): if (rx_los == 'On'):
rx_los_list.append(True) rx_los_list.append(True)
else: else:
rx_los_list.append(False) rx_los_list.append(False)
if (rx_los_list[0] and rx_los_list[1] return rx_los_list
and rx_los_list[2] and rx_los_list[3]):
rx_los = True
else:
rx_los = False
return rx_los
def get_tx_fault(self): def get_tx_fault(self):
""" """
Retrieves the TX fault status of SFP Retrieves the TX fault status of SFP
""" """
tx_fault = None
tx_fault_list = [] tx_fault_list = []
tx_fault_data = self._get_eeprom_data('tx_fault') tx_fault_data = self._get_eeprom_data('tx_fault')
if (tx_fault_data is not None): if (tx_fault_data is not None):
tx_fault = tx_fault_data['data']['Tx1Fault']['value'] tx_fault = tx_fault_data['data']['Tx1Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx2Fault']['value'] tx_fault = tx_fault_data['data']['Tx2Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx3Fault']['value'] tx_fault = tx_fault_data['data']['Tx3Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
tx_fault = tx_fault_data['data']['Tx4Fault']['value'] tx_fault = tx_fault_data['data']['Tx4Fault']['value']
if (tx_fault is 'On'): if (tx_fault == 'On'):
tx_fault_list.append(True) tx_fault_list.append(True)
else: else:
tx_fault_list.append(False) tx_fault_list.append(False)
if (tx_fault_list[0] and tx_fault_list[1] return tx_fault_list
and tx_fault_list[2] and tx_fault_list[3]):
tx_fault = True
else:
tx_fault = False
return tx_fault
def get_tx_disable(self): def get_tx_disable(self):
""" """
Retrieves the tx_disable status of this SFP Retrieves the tx_disable status of this SFP
""" """
tx_disable = None
tx_disable_list = [] tx_disable_list = []
tx_disable_data = self._get_eeprom_data('tx_disable') tx_disable_data = self._get_eeprom_data('tx_disable')
if (tx_disable_data is not None): if (tx_disable_data is not None):
tx_disable = tx_disable_data['data']['Tx1Disable']['value'] tx_disable = tx_disable_data['data']['Tx1Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx2Disable']['value'] tx_disable = tx_disable_data['data']['Tx2Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx3Disable']['value'] tx_disable = tx_disable_data['data']['Tx3Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
tx_disable = tx_disable_data['data']['Tx4Disable']['value'] tx_disable = tx_disable_data['data']['Tx4Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(True) tx_disable_list.append(True)
else: else:
tx_disable_list.append(False) tx_disable_list.append(False)
if (tx_disable_list[0] and tx_disable_list[1] return tx_disable_list
and tx_disable_list[2] and tx_disable_list[3]):
tx_disable = True
else:
tx_disable = False
return tx_disable
def get_tx_disable_channel(self): def get_tx_disable_channel(self):
""" """
@ -612,22 +600,22 @@ class Sfp(SfpBase):
tx_disable_data = self._get_eeprom_data('tx_disable') tx_disable_data = self._get_eeprom_data('tx_disable')
if (tx_disable_data is not None): if (tx_disable_data is not None):
tx_disable = tx_disable_data['data']['Tx1Disable']['value'] tx_disable = tx_disable_data['data']['Tx1Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx2Disable']['value'] tx_disable = tx_disable_data['data']['Tx2Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx3Disable']['value'] tx_disable = tx_disable_data['data']['Tx3Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
tx_disable = tx_disable_data['data']['Tx4Disable']['value'] tx_disable = tx_disable_data['data']['Tx4Disable']['value']
if (tx_disable is 'On'): if (tx_disable == 'On'):
tx_disable_list.append(1) tx_disable_list.append(1)
else: else:
tx_disable_list.append(0) tx_disable_list.append(0)
@ -682,7 +670,7 @@ class Sfp(SfpBase):
power_override_data = self._get_eeprom_data('power_override') power_override_data = self._get_eeprom_data('power_override')
if (power_override_data is not None): if (power_override_data is not None):
power_override = power_override_data['data']['PowerOverRide']['value'] power_override = power_override_data['data']['PowerOverRide']['value']
if (power_override is 'On'): if (power_override == 'On'):
power_override_state = True power_override_state = True
else: else:
power_override_state = False power_override_state = False
@ -697,7 +685,7 @@ class Sfp(SfpBase):
temperature_data = self._get_eeprom_data('Temperature') temperature_data = self._get_eeprom_data('Temperature')
if (temperature_data is not None): if (temperature_data is not None):
temperature = temperature_data['data']['Temperature']['value'] temperature = self._strip_unit_from_str(temperature_data['data']['Temperature']['value'])
return temperature return temperature
@ -709,7 +697,7 @@ class Sfp(SfpBase):
voltage_data = self._get_eeprom_data('Voltage') voltage_data = self._get_eeprom_data('Voltage')
if (voltage_data is not None): if (voltage_data is not None):
voltage = voltage_data['data']['Vcc']['value'] voltage = self._strip_unit_from_str(voltage_data['data']['Vcc']['value'])
return voltage return voltage
@ -717,19 +705,14 @@ class Sfp(SfpBase):
""" """
Retrieves the TX bias current of this SFP Retrieves the TX bias current of this SFP
""" """
tx_bias = None
tx_bias_list = [] tx_bias_list = []
tx_bias_data = self._get_eeprom_data('ChannelMonitor') tx_bias_data = self._get_eeprom_data('ChannelMonitor')
if (tx_bias_data is not None): if (tx_bias_data is not None):
tx_bias = tx_bias_data['data']['TX1Bias']['value'] tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value']))
tx_bias_list.append(tx_bias) tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX2Bias']['value']))
tx_bias = tx_bias_data['data']['TX2Bias']['value'] tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX3Bias']['value']))
tx_bias_list.append(tx_bias) tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value']))
tx_bias = tx_bias_data['data']['TX3Bias']['value']
tx_bias_list.append(tx_bias)
tx_bias = tx_bias_data['data']['TX4Bias']['value']
tx_bias_list.append(tx_bias)
return tx_bias_list return tx_bias_list
@ -737,34 +720,27 @@ class Sfp(SfpBase):
""" """
Retrieves the received optical power for this SFP Retrieves the received optical power for this SFP
""" """
rx_power = None
rx_power_list = [] rx_power_list = []
rx_power_data = self._get_eeprom_data('ChannelMonitor') rx_power_data = self._get_eeprom_data('ChannelMonitor')
if (rx_power_data is not None): if (rx_power_data is not None):
rx_power = rx_power_data['data']['RX1Power']['value'] rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value']))
rx_power_list.append(rx_power) rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX2Power']['value']))
rx_power = rx_power_data['data']['RX2Power']['value'] rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX3Power']['value']))
rx_power_list.append(rx_power) rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value']))
rx_power = rx_power_data['data']['RX3Power']['value']
rx_power_list.append(rx_power)
rx_power = rx_power_data['data']['RX4Power']['value']
rx_power_list.append(rx_power)
return rx_power_list return rx_power_list
def get_tx_power(self): def get_tx_power(self):
""" """
Retrieves the TX power of this SFP Retrieves the TX power of this SFP
""" """
tx_power = None
tx_power_list = [] tx_power_list = []
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
tx_power_list.append('-infdBm') tx_power_list.append(float('-inf'))
return tx_power_list return tx_power_list
@ -868,12 +844,6 @@ class Sfp(SfpBase):
""" """
return False return False
def tx_disable_channel(self, channel, disable):
"""
Sets the tx_disable for specified SFP channels
"""
return False
def set_power_override(self, power_override, power_set): def set_power_override(self, power_override, power_set):
""" """
Sets SFP power level using power_override and power_set Sets SFP power level using power_override and power_set
@ -886,7 +856,7 @@ class Sfp(SfpBase):
""" """
reset = self.get_reset_status() reset = self.get_reset_status()
if (reset == True): if reset:
status = False status = False
else: else:
status = True status = True

View File

@ -131,7 +131,7 @@ class Watchdog(WatchdogBase):
""" """
gpio = "/sys/devices/platform/dell_ich.0/sc_gp_lvl" gpio = "/sys/devices/platform/dell_ich.0/sc_gp_lvl"
timer_offset = -1 timer_offset = -1
if seconds <= 30: if seconds > 0 and seconds <= 30:
timer_offset = 1 timer_offset = 1
seconds = 30 seconds = 30
elif seconds > 30 and seconds <= 60: elif seconds > 30 and seconds <= 60: