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

Making configuration changes with PyEZ

In this recipe, we’ll explore the PyEZ framework and the facilities it provides for manipulating the configuration on JUNOS devices. We’ll create an PyEZ application, pyez-edit-prefix-list.py, that can manipulate a named prefix-list on a JUNOS device. The prefix-list list might be part of an advanced routing protocol policy configuration which we won’t attempt to configure, but we’ll provide the ability to add and remove prefixes from the prefix-list, using a command line interface like this:

Command line argument

Description

-h

Offers brief help text

-t router

IP address of JUNOS router to target

-a prefix/len

Prefix to add to the list

-d prefix/len

Prefix to delete from ...

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