Chapter 4. Junos PyEZ
This chapter looks at Junos PyEZ, another automation tool that allows remote procedure calls to be invoked on Junos devices. PyEZ is a Python library that enables administration and automation of Junos devices. It is an open source project maintained and supported by Juniper Networks with contributions from the user community. The Junos PyEZ project is hosted on GitHub at https://github.com/Juniper/py-junos-eznc.
The PyEZ APIs provide a “mini-framework” that can be used to solve
both simple and complex automation tasks. PyEZ can be used from the
interactive Python shell to quickly perform simple tasks on one or more
Junos devices, or incorporated in full-blown Python scripts of varying
complexity to automate the management and administration of an entire
network of Junos devices. The first several sections of this chapter
demonstrate entering commands at the interactive Python shell indicated by
the >>> prompt. “A PyEZ Example” will demonstrate a full Python script
utilizing the PyEZ library.
PyEZ provides an abstraction layer built on top of the NETCONF
protocol covered in Chapter 2. It does not require
direct NETCONF interaction, but utilizes the vendor-agnostic ncclient1 library for its NETCONF transport. Because the PyEZ library
utilizes NETCONF for its remote procedure calls, it can be used with all
currently supported Junos software versions and Junos platforms.
Like the Junos RESTful API covered in Chapter 3, the PyEZ library supports invoking individual ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access