Navigation
Guide That Contains This Content
[+] Expand All
[-] Collapse All
     

    Related Documentation

     

    Understanding Junos PyEZ Tables and Views

    Junos PyEZ Tables and Views enable you to extract operational information and configuration data from devices running Junos OS as well as configure devices running Junos OS. To extract information, you use the Table widget to map command output or configuration data to a table, which consists of a collection of items that can then be examined as a View. Starting in Junos PyEZ Release 2.0, you can also use Tables and Views to define structured configuration resources. When you add the Table to the Junos PyEZ framework, Junos PyEZ dynamically creates a configuration class for the resource, which you can use to programmatically configure the resource on a device. Tables and Views are defined using YAML, so no complex coding is required to create your own custom Tables and Views.

    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. Operational (op) Tables select items from the RPC reply of an operational command, and configuration Tables select data from specific hierarchies in the selected configuration database. Each Table item represents a record of data and has a unique key. A Table also references a Table View, which is used to map the tag names in the data to the variable property names used within the Python module.

    For example, the following op Table retrieves output for the get-arp-table-information RPC, which corresponds to the show arp command in the CLI. The Table extracts <arp-table-entry> elements from the output, and 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.

    ---
    ArpTable:
      rpc: get-arp-table-information
      item: arp-table-entry
      key: mac-address
      view: ArpView
    
    ArpView:
      fields:
        mac_address: mac-address
        ip_address: ip-address
        interface_name: interface-name

    Junos PyEZ configuration Tables can be used to both retrieve and modify configuration data on devices running Junos OS. Configuration tables that define the get property can only retrieve configuration data. Configuration Tables that define the set property can both retrieve and configure the statements defined in the corresponding View.

    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, see the following topics:

     

    Related Documentation

     

    Modified: 2017-08-29