Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Compare Two Previous (Rollback) Configurations Using the Junos XML Protocol

In a Junos XML protocol session with a device running Junos OS, a client application can compare the contents of two previously committed (rollback) configurations by using either of the following RPCs with the <compare> element:

  • <get-configuration-by-revision>—Compare configurations by referencing a configuration revision identifier.

  • <get-rollback-information>—Compare configurations by referencing a rollback index.

The <get-configuration-by-revision> RPC with the <compare> element is equivalent to the show system configuration revision operational mode command with the compare option. The <compare> element specifies the configuration revision identifier of the configuration that is the basis for comparison. The <revision-string> element defines the configuration revision identifier of the configuration to compare with the base configuration. The syntax is:

For example, the following RPC compares two configurations by referencing their configuration revision identifier strings:

Similarly, the <get-rollback-information> RPC with the <compare> element is equivalent to the show system rollback operational mode command with the compare option. The <compare> element specifies the rollback index of the configuration that is the basis for comparison. The <rollback> element specifies the rollback index of the configuration to compare with the base configuration. Valid values in both tag elements range from 0 (zero, for the most recently committed configuration) through 49. The syntax is:

Note:

The output corresponds more logically to the chronological order of changes if the older configuration is the base configuration. Its index is enclosed in the <compare> element, and the index of the more recent configuration is enclosed in the <rollback> or <revision-string> tag element.

The Junos XML protocol server encloses its response in an <rpc-reply> element, a <rollback-information> or <configuration-revision-information> element, depending on the RPC, and <configuration-information> and <configuration-output> elements. The <load-success/> tag is a side effect of the implementation and does not affect the results.

The information in the <configuration-output> tag element is formatted ASCII text and includes a banner line (such as [edit interfaces]) for each hierarchy level at which the two configurations differ. Each line between banner lines begins with either a plus sign (+) or a minus sign (–). The plus sign indicates that adding the statement to the base configuration results in the second configuration, whereas a minus sign means that removing the statement from the base configuration results in the second configuration.

The following example shows how to request a comparison of the rollback configurations that have indexes of 20 and 4.