From 49c32d0f68ae9a0c18d908c271a82dfd393e64c7 Mon Sep 17 00:00:00 2001 From: Deepak Singhal <115033986+deepak-singhal0408@users.noreply.github.com> Date: Tue, 2 Apr 2024 23:13:41 -0700 Subject: [PATCH] T2-VOQ-VS: Modified exception handling due to new sonic_platform package support for VS (#3250) ### What I did For T2-Chassis VS support, we are adding new sonic_platform package for vs platforms. Please refer https://github.com/sonic-net/sonic-buildimage/pull/18512 for more details. Due to this new platform package, need to modify excpetion handling as now the Module would be found, but the metadata file will not be found for pizzabox vs platforms. #### How I did it Modified the exception handling logic. MSFT ADO: 27414904 #### How to verify it Bring up vms-kvm-t0 topology. ran show interface status. The output is proper. PS: the Main PR(https://github.com/sonic-net/sonic-buildimage/pull/18512) is dependent on this PR to be merged in first. --- utilities_common/platform_sfputil_helper.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/utilities_common/platform_sfputil_helper.py b/utilities_common/platform_sfputil_helper.py index 0de83f05b..741b5334e 100644 --- a/utilities_common/platform_sfputil_helper.py +++ b/utilities_common/platform_sfputil_helper.py @@ -121,10 +121,10 @@ def is_rj45_port(port_name): if not platform_sfp_base: import sonic_platform_base platform_sfp_base = sonic_platform_base.sfp_base.SfpBase - except ModuleNotFoundError as e: + except (ModuleNotFoundError, FileNotFoundError) as e: # This method is referenced by intfutil which is called on vs image - # However, there is no platform API supported on vs image - # So False is returned in such case + # sonic_platform API support is added for vs image(required for chassis), it expects a metadata file, which + # wont be available on vs pizzabox duts, So False is returned(if either ModuleNotFound or FileNotFound) return False if platform_chassis and platform_sfp_base: