Understanding the Request Procedure in a Junos XML Protocol Session
You can use the Junos 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 for many commands in the CLI show
family of commands.
The tag for configuration requests is the Junos XML protocol <get-configuration>
tag. 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 Junos XML protocol 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 Junos XML protocol server, a client application performs the procedures described in the indicated sections:
Establishes a connection to the Junos XML protocol server on the routing, switching, or security platform, as described in Connecting to the Junos XML Protocol Server.
Starts a Junos XML protocol session, as described in Starting Junos XML Protocol Sessions.
Optionally locks the candidate configuration, creates a private copy of the 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. Creating a private copy of the configuration enables the application to make changes without affecting the candidate configuration until the copy is committed. For more information, see Locking and Unlocking the Candidate Configuration or Creating a Private Copy Using the Junos XML Protocol.
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 the Junos XML Protocol and Requesting Configuration Data Using the Junos XML Protocol.
The application can also intermix requests with configuration changes.
Accepts the tag stream emitted by the Junos XML protocol server in response to each request and extracts its content, as described in Parsing the Junos XML Protocol Server Response.
Unlocks the candidate configuration if it is locked or closes a private copy of the configuration or 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 or Creating a Private Copy Using the Junos XML Protocol.
Ends the Junos XML protocol session and closes the connection to the device, as described in Ending a Junos XML Protocol Session and Closing the Connection.