cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
593
Views
5
Helpful
1
Replies

PyATS and defult vrf

I am trying to run pyATS on a few CSRv routers and retrieve their routing tables. When I execute learn, pyATS looks for a vrf identified as 'default' as noted in the console file. I do not have a vrf labeled 'default', it's just the global routing table, so I get no information about the routing table back. Has anyone else run into this problem? Is there a workaround for it? 

 

Thanks,

Paul P.

1 Reply 1

@PaulPatterson99634 i think in CSR/XE you will see VRF default regardless, as the default acts as the global table. Without seeing the code you are running it is hard to spot the problem, if you want to see the whole thing run the command "show ip route" on the device and parse the output to JSON

 

routingTable = dev.parse('show ip route')  
print(json.dumps(routingTable)
{
   "vrf":{
      "default":{
         "address_family":{
            "ipv4":{
               "routes":{
                  "0.0.0.0/0":{
                     "route":"0.0.0.0/0",
                     "active":true,
                     "metric":0,
                     "route_preference":1,
                     "source_protocol_codes":"S*",
                     "source_protocol":"static",
                     "next_hop":{
                        "next_hop_list":{
                           "1":{
                              "index":1,
                              "next_hop":"10.10.20.254",
                              "outgoing_interface":"GigabitEthernet1"
                           }
                        }
                     }
                  },
                  "10.10.20.0/24":{
                     "route":"10.10.20.0/24",
                     "active":true,
                     "source_protocol_codes":"C",
                     "source_protocol":"connected",
                     "next_hop":{
                        "outgoing_interface":{
                           "GigabitEthernet1":{
                              "outgoing_interface":"GigabitEthernet1"
                           }
                        }
                     }
                  },
                  "10.10.20.48/32":{
                     "route":"10.10.20.48/32",
                     "active":true,
                     "source_protocol_codes":"L",
                     "source_protocol":"local",
                     "next_hop":{
                        "outgoing_interface":{
                           "GigabitEthernet1":{
                              "outgoing_interface":"GigabitEthernet1"
                           }
                        }
                     }
                  }
               }
            }
         }
      }
   }
}

Take a look at this example https://github.com/tahigash/pyATS-Lab-Guide

Please mark this as helpful or solution accepted to help others
Connect with me https://bigevilbeard.github.io