Posted on May 29, 2020 5:10 am
 |  Asked by Mayank Sharma
 |  89 views
RESOLVED
0
0
Print Friendly, PDF & Email

Where can i find the json schema for the show ip route vrf x static rest command ……..i need to get the response and parse it to the correct json object

0
Posted by Vikram
Answered on May 29, 2020 5:13 am

Hi Mayank,

Have you tried piping the output to json

For eg.

switch#sh ip route vrf MGMT static | json
{
"vrfs": {
"MGMT": {
"routes": {
"0.0.0.0/0": {
"kernelProgrammed": true,
"directlyConnected": false,
"routeAction": "forward",
"routeLeaked": false,
"vias": [
{
"interface": "Management1",
"nexthopAddr": "10.1.1.1"
}
],
"metric": 0,
"hardwareProgrammed": true,
"routeType": "static",
"preference": 1
}
},
"allRoutesProgrammedKernel": true,
"routingDisabled": true,
"allRoutesProgrammedHardware": true,
"defaultRouteState": "reachable"
}
}
}
switch#

Thanks

0
Posted by Aniket Bhowmick
Answered on May 29, 2020 1:59 pm

Hi Mayank,

Below is an example:

CLI Output:

#sh ip route vrf red static

S 2.2.2.0/24 is directly connected, Vlan100

Output in JSON Format:

#sh ip route vrf red static | json
{
"vrfs": {
"red": {
"routes": {
"2.2.2.0/24": {
"kernelProgrammed": true,
"directlyConnected": true,
"routeAction": "forward",
"routeLeaked": false,
"vias": [
{
"interface": "Vlan100"
}
],
"hardwareProgrammed": true,
"routeType": "static"
}
},
"allRoutesProgrammedKernel": true,
"routingDisabled": true,
"allRoutesProgrammedHardware": true,
"defaultRouteState": "notSet"
}
}
}

^ Is this what you are looking for or is it something else ?

Thanks,

Aniket

Post your Answer

You must be logged in to post an answer.