The initial steps in this recipe are quite simple to follow. Our Python script parses command line arguments in order to obtain two mandatory parameters:
- A router hostname to connect to
- A route-target community to search for
Then we call the <get-route-information> RPC in order to query the routing table, but we constrain the query by specifying the BGP layer-3 VPN table, and we also stipulate that we only want to see routes that carry our specific route-target extended community attribute.