How to do it...

We're going to create a Python script, build-route-filters.py, that will login to a specified router, audit the prefix-list names, and then consult the IRRs in order to create updated versions of those prefix-lists. 

  1. First of all, ensure that bgpq3 is installed on your system and working by running a test query.
      $ bgpq3 -Jl eltel AS20597      policy-options {      replace:       prefix-list eltel {          81.9.0.0/20;          81.9.32.0/20;          81.9.96.0/20;          81.222.128.0/20;          81.222.160.0/20;          81.222.192.0/18;          85.249.8.0/21;          85.249.224.0/19;          89.112.0.0/17;          217.170.64.0/19;       }      }
  1. Assuming all is good, continue to create build-route-filters.py in your preferred development or text editor environment. Start by specifying Python as the script interpreter and importing ...

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.