- 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 Request Operational and Configuration Information Using the Junos XML Protocol
- play_arrow Request Operational Information Using the Junos XML Protocol
- play_arrow Request Configuration Information Using the Junos XML Protocol
- Request Configuration Data Using the Junos XML Protocol
- Specify the Source for Configuration Information Requests in a Junos XML Protocol Session
- Specify the Output Format for Configuration Data in a Junos XML Protocol Session
- Request Commit-Script-Style XML Configuration Data Using the Junos XML Protocol
- Specify the Output Format for Configuration Groups and Interface Ranges Using the Junos XML Protocol
- Request Identifier Indicators for Configuration Elements Using the Junos XML Protocol
- Request Change Indicators for Configuration Elements Using the Junos XML Protocol
- Specify the Scope of Configuration Data to Return in a Junos XML Protocol Session
- Request the Complete Configuration Using the Junos XML Protocol
- Request a Configuration Hierarchy Level or Container Object Without an Identifier Using the Junos XML Protocol
- Request All Configuration Objects of a Specific Type Using the Junos XML Protocol
- Request a Specific Number of Configuration Objects Using the Junos XML Protocol
- Request Identifiers for Configuration Objects of a Specific Type Using the Junos XML Protocol
- Request a Single Configuration Object Using the Junos XML Protocol
- Request Subsets of Configuration Objects Using Regular Expressions
- Request Multiple Configuration Elements Using the Junos XML Protocol
- Retrieve a Previous (Rollback) Configuration Using the Junos XML Protocol
- Retrieve the Rescue Configuration Using the Junos XML Protocol
- Compare the Active or Candidate Configuration to a Prior Version Using the Junos XML Protocol
- Compare Two Previous (Rollback) Configurations Using the Junos XML Protocol
- Request an XML Schema for the Configuration Hierarchy Using the Junos XML Protocol
-
- play_arrow Junos XML Protocol Utilities
- play_arrow Develop Junos XML Protocol C Client Applications
-
- play_arrow Configuration Statements and Operational Commands
Reorder Elements In Configuration Data Using the Junos XML Protocol
For most configuration objects, the order in which the object or its children are created is not significant, because the Junos OS configuration management software stores and displays configuration objects in predetermined positions in the configuration hierarchy. However, some configuration objects—such as routing policies and firewall filters—consist of elements that must be processed and analyzed sequentially in order to produce the intended routing behavior. When a client application uses the Junos XML management protocol to add a new element to an ordered set, the element is appended to the existing list of elements. The client application can then reorder the elements, if appropriate.
In a Junos XML protocol session with a device running Junos
OS, to change the order of configuration elements in an ordered set,
a client application first includes the tag elements described in Creating, Modifying, or Deleting Configuration Elements
Using the Junos XML Protocol. If using Junos XML tag elements,
the application emits the container tag element that represents the
ordered set, and encloses the tag element for each identifier of the
configuration element that is moving. In the following examples, the
identifier tag element is called <name>
.
To move an existing element to the first position in
an ordered set, the application includes the insert="first"
attribute in the opening container tag for that element.
<configuration> <!-- opening tag for each parent of the set --> <ordered-set insert="first"> <name>identifier-for-moving-object</name> </ordered-set> <!-- closing tag for each parent of the set --> </configuration>
To move an existing element to a position that is relative to
another element, the application includes the insert="before"
or insert="after"
attribute in the opening
container tag to indicate the new position of the moving element relative
to another reference element in the set. To identify the reference
element, it includes each of the reference element’s identifiers
as an attribute in the opening container tag for the ordered set.
In the following example, the elements in the set have
one identifier, called <name>
:
<configuration> <!-- opening tag for each parent of the set --> <ordered-set insert="(before | after)" name="referent-value"> <name>identifier-for-moving-object</name> </ordered-set> <!-- closing tag for each parent of the set --> </configuration>
In the following example, each element in the set has two identifiers. The opening tag appears on two lines for legibility only:
<configuration> <!-- opening tag for each parent of the set --> <ordered-set insert="(before | after)" identifier1="referent-value" identifier2="referent-value"> <identifier1>value-for-moving-object</identifier1> <identifier2>value-for-moving-object</identifier2> </ordered-set> <!-- closing tag for each parent of the set --> </configuration>
The insert
attribute can be combined
with the inactive
or active
attribute to deactivate or reactivate the configuration element
as it is reordered. For more information, see Changing a Configuration Element’s Activation
State Simultaneously with Other Changes Using the Junos XML Protocol.
When using configuration mode commands to reorder elements,
the application specifies the insert
command that is equivalent
to the CLI configuration mode command.
<configuration-set> insert statement-path-to-object identifier-for-moving-object (before | after) referent-value </configuration-set>
The insert="first"
attribute
has no equivalent CLI configuration mode command.
The reordering operation is not available when formatted ASCII text or JSON is used to represent the configuration data.
The following example shows how to move a firewall filter
called older-filter
, defined at the [edit firewall filter]
hierarchy level, and place it after another filter called newer-filter
using Junos XML tag elements. This operation is
equivalent to the following configuration mode command:
[edit] user@host# insert firewall family inet filter older-filter after filter newer-filter

The following example shows how to move a firewall filter
called older-filter
, defined at the [edit firewall filter]
hierarchy level, and place it after another filter called newer-filter
using configuration mode commands:
<rpc> <load-configuration action="set" format="text"> <configuration-set> insert firewall family inet filter older-filter after filter newer-filter </configuration-set> </load-configuration> </rpc>
The following example shows how to move an OSPF virtual
link defined at the [edit protocols ospf area area]
hierarchy level. The link with identifiers neighbor-id 192.168.0.3
and transit-area 10.10.10.1
moves before the link with identifiers neighbor-id 192.168.0.5
and transit-area 10.10.10.2
. This operation is equivalent
to the following configuration mode command:
[edit protocols ospf area area] user@host# insert virtual-link neighbor-id 192.168.0.3 transit-area 10.10.10.1 before virtual-link neighbor-id 192.168.0.5 transit-area 10.10.10.2
Client Application
<rpc> <load-configuration> <configuration> <protocols> <ospf> <area> <name>area</name> <virtual-link insert="before" neighbor-id="192.168.0.5" transit-area="10.10.10.2"> <neighbor-id>192.168.0.3</neighbor-id> <transit-area>10.10.10.1</transit-area> </virtual-link> </area> </ospf> </protocols> </configuration> </load-configuration> </rpc>
Junos XML Protocol Server
<rpc-reply xmlns:junos="URL"> <load-configuration-results> <load-success/> </load-configuration-results> </rpc-reply>