Reordering Elements in Configuration Objects
For most configuration objects, the order in which the object or its children are created is not significant, because the Junos 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.
To change the order of configuration elements in an ordered set, a client application includes the tag elements described in Creating, Modifying, or Deleting Configuration Elements. It 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, the identifier tag element is called <name>. In the opening container tag, it includes the insert="before" or insert="after" attribute 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, 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, 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 reordering operation is not available when formatted ASCII text is used to represent the configuration data.
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.
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. This operation is equivalent to the following configuration mode command:

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 1.1.1.1 moves before the link with identifiers neighbor-id 192.168.0.5 and transit-area 1.1.1.2. This operation is equivalent to the following configuration mode command (which appears on two lines for legibility only):
[edit protocols ospf area area]
user@host# insert virtual-link neighbor-id 192.168.0.3 transit-area 1.1.1.1 \
before virtual-link neighbor-id 192.168.0.5 transit-area 1.1.1.2

Hide Navigation Pane
Show Navigation Pane
Download
SHA1