Skip to content

Commit

Permalink
[sfputil] Make SfpUtilHelper.get_physical_to_logical noexcept as in S…
Browse files Browse the repository at this point in the history
…fpUtilBase (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 <volodymyrx.boiko@intel.com>
  • Loading branch information
vboykox authored Jun 27, 2020
1 parent 85edabb commit 82bbeab
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion sonic_platform_base/sonic_sfp/sfputilhelper.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def read_porttab_mappings(self, porttabfile):
def get_physical_to_logical(self, port_num):
"""Returns list of logical ports for the given physical port"""

return self.physical_to_logical[port_num]
return self.physical_to_logical.get(port_num)

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

0 comments on commit 82bbeab

Please sign in to comment.