From 5a4c51aaae702e46ade7bec14ce2bb3bc10cd9e6 Mon Sep 17 00:00:00 2001 From: mssonicbld <79238446+mssonicbld@users.noreply.github.com> Date: Tue, 19 Dec 2023 06:36:16 +0800 Subject: [PATCH] [Dell] S6100 - Update EEPROM API serial_number_str to return service tag instead of serial number (#17440) (#17493) To modify EEPROM API serial_number_str to return service tag instead of serial number in Dell S6100. Ref PR: #1239 How I did it Update EEPROM API serial_number_str to return service tag instead of serial number. How to verify it Verify decode-syseeprom -s returns service tag in Dell S6100. Co-authored-by: Arun Saravanan Balachandran <52521751+ArunSaravananBalachandran@users.noreply.github.com> --- .../s6100/sonic_platform/chassis.py | 2 +- .../s6100/sonic_platform/eeprom.py | 18 ++++++++---------- .../s6100/sonic_platform/module.py | 2 +- 3 files changed, 10 insertions(+), 12 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py index 6b68d9c98bfa..37fdee8bf8be 100755 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/chassis.py @@ -217,7 +217,7 @@ def get_serial(self): Returns: string: Serial number of chassis """ - return self._eeprom.serial_str() + return self._eeprom.serial_number_str() def get_status(self): """ diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py index cab1998be39e..a2f5eb48ea99 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/eeprom.py @@ -83,8 +83,14 @@ def __init__(self, i2c_line=0, iom_eeprom=False): self.eeprom_tlv_dict[mac_code] = '00:00:00:00:00:00' def serial_number_str(self): - (is_valid, results) = self.get_tlv_field( - self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + # For Chassis, return service tag instead of serial number + if not self.is_module: + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERVICE_TAG) + else: + (is_valid, results) = self.get_tlv_field( + self.eeprom_data, self._TLV_CODE_SERIAL_NUMBER) + if not is_valid: return "N/A" @@ -118,14 +124,6 @@ def part_number_str(self): return results[2].decode('ascii') - def serial_str(self): - (is_valid, results) = self.get_tlv_field( - self.eeprom_data, self._TLV_CODE_SERVICE_TAG) - if not is_valid: - return "N/A" - - return results[2].decode('ascii') - def revision_str(self): (is_valid, results) = self.get_tlv_field( self.eeprom_data, self._TLV_CODE_LABEL_REVISION) diff --git a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py index 163a0ab3981c..751d90fcc6ca 100644 --- a/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py +++ b/platform/broadcom/sonic-platform-modules-dell/s6100/sonic_platform/module.py @@ -139,7 +139,7 @@ def get_serial(self): Returns: string: Serial number of module """ - return self._eeprom.serial_str() + return self._eeprom.serial_number_str() def get_status(self): """