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 a routing, switching, or security platform running Junos OS. 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
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, as described in Connecting to the NETCONF Server.
Opens a NETCONF session, as described in Starting the 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 Locking and Unlocking the Candidate Configuration Using NETCONF.
For information about the ephemeral configuration database, see Understanding the Ephemeral Configuration Database and Enabling and Configuring Instances of the Ephemeral Configuration Database.
Makes any number of requests one at a time, freely intermingling operational and configuration requests. See Requesting Operational Information Using NETCONF and Requesting 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 Parsing 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 Locking and Unlocking the Candidate Configuration Using NETCONF
Ends the NETCONF session and closes the connection to the device, as described in Ending a NETCONF Session and Closing the Connection.