Posted on October 7, 2021 9:37 am
 |  Asked by Francois Rigault
 |  88 views
Tags:
RESOLVED
1
0
Print Friendly, PDF & Email

Greetings. Our switches run TerminAttr and ocprometheus which exposes a subset of metrics to Prometheus. Only the Prometheus server and CVP have access to the switch management interface. Occasionally we would like to audit the routing tables of our switches. They are present in CVP under Device > Routing > IPv4 Routing Table, and there we even have the ability to perform a .csv export for a given vrf.

I would like to programmatically download the routing tables of my switches, as already available on CVP web interface, notably to check for any incorrect BGP publication. Is there a way to access the routing tables programmatically through CVP API?

Thanks

 

0
Posted by Francois Rigault
Answered on October 14, 2021 11:50 pm

I think I almost figured it out.

The REST API does not cover this use case but there is a gRPC API that listens on port 8443 that supports this use case. There are examples under https://github.com/aristanetworks/cloudvision-python/tree/trunk/examples/Connector

Looking at what my browser is sending through a websocket while listing the routes, I need to get


pathElts = [
"Smash",
"routing",
"status",
"route"
]

and

pathElts = [
"Smash",
"forwarding",
"status",
"fec"
]

Which should get me the IPv4 routes for the Default vrf which is almost what I want. So far it looks like that: https://github.com/freedge/cloudvision-python/blob/getroutes/examples/Connector/get_routes.py#L46

just need to figure out how to choose the right vrf

1
Posted by Tamas Plugor
Answered on October 15, 2021 12:53 pm

Yes, that's pretty much how you'd do it today, for vrfs you can use the vrf paths:

/Smash/routing/vrf/status/{vrfName}/route

/Smash/forwarding/vrf/status/{vrfName}/fec

and if you have evpn network, you can resolve the tunnelids in the nexthops using /Smash/tunnel/table/evpnVxlan/entry

Obviously instead of the slashes you'd need to create a path elements list as you did above ^
HTH,
Tamas

0
Posted by Francois Rigault
Answered on October 15, 2021 1:46 pm

very nice. It works well.

Post your Answer

You must be logged in to post an answer.