Compare Two Previous (Rollback) Configurations Using NETCONF
In a NETCONF session with a device running Junos OS, to compare the contents of two
previously committed (rollback) configurations, a client application emits the Junos
XML <get-rollback-information>
tag element and its child
<rollback>
and <compare>
tag
elements in an <rpc>
tag element. This operation is
equivalent to the show system rollback
operational mode command
with the compare
option.
The
<rollback>
tag element specifies the index number of the
configuration that is the basis for comparison. The <compare>
tag element specifies the index number 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:
<rpc> <get-rollback-information> <rollback>index-number</rollback> <compare>index-number</compare> </get-rollback-information> </rpc> ]]>]]>
The output corresponds more logically to the chronological order of changes if
the older configuration (the one with the higher index number) is the base
configuration. Its index number is enclosed in the
<rollback>
tag element and the index of the more
recent configuration is enclosed in the <compare>
tag element.
The NETCONF server encloses its response in
<rpc-reply>
, <rollback-information>
,
<configuration-information>
, and
<configuration-output>
tag elements. The
<ok/>
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 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.
<rpc-reply xmlns="URN" xmlns:junos="URL"> <rollback-information> <ok/> <configuration-information> <configuration-output> /* formatted ASCII representing the changes */ </configuration-output> </configuration-information> </rollback-information> </rpc-reply> ]]>]]>
The following example shows how to request a comparison of the rollback configurations that have indexes of 20 and 4.