Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?


Understanding Junos PyEZ Tables and Views

SUMMARY Use Junos PyEZ Tables and Views to extract operational or configuration data from Junos devices or to programmatically configure specific resources on Junos devices.

Junos PyEZ Tables and Views are simple YAML definitions that enable you to:

  • extract operational information from Junos devices

  • retrieve configuration data from Junos devices

  • configure Junos devices

Tables and Views provide a simple and efficient way to extract information from complex operational command output or configuration data and map it to a Python data structure. Tables and Views are defined using YAML, so no complex coding is required to create your own. To extract information, you use predefined or custom Tables to map command output or configuration data to a table, which consists of a collection of items. Each Table item represents a record of data and has a unique key. A Table also references a specific View, which is used to map the tag names or fields in the data to the variable names in the Python data structure.

Table 1 outlines the different types of Tables and notes the Junos PyEZ release in which each type was first supported. Junos PyEZ operational (op) Tables select items from operational command output. Op Tables can execute RPCs and parse structured output (XML) , or they can execute commands and parse unstructured output (CLI-formatted text). Junos PyEZ configuration Tables define structured configuration resources that select or configure statements in specified hierarchies of the given configuration database.

Configuration tables that define the get property can only retrieve configuration data. Configuration Tables that define the set property can both retrieve as well as modify the configuration statements defined in the corresponding View. When you add the configuration Table to the Junos PyEZ framework, Junos PyEZ dynamically creates a configuration class for the resource, which enables you to programmatically configure the resource on a device.

Table 1: Junos PyEZ Table Types

Table Type



Junos PyEZ Release

Operational Table

RPC with structured output

Execute an RPC on a device and return structured XML output


Command with unstructured output

Execute a CLI command on a device or execute a vty command on an FPC and return unstructured CLI-formatted output


Configuration Table


Retrieve configuration data



Retrieve configuration data or configure statements defined in the corresponding View


For example, the following op Table retrieves output for the get-arp-table-information RPC with the no-resolve option, which corresponds to the show arp no-resolve command in the Junos OS CLI. The Table extracts arp-table-entry elements from the XML output. The corresponding View selects three fields from each arp-table-entry item by mapping the user-defined field name to the XPath expression that corresponds to the location of that data in the Junos XML output. In this case, mac-address, ip-address, and interface-name are child elements of arp-table-entry.

For information about creating and using operational Tables and Views, see the following topics:

For information about creating and using configuration Tables and Views, see the following topics:

For information about loading or importing custom Tables and Views in your Junos PyEZ application or about saving data to files, see the following topics: