diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py index 3c5d5ef3f5..fbdbf650db 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/fan.py @@ -155,7 +155,7 @@ class Fan(FanBase): string: The name of the Fan """ if not self.is_psu_fan: - return "Fan{}".format(self.index) + return "FanTray{}-Fan1".format(self.index) else: return "PSU{} Fan".format(self.index) @@ -213,7 +213,7 @@ class Fan(FanBase): status = False fan_speed = self._get_i2c_register(self.get_fan_speed_reg) if (fan_speed != 'ERR'): - if (int(fan_speed) > 14000): + if (int(fan_speed) > 1000): status = True return status @@ -337,4 +337,5 @@ class Fan(FanBase): An integer, the percentage of full fan speed, in the range 0 (off) to 100 (full speed) """ - return 79 + # Fan speeds are controlled by fancontrol.sh + return self.get_speed() diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py index 426db71728..32230d9c92 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/platform.py @@ -8,7 +8,6 @@ ############################################################################# try: - import os from sonic_platform_base.platform_base import PlatformBase from sonic_platform.chassis import Chassis except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py index 20641435f7..af52ccedbc 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/psu.py @@ -26,6 +26,7 @@ class Psu(PsuBase): I2C_DIR = "/sys/class/i2c-adapter/" def __init__(self, psu_index): + PsuBase.__init__(self) # PSU is 1-based in DellEMC platforms self.index = psu_index + 1 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) - # 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)) def _get_cpld_register(self, reg_name): @@ -109,9 +106,9 @@ class Psu(PsuBase): power_reg = glob.glob(self.psu_power_reg) if len(voltage_reg) and len(current_reg) and len(power_reg): - self.psu_voltage_reg = voltage_reg_path[0] - self.psu_current_reg = current_reg_path[0] - self.psu_power_reg = power_reg_path[0] + self.psu_voltage_reg = voltage_reg[0] + self.psu_current_reg = current_reg[0] + self.psu_power_reg = power_reg[0] self.is_driver_initialized = True def get_name(self): diff --git a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py index c4c958a841..175e601dbe 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6000/sonic_platform/sfp.py @@ -9,9 +9,8 @@ ############################################################################# try: - import os + import re import time - from sonic_platform_base.chassis_base import ChassisBase 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 sff8436Dom @@ -44,7 +43,8 @@ info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', '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', 'power_lpmode', 'tx_disable', 'tx_disable_channel', @@ -169,6 +169,14 @@ class Sfp(SfpBase): 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): """ @@ -487,115 +495,94 @@ class Sfp(SfpBase): """ Retrieves the RX LOS (lost-of-signal) status of SFP """ - rx_los = None rx_los_list = [] rx_los_data = self._get_eeprom_data('rx_los') if (rx_los_data is not None): rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - - return rx_los + return rx_los_list def get_tx_fault(self): """ Retrieves the TX fault status of SFP """ - tx_fault = None tx_fault_list = [] tx_fault_data = self._get_eeprom_data('tx_fault') if (tx_fault_data is not None): tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - return tx_fault + return tx_fault_list def get_tx_disable(self): """ Retrieves the tx_disable status of this SFP """ - tx_disable = None tx_disable_list = [] tx_disable_data = self._get_eeprom_data('tx_disable') if (tx_disable_data is not None): tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - return tx_disable + return tx_disable_list def get_tx_disable_channel(self): """ @@ -607,22 +594,22 @@ class Sfp(SfpBase): tx_disable_data = self._get_eeprom_data('tx_disable') if (tx_disable_data is not None): tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) @@ -674,7 +661,7 @@ class Sfp(SfpBase): power_override_data = self._get_eeprom_data('power_override') if (power_override_data is not None): power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): + if (power_override == 'On'): power_override_state = True else: power_override_state = False @@ -689,7 +676,7 @@ class Sfp(SfpBase): temperature_data = self._get_eeprom_data('Temperature') 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 @@ -701,7 +688,7 @@ class Sfp(SfpBase): voltage_data = self._get_eeprom_data('Voltage') 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 @@ -709,19 +696,14 @@ class Sfp(SfpBase): """ Retrieves the TX bias current of this SFP """ - tx_bias = None tx_bias_list = [] tx_bias_data = self._get_eeprom_data('ChannelMonitor') if (tx_bias_data is not None): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - 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) + tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._strip_unit_from_str(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(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value'])) return tx_bias_list @@ -729,19 +711,14 @@ class Sfp(SfpBase): """ Retrieves the received optical power for this SFP """ - rx_power = None rx_power_list = [] rx_power_data = self._get_eeprom_data('ChannelMonitor') if (rx_power_data is not None): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - 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) + rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value'])) + rx_power_list.append(self._strip_unit_from_str(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(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value'])) return rx_power_list @@ -750,13 +727,12 @@ class Sfp(SfpBase): """ Retrieves the TX power of this SFP """ - tx_power = None tx_power_list = [] - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) return tx_power_list @@ -854,12 +830,6 @@ class Sfp(SfpBase): """ 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): """ Sets SFP power level using power_override and power_set diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py index bc8766fd10..288c1a2ccf 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py @@ -72,6 +72,11 @@ class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): 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): (is_valid, results) = self.get_tlv_field( self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py index 0f3c766389..8404a8d2bf 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/fan.py @@ -230,8 +230,8 @@ class Fan(FanBase): bool: True if set success, False if fail. """ # Leds are controlled by Smart-fussion FPGA. - status = False - return status + # Return True to avoid thermalctld alarm. + return True 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) 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() diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py index d0f77ffa4a..6b93bcfd1f 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py @@ -51,6 +51,7 @@ class Module(ModuleBase): } def __init__(self, module_index): + ModuleBase.__init__(self) # Modules are 1-based in DellEMC platforms self.index = module_index + 1 self.port_start = (self.index - 1) * 16 @@ -61,11 +62,6 @@ class Module(ModuleBase): self.iom_status_reg = "iom_status" 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, i2c_line=self.port_i2c_line) self._component_list.append(component) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py index 426db71728..32230d9c92 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/platform.py @@ -8,7 +8,6 @@ ############################################################################# try: - import os from sonic_platform_base.platform_base import PlatformBase from sonic_platform.chassis import Chassis except ImportError as e: diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py index 18a8b5d035..48b266daa2 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/psu.py @@ -25,6 +25,7 @@ class Psu(PsuBase): MAILBOX_DIR = HWMON_DIR + HWMON_NODE def __init__(self, psu_index): + PsuBase.__init__(self) # PSU is 1-based in DellEMC platforms self.index = psu_index + 1 self.psu_presence_reg = "psu{}_presence".format(self.index) @@ -38,10 +39,6 @@ class Psu(PsuBase): self.psu_current_reg = "curr702_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 psu_fan = Fan(fan_index=self.index, psu_fan=True) self._fan_list.append(psu_fan) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py index 6ccef9ecea..6947b6cf2b 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/sfp.py @@ -9,9 +9,8 @@ ############################################################################# try: - import os + import re import time - from sonic_platform_base.chassis_base import ChassisBase 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 sff8436Dom @@ -44,7 +43,8 @@ info_dict_keys = ['type', 'hardware_rev', 'serial', 'manufacturer', 'model', 'connector', 'encoding', 'ext_identifier', 'ext_rateselect_compliance', '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', 'power_lpmode', 'tx_disable', 'tx_disable_channel', @@ -168,6 +168,15 @@ class Sfp(SfpBase): 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): """ Retrieves transceiver info of this SFP @@ -492,115 +501,94 @@ class Sfp(SfpBase): """ Retrieves the RX LOS (lost-of-signal) status of SFP """ - rx_los = None rx_los_list = [] rx_los_data = self._get_eeprom_data('rx_los') if (rx_los_data is not None): rx_los = rx_los_data['data']['Rx1LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx2LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx3LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) rx_los = rx_los_data['data']['Rx4LOS']['value'] - if (rx_los is 'On'): + if (rx_los == 'On'): rx_los_list.append(True) else: rx_los_list.append(False) - if (rx_los_list[0] and rx_los_list[1] - and rx_los_list[2] and rx_los_list[3]): - rx_los = True - else: - rx_los = False - - return rx_los + return rx_los_list def get_tx_fault(self): """ Retrieves the TX fault status of SFP """ - tx_fault = None tx_fault_list = [] tx_fault_data = self._get_eeprom_data('tx_fault') if (tx_fault_data is not None): tx_fault = tx_fault_data['data']['Tx1Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx2Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx3Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) tx_fault = tx_fault_data['data']['Tx4Fault']['value'] - if (tx_fault is 'On'): + if (tx_fault == 'On'): tx_fault_list.append(True) else: tx_fault_list.append(False) - if (tx_fault_list[0] and tx_fault_list[1] - and tx_fault_list[2] and tx_fault_list[3]): - tx_fault = True - else: - tx_fault = False - - return tx_fault + return tx_fault_list def get_tx_disable(self): """ Retrieves the tx_disable status of this SFP """ - tx_disable = None tx_disable_list = [] tx_disable_data = self._get_eeprom_data('tx_disable') if (tx_disable_data is not None): tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(True) else: tx_disable_list.append(False) - if (tx_disable_list[0] and tx_disable_list[1] - and tx_disable_list[2] and tx_disable_list[3]): - tx_disable = True - else: - tx_disable = False - - return tx_disable + return tx_disable_list def get_tx_disable_channel(self): """ @@ -612,22 +600,22 @@ class Sfp(SfpBase): tx_disable_data = self._get_eeprom_data('tx_disable') if (tx_disable_data is not None): tx_disable = tx_disable_data['data']['Tx1Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx2Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx3Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) tx_disable = tx_disable_data['data']['Tx4Disable']['value'] - if (tx_disable is 'On'): + if (tx_disable == 'On'): tx_disable_list.append(1) else: tx_disable_list.append(0) @@ -682,7 +670,7 @@ class Sfp(SfpBase): power_override_data = self._get_eeprom_data('power_override') if (power_override_data is not None): power_override = power_override_data['data']['PowerOverRide']['value'] - if (power_override is 'On'): + if (power_override == 'On'): power_override_state = True else: power_override_state = False @@ -697,7 +685,7 @@ class Sfp(SfpBase): temperature_data = self._get_eeprom_data('Temperature') 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 @@ -709,7 +697,7 @@ class Sfp(SfpBase): voltage_data = self._get_eeprom_data('Voltage') 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 @@ -717,19 +705,14 @@ class Sfp(SfpBase): """ Retrieves the TX bias current of this SFP """ - tx_bias = None tx_bias_list = [] tx_bias_data = self._get_eeprom_data('ChannelMonitor') if (tx_bias_data is not None): - tx_bias = tx_bias_data['data']['TX1Bias']['value'] - tx_bias_list.append(tx_bias) - tx_bias = tx_bias_data['data']['TX2Bias']['value'] - tx_bias_list.append(tx_bias) - 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) + tx_bias_list.append(self._strip_unit_from_str(tx_bias_data['data']['TX1Bias']['value'])) + tx_bias_list.append(self._strip_unit_from_str(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(self._strip_unit_from_str(tx_bias_data['data']['TX4Bias']['value'])) return tx_bias_list @@ -737,34 +720,27 @@ class Sfp(SfpBase): """ Retrieves the received optical power for this SFP """ - rx_power = None rx_power_list = [] rx_power_data = self._get_eeprom_data('ChannelMonitor') if (rx_power_data is not None): - rx_power = rx_power_data['data']['RX1Power']['value'] - rx_power_list.append(rx_power) - rx_power = rx_power_data['data']['RX2Power']['value'] - rx_power_list.append(rx_power) - 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) + rx_power_list.append(self._strip_unit_from_str(rx_power_data['data']['RX1Power']['value'])) + rx_power_list.append(self._strip_unit_from_str(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(self._strip_unit_from_str(rx_power_data['data']['RX4Power']['value'])) return rx_power_list - def get_tx_power(self): """ Retrieves the TX power of this SFP """ - tx_power = None tx_power_list = [] - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') - tx_power_list.append('-infdBm') + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) + tx_power_list.append(float('-inf')) return tx_power_list @@ -868,12 +844,6 @@ class Sfp(SfpBase): """ 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): """ Sets SFP power level using power_override and power_set @@ -886,7 +856,7 @@ class Sfp(SfpBase): """ reset = self.get_reset_status() - if (reset == True): + if reset: status = False else: status = True diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py index 207ccb8971..c6d5e6e2e9 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/watchdog.py @@ -131,7 +131,7 @@ class Watchdog(WatchdogBase): """ gpio = "/sys/devices/platform/dell_ich.0/sc_gp_lvl" timer_offset = -1 - if seconds <= 30: + if seconds > 0 and seconds <= 30: timer_offset = 1 seconds = 30 elif seconds > 30 and seconds <= 60: