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 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 ...

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