Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[show][multiasic]Fixed SONIC_CLI_IFACE_MODE=alias show ip|ipv6 route output in default mode issue #2422

Merged
merged 1 commit into from
Nov 18, 2022

Conversation

mlok-nokia
Copy link
Contributor

@mlok-nokia mlok-nokia commented Oct 4, 2022

What I did

There are many issues with the "SONIC_CLI_IFACE_MODE=aliasshow ip/ipv6 route [json]" commands on both single asic platform and multiasic platform

  • Doesn't show the interface alias on single asic platform
  • Display the route info twice either in Json format or default format on the single asic platform
  • Doesn't show the interface alias on multiasic platform
  • Display the route info in the Json format even if Json is not specified in the CLI command

Resolves# sonic-net/sonic-buildimage#8498

This PR is required by 202205 branch

How I did it

  • In the current show_routes() function, the internal command to get the route for single asic platform is formatted to "vtysh show ip/ipv6 route" while it is formatted to "vtysh show ip/ipv6 route json". This commit changes to use the same command "vtysh show ip/ipv6 route json" for both single asic platform and multiasic platform.
  • With the same format (in Json) output, add logic to run_bgp_show_command() to convert the Interface name to alias if SONIC_CLI_IFACE_MODE=alias for both show ip/ipv4 route command
  • Add code to skip the function run_command_in_alias_mode() for "show ip/ipv6 route" command since it is not applicable to show the route table info.
  • Modify and clean up the show_routes() function to use the same code path to display route info for both none-multasic and multiasic platform.
  • Add unit test cases: test_show_ipv6_route_alias() and test show_multi_asic_ipv6_route_all_namespace_alias()

How to verify it

  1. execute show command "SONIC_CLI_IFACE_MODE=alias show ip route", it will display the route info in the default format with the interface name
  2. verify the port interface name is displayed the alias instead of the port name
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ip route 0.0.0.0/0
Routing entry for 0.0.0.0/0
  Known via "bgp", distance 20, metric 0, best
  Last update 01:24:03 ago
  * 10.0.0.11, via Ethernet-IB0 onlink
  * 10.0.0.11 (recursive)
  * 10.0.0.7, via Ethernet-IB0 onlink
  * 10.0.0.7 (recursive)
  * 10.0.0.5, via Ethernet1/18
  * 10.0.0.1, via PortChannel102
  * 10.0.0.1 (recursive)
  * 10.0.0.1, via Ethernet-IB1 onlink
  * 10.0.0.5 (recursive)
  * 10.0.0.5, via Ethernet-IB1 onlink
  * 10.0.0.7, via PortChannel106
  * 10.0.0.11, via Ethernet1/36
  1. Also exec the "show ipv6 command" to verify the ipv6 route info is displayed in the correct format with the alias name.
admin@sonic:~$ SONIC_CLI_IFACE_MODE=alias show ipv6 route  ::0/0
Routing entry for ::/0
  Known via "kernel", distance 210, metric 0
  Last update 21:31:04 ago
  * fd00::1, via eth0

Routing entry for ::/0
  Known via "bgp", distance 20, metric 0, best
  Last update 01:27:15 ago
  * fc00::16, via Ethernet-IB0 onlink
  * fc00::16 (recursive)
  * fc00::e, via Ethernet-IB0 onlink
  * fc00::e (recursive)
  * fc00::a, via Ethernet1/18
  * fc00::2, via PortChannel102
  * fc00::2 (recursive)
  * fc00::2, via Ethernet-IB1 onlink
  * fc00::a (recursive)
  * fc00::a, via Ethernet-IB1 onlink
  * fc00::e, via PortChannel106
  * fc00::16, via Ethernet1/36

The following command have been run to against these changes. They all work as expected:

------------------- Multiasic ip/ipv6 route ---------------------
show ip route 
SONIC_CLI_IFACE_MODE=alias show ip route 
show ip route json
SONIC_CLI_IFACE_MODE=alias show ip route json

show ip route -n asic0
SONIC_CLI_IFACE_MODE=alias show ip route -n asic0 
show ip route json -n asic0
SONIC_CLI_IFACE_MODE=alias show ip route json -n asic0 

show ip route -d all
SONIC_CLI_IFACE_MODE=alias show ip route -d all
show ip route json -d all
SONIC_CLI_IFACE_MODE=alias show ip route json -d all

show ip route -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route -d frontend
show ip route json -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route json -d frontend

show ip route 192.217.192.128
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128
show ip route 192.217.192.128 json
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128 json

show ip route 192.217.192.128 -d all
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128 -d all
show ip route 192.217.192.128 json -d all
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128 json -d all

show ip route 192.217.192.128 -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128 -d frontend
show ip route 192.217.192.128 json -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route 192.217.192.128 json -d frontend

show ipv6 route 
SONIC_CLI_IFACE_MODE=alias show ipv6 route 
show ipv6 route json
SONIC_CLI_IFACE_MODE=alias show ipv6 route json

show ipv6 route -d all
SONIC_CLI_IFACE_MODE=alias show ipv6 route -d all
show ipv6 route json -d all
SONIC_CLI_IFACE_MODE=alias show ip route json -d all

