Skip to content

Commit

Permalink
[xcvrd] Fix xcvrd crash on other port prefixes (#123)
Browse files Browse the repository at this point in the history
Implement a better check for logical_port_name_to_physical_port_list function.

Currently it will only accept names that start with "Ethernet". If we try to add other ports it will crash.

In the future Arista will implement other port types. For example "Recirc0".

Co-authored-by: Zhi Yuan Carl Zhao <zyzhao@arista.com>
  • Loading branch information
zzhiyuan and Zhi Yuan Carl Zhao authored Feb 23, 2021
1 parent c3c1a59 commit b9381a5
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sonic-xcvrd/xcvrd/xcvrd.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,14 +105,14 @@


def logical_port_name_to_physical_port_list(port_name):
if port_name.startswith("Ethernet"):
try:
return [int(port_name)]
except ValueError:
if platform_sfputil.is_logical_port(port_name):
return platform_sfputil.get_logical_to_physical(port_name)
else:
helper_logger.log_error("Invalid port '{}'".format(port_name))
return None
else:
return [int(port_name)]

# Get physical port name

Expand Down

0 comments on commit b9381a5

Please sign in to comment.