If we set interface naming mode to 'alias', and run the 'show ip route' command, the output is shown in json format. If we don't set SONIC_CLI_IFACE_MODE or set it to 'default', then the output is not in JSON format
admin@vlab-08:~$ SONIC_CLI_IFACE_MODE=alias show ip route 192.168.1.0
{
"0.0.0.0\/0":[
{
"prefix":"0.0.0.0\/0",
"protocol":"static",
"vrfId":0,
"vrfName":"default",
"distance":200,
"metric":0,
"table":254,
"internalStatus":0,
"internalFlags":65,
"internalNextHopNum":1,
"internalNextHopActiveNum":0,
"uptime":"20:39:09",
"nexthops":[
{
"flags":0,
"ip":"10.250.0.1",
"afi":"ipv4",
"weight":1
}
]
},
{
"prefix":"0.0.0.0\/0",
"protocol":"bgp",
"vrfId":0,
"vrfName":"default",
"selected":true,
"destSelected":true,
"distance":20,
"metric":0,
"installed":true,
"table":254,
"internalStatus":16,
"internalFlags":8,
"internalNextHopNum":2,
"internalNextHopActiveNum":2,
"uptime":"20:39:09",
"nexthops":[
{
"flags":3,
"fib":true,
"ip":"10.0.0.1",
"afi":"ipv4",
"interfaceIndex":75,
"interfaceName":"PortChannel0002",
"active":true,
"weight":1
},
{
"flags":3,
"fib":true,
"ip":"10.0.0.5",
"afi":"ipv4",
"interfaceIndex":76,
"interfaceName":"PortChannel0005",
"active":true,
"weight":1
}
]
}
]
}
Expect the output to be the same format as with SONIC_IFACE_CLI_MODE set to default
admin@vlab-08:~$ SONIC_IFACE_CLI_MODE=default show ip route 192.168.1.1
Routing entry for 0.0.0.0/0
Known via "bgp", distance 20, metric 0, best
Last update 20:39:14 ago
* 10.0.0.5, via PortChannel0005
* 10.0.0.1, via PortChannel0002
Routing entry for 0.0.0.0/0
Known via "static", distance 200, metric 0
Last update 20:39:14 ago
* 10.250.0.1 inactive
admin@vlab-08:~$ show version
SONiC Software Version: SONiC.official_masic_test.24903-74c2532a
Distribution: Debian 10.10
Kernel: 4.19.0-12-2-amd64
Build commit: 74c2532a
Build date: Thu Jul 22 03:49:09 UTC 2021
Built by: AzDevOps@sonic-build-workers-000IRK
Platform: x86_64-kvm_x86_64-r0
HwSKU: msft_four_asic_vs
ASIC: vs
ASIC Count: 4
Serial Number: None
Model Number: None
Hardware Revision: None
Uptime: 15:42:29 up 12 days, 20:44, 1 user, load average: 0.30, 0.16, 0.11
(paste your output here or download and attach the file here )
Description
If we set interface naming mode to 'alias', and run the 'show ip route' command, the output is shown in json format. If we don't set SONIC_CLI_IFACE_MODE or set it to 'default', then the output is not in JSON format
Because of this, sonic-mgmt test test_show_ip_route_v4(https://github.com/Azure/sonic-mgmt/blob/master/tests/iface_namingmode/test_iface_namingmode.py#L921) and test_show_ip_route_v6 are failing when run in alias mode.
Steps to reproduce the issue:
Describe the results you received:
The output of 'SONIC_IFACE_CLI_MODE=alias show ip route 192.168.1.1 is:
Describe the results you expected:
Expect the output to be the same format as with SONIC_IFACE_CLI_MODE set to default
Output of
show version:On a multi-asic KVM
Output of
show techsupport:Additional information you deem important (e.g. issue happens only occasionally):