DellEMC S6100 : Platform2.0 API [Module]
This commit is contained in:
parent
79b1eb8fc1
commit
dd9c2a5b22
@ -54,6 +54,8 @@ class Module(ModuleBase):
|
||||
self.port_start = (self.index - 1) * 16
|
||||
self.port_end = (self.index * 16) - 1
|
||||
self.port_i2c_line = self.IOM_I2C_MAPPING[self.index]
|
||||
self._component_name_list = ['CPLD']
|
||||
self.eeprom_tlv_dict = dict()
|
||||
|
||||
self.iom_status_reg = "iom_status"
|
||||
self.iom_presence_reg = "iom_presence"
|
||||
@ -119,6 +121,24 @@ class Module(ModuleBase):
|
||||
|
||||
return status
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the part number of the module
|
||||
|
||||
Returns:
|
||||
string: part number of module
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the module
|
||||
|
||||
Returns:
|
||||
string: Serial number of module
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the Module
|
||||
@ -145,3 +165,62 @@ class Module(ModuleBase):
|
||||
"""
|
||||
# In S6100, individual modules doesn't have MAC address
|
||||
return '00:00:00:00:00:00'
|
||||
|
||||
def get_serial_number(self):
|
||||
"""
|
||||
Retrieves the hardware serial number for the module
|
||||
|
||||
Returns:
|
||||
A string containing the hardware serial number for this module.
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_system_eeprom_info(self):
|
||||
"""
|
||||
Retrieves the full content of system EEPROM information for the module
|
||||
|
||||
Returns:
|
||||
A dictionary where keys are the type code defined in
|
||||
OCP ONIE TlvInfo EEPROM format and values are their corresponding
|
||||
values.
|
||||
Ex. { ‘0x21’:’AG9064’, ‘0x22’:’V1.0’, ‘0x23’:’AG9064-0109867821’,
|
||||
‘0x24’:’001c0f000fcd0a’, ‘0x25’:’02/03/2018 16:22:00’,
|
||||
‘0x26’:’01’, ‘0x27’:’REV01’, ‘0x28’:’AG9064-C2358-16G’}
|
||||
"""
|
||||
return self.eeprom_tlv_dict
|
||||
|
||||
def get_firmware_version(self, component_name):
|
||||
"""
|
||||
Retrieves platform-specific hardware/firmware versions for module
|
||||
componenets such as BIOS, CPLD, FPGA, etc.
|
||||
|
||||
Args:
|
||||
component_name: A string, the component name.
|
||||
|
||||
Returns:
|
||||
A string containing platform-specific component versions
|
||||
"""
|
||||
if component_name == 'CPLD':
|
||||
cpld_version_file = ("/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
|
||||
"iom_cpld_vers").format(self.port_i2c_line)
|
||||
|
||||
if (not os.path.isfile(cpld_version_file)):
|
||||
return 'NA'
|
||||
|
||||
try:
|
||||
with open(cpld_version_file, 'r') as fd:
|
||||
ver_str = fd.read()
|
||||
except Exception as error:
|
||||
return 'NA'
|
||||
|
||||
if ver_str == 'read error':
|
||||
return 'NA'
|
||||
|
||||
ver_str = ver_str.rstrip('\r\n')
|
||||
cpld_version = int(ver_str.split(':')[1], 16)
|
||||
major_version = (cpld_version & 0xF0) >> 4
|
||||
minor_version = cpld_version & 0xF
|
||||
|
||||
return "%d.%d" % (major_version, minor_version)
|
||||
else:
|
||||
return 'NA'
|
||||
|
@ -210,6 +210,18 @@ class Psu(PsuBase):
|
||||
|
||||
return status
|
||||
|
||||
def get_status_led(self):
|
||||
"""
|
||||
Gets the state of the PSU status LED
|
||||
|
||||
Returns:
|
||||
A string, one of the predefined STATUS_LED_COLOR_* strings.
|
||||
"""
|
||||
if self.get_powergood_status():
|
||||
return self.STATUS_LED_COLOR_GREEN
|
||||
else:
|
||||
return self.STATUS_LED_COLOR_OFF
|
||||
|
||||
def set_status_led(self, color):
|
||||
"""
|
||||
Sets the state of the PSU status LED
|
||||
|
@ -50,6 +50,8 @@ class Thermal(ThermalBase):
|
||||
+ "temp{}_input".format(hwmon_temp_index)
|
||||
self.thermal_high_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
self.thermal_low_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_min".format(hwmon_temp_index)
|
||||
|
||||
def _read_sysfs_file(self, sysfs_file):
|
||||
# On successful read, returns the value read from given
|
||||
@ -160,6 +162,24 @@ class Thermal(ThermalBase):
|
||||
|
||||
return "{:.3f}".format(thermal_high_threshold)
|
||||
|
||||
def get_low_threshold(self):
|
||||
"""
|
||||
Retrieves the low threshold temperature of thermal
|
||||
|
||||
Returns:
|
||||
A float number, the low threshold temperature of thermal in
|
||||
Celsius up to nearest thousandth of one degree Celsius,
|
||||
e.g. 30.125
|
||||
"""
|
||||
thermal_low_threshold = self._read_sysfs_file(
|
||||
self.thermal_low_threshold_file)
|
||||
if (thermal_low_threshold != 'ERR'):
|
||||
thermal_low_threshold = float(thermal_low_threshold) / 1000
|
||||
else:
|
||||
thermal_low_threshold = 0
|
||||
|
||||
return "{:.3f}".format(thermal_low_threshold)
|
||||
|
||||
def set_high_threshold(self, temperature):
|
||||
"""
|
||||
Sets the high threshold temperature of thermal
|
||||
|
Loading…
Reference in New Issue
Block a user