From 2630571f898e34fde9a2ecee6e682d3e6d3f2d6a Mon Sep 17 00:00:00 2001 From: Aravind Mani Date: Tue, 17 Mar 2020 13:18:12 +0530 Subject: [PATCH 1/3] fix Z9100 port index issue --- .../z9100/sonic_platform/chassis.py | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py index 3472bb3e7fb0..1497037102c8 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py @@ -162,6 +162,29 @@ def get_serial(self): string: Serial number of chassis """ return self.sys_eeprom.serial_str() + + def get_sfp(self, index): + """ + Retrieves sfp represented by (0-based) index + + Args: + index: An integer, the index (0-based) of the sfp to retrieve. + The index should be the sequence of a physical port in a chassis, + starting from 0. + For example, 0 for Ethernet0, 1 for Ethernet4 and so on. + + Returns: + An object dervied from SfpBase representing the specified sfp + """ + sfp = None + + try: + sfp = self._sfp_list[index-1] + except IndexError: + sys.stderr.write("SFP index {} out of range (0-{})\n".format( + index, len(self._sfp_list)-1)) + + return sfp def get_status(self): """ From 12939f7f36c076c537a46dd4955a7f5f1a9657b4 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Mon, 23 Mar 2020 12:00:08 +0530 Subject: [PATCH 2/3] Update chassis.py --- .../sonic-platform-modules-dell/z9100/sonic_platform/chassis.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py index 37317536e2e7..933d7a60aeb5 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py @@ -161,7 +161,7 @@ def get_serial(self): Returns: string: Serial number of chassis """ - return self.sys_eeprom.serial_str() + return self._eeprom.serial_str() def get_sfp(self, index): """ From d6473fa00e380ef7c31657870bdcbbc1349740d5 Mon Sep 17 00:00:00 2001 From: Aravind Mani <53524901+aravindmani-1@users.noreply.github.com> Date: Mon, 23 Mar 2020 15:04:17 +0530 Subject: [PATCH 3/3] Update chassis.py --- .../z9100/sonic_platform/chassis.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py index 933d7a60aeb5..3e070d54004e 100755 --- a/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py +++ b/platform/broadcom/sonic-platform-modules-dell/z9100/sonic_platform/chassis.py @@ -165,12 +165,12 @@ def get_serial(self): def get_sfp(self, index): """ - Retrieves sfp represented by (0-based) index + Retrieves sfp represented by (1-based) index Args: - index: An integer, the index (0-based) of the sfp to retrieve. + index: An integer, the index (1-based) of the sfp to retrieve. The index should be the sequence of a physical port in a chassis, - starting from 0. + starting from 1. For example, 0 for Ethernet0, 1 for Ethernet4 and so on. Returns: @@ -181,7 +181,7 @@ def get_sfp(self, index): try: sfp = self._sfp_list[index-1] except IndexError: - sys.stderr.write("SFP index {} out of range (0-{})\n".format( + sys.stderr.write("SFP index {} out of range (1-{})\n".format( index, len(self._sfp_list)-1)) return sfp