Establishing The Connection; Submitting A Request To The Junos Xml Protocol Server - 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

Submitting a Request to the Junos XML Protocol Server

Copyright © 2010, Juniper Networks, Inc.
my $input_string = "";
open(FH, $input_file) or return undef;
In the next subsection, the subroutine temporarily discards the lines that contain the
opening
<get-configuration>
disallowed characters on each remaining line with predefined entity references and
appends the line to the
$input_string
while(<FH>) {
my $line = $_;
$line =~ s/<configuration-text>//g;
$line =~ s/<\/configuration-text>//g;
$line =~ s/($char_class)/$escape_symbols{$1}/ge;
$input_string .= $line;
}
The subroutine concludes by replacing the opening
tags, and returning the converted set of statements:
</get-configuration>
return "<configuration-text>$input_string</configuration-text>";
}

Establishing the Connection

After obtaining values for the parameters required for the
"Obtain and Record Parameters Required by the JUNOS::Device Object" on page 212),
each sample script records them in the
my %deviceinfo = (
access => $access,
login => $login,
password => $password,
hostname => $hostname,
);
The script then invokes the Junos XML protocol-specific
JUNOS::Device
object and establish a connection to the specified routing, switching, or
security platform. If the connection attempt fails (as tested by the
script exits.
my $jnx = new JUNOS::Device(%deviceinfo);
unless ( ref $jnx ) {
die "ERROR: $deviceinfo{hostname}: failed to connect.\n";
After establishing a connection to a Junos XML protocol server (see "Establishing the
Connection" on page 217), your application can submit one or more requests by invoking
the Perl methods that are supported in the version of the Junos XML protocol and Junos
XML API used by the application:
Each version of software supports a set of methods that correspond to CLI operational
mode commands (later releases generally support more methods). For a list of the
operational methods supported in the current version, see "Mapping CLI Commands
to Perl Methods" on page 232 and the files stored in the
the Junos XML protocol Perl distribution (
Chapter 9: Writing Junos XML Protocol Perl Client Applications
and closing
</get-configuration>
variable:
<get-configuration>
hash:
%deviceinfo
is the Junos OS version code, such as
release
tags, then replaces the
and closing
object (see
JUNOS::Device
subroutine to create a
new
ref
operator), the
directory of
lib/JUNOS/release
217

Advertisement

Table of Contents
loading

This manual is also suitable for:

Junos os

Table of Contents