From 7ca4f516a4894aa5b25bdd1c90f3623a4f272bf2 Mon Sep 17 00:00:00 2001 From: Prince George <45705344+prgeor@users.noreply.github.com> Date: Thu, 26 Aug 2021 23:49:19 +0530 Subject: [PATCH] Update SFP index definition (#214) Signed-off-by: Prince George --- sonic_platform_base/chassis_base.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sonic_platform_base/chassis_base.py b/sonic_platform_base/chassis_base.py index c587df192601..96cec9e9ec51 100644 --- a/sonic_platform_base/chassis_base.py +++ b/sonic_platform_base/chassis_base.py @@ -468,17 +468,18 @@ def get_all_sfps(self): A list of objects derived from SfpBase representing all sfps available on this chassis """ - return self._sfp_list + return [ sfp for sfp in self._sfp_list if sfp is not None ] def get_sfp(self, index): """ - Retrieves sfp represented by (0-based) index + Retrieves sfp corresponding to physical port 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. + index: An integer (>=0), the index of the sfp to retrieve. + The index should correspond to the physical port in a chassis. + For example:- + 1 for Ethernet0, 2 for Ethernet4 and so on for one platform. + 0 for Ethernet0, 1 for Ethernet4 and so on for another platform. Returns: An object dervied from SfpBase representing the specified sfp