Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session

In a Junos XML protocol session with a device running Junos OS, a client application uses the <get-configuration> tag element to request configuration data from the device. A client application can request information from the candidate configuration, the active configuration (that is, the one most recently committed on the device), or from an open instance of the ephemeral configuration database.

The client application can instruct the device to return configuration information from either the candidate configuration or the active configuration by setting the database attribute to the appropriate value. To request information from the candidate configuration, a client application includes the <get-configuration> tag element and either includes the database="candidate" attribute or omits the attribute completely. The Junos XML protocol server returns Junos XML-tagged output by default, except when the compare attribute is included.

To request information from the active configuration, a client application includes the <get-configuration> tag element with the database="committed" attribute enclosed within the <rpc> element.

For information about the tag elements to enclose in the <get-configuration> tag element, see Specifying the Scope of Configuration Data to Return in a Junos XML Protocol Session.

Note:

Starting in Junos OS Release 13.1, when a logical system user requests the entire logical system configuration using the <get-configuration> operation, the RPC reply includes the <configuration> root tag. Prior to Junos OS Release 13.1, the <configuration> root tag was omitted.

To request information from a specific instance of the ephemeral configuration database, a client application first opens the ephemeral instance using the <open-configuration> operation with the appropriate child tags.

While the ephemeral instance is open, the client application requests information from that instance by using the <get-configuration> operation. After all operations on the ephemeral instance are complete, the client application closes the instance with the <close-configuration/> operation.

The Junos XML protocol server encloses its reply in the <rpc-reply> tag element. Within the <rpc-reply> element, the configuration data for the requested configuration is enclosed within the <configuration> element for Junos XML-tagged output, the <configuration-text> element for formatted ASCII output, the <configuration-set> element for configuration mode set commands, or the <configuration-json> element for configuration data represented using JavaScript Object Notation (JSON).

When returning information from the candidate configuration or from an instance of the ephemeral configuration database, the output includes information about when the configuration was last changed. When displaying the configuration as Junos XML tag elements, the Junos XML protocol server includes this information as attributes in the opening <configuration> tag (they appear on multiple lines here only for legibility).

junos:changed-localtime represents the time of the last change as the date and time in the device’s local time zone.

junos:changed-seconds represents the time of the last change as the number of seconds since midnight on 1 January 1970.

When returning information from the active configuration, the output includes information about when the configuration was last committed. When displaying the configuration as Junos XML tag elements, the Junos XML protocol server includes this information as attributes in the opening <configuration> tag (they appear on multiple lines here only for legibility).

junos:commit-localtime represents the commit time as the date and time in the device’s local time zone.

junos:commit-seconds represents the commit time as the number of seconds since midnight on 1 January 1970.

junos:commit-user specifies the Junos OS username of the user who requested the commit operation.

The database attribute in the application’s request can be combined with one or more of the following attributes in the <get-configuration/> tag or opening <get-configuration> tag:

The application can also include the database attribute after requesting an indicator for identifiers (as described in Requesting Identifier Indicators for Configuration Elements Using the Junos XML Protocol).

The following example shows how to request the entire committed configuration. In actual output, the Junos-version variable is replaced by a value such as 20.4R1 for the initial version of Junos OS Release 20.4.

Release History Table
Release
Description
13.1
Starting in Junos OS Release 13.1, when a logical system user requests the entire logical system configuration using the <get-configuration> operation, the RPC reply includes the <configuration> root tag.