Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Request an Inventory of Hardware Components Using a NETCONF Perl Client Application

The NETCONF Perl distribution includes several sample Perl scripts to perform various functions on devices running Junos OS. The get_chassis_inventory.pl script retrieves and displays a detailed inventory of the hardware components installed in a routing, switching, or security platform. It is equivalent to issuing the show chassis hardware detail operational mode command in the Junos OS CLI. This topic describes the portion of the script that executes the query.

After establishing a connection to the NETCONF server, the script sends the get_chassis_inventory request and includes the detail argument.

Note:

When using the release-independent NETCONF Perl distribution, to include a fixed-form option when invoking a method, set the option equal to the value 1 (one).

The script sends the query and assigns the return value to the $res variable. The script first prints the RPC request and response to standard output, then it prints the response to the specified file. The script then checks for and prints any error encountered.