How it works...

Our Python script starts up and scans the command line argument for options that influence its behaviour. We allow the user to specify the parameters associated with username, port number, and target router address. We also grant the user access to a -f switch—to force the update of a particular prefix-list.

Once established, the script scans the JUNOS device looking for any prefix-list objects in the policy-options hierarchy that are named with the SUFFIX denoted at the top of the file. We've chosen an initial default value of .auto for this.

For every matching prefix-list found, the script will call upon bgpq3—specified by name using the runtime constant IRRTOOL, in case the full pathname needs to be provided—in order to ...

Get JUNOS Automation Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.