11-03-2020 12:57 AM
I try restconf but get 404 error
11-16-2020 06:40 PM
Multiple ways to achieve this. You can do a simple send_command in python using the netmiko library and ssh, then process the response in python data structures.
11-17-2020 05:06 AM
You could use - https://ios-xe-mgmt.cisco.com:9443/restconf/data/ietf-routing:routing-state/routing-instance
curl -v -k -u admin:admin -H "Accept: application/yang-data+json" https://ios-xe-mgmt.cisco.com:9443/restconf/data/ietf-routing:routing-state/routing-instance
Output
{
"ietf-routing:routing-instance": [
{
"name": "default",
"type": "ietf-routing:default-routing-instance",
"router-id": "0.0.0.0",
"routing-protocols": {
"routing-protocol": [
{
"type": "ietf-routing:direct",
"name": "0"
},
{
"type": "ietf-routing:static",
"name": "0"
}
]
},
"ribs": {
"rib": [
{
"name": "ipv4-default",
"address-family": "ietf-routing:ipv4",
"default-rib": false,
"routes": {
"route": [
{
"destination-prefix": "0.0.0.0/0",
"route-preference": 1,
"metric": 1,
"next-hop": {
"outgoing-interface": "GigabitEthernet1",
"next-hop-address": "10.10.20.254"
},
"source-protocol": "ietf-routing:static",
"active": [null]
},
{
"destination-prefix": "1.1.1.200/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback200",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "1.2.3.4/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback1234",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "1.2.3.55/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback55",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.1.1.1/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback1001",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.10.20.0/24",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet1",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.10.20.48/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet1",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.10.255.0/24",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet3",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.10.255.1/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet3",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.255.255.0/24",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet2",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "10.255.255.1/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "GigabitEthernet2",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "172.16.100.0/24",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback100",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "172.16.100.1/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "Loopback100",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
}
]
}
},
{
"name": "ipv6-default",
"address-family": "ietf-routing:ipv6",
"default-rib": false
}
]
}
},
{
"name": "__Platform_iVRF:_ID00_",
"type": "ietf-routing:vrf-routing-instance",
"router-id": "0.0.0.0",
"interfaces": {
"interface": ["LIIN0"]
},
"routing-protocols": {
"routing-protocol": [
{
"type": "ietf-routing:direct",
"name": "0"
}
]
},
"ribs": {
"rib": [
{
"name": "ipv4-default",
"address-family": "ietf-routing:ipv4",
"default-rib": false,
"routes": {
"route": [
{
"destination-prefix": "192.168.1.4/30",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "LIIN0",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
},
{
"destination-prefix": "192.168.1.6/32",
"route-preference": 0,
"metric": 0,
"next-hop": {
"outgoing-interface": "LIIN0",
"next-hop-address": "0.0.0.0"
},
"source-protocol": "ietf-routing:direct",
"active": [null]
}
]
}
},
{
"name": "ipv6-default",
"address-family": "ietf-routing:ipv6",
"default-rib": false
}
]
}
}
]
}
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide