Skip to content

Commit

Permalink
DellEMC: S6100, S6000 - Enable thermalctld, Platform API implementati…
Browse files Browse the repository at this point in the history
…on and fixes

    - Enable 'thermalctld'
    - Implement DeviceBase methods (presence, status, model, serial) for Fantay and Component
    - Implement ‘get_position_in_parent’, ‘is_replaceable’ methods for all device types
    - SFP: Make eeprom read both Python2 and Python3 compatible
    - SFP: Fix ‘get_tx_disable_channel’ method’s return type
    - SFP: Implement ‘tx_disable’, ‘tx_disable_channel’ and ‘set_power_override’ methods
    - S6000: Implement ‘get_status_led’, ‘set_status_led’ methods for Chassis
    - S6000: Make available the data of both Fans present in each Fantray
  • Loading branch information
ArunSaravananBalachandran committed Jan 13, 2021
1 parent afc87b8 commit daf0457
Show file tree
Hide file tree
Showing 18 changed files with 816 additions and 270 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"skip_ledd": true,
"skip_thermalctld": true
"skip_ledd": true
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
{
"skip_ledd": true,
"skip_thermalctld": true
"skip_ledd": true
}
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ class Chassis(ChassisBase):

def __init__(self):
ChassisBase.__init__(self)
self.status_led_reg = "system_led"
self.supported_led_color = ['green', 'blinking green', 'amber', 'blinking amber']
# Initialize SFP list
self.PORT_START = 0
self.PORT_END = 31
Expand Down Expand Up @@ -101,13 +103,30 @@ def _get_cpld_register(self, reg_name):
try:
with open(mb_reg_file, 'r') as fd:
rv = fd.read()
except Exception as error:
except IOError:
rv = 'ERR'

rv = rv.rstrip('\r\n')
rv = rv.lstrip(" ")
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)):
return rv

try:
with open(cpld_reg_file, 'w') as fd:
rv = fd.write(str(value))
except IOError:
rv = 'ERR'

return rv

def _nvram_write(self, offset, val):
resource = "/dev/nvram"
fd = os.open(resource, os.O_RDWR)
Expand Down Expand Up @@ -179,6 +198,23 @@ def get_status(self):
"""
return True

def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device.
Returns:
integer: The 1-based relative physical position in parent
device or -1 if cannot determine the position
"""
return -1

def is_replaceable(self):
"""
Indicate whether Chassis is replaceable.
Returns:
bool: True if it is replaceable.
"""
return False

def get_base_mac(self):
"""
Retrieves the base MAC address for the chassis
Expand Down Expand Up @@ -305,4 +341,41 @@ def get_change_event(self, timeout=0):
return True, ret_dict
return False, ret_dict

def set_status_led(self, color):
"""
Sets the state of the system LED
Args:
color: A string representing the color with which to set the
system LED
Returns:
bool: True if system LED state is set successfully, False if not
"""
if color not in self.supported_led_color:
return False

# Change color string format to the one used by driver
color = color.replace('amber', 'yellow')
color = color.replace('blinking ', 'blink_')
rv = self._set_cpld_register(self.status_led_reg, color)
if (rv != 'ERR'):
return True
else:
return False

def get_status_led(self):
"""
Gets the state of the system LED
Returns:
A string, one of the valid LED color strings which could be vendor
specified.
"""
status_led = self._get_cpld_register(self.status_led_reg)
if (status_led != 'ERR'):
status_led = status_led.replace('yellow', 'amber')
status_led = status_led.replace('blink_', 'blinking ')
return status_led
else:
return None
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ class Component(ComponentBase):
"booting")],
["System-CPLD", "Used for managing CPU board devices and power"],
["Master-CPLD", ("Used for managing Fan, PSU, system LEDs, QSFP "
"modules (1-16)")],
["Slave-CPLD", "Used for managing QSFP modules (17-32)"]
"modules (17-32)")],
["Slave-CPLD", "Used for managing QSFP modules (1-16)"]
]

def __init__(self, component_index):
Expand Down Expand Up @@ -90,6 +90,55 @@ def get_name(self):
"""
return self.name

def get_model(self):
"""
Retrieves the part number of the component
Returns:
string: Part number of component
"""
return 'NA'

def get_serial(self):
"""
Retrieves the serial number of the component
Returns:
string: Serial number of component
"""
return 'NA'

def get_presence(self):
"""
Retrieves the presence of the component
Returns:
bool: True if present, False if not
"""
return True

def get_status(self):
"""
Retrieves the operational status of the component
Returns:
bool: True if component is operating properly, False if not
"""
return True

def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device.
Returns:
integer: The 1-based relative physical position in parent
device or -1 if cannot determine the position
"""
return -1

def is_replaceable(self):
"""
Indicate whether component is replaceable.
Returns:
bool: True if it is replaceable.
"""
return False

def get_description(self):
"""
Retrieves the description of the component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
('Fab Rev', 's', 2)
]

# Fan eeprom fields in format required by EepromDecoder
fan_eeprom_format = [
# FanTray eeprom fields in format required by EepromDecoder
fantray_eeprom_format = [
('PPID', 's', 20), ('DPN Rev', 's', 3), ('Service Tag', 's', 7),
('Part Number', 's', 10), ('Part Num Revision', 's', 3),
('Mfg Test', 's', 2), ('Redundant copy', 's', 83),
Expand All @@ -51,10 +51,10 @@ class Eeprom(TlvInfoDecoder):

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_fan_eeprom = is_fan
self.is_sys_eeprom = not (is_psu | is_fan)
self.is_fantray_eeprom = is_fantray
self.is_sys_eeprom = not (is_psu | is_fantray)

if self.is_sys_eeprom:
self.start_offset = 0
Expand All @@ -71,10 +71,10 @@ def __init__(self, is_psu=False, psu_index=0, is_fan=False, fan_index=0):
+ "i2c-1/1-005{}/eeprom".format(2 - self.index)
self.format = psu_eeprom_format
else:
self.index = fan_index
self.index = fantray_index
self.eeprom_path = self.I2C_DIR \
+ "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,
self.start_offset, '', True)
self._load_device_eeprom()
Expand Down
Loading

0 comments on commit daf0457

Please sign in to comment.