Example of a Junos XML Protocol Session
This section describes the sequence of tag elements in a sample Junos XML protocol session. The client application begins by establishing a connection to a Junos XML protocol server. See the following sections:
- Exchanging Initialization PIs and Tag Elements
- Sending an Operational Request
- Locking the Configuration
- Changing the Configuration
- Committing the Configuration
- Unlocking the Configuration
- Closing the Junos XML Protocol Session
Exchanging Initialization PIs and Tag Elements
After the client application establishes a connection to a Junos XML protocol server, the two exchange initialization PIs and tag elements, as shown in the following example. Note that the Junos XML protocol server’s opening <junoscript> tag appears on multiple lines for legibility only. Neither the Junos XML protocol server nor client applications insert a newline character into the list of attributes. Also, in an actual exchange, the JUNOS-release variable is replaced by a value such as 10.3R1 for the initial version of Junos OS Release 10.3. For a detailed discussion of the <?xml?> PI and opening <junoscript> tag, see Starting the Junos XML Protocol Session.

Sending an Operational Request
The client application now emits the <get-chassis-inventory> tag element to request information about the device’s chassis hardware. The Junos XML protocol server returns the requested information in the <chassis-inventory> tag element.

Locking the Configuration
The client application then prepares to create a new privilege class called network-mgmt at the [edit system login class] hierarchy level. It begins by using the <lock-configuration/> tag to prevent any other users or applications from altering the candidate configuration at the same time. To confirm that the candidate configuration is locked, the Junos XML protocol server returns an <rpc-reply> and an </rpc-reply> tag with nothing between them.

Changing the Configuration
The client application emits the tag elements that add the new network-mgmt privilege class to the candidate configuration. The Junos XML protocol server returns the <load-configuration-results> tag element to enclose a tag element that reports the outcome of the load operation. (Understanding the meaning of these tag elements is not necessary for the purposes of this example, but for information about them, see Changing Configuration Information.)

Committing the Configuration
The client application commits the candidate configuration. The Junos XML protocol server returns the <commit-results> tag element to enclose tag elements that report the outcome of the commit operation (for information about these tag elements, see Committing a Configuration).

Unlocking the Configuration
The client application unlocks (and by implication closes) the candidate configuration. As when it opens the configuration, the Junos XML protocol server confirms successful closure of the configuration only by returning an opening <rpc-reply> and closing </rpc-reply> tag with nothing between them.

Closing the Junos XML Protocol Session
The client application closes the Junos XML protocol session.

Hide Navigation Pane
Show Navigation Pane
Download
SHA1