Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Request an Inventory of Hardware Components Using Junos XML Protocol Perl Client Applications

The Junos XML protocol Perl distribution includes several sample Perl scripts that 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. The output is equivalent to issuing the show chassis hardware detail operational mode command in the Junos OS command-line interface (CLI). This topic describes the portion of the script that executes the query.

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

The script sends the query and assigns the results to the $res variable. It performs two tests on the results, and prints an error message if it cannot send the request or if errors occurred when executing it. If no errors occur, the script uses XSLT to transform the results. For more information, see Parsing and Formatting Junos XML Protocol Server Responses in Perl Client Applications.