Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

Requesting Change Indicators for Configuration Elements Using the Junos XML Protocol

 

In a Junos XML protocol session with a device running Junos OS, to request that the server indicate which configuration elements have changed since the last commit, a client application includes the changed="changed" attribute in the <get-configuration/> request tag. It encloses the request in an <rpc> tag 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.

The configuration source determines which elements are marked as changed. When the database="candidate" attribute is included in the <get-configuration/> tag or when the database attribute is omitted, the candidate configuration is compared to the active configuration. Elements added to the candidate configuration after the last commit operation are marked with the junos:changed="changed" attribute. When the database="committed" attribute is included in the <get-configuration/> tag, the active configuration is compared to the first rollback configuration. Elements added to the active configuration by the most recent commit are marked with the junos:changed="changed" attribute.

The Junos XML protocol server indicates which elements have changed by including the junos:changed="changed" attribute in the opening tag of every parent tag element in the path to the changed configuration element. If the changed configuration element is represented by a single (empty) tag, the junos:changed="changed" attribute appears in the tag. If the changed element is represented by a container tag element, the junos:changed="changed" attribute appears in the opening container tag and also in the opening tag for each child tag element enclosed in the container tag element.

The Junos XML protocol server encloses its response in <rpc-reply> and <configuration> tag elements. For information about the standard attributes in the opening <configuration> tag, see Specifying the Source for Configuration Information Requests in a Junos XML Protocol Session.

If the requested output format is JSON, the Junos XML protocol server includes the "junos:changed" : "changed" attribute in the attribute lists for the same elements as described previously and encloses the response in <configuration-json> and <rpc-reply> tag elements.

Note

Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization. The new default uses the "@" symbol instead of the field name "attribute" to indicate an attribute.

Note

When a commit operation succeeds, the Junos XML protocol server removes the junos:changed="changed" attribute from all tag elements. However, if warnings are generated during the commit, the attribute is not removed. In this case, the junos:changed="changed" attribute appears on tag elements that changed before the commit as well as those that changed after the commit.

An example of a commit-time warning is the message explaining that a configuration element will not actually apply until the device is rebooted. The warning appears in the tag string that the Junos XML protocol server returns to confirm the success of the commit, enclosed in an <xnm:warning> tag element.

To remove the junos:changed="changed" attribute from elements that changed before the commit, the client application must take any action necessary to eliminate the cause of the warning, and commit the configuration again.

The changed attribute can be combined with one or more of the following other attributes in the <get-configuration/> tag or opening <get-configuration> tag:

It does not make sense to combine the changed attribute with the format="text" attribute or with the compare attribute, which produces only text output. The junos:changed="changed" attribute appears only in Junos XML-tagged output, which is the default output format, and in JSON output. When the commit-scripts="view" attribute is included in the <get-configuration> tag, the junos:changed="changed" attribute is automatically included in the output, and you do not need to explicitly include this attribute in the <get-configuration> request.

The application can also include the changed 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 change indicators for configuration elements at the [edit system syslog] hierarchy level in the candidate configuration. The output indicates that a log file called interactive-commands has been configured since the last commit.

Release History Table
Release
Description
Starting in Junos OS Release 16.1, devices running Junos OS emit JSON-formatted configuration data using a new default implementation for serialization.