Skip to content

Commit 82bbeab

Browse files
authored
[sfputil] Make SfpUtilHelper.get_physical_to_logical noexcept as in SfpUtilBase (sonic-net#96)
The SfpUtil interface used in xcvrd expects get_physical_to_logical to return None in the case of unknown port: https://github.com/Azure/sonic-platform-daemons/blob/master/sonic-xcvrd/scripts/xcvrd#L906 Note SfpUtilBase implementation already conforms the interface in xcvrd: https://github.com/Azure/sonic-platform-common/blob/master/sonic_platform_base/sonic_sfp/sfputilbase.py#L603 Signed-off-by: Volodymyr Boyko <[email protected]>
1 parent 85edabb commit 82bbeab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

sonic_platform_base/sonic_sfp/sfputilhelper.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ def read_porttab_mappings(self, porttabfile):
172172
def get_physical_to_logical(self, port_num):
173173
"""Returns list of logical ports for the given physical port"""
174174

175-
return self.physical_to_logical[port_num]
175+
return self.physical_to_logical.get(port_num)
176176

177177
def get_logical_to_physical(self, logical_port):
178178
"""Returns list of physical ports for the given logical port"""

0 commit comments

Comments
 (0)