- play_arrow Overview
- play_arrow NETCONF XML Management Protocol Overview
- play_arrow NETCONF and Junos XML Tags Overview
- XML and Junos OS Overview
- XML Overview
- XML and NETCONF XML Management Protocol Conventions Overview
- Map Junos OS Commands and Command Output to Junos XML Tag Elements
- Map Configuration Statements to Junos XML Tag Elements
- Using NETCONF Configuration Response Tag Elements in NETCONF Requests and Configuration Changes
-
- play_arrow Manage NETCONF Sessions
- play_arrow NETCONF Session Overview
- play_arrow Manage NETCONF Sessions
- Establish an SSH Connection for a NETCONF Session
- NETCONF Sessions over Transport Layer Security (TLS)
- NETCONF and Shell Sessions over Enhanced Outbound HTTPS
- NETCONF Sessions over Outbound HTTPS
- NETCONF Call Home Sessions
- NETCONF Sessions
- Sample NETCONF Session
- How Character Encoding Works on Juniper Networks Devices
- Configure RFC-Compliant NETCONF Sessions
- NETCONF Monitoring
- NETCONF Event Notifications
- play_arrow NETCONF Tracing Operations
- play_arrow NETCONF Protocol Operations and Attributes
- play_arrow NETCONF Request and Response Tags
- play_arrow Junos XML Protocol Elements Supported in NETCONF Sessions
- <abort/>
- <abort-acknowledgement/>
- <checksum-information>
- <close-configuration/>
- <commit-configuration>
- <commit-results>
- <commit-revision-information>
- <database-status>
- <database-status-information>
- <end-session/>
- <get-checksum-information>
- <get-configuration>
- <load-configuration>
- <load-configuration-results>
- <lock-configuration/>
- <open-configuration>
- <reason>
- <request-end-session/>
- <routing-engine>
- <unlock-configuration/>
- <xnm:error>
- <xnm:warning>
- play_arrow Junos XML Protocol Element Attributes Supported in NETCONF Sessions
-
- play_arrow Manage Configurations Using NETCONF
- play_arrow Change the Configuration Using NETCONF
- Edit the Configuration Using NETCONF
- Upload and Format Configuration Data in a NETCONF Session
- Set the Edit Configuration Mode in a NETCONF Session
- Handle Errors While Editing the Candidate Configuration in a NETCONF Session
- Replace the Candidate Configuration Using NETCONF
- Roll Back Uncommitted Changes in the Candidate Configuration Using NETCONF
- Delete the Configuration Using NETCONF
- Change Individual Configuration Elements Using NETCONF
- Merge Configuration Elements Using NETCONF
- Create Configuration Elements Using NETCONF
- Delete Configuration Elements Using NETCONF
- Replace Configuration Elements Using NETCONF
- Replace Patterns in Configuration Data Using the NETCONF or Junos XML Protocol
- play_arrow Commit the Configuration Using NETCONF
- play_arrow Ephemeral Configuration Database
- Understanding the Ephemeral Configuration Database
- Unsupported Configuration Statements in the Ephemeral Configuration Database
- Enable and Configure Instances of the Ephemeral Configuration Database
- Commit and Synchronize Ephemeral Configuration Data Using the NETCONF or Junos XML Protocol
- Managing Ephemeral Configuration Database Space
- Example: Configure the Ephemeral Configuration Database Using NETCONF
-
- play_arrow Request Operational and Configuration Information Using NETCONF
- play_arrow Request Operational Information Using NETCONF
- play_arrow Request Configuration Information Using NETCONF
- Request the Committed Configuration and Device State Using NETCONF
- Request Configuration Data Using NETCONF
- Specify the Source for Configuration Information Requests Using NETCONF
- Specify the Scope of Configuration Information to Return in a NETCONF Response
- Request the Complete Configuration Using NETCONF
- Request a Configuration Hierarchy Level or Container Object Without an Identifier Using NETCONF
- Request All Configuration Objects of a Specified Type Using NETCONF
- Request Identifiers for Configuration Objects of a Specified Type Using NETCONF
- Request A Specific Configuration Object Using NETCONF
- Request Specific Child Tags for a Configuration Object Using NETCONF
- Request Multiple Configuration Elements Simultaneously Using NETCONF
- Retrieve a Previous (Rollback) Configuration Using NETCONF
- Compare Two Previous (Rollback) Configurations Using NETCONF
- Retrieve the Rescue Configuration Using NETCONF
- Request an XML Schema for the Configuration Hierarchy Using NETCONF
-
- play_arrow YANG
- play_arrow YANG Overview
- Understanding YANG on Devices Running Junos OS
- Understanding Junos YANG Modules
- YANG Modules Overview
- Understanding the YANG Modules That Define the Junos OS Configuration
- Understanding the YANG Modules for Junos Operational Commands
- Junos Genstate YANG Data Models
- Understanding the Junos DDL Extensions YANG Module
- YANG Metadata Annotations for Junos Devices
- Use Juniper Networks YANG Modules
- play_arrow Create and Use Non-Native YANG Modules
- Understanding the Management of Nonnative YANG Modules on Devices Running Junos OS
- Manage YANG Packages, Modules, and Scripts on Junos Devices
- Managing YANG Packages and Configurations During a Software Upgrade or Downgrade
- Create Translation Scripts for YANG Configuration Models
- Disable and Enable YANG Translation Scripts on Devices Running Junos OS
- Commit and Display Configuration Data for Nonnative YANG Modules
- Create Custom RPCs in YANG for Devices Running Junos OS
- Create Action Scripts for YANG RPCs on Junos Devices
- Use Custom YANG RPCs on Devices Running Junos OS
- Example: Use a Custom YANG RPC to Retrieve Operational Information on Junos Devices
- Understanding Junos OS YANG Extensions for Formatting RPC Output
- Customize YANG RPC Output on Devices Running Junos OS
- Define Different Levels of Output in Custom YANG RPCs for Junos Devices
- Display Valid Command Option and Configuration Statement Values in the CLI for Custom YANG Modules
- Configure a NETCONF Proxy Telemetry Sensor in Junos
-
- play_arrow OpenDaylight Integration
- play_arrow Configure OpenDaylight Integration
-
- play_arrow Configuration Statements and Operational Commands
Connect to the NETCONF Server in Perl Client Applications
The following sections explain how to use the NET::Netconf::Manager
object in a Perl client application
to connect to the NETCONF server on a device running Junos OS:
Satisfy Protocol Prerequisites
The NETCONF server supports several access protocols. For each connection to the NETCONF server on a device running Junos OS, the application must specify the protocol it is using. Perl client applications can communicate with the NETCONF server via SSH only.
Before your application can run, you must satisfy the prerequisites
for SSH. This involves enabling NETCONF on the device by configuring
the set system services netconf ssh
statement.
Group Requests
Establishing a connection to the NETCONF server on a device
running Junos OS is one of the more time-intensive and resource-intensive
functions performed by an application. If the application sends multiple
requests to a device, it makes sense to send all of them within the
context of one connection. If your application sends the same requests
to multiple devices, you can structure the script to iterate through
either the set of devices or the set of requests. Keep in mind, however,
that your application can effectively send only one request to one
NETCONF server at a time. This is because the NET::Netconf::Manager
object does not return control to the application until it receives
the closing </rpc-reply>
tag that represents
the end of the NETCONF server's response to the current request.
Obtain and Record Parameters Required by the NET::Netconf::Manager Object
The NET::Netconf::Manager
object
takes the following required parameters, specified as keys in a Perl
hash:
access
—The access protocol to use when communicating with the NETCONF server. Before the application runs, satisfy the SSH prerequisites.hostname
—The name of the device to which to connect. For best results, specify either a fully-qualified hostname or an IP address.login
—The username under which to establish the connection to the NETCONF server and issue requests. The username must already exist on the specified device and have the permission bits necessary for making the requests invoked by the application.password
—The password corresponding to the username.
The sample scripts in the NETCONF Perl distribution record
the parameters in a Perl hash called %deviceinfo
, declared as follows:
my %deviceinfo = ( 'access' => $access, 'login' => $login, 'password' => $password, 'hostname' => $hostname, );
The sample scripts included in the NETCONF Perl client distribution obtain the parameters from options entered on the command line by a user. For more information about collecting parameter values interactively, see Collect Parameters Interactively in NETCONF Perl Client Applications. 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.
Obtaining Application-Specific Parameters
In addition to the parameters required by the NET::Netconf::Manager
object, applications might need to define other parameters, such
as the name of the file to which to write the data returned by the
NETCONF server in response to a request.
As with the parameters required by the NET::Netconf::Manager
object, the client application can hardcode the values in the application
code, obtain them from a file, or obtain them interactively. The sample
scripts obtain values for these parameters from command-line options
in the same manner as they obtain the parameters required by the NET::Netconf::Manager
object. Several examples follow.
The following line enables a debugging trace if the user
includes the -d
command-line option:
my $debug_level = $opt{'d'};
The following line sets the $outputfile
variable to the value specified by the -o
command-line
option. It names the local file to which the NETCONF server's response
is written. If the -o
option is not provided, the variable
is set to the empty string.
my $outputfile = $opt{'o'} || "";
Establishing the Connection
After obtaining values for the parameters required for
the NET::Netconf::Manager
object, each
sample script records them in the %deviceinfo
hash.
my %deviceinfo = ( 'access' => $access, 'login' => $login, 'password' => $password, 'hostname' => $hostname, );
The script then invokes the NETCONF-specific new
subroutine to create a NET::Netconf::Manager
object and establish a connection to the specified routing, switching,
or security platform. If the connection attempt fails (as tested by
the ref
operator), the script exits.
my $jnx = new Net::Netconf::Manager(%deviceinfo); unless (ref $jnx) { croak "ERROR: $deviceinfo{hostname}: failed to connect.\n"; }