Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Writing NETCONF Perl Client Applications

 

The Juniper Networks NETCONF Perl client enables programmers familiar with the Perl programming language to create their own Perl applications to manage and configure routing, switching, and security devices running Junos OS. The Net::Netconf::Manager module provides an object-oriented interface for communicating with a NETCONF server on devices running Junos OS, and enables you to connect to the device, establish a NETCONF session, and execute operational and configuration requests.

The following outline lists the basic tasks involved in writing a NETCONF Perl client application that manages a device running Junos OS. Each task provides a link to more detailed information about performing that task.

  1. Import Perl Modules and Declare Constants—Importing Perl Modules and Declaring Constants in NETCONF Perl Client Applications
  2. Connect to the NETCONF Server—Connecting to the NETCONF Server in Perl Client Applications and Collecting Parameters Interactively in NETCONF Perl Client Applications
  3. Submit Requests to the NETCONF Server—Submitting a Request to the NETCONF Server in Perl Client Applications
  4. Parse and Format the Response from the NETCONF Server—Parsing the NETCONF Server Response in Perl Client Applications
  5. Close the Connection to the NETCONF Server—Closing the Connection to the NETCONF Server in Perl Client Applications

The tasks are illustrated in the following example, which uses the Net::Netconf::Manager object to request information from a device running Junos OS. The example presents the minimum code required to execute a simple query.

Note

Prior to Junos OS Release 16.1, every Junos OS release included a new, release-dependent version of the NETCONF Perl client. Beginning in Junos OS Release 16.1, the NETCONF Perl client is release-independent, is hosted on GitHub and CPAN, and can manage devices running any version of the Junos OS release. The sample scripts in the release-dependent versions of the NETCONF Perl distribution differ from those in the release-independent version hosted on GitHub and CPAN.

  1. Import required modules and declare constants.
  2. Create a Manager object and connect to the device.
  3. Construct the query and send it to the NETCONF server.
  4. Process the response as needed.
  5. Disconnect from the NETCONF server.
Release History Table
Release
Description
Beginning in Junos OS Release 16.1, the NETCONF Perl client is release-independent, is hosted on GitHub and CPAN, and can manage devices running any version of the Junos OS release. The sample scripts in the release-dependent versions of the NETCONF Perl distribution differ from those in the release-independent version hosted on GitHub and CPAN.