Object - Juniper JUNOS OS 10.3 - XML MANAGEMENT PROTOCOL GUIDE 6-30-2010 Manual

Junos xml management protocol guide
Hide thumbs Also See for JUNOS OS 10.3 - XML MANAGEMENT PROTOCOL GUIDE 6-30-2010:
Table of Contents

Advertisement

Junos 10.3 Junos XML Management Protocol Guide
212
of requests. Keep in mind, however, that your application can effectively send only one
request to one Junos XML protocol server at a time. This is because the
object does not return control to the application until it receives the closing </rpc-reply>
tag that represents the end of the Junos XML protocol server's response to the current
request.
Obtain and Record Parameters Required by the JUNOS::Device Object
The
object takes the following required parameters, specified as keys in
JUNOS::Device
a Perl hash:
The access protocol to use when communicating with the Junos XML protocol server
(key name:
access
). For a list of the acceptable values, see "Supported Access
Protocols" on page 27. Before the application runs, satisfy the protocol-specific
prerequisites described in "Prerequisites for Establishing a Connection" on page 27.
The name of the device to which to connect (key name: hostname). For best results,
specify either a fully qualified hostname or an IP address.
The username under which to establish the connection to the Junos XML protocol
server and issue requests (key name:
specified device and have the permission bits necessary for making the requests invoked
by the application.
The password for the username (key name:
The sample scripts record the parameters in a Perl hash called
as follows:
my %deviceinfo = (
'access' => $access,
'login' => $login,
'password' => $password,
'hostname' => $hostname,
);
The sample scripts obtain the parameters from options entered on the command line
by a user. Your application can also obtain values for the parameters from a file or
database, or you can hardcode one or more of the parameters into the application code
if they are constant.
Example: Collecting Parameters Interactively
Each sample script obtains the parameters required by the
command-line options provided by the user who invokes the script. The script records
the options in a Perl hash called
Perl module to read the options from the command line. (Scripts used in production
environments probably do not obtain parameters interactively, so this section is important
mostly for understanding the sample scripts.)
In the following example from the
the
function defines the acceptable options, which vary depending on the
getopts
application. A colon after the option letter indicates that it takes an argument.
login
). The username must already exist on the
).
password
, using the
function defined in the
%opt
getopts
get_chassis_inventory.pl
Copyright © 2010, Juniper Networks, Inc.
JUNOS::Device
%deviceinfo
, declared
object from
JUNOS::Device
Getopt::Std
script, the first parameter to

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junos os

Table of Contents