From 0ab3d3346235d374184bfd1c7c4bab637e20256d Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Tue, 16 Aug 2022 06:19:11 +0000 Subject: [PATCH 1/2] Fix issue: exception in is_rj45_port in multi ASIC env Signed-off-by: Stephen Sun --- utilities_common/platform_sfputil_helper.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/utilities_common/platform_sfputil_helper.py b/utilities_common/platform_sfputil_helper.py index b4c819b4d8..e38aa84ea0 100644 --- a/utilities_common/platform_sfputil_helper.py +++ b/utilities_common/platform_sfputil_helper.py @@ -131,10 +131,10 @@ def is_rj45_port(port_name): if not platform_porttab_mapping_read: platform_sfputil_read_porttab_mappings() - physical_port = logical_port_name_to_physical_port_list(port_name)[0] try: + physical_port = logical_port_name_to_physical_port_list(port_name) port_type = platform_chassis.get_port_or_cage_type(physical_port) - except NotImplementedError as e: + except Exception as e: port_type = None return port_type == platform_sfp_base.SFP_PORT_TYPE_BIT_RJ45 From 479d21800c997c67dd9059c9749bd6c1d6cf9ad3 Mon Sep 17 00:00:00 2001 From: Stephen Sun Date: Thu, 18 Aug 2022 08:30:28 +0800 Subject: [PATCH 2/2] Fix typo: missing [0] Signed-off-by: Stephen Sun --- utilities_common/platform_sfputil_helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utilities_common/platform_sfputil_helper.py b/utilities_common/platform_sfputil_helper.py index e38aa84ea0..17a5bdcf1e 100644 --- a/utilities_common/platform_sfputil_helper.py +++ b/utilities_common/platform_sfputil_helper.py @@ -133,7 +133,8 @@ def is_rj45_port(port_name): try: physical_port = logical_port_name_to_physical_port_list(port_name) - port_type = platform_chassis.get_port_or_cage_type(physical_port) + if physical_port: + port_type = platform_chassis.get_port_or_cage_type(physical_port[0]) except Exception as e: port_type = None