From 607cbdefd3dc048f2201df8d6e68710758d997de Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Thu, 19 Jan 2023 08:27:48 +0800 Subject: [PATCH] [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. --- .../platform_components.json | 5 +++-- .../sonic_platform/chassis.py | 16 ++++++++++++++-- .../sonic_platform/component.py | 6 ++++-- .../x86_64-cel_seastone-r0/sonic_platform/psu.py | 2 +- .../system_health_monitoring_config.json | 8 +++----- 5 files changed, 25 insertions(+), 12 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/platform_components.json b/device/celestica/x86_64-cel_seastone-r0/platform_components.json index cd89d358d4..8df07b1320 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform_components.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform_components.json @@ -1,13 +1,14 @@ { "chassis": { - "Celestica-DX010-C32": { + "Seastone-DX010": { "component": { "CPLD1": {}, "CPLD2": {}, "CPLD3": {}, "CPLD4": {}, + "CPLD5": {}, "BIOS": {} } } } -} \ No newline at end of file +} diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py index 8a9ed17139..3f61ef139b 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/chassis.py @@ -20,7 +20,7 @@ NUM_FAN_TRAY = 5 NUM_PSU = 2 NUM_THERMAL = 5 NUM_SFP = 32 -NUM_COMPONENT = 5 +NUM_COMPONENT = 6 RESET_REGISTER = "0x103" HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/" REBOOT_CAUSE_FILE = "reboot-cause.txt" @@ -44,6 +44,7 @@ class Chassis(ChassisBase): self.__initialize_psu() self.__initialize_thermals() self.__initialize_components() + self.__initialize_system_led() def __initialize_sfp(self): sfputil_helper = SfpUtilHelper() @@ -86,6 +87,9 @@ class Chassis(ChassisBase): component = Component(index) self._component_list.append(component) + def __initialize_system_led(self): + self.set_status_led(self.STATUS_LED_COLOR_GREEN) + def __get_air_flow(self): air_flow_path = '/usr/share/sonic/device/{}/fan_airflow'.format( self._api_helper.platform) \ @@ -317,6 +321,14 @@ class Chassis(ChassisBase): """ 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): """ 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_str = { - '255': self.STATUS_LED_COLOR_GREEN, + '1': self.STATUS_LED_COLOR_GREEN, '0': self.STATUS_LED_COLOR_OFF }.get(status, None) diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py index 782708025a..03f879805a 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/component.py @@ -25,9 +25,11 @@ CPLD_ADDR_MAPPING = { } GETREG_PATH = "/sys/devices/platform/dx010_cpld/getreg" 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", - "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): diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py index 7dd647be4e..8f3b561fd1 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/psu.py @@ -197,7 +197,7 @@ class Psu(PsuBase): """ set_status_str = { - self.STATUS_LED_COLOR_GREEN: '1', + self.STATUS_LED_COLOR_GREEN: '255', self.STATUS_LED_COLOR_OFF: '0' }.get(color, None) diff --git a/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json b/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json index 4dc38d035a..c183991881 100644 --- a/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json +++ b/device/celestica/x86_64-cel_seastone-r0/system_health_monitoring_config.json @@ -1,10 +1,8 @@ { "services_to_ignore": [], "devices_to_ignore": [ - "asic", - "psu.temperature", - "PSU2 Fan", - "PSU1 Fan" + "PSU-1 FAN-1", + "PSU-2 FAN-1" ], "user_defined_checkers": [], "polling_interval": 60, @@ -13,4 +11,4 @@ "normal": "green", "booting": "orange_blink" } -} \ No newline at end of file +}