O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How it works...

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.

It's crucially important to add the constraining parameters to the <get-route-information> RPC. If you don't, you may find yourself downloading the global Internet table, decorated with XML. PyEZ will likely timeout the RPC on duration, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required