Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Mapping Junos OS Commands to Perl Methods

Juniper Networks provides Perl modules to help you more quickly and easily develop custom Perl scripts for configuring and monitoring switches, routers, and security devices running Junos OS. The modules implement an object that client applications can use to communicate with the NETCONF or Junos XML protocol server on a device running Junos OS. The NETCONF and Junos XML protocol Perl distributions include sample Perl scripts, which illustrate how to use the modules in scripts that perform various functions.

The Junos XML API is an XML representation of Junos OS configuration statements and operational mode commands. It defines an XML equivalent for all statements in the Junos OS configuration hierarchy and many of the commands that you issue in CLI operational mode. Each operational mode command with a Junos XML counterpart maps to a request tag element and, if necessary, a response tag element. You can map the request tag element for operational mode commands to Perl methods. There is a Perl method for every Junos XML request tag element.

To derive the Perl method name from the request tag element name, replace each hyphen in the tag element name with an underscore and remove the enclosing angle brackets from the tag element name. For example, the <get-bgp-group-information> tag element maps to the get_bgp_group_information Perl method.

The sample scripts included with the Perl distributions invoke only a small number of the Junos XML Perl methods available in Junos OS. For a list of all of the request tag elements available in the current version of the Junos OS, see the chapter in the Junos XML API Operational Developer Reference that maps Junos XML request tag elements to CLI commands and Perl methods. For information about optional and required attributes for a particular Perl method, see the entry for the corresponding Junos XML request tag element in the chapters titled “Summary of Operational Request Tag Elements” in the Junos XML API Operational Developer Reference.