Junos PyEZ Modules Overview
SUMMARY The Junos PyEZ Python library provides modules that you can use to connect to and perform operations on Junos devices.
Junos PyEZ is a microframework for Python that enables you to manage and automate Junos devices.
Junos PyEZ consists of the jnpr.junos
package, which contains modules that
handle device connectivity and provide operational and configuration utilities.
Table 1 outlines the primary Junos PyEZ modules that are used to manage Junos devices. For detailed information about each module, see the Junos PyEZ API Reference at http://junos-pyez.readthedocs.org/.
jnpr.junos Modules |
Description |
---|---|
|
Defines the |
|
Includes predefined operational Tables and Views that can be used to filter unstructured output returned from CLI and vty commands and convert it to JSON. |
|
Defines exceptions encountered when accessing, configuring, and managing Junos devices. |
|
Contains code pertaining to Tables and Views, including
the |
|
A dictionary-like object of read-only facts about the
device. These facts are accessed using the |
|
Includes predefined operational Tables and Views that can be used to filter structured (XML) output returned from RPCs. |
|
Includes predefined configuration Tables and Views representing specific configuration resources, which can be used to programmatically configure Junos devices. |
|
Contains code used by the |
|
Includes configuration utilities, file system utilities, shell utilities, software installation utilities, and secure copy utilities. |
In Junos PyEZ, each device is modeled as an instance of the
jnpr.junos.device.Device
class. The device
module provides
access to Junos devices through a serial console connection, telnet, or SSH and also supports
connecting to the device through a telnet or SSH connection to a console server that is connected
to the device’s CONSOLE
port. All connection methods support retrieving device
facts, performing operations, and executing RPCs on demand. Support for serial console
connections and for telnet and SSH connections through a console server enables you to connect to
and initially configure new or zeroized devices that are not yet configured for remote access.
Facts about the device are accessed using the facts
attribute of the
Device
object instance.
The utils
module defines submodules and classes that handle software
installation, file system and copy operations, and configuration management. The
exception
module defines exceptions encountered when managing Junos devices.
The command
, op
, resources
, and
factory
modules pertain to Tables and Views. The command
and
op
modules contain predefined operational Tables and Views that can be used to
extract specific information from the output of common operational commands and RPCs on Junos
devices. The resources
module contains predefined configuration Tables and Views
that can be used to configure specific resources on Junos devices. The factory
module contains methods that enable you to load your own custom Tables and Views in Junos PyEZ
applications.