[Celestica Seastone] fix multi sonic platform issues (#13356)

Why I did it
Fix the following issues for Seastone platform:

- system-health issue: show system-health detail will not complete #9530, Celestica Seastone DX010-C32: show system-health detail fails with 'Chassis' object has no attribute 'initizalize_system_led' #11322
- show platform firmware updates issue: Celestica Seastone DX010-C32: show platform firmware updates #11317
- other platform optimization

How I did it
Modify and optimize the platform implememtation.

How to verify it
Manual run the test commands described in these issues.
This commit is contained in:
Ikki Zhu 2023-01-19 08:27:48 +08:00 committed by Qi Luo
parent 2357eeef46
commit 607cbdefd3
5 changed files with 25 additions and 12 deletions

View File

@ -1,11 +1,12 @@
{ {
"chassis": { "chassis": {
"Celestica-DX010-C32": { "Seastone-DX010": {
"component": { "component": {
"CPLD1": {}, "CPLD1": {},
"CPLD2": {}, "CPLD2": {},
"CPLD3": {}, "CPLD3": {},
"CPLD4": {}, "CPLD4": {},
"CPLD5": {},
"BIOS": {} "BIOS": {}
} }
} }

View File

@ -20,7 +20,7 @@ NUM_FAN_TRAY = 5
NUM_PSU = 2 NUM_PSU = 2
NUM_THERMAL = 5 NUM_THERMAL = 5
NUM_SFP = 32 NUM_SFP = 32
NUM_COMPONENT = 5 NUM_COMPONENT = 6
RESET_REGISTER = "0x103" RESET_REGISTER = "0x103"
HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/"
REBOOT_CAUSE_FILE = "reboot-cause.txt" REBOOT_CAUSE_FILE = "reboot-cause.txt"
@ -44,6 +44,7 @@ class Chassis(ChassisBase):
self.__initialize_psu() self.__initialize_psu()
self.__initialize_thermals() self.__initialize_thermals()
self.__initialize_components() self.__initialize_components()
self.__initialize_system_led()
def __initialize_sfp(self): def __initialize_sfp(self):
sfputil_helper = SfpUtilHelper() sfputil_helper = SfpUtilHelper()
@ -86,6 +87,9 @@ class Chassis(ChassisBase):
component = Component(index) component = Component(index)
self._component_list.append(component) self._component_list.append(component)
def __initialize_system_led(self):
self.set_status_led(self.STATUS_LED_COLOR_GREEN)
def __get_air_flow(self): def __get_air_flow(self):
air_flow_path = '/usr/share/sonic/device/{}/fan_airflow'.format( air_flow_path = '/usr/share/sonic/device/{}/fan_airflow'.format(
self._api_helper.platform) \ self._api_helper.platform) \
@ -317,6 +321,14 @@ class Chassis(ChassisBase):
""" """
return False return False
def initizalize_system_led(self):
"""
This function is not defined in chassis base class,
system-health command would invoke chassis.initizalize_system_led(),
add this stub function just to let the command sucessfully execute
"""
pass
def set_status_led(self, color): def set_status_led(self, color):
""" """
Sets the state of the PSU status LED Sets the state of the PSU status LED
@ -345,7 +357,7 @@ class Chassis(ChassisBase):
""" """
status = self._api_helper.read_txt_file(STATUS_LED_PATH) status = self._api_helper.read_txt_file(STATUS_LED_PATH)
status_str = { status_str = {
'255': self.STATUS_LED_COLOR_GREEN, '1': self.STATUS_LED_COLOR_GREEN,
'0': self.STATUS_LED_COLOR_OFF '0': self.STATUS_LED_COLOR_OFF
}.get(status, None) }.get(status, None)

View File

@ -25,9 +25,11 @@ CPLD_ADDR_MAPPING = {
} }
GETREG_PATH = "/sys/devices/platform/dx010_cpld/getreg" GETREG_PATH = "/sys/devices/platform/dx010_cpld/getreg"
BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version" BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version"
COMPONENT_NAME_LIST = ["CPLD1", "CPLD2", "CPLD3", "CPLD4", "BIOS"] COMPONENT_NAME_LIST = ["CPLD1", "CPLD2", "CPLD3", "CPLD4", "CPLD5", "BIOS"]
COMPONENT_DES_LIST = ["Used for managing the CPU", COMPONENT_DES_LIST = ["Used for managing the CPU",
"Used for managing QSFP+ ports (1-10)", "Used for managing QSFP+ ports (11-20)", "Used for managing QSFP+ ports (22-32)", "Basic Input/Output System"] "Used for managing QSFP+ ports (1-10)", "Used for managing QSFP+ ports (11-21)",
"Used for misc status and control", "Used for managing QSFP+ ports (22-32)",
"Basic Input/Output System"]
class Component(ComponentBase): class Component(ComponentBase):

View File

@ -197,7 +197,7 @@ class Psu(PsuBase):
""" """
set_status_str = { set_status_str = {
self.STATUS_LED_COLOR_GREEN: '1', self.STATUS_LED_COLOR_GREEN: '255',
self.STATUS_LED_COLOR_OFF: '0' self.STATUS_LED_COLOR_OFF: '0'
}.get(color, None) }.get(color, None)

View File

@ -1,10 +1,8 @@
{ {
"services_to_ignore": [], "services_to_ignore": [],
"devices_to_ignore": [ "devices_to_ignore": [
"asic", "PSU-1 FAN-1",
"psu.temperature", "PSU-2 FAN-1"
"PSU2 Fan",
"PSU1 Fan"
], ],
"user_defined_checkers": [], "user_defined_checkers": [],
"polling_interval": 60, "polling_interval": 60,