DellEMC: N3248TE platform API2.0 changes (#10400)

DellEMC: N3248TE platform API2.0 changes

Why I did it
N3248TE Platform API 2.0 changes

How I did it
Implemented the functional API's needed for Platform API 2.0
Added system_health_monitoring_config.json file
How to verify it
Used the API 2.0 test suite to validate the test cases.

Co-authored-by: Arun LK <Arun_L_K@dell.com>
This commit is contained in:
arunlk-dell 2022-04-01 20:04:31 +05:30 committed by GitHub
parent 94ec85464b
commit a9e86c3b82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 99 additions and 10 deletions

View File

@ -0,0 +1,11 @@
{
"services_to_ignore": [],
"devices_to_ignore": ["fan.speed","psu.temperature","psu.voltage","asic"],
"user_defined_checkers": [],
"polling_interval": 60,
"led_color": {
"fault" : "blink_yellow",
"normal" : "green",
"booting": "blink_green"
}
}

View File

@ -118,7 +118,8 @@ class Chassis(ChassisBase):
# reg name and on failure rethrns 'ERR'
cpld_reg_file = self.CPLD_DIR + '/' + reg_name
try:
rv = open(cpld_reg_file, 'r').read()
with open(cpld_reg_file, 'r') as fd:
rv = fd.read()
except IOError : return 'ERR'
return rv.strip('\r\n').lstrip(' ')

View File

@ -47,7 +47,8 @@ class Fan(FanBase):
cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/"
cpld_reg_file = cpld_dir + '/' + reg_name
try:
buf = open(cpld_reg_file, 'r').read()
with open(cpld_reg_file, 'r')as fd:
buf = fd.read()
except (IOError, AttributeError):
return 'ERR'
return buf.strip('\r\n').lstrip(' ')
@ -228,7 +229,26 @@ class Fan(FanBase):
Returns:
bool: True if set success, False if fail.
"""
# Fan tray status LED controlled by HW
# Return True to avoid thermalctld alarm
# N3248TE has led only on FanTray and not available for seperate fans
return True
def get_status_led(self):
"""
Gets the current system LED color
Returns:
A string that represents the supported color
"""
return None
def get_target_speed(self):
"""
Retrieves the target (expected) speed of the fan
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
# Return current speed to avoid false thermalctld alarm.
return self.get_speed()

View File

@ -38,7 +38,8 @@ class Psu(PsuBase):
cpld_dir = "/sys/devices/platform/dell-n3248te-cpld.0/"
cpld_reg_file = cpld_dir + '/' + reg_name
try:
rv = open(cpld_reg_file, 'r').read()
with open(cpld_reg_file, 'r') as fd:
rv = fd.read()
except IOError : return 'ERR'
return rv.strip('\r\n').lstrip(' ')
@ -46,7 +47,8 @@ class Psu(PsuBase):
try :
dps_dir = self.dps_hwmon + '/' + os.listdir(self.dps_hwmon)[0]
dps_reg_file = dps_dir + '/' + reg_name
rv = open(dps_reg_file, 'r').read()
with open(dps_reg_file, 'r') as fd:
rv = fd.read()
except (IOError, OSError) : return 'ERR'
return rv

View File

@ -20,6 +20,22 @@ except ImportError as e:
SFP_PORT_START = 49
SFP_PORT_END = 54
QSFP_INFO_OFFSET = 128
SFP_INFO_OFFSET = 0
QSFP_DD_PAGE0 = 0
SFP_TYPE_LIST = [
'0x3' # SFP/SFP+/SFP28 and later
]
QSFP_TYPE_LIST = [
'0xc', # QSFP
'0xd', # QSFP+ or later
'0x11' # QSFP28 or later
]
QSFP_DD_TYPE_LIST = [
'0x18' #QSFP_DD Type
]
class Sfp(SfpOptoeBase):
"""
DELLEMC Platform-specific Sfp class
@ -35,7 +51,7 @@ class Sfp(SfpOptoeBase):
return self.eeprom_path
def get_name(self):
return "SFP/SFP+/SFP28"
return "SFP/SFP+/SFP28" if self.index < 53 else "QSFP+ or later"
def pci_mem_read(self, mm, offset):
mm.seek(offset)
@ -70,7 +86,8 @@ class Sfp(SfpOptoeBase):
def _get_cpld_register(self, reg):
reg_file = '/sys/devices/platform/dell-n3248te-cpld.0/' + reg
try:
rv = open(reg_file, 'r').read()
with open(reg_file, 'r') as fd:
rv = fd.read()
except IOError : return 'ERR'
return rv.strip('\r\n').lstrip(' ')
@ -109,7 +126,7 @@ class Sfp(SfpOptoeBase):
"""
Reset the SFP and returns all user settings to their default state
"""
return True
return False
def set_lpmode(self, lpmode):
"""
@ -128,4 +145,42 @@ class Sfp(SfpOptoeBase):
"""
Retrieves the maximumum power allowed on the port in watts
"""
return 2.5
return 5.0 if self.sfp_type == 'QSFP' else 2.5
def is_replaceable(self):
"""
Indicate whether this device is replaceable.
Returns:
bool: True if it is replaceable.
"""
return True
def get_error_description(self):
"""
Retrives the error descriptions of the SFP module
Returns:
String that represents the current error descriptions of vendor specific errors
In case there are multiple errors, they should be joined by '|',
like: "Bad EEPROM|Unsupported cable"
"""
if not self.get_presence():
return self.SFP_STATUS_UNPLUGGED
else:
if not os.path.isfile(self.eeprom_path):
return "EEPROM driver is not attached"
if self.sfp_type == 'SFP':
offset = SFP_INFO_OFFSET
elif self.sfp_type == 'QSFP':
offset = QSFP_INFO_OFFSET
elif self.sfp_type == 'QSFP_DD':
offset = QSFP_DD_PAGE0
try:
with open(self.eeprom_path, mode="rb", buffering=0) as eeprom:
eeprom.seek(offset)
eeprom.read(1)
except OSError as e:
return "EEPROM read failed ({})".format(e.strerror)
return self.SFP_STATUS_OK