Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Parse the NETCONF Server Response in Perl Client Applications

In a NETCONF Perl client application, after establishing a connection to a NETCONF server, the client application can submit one or more requests by invoking Perl methods. The NETCONF server returns the appropriate information in an <rpc-reply> element. There are two ways of parsing the NETCONF server’s response:

  • By using functions of XML::LibXML::DOM

  • By using functions of XML::LibXML::XPATHContext

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 release-independent version of the NETCONF Perl client does not include the Net::Netconf::Transform module that was present in the release-dependent versions of the client.

For example, consider the following reply from a NETCONF server:

Suppose the user wants to parse the response and retrieve the value of the <serial-number> element.

The following code uses XML::LibXMl::DOM to retrieve the value. The example stores the response in a variable and calls methods of DOM to parse the response.

The following code uses XML::LibXML::XPATHContext to retrieve the value. The example stores the response in a variable and calls XPathContext methods to retrieve the value. The local-name() function returns the element name without the namespace. The XPATH expression appears on multiple lines for readability.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
16.1
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.