Understanding the Request Procedure in a NETCONF Session
You can use the NETCONF XML management protocol and Junos XML API to request information about
the status and the current configuration of devices running Junos OS or device running
Junos OS Evolved. The tags for operational requests are defined in the Junos XML API and
correspond to Junos OS command-line interface (CLI) operational commands. There is a
request tag element for many commands in the CLI show
family of
commands.
The tag element for configuration requests is the NETCONF <get-config>
tag element. It corresponds to the
CLI configuration mode show
command. The Junos XML tag
elements that make up the content of both the client application’s
requests and the NETCONF server’s responses correspond to CLI
configuration statements, which are described in the Junos OS configuration
guides.
In addition to information about the current configuration, client applications can request other configuration-related information, including information about previously committed (rollback) configurations, information about the rescue configuration, or an XML schema representation of the configuration hierarchy.
To request information from the NETCONF server, a client application performs the procedures described in the indicated sections:
Establishes a connection to the NETCONF server on the routing, switching, or security platform.
Opens a NETCONF session.
Optionally locks the candidate configuration or opens an instance of the ephemeral configuration database.
Locking the configuration prevents other users or applications from changing it at the same time. For more information, see Lock and Unlock the Candidate Configuration.
For information about the ephemeral configuration database, see Understanding the Ephemeral Configuration Database and Enable and Configure Instances of the Ephemeral Configuration Database.
Makes any number of requests one at a time, freely intermingling operational and configuration requests. See Request Operational Information Using NETCONF and Request Configuration Data Using NETCONF. The application can also intermix requests with configuration changes.
Accepts the tag stream emitted by the NETCONF server in response to each request and extracts its content, as described in Parse the NETCONF Server Response.
Unlocks the candidate configuration, if it is locked, or closes an open instance of the ephemeral configuration database.
Other users and applications cannot change the candidate configuration while it remains locked. For more information, see Lock and Unlock the Candidate Configuration
Ends the NETCONF session and closes the connection to the device, as described in End a NETCONF Session and Close the Connection.