[201911] DellEMC: S6000, S6100 - Enable thermalctld, Platform API changes (#9384)

Why I did it
To incorporate the below changes in DellEMC S6100, S6000 platforms.

Enable thermalctld
Backport Platform API changes from master branch.
How I did it
Remove 'skip_thermalctld:true' in pmon_daemon_control.json
Implement the platform API methods in the respective device files
How to verify it
Verified that platform data is displayed by show platform fan and show platform temperature commands.
This commit is contained in:
Arun Saravanan Balachandran 2021-12-11 01:53:22 +05:30 committed by GitHub
parent dfa77a54d5
commit 33ef26d97b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 126 additions and 182 deletions

View File

@ -1,4 +1,3 @@
{ {
"skip_ledd": true, "skip_ledd": true
"skip_thermalctld": true
} }

View File

@ -1,4 +1,3 @@
{ {
"skip_ledd": true, "skip_ledd": true
"skip_thermalctld": true
} }

View File

@ -10,21 +10,21 @@
try: try:
import os import os
import time import time
import datetime
import struct
import subprocess import subprocess
import struct
from sonic_platform_base.chassis_base import ChassisBase from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform.sfp import Sfp from sonic_platform.component import Component
from sonic_platform.eeprom import Eeprom, EepromS6000 from sonic_platform.eeprom import Eeprom, EepromS6000
from sonic_platform.fan import Fan from sonic_platform.fan import Fan
from sonic_platform.psu import Psu from sonic_platform.psu import Psu
from sonic_platform.sfp import Sfp
from sonic_platform.thermal import Thermal from sonic_platform.thermal import Thermal
from sonic_platform.component import Component
except ImportError as e: except ImportError as e:
raise ImportError(str(e) + "- required module not found") raise ImportError(str(e) + "- required module not found")
MAX_S6000_FAN = 3 MAX_S6000_FANTRAY = 3
MAX_S6000_FAN_PER_FANTRAY = 2
MAX_S6000_PSU = 2 MAX_S6000_PSU = 2
MAX_S6000_THERMAL = 10 MAX_S6000_THERMAL = 10
MAX_S6000_COMPONENT = 4 MAX_S6000_COMPONENT = 4
@ -76,9 +76,10 @@ class Chassis(ChassisBase):
else: else:
self._eeprom = EepromS6000() self._eeprom = EepromS6000()
for i in range(MAX_S6000_FAN): for i in range(1, MAX_S6000_FANTRAY+1):
fan = Fan(i) for j in range(1, MAX_S6000_FAN_PER_FANTRAY+1):
self._fan_list.append(fan) fan = Fan(fantray_index=i, fan_index=j)
self._fan_list.append(fan)
for i in range(MAX_S6000_PSU): for i in range(MAX_S6000_PSU):
psu = Psu(i) psu = Psu(i)
@ -102,7 +103,7 @@ class Chassis(ChassisBase):
try: try:
with open(mb_reg_file, 'r') as fd: with open(mb_reg_file, 'r') as fd:
rv = fd.read() rv = fd.read()
except Exception as error: except IOError:
rv = 'ERR' rv = 'ERR'
rv = rv.rstrip('\r\n') rv = rv.rstrip('\r\n')

View File

@ -18,7 +18,6 @@
try: try:
import binascii import binascii
import os
import redis import redis
import struct import struct
from collections import OrderedDict from collections import OrderedDict
@ -37,8 +36,8 @@ psu_eeprom_format = [
('Fab Rev', 's', 2) ('Fab Rev', 's', 2)
] ]
# Fan eeprom fields in format required by EepromDecoder # FanTray eeprom fields in format required by EepromDecoder
fan_eeprom_format = [ fantray_eeprom_format = [
('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7), ('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7),
('Part Number', 's', 10), ('Part Num Revision', 's', 3), ('Part Number', 's', 10), ('Part Num Revision', 's', 3),
('Mfg Test', 's', 2), ('Redundant copy', 's', 83), ('Mfg Test', 's', 2), ('Redundant copy', 's', 83),
@ -52,10 +51,10 @@ class Eeprom(TlvInfoDecoder):
I2C_DIR = "/sys/class/i2c-adapter/" I2C_DIR = "/sys/class/i2c-adapter/"
def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0): def __init__(self, is_psu=False, psu_index=0, is_fantray=False, fantray_index=0):
self.is_psu_eeprom = is_psu self.is_psu_eeprom = is_psu
self.is_fan_eeprom = is_fan self.is_fantray_eeprom = is_fantray
self.is_sys_eeprom = not (is_psu | is_fan) self.is_sys_eeprom = not (is_psu | is_fantray)
if self.is_sys_eeprom: if self.is_sys_eeprom:
self.start_offset = 0 self.start_offset = 0
@ -72,10 +71,10 @@ class Eeprom(TlvInfoDecoder):
+ "i2c-1/1-005{}/eeprom".format(2 - self.index) + "i2c-1/1-005{}/eeprom".format(2 - self.index)
self.format = psu_eeprom_format self.format = psu_eeprom_format
else: else:
self.index = fan_index self.index = fantray_index
self.eeprom_path = self.I2C_DIR \ self.eeprom_path = self.I2C_DIR \
+ "i2c-11/11-005{}/eeprom".format(4 - self.index) + "i2c-11/11-005{}/eeprom".format(4 - self.index)
self.format = fan_eeprom_format self.format = fantray_eeprom_format
EepromDecoder.__init__(self, self.eeprom_path, self.format, EepromDecoder.__init__(self, self.eeprom_path, self.format,
self.start_offset, '', True) self.start_offset, '', True)
self._load_device_eeprom() self._load_device_eeprom()

View File

@ -27,31 +27,40 @@ class Fan(FanBase):
CPLD_DIR = "/sys/devices/platform/dell-s6000-cpld.0/" CPLD_DIR = "/sys/devices/platform/dell-s6000-cpld.0/"
I2C_DIR = "/sys/class/i2c-adapter/" I2C_DIR = "/sys/class/i2c-adapter/"
FAN_DEV_MAPPING = {
1: {1: ("i2c-11/11-002a", 1), 2: ("i2c-11/11-002a", 2)},
2: {1: ("i2c-11/11-0029", 3), 2: ("i2c-11/11-0029", 4)},
3: {1: ("i2c-11/11-0029", 1), 2: ("i2c-11/11-0029", 2)}
}
def __init__(self, fan_index, psu_fan=False, dependency=None): def __init__(self, fantray_index=1, fan_index=1,
psu_index=1, psu_fan=False, dependency=None):
self.is_psu_fan = psu_fan self.is_psu_fan = psu_fan
self.is_driver_initialized = True self.is_driver_initialized = True
if not self.is_psu_fan: if not self.is_psu_fan:
# Fan is 1-based in DellEMC platforms # Fan is 1-based in DellEMC platforms
self.index = fan_index + 1 self.fantray_index = fantray_index
self.fan_presence_reg = "fan_prs"
self.fan_led_reg = "fan{}_led".format(fan_index)
self.get_fan_speed_reg = self.I2C_DIR + "i2c-11/11-0029/" +\
"fan{}_input".format(self.index)
self.set_fan_speed_reg = self.I2C_DIR + "i2c-11/11-0029/" +\
"fan{}_target".format(self.index)
self.eeprom = Eeprom(is_fan=True, fan_index=self.index)
self.max_fan_speed = MAX_S6000_FAN_SPEED
self.supported_led_color = ['off', 'green', 'amber']
else:
self.index = fan_index self.index = fan_index
self.fan_presence_reg = "fan_prs"
self.get_fan_speed_reg = self.I2C_DIR +\
"{}/fan{}_input".format(*self.FAN_DEV_MAPPING[fantray_index][fan_index])
self.set_fan_speed_reg = self.I2C_DIR +\
"{}/fan{}_target".format(*self.FAN_DEV_MAPPING[fantray_index][fan_index])
self.max_fan_speed = MAX_S6000_FAN_SPEED
# FanTray EEPROM
self.eeprom = Eeprom(is_fantray=True, fantray_index=self.fantray_index)
else:
self.psu_index = psu_index
self.index = 1
self.dependency = dependency self.dependency = dependency
self.set_fan_speed_reg = self.I2C_DIR +\ self.set_fan_speed_reg = self.I2C_DIR +\
"i2c-1/1-005{}/fan1_target".format(10 - self.index) "i2c-1/1-005{}/fan1_target".format(10 - self.psu_index)
hwmon_dir = self.I2C_DIR +\ hwmon_dir = self.I2C_DIR +\
"i2c-1/1-005{}/hwmon/".format(10 - self.index) "i2c-1/1-005{}/hwmon/".format(10 - self.psu_index)
try: try:
hwmon_node = os.listdir(hwmon_dir)[0] hwmon_node = os.listdir(hwmon_dir)[0]
except OSError: except OSError:
@ -73,31 +82,13 @@ class Fan(FanBase):
try: try:
with open(cpld_reg_file, 'r') as fd: with open(cpld_reg_file, 'r') as fd:
rv = fd.read() rv = fd.read()
except: except IOError:
rv = 'ERR' rv = 'ERR'
rv = rv.rstrip('\r\n') rv = rv.rstrip('\r\n')
rv = rv.lstrip(" ") rv = rv.lstrip(" ")
return rv return rv
def _set_cpld_register(self, reg_name, value):
# On successful write, returns the value will be written on
# reg_name and on failure returns 'ERR'
rv = 'ERR'
cpld_reg_file = self.CPLD_DIR + reg_name
if (not os.path.isfile(cpld_reg_file)):
print "open error"
return rv
try:
with open(cpld_reg_file, 'w') as fd:
rv = fd.write(str(value))
except:
rv = 'ERR'
return rv
def _get_i2c_register(self, reg_file): def _get_i2c_register(self, reg_file):
# On successful read, returns the value read from given # On successful read, returns the value read from given
# reg_name and on failure returns 'ERR' # reg_name and on failure returns 'ERR'
@ -117,7 +108,7 @@ class Fan(FanBase):
try: try:
with open(reg_file, 'r') as fd: with open(reg_file, 'r') as fd:
rv = fd.read() rv = fd.read()
except: except IOError:
rv = 'ERR' rv = 'ERR'
rv = rv.rstrip('\r\n') rv = rv.rstrip('\r\n')
@ -135,7 +126,7 @@ class Fan(FanBase):
try: try:
with open(reg_file, 'w') as fd: with open(reg_file, 'w') as fd:
rv = fd.write(str(value)) rv = fd.write(str(value))
except: except IOError:
rv = 'ERR' rv = 'ERR'
return rv return rv
@ -155,9 +146,9 @@ 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{}-Fan{}".format(self.fantray_index, self.index)
else: else:
return "PSU{} Fan".format(self.index) return "PSU{} Fan".format(self.psu_index)
def get_presence(self): def get_presence(self):
""" """
@ -185,10 +176,7 @@ class Fan(FanBase):
Returns: Returns:
string: Part number of Fan string: Part number of Fan
""" """
if not self.is_psu_fan: return 'NA'
return self.eeprom.get_part_number()
else:
return 'NA'
def get_serial(self): def get_serial(self):
""" """
@ -197,11 +185,7 @@ class Fan(FanBase):
Returns: Returns:
string: Serial number of Fan string: Serial number of Fan
""" """
# Sample Serial number format "US-01234D-54321-25A-0123-A00" return 'NA'
if not self.is_psu_fan:
return self.eeprom.get_serial_number()
else:
return 'NA'
def get_status(self): def get_status(self):
""" """
@ -213,7 +197,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
@ -298,16 +282,9 @@ class Fan(FanBase):
Returns: Returns:
bool: True if set success, False if fail. bool: True if set success, False if fail.
""" """
if self.is_psu_fan or (color not in self.supported_led_color): # No LED available for FanTray and PSU Fan
return False # Return True to avoid thermalctld alarm.
if(color == self.STATUS_LED_COLOR_AMBER): return True
color = 'yellow'
rv = self._set_cpld_register(self.fan_led_reg ,color)
if (rv != 'ERR'):
return True
else:
return False
def get_status_led(self): def get_status_led(self):
""" """
@ -316,18 +293,8 @@ class Fan(FanBase):
Returns: Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings. A string, one of the predefined STATUS_LED_COLOR_* strings.
""" """
if self.is_psu_fan: # No LED available for FanTray and PSU Fan
# No LED available for PSU Fan return None
return None
fan_led = self._get_cpld_register(self.fan_led_reg)
if (fan_led != 'ERR'):
if (fan_led == 'yellow'):
return self.STATUS_LED_COLOR_AMBER
else:
return fan_led
else:
return self.STATUS_LED_COLOR_OFF
def get_target_speed(self): def get_target_speed(self):
""" """
@ -337,4 +304,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

@ -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,11 +53,7 @@ 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 self._fan_list.append(Fan(psu_index=self.index, psu_fan=True, dependency=self))
# 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): def _get_cpld_register(self, reg_name):
# On successful read, returns the value read from given # On successful read, returns the value read from given
@ -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

@ -96,7 +96,7 @@ class Thermal(ThermalBase):
try: try:
with open(sysfs_file, 'r') as fd: with open(sysfs_file, 'r') as fd:
rv = fd.read() rv = fd.read()
except: except IOError:
rv = 'ERR' rv = 'ERR'
rv = rv.rstrip('\r\n') rv = rv.rstrip('\r\n')

View File

@ -10,17 +10,15 @@
try: try:
import os import os
from sonic_platform_base.platform_base import PlatformBase import time
from sonic_platform_base.chassis_base import ChassisBase from sonic_platform_base.chassis_base import ChassisBase
from sonic_platform.sfp import Sfp from sonic_platform.component import Component
from sonic_platform.psu import Psu from sonic_platform.eeprom import Eeprom
from sonic_platform.fan import Fan from sonic_platform.fan import Fan
from sonic_platform.module import Module from sonic_platform.module import Module
from sonic_platform.psu import Psu
from sonic_platform.thermal import Thermal from sonic_platform.thermal import Thermal
from sonic_platform.component import Component
from sonic_platform.watchdog import Watchdog from sonic_platform.watchdog import Watchdog
from eeprom import Eeprom
import time
except ImportError as e: except ImportError as e:
raise ImportError(str(e) + "- required module not found") raise ImportError(str(e) + "- required module not found")
@ -65,7 +63,7 @@ class Chassis(ChassisBase):
self._module_list.append(module) self._module_list.append(module)
self._sfp_list.extend(module._sfp_list) self._sfp_list.extend(module._sfp_list)
for i in range(MAX_S6100_FAN): for i in range(1, MAX_S6100_FAN+1):
fan = Fan(i) fan = Fan(i)
self._fan_list.append(fan) self._fan_list.append(fan)

View File

@ -73,6 +73,10 @@ class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
tlv_index += ord(eeprom[tlv_index+1]) + 2 tlv_index += ord(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(

View File

@ -26,13 +26,10 @@ class Fan(FanBase):
HWMON_NODE = os.listdir(HWMON_DIR)[0] HWMON_NODE = os.listdir(HWMON_DIR)[0]
MAILBOX_DIR = HWMON_DIR + HWMON_NODE MAILBOX_DIR = HWMON_DIR + HWMON_NODE
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False): def __init__(self, fantray_index=1, psu_index=1, psu_fan=False):
self.is_psu_fan = psu_fan self.is_psu_fan = psu_fan
if not self.is_psu_fan: if not self.is_psu_fan:
# API index is starting from 0, DellEMC platform index is starting self.fantrayindex = fantray_index
# from 1
self.fantrayindex = fantray_index + 1
self.fanindex = fan_index + 1
self.fan_presence_reg = "fan{}_fault".format( self.fan_presence_reg = "fan{}_fault".format(
2 * self.fantrayindex - 1) 2 * self.fantrayindex - 1)
self.fan_status_reg = "fan{}_alarm".format( self.fan_status_reg = "fan{}_alarm".format(
@ -41,15 +38,12 @@ class Fan(FanBase):
2 * self.fantrayindex - 1) 2 * self.fantrayindex - 1)
self.get_fan_dir_reg = "fan{}_airflow".format( self.get_fan_dir_reg = "fan{}_airflow".format(
2 * self.fantrayindex - 1) 2 * self.fantrayindex - 1)
self.fan_serialno_reg = "fan{}_serialno".format(
2 * self.fantrayindex - 1)
self.max_fan_speed = MAX_S6100_FAN_SPEED self.max_fan_speed = MAX_S6100_FAN_SPEED
else: else:
# PSU Fan index starts from 11 self.psuindex = psu_index
self.fanindex = fan_index + 10 self.fan_presence_reg = "fan{}_fault".format(self.psuindex + 10)
self.fan_presence_reg = "fan{}_fault".format(self.fanindex) self.get_fan_speed_reg = "fan{}_input".format(self.psuindex + 10)
self.get_fan_speed_reg = "fan{}_input".format(self.fanindex) self.get_fan_dir_reg = "fan{}_airflow".format(self.psuindex + 10)
self.get_fan_dir_reg = "fan{}_airflow".format(self.fanindex)
self.max_fan_speed = MAX_S6100_PSU_FAN_SPEED self.max_fan_speed = MAX_S6100_PSU_FAN_SPEED
def _get_pmc_register(self, reg_name): def _get_pmc_register(self, reg_name):
@ -77,10 +71,9 @@ class Fan(FanBase):
string: The name of the device string: The name of the device
""" """
if not self.is_psu_fan: if not self.is_psu_fan:
return "FanTray{}-Fan{}".format( return "FanTray{}-Fan1".format(self.fantrayindex)
self.fantrayindex, self.fanindex - 1)
else: else:
return "PSU{} Fan".format(self.fanindex - 10) return "PSU{} Fan".format(self.psuindex)
def get_model(self): def get_model(self):
""" """
@ -88,21 +81,7 @@ class Fan(FanBase):
Returns: Returns:
string: Part number of FAN string: Part number of FAN
""" """
# For Serial number "US-01234D-54321-25A-0123-A00", the part return 'NA'
# number is "01234D"
if self.is_psu_fan:
return 'NA'
fan_serialno = self._get_pmc_register(self.fan_serialno_reg)
if (fan_serialno != 'ERR') and self.get_presence():
if (len(fan_serialno.split('-')) > 1):
fan_partno = fan_serialno.split('-')[1]
else:
fan_partno = 'NA'
else:
fan_partno = 'NA'
return fan_partno
def get_serial(self): def get_serial(self):
""" """
@ -110,15 +89,7 @@ class Fan(FanBase):
Returns: Returns:
string: Serial number of FAN string: Serial number of FAN
""" """
# Sample Serial number format "US-01234D-54321-25A-0123-A00" return 'NA'
if self.is_psu_fan:
return 'NA'
fan_serialno = self._get_pmc_register(self.fan_serialno_reg)
if (fan_serialno == 'ERR') or not self.get_presence():
fan_serialno = 'NA'
return fan_serialno
def get_presence(self): def get_presence(self):
""" """
@ -126,14 +97,14 @@ class Fan(FanBase):
Returns: Returns:
bool: True if fan is present, False if not bool: True if fan is present, False if not
""" """
status = False presence = False
fantray_presence = self._get_pmc_register(self.fan_presence_reg) fan_presence = self._get_pmc_register(self.fan_presence_reg)
if (fantray_presence != 'ERR'): if (fan_presence != 'ERR'):
fantray_presence = int(fantray_presence, 10) fan_presence = int(fan_presence, 10)
if (~fantray_presence & 0b1): if (~fan_presence & 0b1):
status = True presence = True
return status return presence
def get_status(self): def get_status(self):
""" """
@ -216,7 +187,6 @@ class Fan(FanBase):
Returns: Returns:
bool: True if set success, False if fail. bool: True if set success, False if fail.
""" """
# Fan speeds are controlled by Smart-fussion FPGA. # Fan speeds are controlled by Smart-fussion FPGA.
return False return False
@ -229,9 +199,9 @@ class Fan(FanBase):
Returns: Returns:
bool: True if set success, False if fail. bool: True if set success, False if fail.
""" """
# Leds are controlled by Smart-fussion FPGA. # No LED available for FanTray and PSU Fan
status = False # Return True to avoid thermalctld alarm.
return status return True
def get_status_led(self): def get_status_led(self):
""" """
@ -240,17 +210,8 @@ class Fan(FanBase):
Returns: Returns:
A string, one of the predefined STATUS_LED_COLOR_* strings. A string, one of the predefined STATUS_LED_COLOR_* strings.
""" """
if self.is_psu_fan: # No LED available for FanTray and PSU Fan
# No LED available for PSU Fan return None
return None
else:
if self.get_presence():
if self.get_status():
return self.STATUS_LED_COLOR_GREEN
else:
return self.STATUS_LED_COLOR_AMBER
else:
return self.STATUS_LED_COLOR_OFF
def get_target_speed(self): def get_target_speed(self):
""" """
@ -259,6 +220,6 @@ 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

@ -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,12 +39,8 @@ 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(psu_index=self.index, psu_fan=True)
self._fan_list.append(psu_fan) self._fan_list.append(psu_fan)
def _get_pmc_register(self, reg_name): def _get_pmc_register(self, reg_name):

View File

@ -49,10 +49,14 @@ class Thermal(ThermalBase):
self.thermal_temperature_file = self.HWMON_DIR \ self.thermal_temperature_file = self.HWMON_DIR \
+ "temp{}_input".format(hwmon_temp_index) + "temp{}_input".format(hwmon_temp_index)
self.thermal_high_threshold_file = self.HWMON_DIR \ self.thermal_high_threshold_file = self.HWMON_DIR \
+ "temp{}_crit".format(hwmon_temp_index) + "temp{}_max".format(hwmon_temp_index)
self.thermal_low_threshold_file = self.HWMON_DIR \ self.thermal_low_threshold_file = self.HWMON_DIR \
+ "temp{}_min".format(hwmon_temp_index) + "temp{}_min".format(hwmon_temp_index)
if not self.is_cpu_thermal:
self.thermal_high_crit_threshold_file = self.HWMON_DIR \
+ "temp{}_crit".format(hwmon_temp_index)
def _read_sysfs_file(self, sysfs_file): def _read_sysfs_file(self, sysfs_file):
# On successful read, returns the value read from given # On successful read, returns the value read from given
# sysfs_file and on failure returns 'ERR' # sysfs_file and on failure returns 'ERR'
@ -180,6 +184,27 @@ class Thermal(ThermalBase):
return thermal_low_threshold / 1000.0 return thermal_low_threshold / 1000.0
def get_high_critical_threshold(self):
"""
Retrieves the high critical threshold temperature of thermal
Returns:
A float number, the high critical threshold temperature of
thermal in Celsius up to nearest thousandth of one degree
Celsius, e.g. 30.125
"""
if self.is_cpu_thermal:
return super(Thermal, self).get_high_critical_threshold()
thermal_high_crit_threshold = self._read_sysfs_file(
self.thermal_high_crit_threshold_file)
if (thermal_high_crit_threshold != 'ERR'):
thermal_high_crit_threshold = float(thermal_high_crit_threshold)
else:
thermal_high_crit_threshold = 0
return thermal_high_crit_threshold / 1000.0
def set_high_threshold(self, temperature): def set_high_threshold(self, temperature):
""" """
Sets the high threshold temperature of thermal Sets the high threshold temperature of thermal