- play_arrow Overview
- play_arrow Junos XML Management Protocol and Junos XML API Overview
- play_arrow Junos XML Protocol and Junos XML Tags Overview
- XML and Junos OS Overview
- XML Overview
- XML and Junos XML Management Protocol Conventions Overview
- Map Junos OS Commands and Command Output to Junos XML Tag Elements
- Map Configuration Statements to Junos XML Tag Elements
- Using Configuration Response Tag Elements in Junos XML Protocol Requests and Configuration Changes
- play_arrow Junos XML Protocol and JSON Overview
-
- play_arrow Manage Junos XML Protocol Sessions
- play_arrow Junos XML Protocol Session Overview
- play_arrow Manage Junos XML Protocol Sessions
- Satisfy the Prerequisites for Establishing a Connection to the Junos XML Protocol Server
- Configure clear-text or SSL Service for Junos XML Protocol Client Applications
- Connect to the Junos XML Protocol Server
- Start a Junos XML Protocol Session
- Authenticate with the Junos XML Protocol Server for Cleartext or SSL Connections
- Send Requests to the Junos XML Protocol Server
- Parse the Junos XML Protocol Server Response
- Parse Response Tag Elements Using a Standard API in NETCONF and Junos XML Protocol Sessions
- How Character Encoding Works on Juniper Networks Devices
- Handle an Error or Warning in Junos XML Protocol Sessions
- Halt a Request in Junos XML Protocol Sessions
- Lock, Unlock, or Create a Private Copy of the Candidate Configuration Using the Junos XML Protocol
- Terminate a Junos XML Protocol Session
- End a Junos XML Protocol Session and Close the Connection
- Sample Junos XML Protocol Session
- play_arrow Junos XML Protocol Tracing Operations
- play_arrow Junos XML Protocol Operations
- play_arrow Junos XML Protocol Processing Instructions
- play_arrow Junos XML Protocol Response Tags
- play_arrow Junos XML Element Attributes
- active
- count
- delete
- inactive
- insert
- junos:changed
- junos:changed-localtime
- junos:changed-seconds
- junos:commit-localtime
- junos:commit-seconds
- junos:commit-user
- junos:group
- junos:interface-range
- junos:key
- junos:position
- junos:total
- matching
- protect
- recurse
- rename
- replace
- replace-pattern
- start
- unprotect
- xmlns
-
- play_arrow Manage Configurations Using the Junos XML Protocol
- play_arrow Change the Configuration Using the Junos XML Protocol
- Request Configuration Changes Using the Junos XML Protocol
- Upload and Format Configuration Data in a Junos XML Protocol Session
- Upload Configuration Data as a File Using the Junos XML Protocol
- Upload Configuration Data as a Data Stream Using the Junos XML Protocol
- Define the Format of Configuration Data to Upload in a Junos XML Protocol Session
- Specify the Scope of Configuration Data to Upload in a Junos XML Protocol Session
- Replace the Configuration Using the Junos XML Protocol
- Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol
- Create New Elements in Configuration Data Using the Junos XML Protocol
- Merge Elements in Configuration Data Using the Junos XML Protocol
- Replace Elements in Configuration Data Using the Junos XML Protocol
- Replace Only Updated Elements in Configuration Data Using the Junos XML Protocol
- Delete Elements in Configuration Data Using the Junos XML Protocol
- Rename Objects In Configuration Data Using the Junos XML Protocol
- Reorder Elements In Configuration Data Using the Junos XML Protocol
- Protect or Unprotect a Configuration Object Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Using the Junos XML Protocol
- Change a Configuration Element’s Activation State Simultaneously with Other Changes Using the Junos XML Protocol
- Replace Patterns in Configuration Data Using the NETCONF or Junos XML Protocol
- play_arrow Commit the Configuration on a Device Using the Junos XML Protocol
- Verify Configuration Syntax Using the Junos XML Protocol
- Commit the Candidate Configuration Using the Junos XML Protocol
- Commit a Private Copy of the Configuration Using the Junos XML Protocol
- Commit a Configuration at a Specified Time Using the Junos XML Protocol
- Commit the Candidate Configuration Only After Confirmation Using the Junos XML Protocol
- Commit and Synchronize a Configuration on Redundant Control Planes Using the Junos XML Protocol
- Log a Message About a Commit Operation Using the Junos XML Protocol
- View the Configuration Revision Identifier for Determining Synchronization Status of Devices with NMS
- play_arrow Ephemeral Configuration Database
- Understanding the Ephemeral Configuration Database
- Unsupported Configuration Statements in the Ephemeral Configuration Database
- Enable and Configure Instances of the Ephemeral Configuration Database
- Commit and Synchronize Ephemeral Configuration Data Using the NETCONF or Junos XML Protocol
- Managing Ephemeral Configuration Database Space
-
- play_arrow Junos XML Protocol Utilities
- play_arrow Develop Junos XML Protocol C Client Applications
-
- play_arrow Configuration Statements and Operational Commands
Compare the Active or Candidate Configuration to a Prior Version Using the Junos XML Protocol
In the Junos OS CLI, you use the compare
command to compare the active or candidate configuration to a previously
committed configuration and display the differences. You can specify
the comparison configuration by referencing its configuration revision
identifier or its rollback number.
For example, in operational mode, you can compare the active configuration to a previously committed configuration by using the following commands:
show configuration | compare revision revision-id
show configuration | compare rollback rollback-number
Similarly in configuration mode, you can compare the candidate configuration to a previously committed configuration by using the following commands:
show | compare revision revision-id
show | compare rollback rollback-number
In a Junos XML protocol session with a device running Junos
OS, to request that the server display the differences between the
active or candidate configuration and a previously committed configuration
(the comparison configuration), a client application uses the <get-configuration>
operation with the compare
attribute. The compare
attribute accepts the following values, which indicate the method
used to reference the comparison configuration:
configuration-revision
—Reference the comparison configuration by its configuration revision identifier string, which you define in theconfiguration-revision="revision-id"
attribute.rollback
—Reference the comparison configuration by its rollback index, which you define in therollback="rollback-number"
attribute.
The compare
attribute can be combined
with the database
attribute to indicate
whether the candidate configuration or the active configuration is
compared to the previously committed configuration. To compare the
active configuration, specify database="committed"
. To compare the candidate configuration, specify database="candidate"
or omit the database
attribute.
You define the comparison configuration by defining the configuration-revision
or rollback
attribute and specifying the appropriate configuration revision
identifier or rollback index. If you include the compare
attribute but either omit the corresponding configuration-revision
or rollback
attribute or provide an invalid
configuration revision identifier, the server uses the active configuration
as the comparison configuration. The active configuration corresponds
to rollback number 0.
For example, to compare the candidate configuration to the configuration that has the given configuration revision identifier, use the following syntax:
<rpc> <get-configuration compare="configuration-revision" configuration-revision="revision-id" format="text"> <!-- optional - configuration elements to compare --> </get-configuration> </rpc>
Similarly, to compare the candidate configuration to the configuration that has the given rollback index, use the following syntax:
<rpc> <get-configuration compare="rollback" rollback="[0-49]" format="text"> <!-- optional - configuration elements to compare --> </get-configuration> </rpc>
To compare the active configuration to a previous configuration,
include the database="committed"
attribute.
For example:
<rpc> <get-configuration database="committed" compare="configuration-revision" configuration-revision="re0-1605138555-328"/> </rpc>
You can also specify the scope of the comparison. You can compare the full configuration or you can compare a subset of the configuration. To compare a subset of the configuration, define a subtree filter that selects the elements to compare, as shown in the following example:
<rpc> <get-configuration compare="configuration-revision" configuration-revision="re0-1605288042-335"> <configuration> <system> <scripts/> </system> </configuration> </get-configuration> </rpc>
When you compare the candidate configuration to the active configuration,
the compare
operation returns XML output.
For all other comparisons, it returns the output as text using a patch
format. The text output is enclosed in the <configuration-information>
and <configuration-output>
tags. The
output uses the following conventions to specify the differences between
configurations:
Statements that are only in the active or candidate configuration are prefixed with a plus sign (+).
Statements that are only in the comparison file are prefixed with a minus sign (–).
Statements that are unchanged are prefixed with a single blank space ( ).
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.4R1/junos"> <configuration-information> <configuration-output> [edit system scripts op] - file bgp-summary.py; + file bgp-neighbors.py; </configuration-output> </configuration-information> </rpc-reply>
When you compare the candidate configuration to the
active configuration, you can display the differences in text, XML,
or JSON format by including the appropriate value for the format
attribute in the request. You can display the
differences in XML format starting in Junos OS Release 15.1R1, and
you can display the differences in JSON format starting in Junos
OS Release 16.1R1.
<rpc> <get-configuration compare="rollback" rollback="0" format="xml"/> </rpc> <rpc-reply xmlns:junos="http://xml.juniper.net/junos/16.1R1/junos"> <configuration> <system> <scripts operation="create"> <op> <file> <name>bgp.slax</name> </file> </op> </scripts> </system> </configuration> </rpc-reply>
<rpc> <get-configuration compare="rollback" rollback="0" format="json"/> </rpc> <rpc-reply xmlns:junos="http://xml.juniper.net/junos/16.1R1/junos"> <configuration-information> <json-output> { "configuration" : { "system" : { "scripts" : { "@" : { "operation" : "create" }, "op" : { "file" : [ { "name" : "bgp.slax" } ] } } } } } </json-output> </configuration-information> </rpc-reply>
Starting in Junos OS Release 16.2R2, when you compare the candidate
and active configurations and display the differences in XML or JSON
format, the device omits the <configuration>
tag in the XML output and omits the configuration
object in the JSON output if the comparison either returns no differences
or if the comparison returns differences for only non-native configuration
data, for example, configuration data associated with an OpenConfig
data model.