sonic-utilities
sonic-utilities copied to clipboard
CLI fail when alias name equals interface name
What I did
Fix the CLI fail when set interface_naming_mode as alias and the alias name equal interface name
admin@as9516:~$ show int status Ethernet0,Ethernet8
Interface Lanes Speed MTU Oper FEC Alias Vlan Oper Admin ProtoDown Eff Admin Type Asym PFC Oper Speed
----------- --------------------- ------- ----- ---------- --------- -------------- ------ ------- ----------- ----------- ------ ---------- ------------
Ethernet0 0,1,2,3,4,5,6,7 400G 9100 rs Etp0 PortChannel500 down up False up N/A N/A 400G
Ethernet8 8,9,10,11,12,13,14,15 400G 9100 rs Ethernet8 PortChannel500 down up False up N/A N/A 400G
admin@as9516:~$
admin@as9516:~$ sudo config interface_naming_mode alias
Please logout and log back in for changes take effect.
admin@as9516:~$ exit
...login...
admin@as9516:~$ show int status Etp0
Interface Lanes Speed MTU Oper FEC Alias Vlan Oper Admin ProtoDown Eff Admin Type Asym PFC Oper Speed
----------- --------------- ------- ----- ---------- ------- -------------- ------ ------- ----------- ----------- ------ ---------- ------------
Ethernet0 0,1,2,3,4,5,6,7 400G 9100 rs Etp0 PortChannel500 down up False up N/A N/A 400G
admin@as9516:~$ show int status Ethernet8
Usage: show int status [OPTIONS] [INTERFACENAME]
Try "show int status -h" for help.
Error: cannot find interface name for alias Ethernet8
How I did it
Create another API for interface_naming_mode to get interface name by alias name
How to verify it
admin@as9516-32d-2:~$ show interfaces status Ethernet8
Interface Lanes Speed MTU Oper FEC Alias Vlan Oper Admin ProtoDown Eff Admin Type Asym PFC Oper Speed
----------- --------- ------- ----- ---------- --------- ------ ------ ------- ----------- ----------- ---------------- ---------- ------------
Ethernet8 8,9,10,11 100G 9100 rs Ethernet8 trunk up up False up *QSFP28 or later off 100G
admin@as9516-32d-2:~$ sudo config interface_naming_mode alias
Please logout and log back in for changes take effect.
admin@as9516-32d-2:~$ exit
...login...
admin@as9516-32d-2:~$ show int status Ethernet8
Interface Lanes Speed MTU Oper FEC Alias Vlan Oper Admin ProtoDown Eff Admin Type Asym PFC Oper Speed
----------- --------- ------- ----- ---------- --------- ------ ------ ------- ----------- ----------- ---------------- ---------- ------------
Ethernet8 8,9,10,11 100G 9100 rs Ethernet8 trunk up up False up *QSFP28 or later off 100G