Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Send Requests to the Junos XML Protocol Server

In a Junos XML protocol session with a device running Junos OS, a client application initiates a request by emitting the opening <rpc> tag, one or more tag elements that represent the particular request, and the closing </rpc> tag, in that order.

The application encloses each request in its own separate pair of opening <rpc> and closing </rpc> tags. Each request must constitute a well-formed XML document by including only compliant and correctly ordered tag elements. The Junos XML protocol server ignores any newline characters, spaces, or other white space characters that occur between tag elements in the tag stream, but it preserves white space within tag elements.

Optionally, a client application can include one or more attributes of the form attribute-name="value" in the opening <rpc> tag for each request. The Junos XML protocol server echoes each attribute, unchanged, in the opening <rpc-reply> tag in which it encloses its response.

A client application can use this feature to associate requests and responses by including an attribute in each opening <rpc> request tag that assigns a unique identifier. The Junos XML protocol server echoes the attribute in its opening <rpc-reply> tag, making it easy to map the response to the initiating request. The client application can freely define attribute names, except as described in the following note.

Note:

The xmlns:junos attribute name is reserved. The Junos XML protocol server sets the attribute to an appropriate value on the opening <rpc-reply> tag, so client applications must not emit it in the opening <rpc> tag.

Although operational and configuration requests conceptually belong to separate classes, a Junos XML protocol session does not have distinct modes that correspond to CLI operational and configuration modes. Each request tag is enclosed within its own <rpc> tag, so a client application can freely alternate operational and configuration requests. A client application can make three classes of requests:

Operational Requests

Operational requests are requests for information about the status of a device running Junos OS. Operational requests correspond to the Junos OS CLI operational mode commands. The Junos XML API defines a request tag for many CLI commands. For example, the <get-interface-information> tag corresponds to the show interfaces command, and the <get-chassis-inventory> tag requests the same information as the show chassis hardware command.

The following RPC requests detailed information about interface ge-2/3/0:

For more information about operational requests, see Requesting Operational Information Using the Junos XML Protocol. For information about the Junos XML request tag elements available in the current Junos OS Release, see the Junos XML API Operational Developer Reference and the XML API Explorer.

Configuration Information Requests

Configuration information requests are requests for information about the device’s candidate configuration, a private configuration, the ephemeral configuration, or the committed configuration (the one currently in active use on the routing, switching, or security platform). The candidate and committed configurations diverge when there are uncommitted changes to the candidate configuration.

The Junos XML protocol defines the <get-configuration> operation for retrieving configuration information. The Junos XML API defines a tag element for every container and leaf statement in the configuration hierarchy.

The following example shows how to request information about the [edit system login] hierarchy level in the candidate configuration:

For more information about configuration information requests, see Requesting Configuration Data Using the Junos XML Protocol. For a summary of Junos XML configuration tag elements, see the Junos XML API Configuration Developer Reference and the XML API Explorer.

Configuration Change Requests

Configuration change requests are requests to change the configuration, or to commit those changes to put them into active use on the device running Junos OS. The Junos XML protocol defines the <load-configuration> operation for changing configuration information. The Junos XML API defines a tag element for every CLI configuration statement described in the Junos OS configuration guides.

The following example shows how to create a new Junos OS user account called admin at the [edit system login] hierarchy level in the candidate configuration:

For more information about configuration change requests, see Requesting Configuration Changes Using the Junos XML Protocol and Committing the Candidate Configuration Using the Junos XML Protocol. For a summary of Junos XML configuration tag elements, see the Junos XML API Configuration Developer Reference and the XML API Explorer.