- 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
Retrieve a Previous (Rollback) Configuration Using the Junos XML Protocol
In a Junos XML protocol session with a device running Junos OS, a client application can request a previously committed (rollback) configuration. The client can retrieve the configuration by referencing the configuration’s rollback index or its configuration revision identifier.
How to Retrieve a Configuration Using the Rollback Number
In a Junos XML protocol session with a device running Junos
OS, to request a previously committed (rollback) configuration, a
client application executes the <get-rollback-information>
RPC with the <rollback>
element. This
operation is equivalent to the show system rollback
operational
mode command. The <rollback>
element
specifies the rollback index of the previous configuration to display;
its value can be from 0 (zero, for the most recently committed configuration)
through one less than the number of stored previous configurations
(maximum is 49).
To request Junos XML-tagged output, which is the default,
the application either includes the <format>
element with the value xml
or omits the <format>
element.
<rpc> <get-rollback-information> <rollback>index-number</rollback> </get-rollback-information> </rpc>
The Junos XML protocol server encloses its response in <rpc-reply>
, <rollback-information>
, and <configuration>
tag elements.
The <load-success/>
tag is a side effect
of the implementation and does not affect the results. For information
about the attributes in the opening <configuration>
tag, see Specifying the Source for Configuration
Information Requests in a Junos XML Protocol Session.
<rpc-reply xmlns:junos="URL"> <rollback-information> <load-success/> <configuration attributes> <!-- tag elements for the complete previous configuration --> </configuration> </rollback-information> </rpc-reply>
To request formatted ASCII output, the application includes
the <format>
element with the value text
.
<rpc> <get-rollback-information> <rollback>index-number</rollback> <format>text</format> </get-rollback-information> </rpc>
The Junos XML protocol server encloses its response in <rpc-reply>
, <rollback-information>
, <configuration-information>
, and <configuration-output>
tag elements. For more information
about the formatted ASCII notation used in Junos OS configuration
statements, see Specifying the Output
Format for Configuration Data in a Junos XML Protocol Session.
<rpc-reply xmlns:junos="URL"> <rollback-information> <load-success/> <configuration-information> <configuration-output> <!-- formatted ASCII text for the complete previous configuration --> </configuration-output> </configuration-information> </rollback-information> </rpc-reply>
Starting in Junos
OS Release 16.1, to request a previously committed (rollback) configuration
in JSON format, the application includes the <format>
element with the value json
in the <get-rollback-information>
element. Prior to Junos OS Release 16.1, JSON-formatted data is requested
by including the format="json"
attribute
in the opening <get-rollback-information>
tag.
<rpc> <get-rollback-information> <rollback>index-number</rollback> <format>json</format> </get-rollback-information> </rpc>
When you use the format="json"
attribute to specify the format, the Junos XML protocol server encloses
its response in an <rpc-reply>
element,
the field name for the top-level JSON member is "rollback-information"
, and the emitted configuration data uses an older implementation
for serialization. When you use the <format>json</format>
element to request JSON-formatted data, the Junos XML protocol server
encloses its response in <rpc-reply>
, <rollback-information>
, <configuration-information>
, and <json-output>
tag elements, the field name for the top-level JSON member is "configuration"
, and the emitted configuration data
uses a newer implementation for serialization.
<rpc-reply xmlns:junos="URL"> <rollback-information> <load-success/> <configuration-information> <json-output> <!-- JSON data for the complete previous configuration --> </json-output> </configuration-information> </rollback-information> </rpc-reply>
The following example shows how to request Junos XML-tagged output for the rollback configuration that has an index of 2. 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.

How to Retrieve a Configuration Using the Configuration Revision Identifier
When you successfully commit a configuration, Junos OS assigns that configuration a unique configuration revision identifier. Whereas the rollback index for a previously committed configuration increments with each commit, the configuration revision identifier remains static for the same configuration.
Starting in Junos OS Release 20.4R1, a Junos XML protocol client
application can use the <get-configuration-by-revision>
RPC to retrieve the configuration corresponding to a given configuration
revision identifier. For example:
<rpc> <get-configuration-by-revision> <revision-string>re0-1605226203-331</revision-string> </get-configuration-by-revision> </rpc>
The server returns the requested configuration enclosed in the <configuration-revision-information>
element.
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.4R1/junos"> <configuration-revision-information> <load-success/> <configuration junos:changed-seconds="1605226201" junos:changed-localtime="2020-11-12 16:10:01 PST"> ... </configuration> </configuration-revision-information> </rpc-reply>
By default, the <get-configuration-by-revision>
RPC returns the configuration in XML format. To return the configuration
as text or JSON, include the <format>
element in the RPC and specify text
or json
.
<rpc> <get-configuration-by-revision> <revision-string>re0-1605226203-331</revision-string> <format>text</format> </get-configuration-by-revision> </rpc>
<rpc> <get-configuration-by-revision> <revision-string>re0-1605226203-331</revision-string> <format>json</format> </get-configuration-by-revision> </rpc>
You can determine the mapping between a configuration revision identifier and the current rollback index for a particular configuration. Remember that the configuration revision identifier for a given committed configuration is static whereas the rollback index increments with each commit.
To determine the rollback number corresponding to a specific
configuration revision identifier, execute the <get-configuration-by-revision>
RPC, specify the revision identifier, and include the empty <rollback-number/>
tag.
<rpc> <get-configuration-by-revision> <revision-string>re0-1605226203-331</revision-string> <rollback-number/> </get-configuration-by-revision> </rpc>
The device returns the rollback index currently associated with that configuration revision identifier.
<rpc-reply> <configuration-revision-information> <rollback-number>2</rollback-number> </configuration-revision-information> </rpc-reply>
Similarly, to determine the configuration revision identifier
currently associated with a specific rollback number, execute the <get-rollback-information>
RPC, specify the rollback
index, and include the empty <configuration-revision/>
tag.
<rpc> <get-rollback-information> <rollback>2</rollback> <configuration-revision/> </get-rollback-information> </rpc>
The device returns the configuration revision identifier currently associated with that rollback index.
<rpc-reply> <rollback-information> <configuration-revision>re0-1605226203-331</configuration-revision> </rollback-information>
A client application can also retrieve the mapping of configuration
revision identifiers to rollback indices by viewing the device’s
commit history. To view the commit history and include the configuration
revision identifiers, a client application executes the <get-commit-information>
RPC with the <include-configuration-revision/>
child element.
The server returns XML output equivalent to the show system commit
include-configuration-revision
operational mode command output.
<rpc> <get-commit-information> <include-configuration-revision/> </get-commit-information> </rpc>
<rpc-reply xmlns:junos="http://xml.juniper.net/junos/20.4R1/junos"> <commit-information> <commit-history> <sequence-number>0</sequence-number> <user>admin</user> <client>netconf</client> <date-time junos:seconds="1605236880">2020-11-12 19:08:00 PST</date-time> <configuration-revision>re0-1605236878-333</configuration-revision> </commit-history> <commit-history> <sequence-number>1</sequence-number> <user>user1</user> <client>netconf</client> <date-time junos:seconds="1605228068">2020-11-12 16:41:08 PST</date-time> <configuration-revision>re0-1605228066-332</configuration-revision> </commit-history> </commit-information> <commit-history> <sequence-number>2</sequence-number> <user>admin</user> <client>cli</client> <date-time junos:seconds="1605226205">2020-11-12 16:10:05 PST</date-time> <configuration-revision>re0-1605226203-331</configuration-revision> </commit-history> ... </rpc-reply>
Change History Table
Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.
<format>
element with the value json
in the <get-rollback-information>
element.