show ipv6 route -d frontend
SONIC_CLI_IFACE_MODE=alias show ipv6 route -d frontend
show ipv6 route json -d frontend
SONIC_CLI_IFACE_MODE=alias show ipv6 route json -d frontend

show ipv6 route fe80::
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64
show ipv6 route  fe80::/64 json
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json

show ipv6 route fe80::/64 -d all 
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 -d all 
show ipv6 route  fe80::/64 json -d all  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json -d all 

show ipv6 route fe80::/64 -d frontend  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 -d frontend  
show ipv6 route  fe80::/64 json -d frontend  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json -d frontend   

================  Non-multiasic ip/ route =======================
show ip route
SONIC_CLI_IFACE_MODE=alias show ip route
show ip route json
SONIC_CLI_IFACE_MODE=alias show ip route json

show ip route -d all
SONIC_CLI_IFACE_MODE=alias show ip route -d all
show ip route json -d all 
SONIC_CLI_IFACE_MODE=alias show ip route json -d all 

show ip route 10.1.0.32
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32
show ip route 192.217.192.128 json
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32 json

show ip route 10.1.0.32 -d all
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32  -d all
show ip route 10.1.0.32 json -d all
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32  json -d all


show ip route 10.1.0.32 -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32  -d frontend
show ip route 10.1.0.32 json -d frontend
SONIC_CLI_IFACE_MODE=alias show ip route 10.1.0.32  json -d frontend

show ipv6 route 
SONIC_CLI_IFACE_MODE=alias show ipv6 route 
show ipv6 route json
SONIC_CLI_IFACE_MODE=alias show ipv6 route json

show ipv6 route -d all
SONIC_CLI_IFACE_MODE=alias show ipv6 route -d all
show ipv6 route json -d all
SONIC_CLI_IFACE_MODE=alias show ip route json -d all

show ipv6 route -d frontend
SONIC_CLI_IFACE_MODE=alias show ipv6 route -d frontend
show ipv6 route json -d frontend
SONIC_CLI_IFACE_MODE=alias show ipv6 route json -d frontend

show ipv6 route fe80::
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64
show ipv6 route  fe80::/64 json
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json

show ipv6 route fe80::/64 -d all 
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 -d all 
show ipv6 route  fe80::/64 json -d all  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json -d all 

show ipv6 route fe80::/64 -d frontend  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 -d frontend  
show ipv6 route  fe80::/64 json -d frontend  
SONIC_CLI_IFACE_MODE=alias show ipv6 route fe80::/64 json -d frontend   

Previous command output (if the output of a command-line utility has changed)

New command output (if the output of a command-line utility has changed)

@mlok-nokia mlok-nokia changed the title Fixed SONIC_CLI_IFACE_MODE=alias show ip|ipv6 route output in default mode issue [show][multiasic]Fixed SONIC_CLI_IFACE_MODE=alias show ip|ipv6 route output in default mode issue Oct 5, 2022
@mlok-nokia mlok-nokia force-pushed the show-ip-route-alias branch 2 times, most recently from 14d1157 to 92f1336 Compare October 10, 2022 21:30
@mlok-nokia
Copy link
Contributor Author

@judyjoseph @abdosi Please help or inivite the right people to review this PR. Thanks

@mlok-nokia
Copy link
Contributor Author

@judyjoseph & @abdosi Please help to review this PR. Thanks.

@mlok-nokia
Copy link
Contributor Author

@abdosi Since this PR is approved, could you please merge it. Thanks

@abdosi abdosi merged commit 25acda3 into sonic-net:master Nov 18, 2022
preetham-singh pushed a commit to preetham-singh/sonic-utilities that referenced this pull request Nov 21, 2022
… mode issue (sonic-net#2422)

There are many issues with the "SONIC_CLI_IFACE_MODE=aliasshow ip/ipv6 route [json]" commands on both single asic platform and multiasic platform

Doesn't show the interface alias on single asic platform
Display the route info twice either in Json format or default format on the single asic platform
Doesn't show the interface alias on multiasic platform
Display the route info in the Json format even if Json is not specified in the CLI command
Resolves# sonic-net/sonic-buildimage#8498
mdanish-kh pushed a commit to mdanish-kh/sonic-utilities that referenced this pull request Nov 23, 2022
… mode issue (sonic-net#2422)

There are many issues with the "SONIC_CLI_IFACE_MODE=aliasshow ip/ipv6 route [json]" commands on both single asic platform and multiasic platform

Doesn't show the interface alias on single asic platform
Display the route info twice either in Json format or default format on the single asic platform
Doesn't show the interface alias on multiasic platform
Display the route info in the Json format even if Json is not specified in the CLI command
Resolves# sonic-net/sonic-buildimage#8498
yxieca pushed a commit that referenced this pull request Nov 29, 2022
… mode issue (#2422)

There are many issues with the "SONIC_CLI_IFACE_MODE=aliasshow ip/ipv6 route [json]" commands on both single asic platform and multiasic platform

Doesn't show the interface alias on single asic platform
Display the route info twice either in Json format or default format on the single asic platform
Doesn't show the interface alias on multiasic platform
Display the route info in the Json format even if Json is not specified in the CLI command
Resolves# sonic-net/sonic-buildimage#8498
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants