From 43030b416e31b4ab1a079700bd9a5aef00a0ce36 Mon Sep 17 00:00:00 2001 From: Ikki Zhu <79439153+qnos@users.noreply.github.com> Date: Fri, 10 Feb 2023 11:07:13 +0800 Subject: [PATCH] [DX010 platform] fix dx010 platform testcase issues (#13595) Why I did it 1. fix chassis test_set_fans_led case 2. fix chassis get_name case mismatch issue 3. fix fan_drawer test_set_fans_speed 4. fix component test_components test case How I did it Add corresponding configuration into chassis json file How to verify it Run platform tests cases to verify these failure cases --- .../x86_64-cel_seastone-r0/platform.json | 85 ++++++++++++++++--- .../platform_components.json | 2 +- .../sonic_platform/chassis.py | 2 +- .../sonic_platform/eeprom.py | 3 + .../sonic_platform/sfp.py | 13 +++ 5 files changed, 92 insertions(+), 13 deletions(-) diff --git a/device/celestica/x86_64-cel_seastone-r0/platform.json b/device/celestica/x86_64-cel_seastone-r0/platform.json index ac11374b652b..a3778ae81aef 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform.json @@ -1,6 +1,6 @@ { "chassis": { - "name": "Celestica-DX010-C32", + "name": "DX010", "status_led": { "controllable": true, "colors": ["green", "off"] @@ -18,6 +18,9 @@ { "name": "CPLD4" }, + { + "name": "CPLD5" + }, { "name": "BIOS" } @@ -123,10 +126,22 @@ }, "fans": [ { - "name": "FAN-1F" + "name": "FAN-1F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "FAN-1R" + "name": "FAN-1R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] }, @@ -138,10 +153,22 @@ }, "fans": [ { - "name": "FAN-2F" + "name": "FAN-2F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "FAN-2R" + "name": "FAN-2R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] }, @@ -153,10 +180,22 @@ }, "fans": [ { - "name": "FAN-3F" + "name": "FAN-3F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "FAN-3R" + "name": "FAN-3R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] }, @@ -168,10 +207,22 @@ }, "fans": [ { - "name": "FAN-4F" + "name": "FAN-4F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "FAN-4R" + "name": "FAN-4R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] }, @@ -183,10 +234,22 @@ }, "fans": [ { - "name": "FAN-5F" + "name": "FAN-5F", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } }, { - "name": "FAN-5R" + "name": "FAN-5R", + "status_led": { + "controllable": false + }, + "speed": { + "controllable": false + } } ] } 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 8df07b1320ce..1574e1bd2c38 100644 --- a/device/celestica/x86_64-cel_seastone-r0/platform_components.json +++ b/device/celestica/x86_64-cel_seastone-r0/platform_components.json @@ -1,6 +1,6 @@ { "chassis": { - "Seastone-DX010": { + "DX010": { "component": { "CPLD1": {}, "CPLD2": {}, 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 3f61ef139b2d..51da9c2353fb 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 @@ -270,7 +270,7 @@ def get_name(self): Returns: string: The name of the device """ - return self._api_helper.hwsku + return self._eeprom.get_product_name() def get_presence(self): """ diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py index bfde69c8d296..9652ae8c3b75 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/eeprom.py @@ -131,6 +131,9 @@ def _valid_tlv(self, eeprom_data): def get_eeprom(self): return self._valid_tlv(self._eeprom) + def get_product_name(self): + return self._eeprom.get('0x21', NULL) + def get_pn(self): return self._eeprom.get('0x22', NULL) diff --git a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py index a90c82b50fcb..ca2448c80dfd 100644 --- a/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py +++ b/device/celestica/x86_64-cel_seastone-r0/sonic_platform/sfp.py @@ -2202,3 +2202,16 @@ def is_replaceable(self): A boolean value, True if 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 + + return self.SFP_STATUS_OK