Skip to content

Commit b9381a5

Browse files
zzhiyuanZhi Yuan Carl Zhao
and
Zhi Yuan Carl Zhao
authored
[xcvrd] Fix xcvrd crash on other port prefixes (sonic-net#123)
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 <[email protected]>
1 parent c3c1a59 commit b9381a5

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

sonic-xcvrd/xcvrd/xcvrd.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -105,14 +105,14 @@
105105

106106

107107
def logical_port_name_to_physical_port_list(port_name):
108-
if port_name.startswith("Ethernet"):
108+
try:
109+
return [int(port_name)]
110+
except ValueError:
109111
if platform_sfputil.is_logical_port(port_name):
110112
return platform_sfputil.get_logical_to_physical(port_name)
111113
else:
112114
helper_logger.log_error("Invalid port '{}'".format(port_name))
113115
return None
114-
else:
115-
return [int(port_name)]
116116

117117
# Get physical port name
118118

0 commit comments

Comments
 (0)