Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Announcement: Try the Ask AI chatbot for answers to your technical questions about Juniper products and solutions.

close
external-header-nav
keyboard_arrow_up
close
keyboard_arrow_left
list Table of Contents
file_download PDF
{ "lLangCode": "en", "lName": "English", "lCountryCode": "us", "transcode": "en_US" }
English
keyboard_arrow_right

Rename Objects In Configuration Data Using the Junos XML Protocol

date_range 14-Jul-21

In a Junos XML protocol session with a device running Junos OS, to change the name of one or more of a configuration object’s identifiers, a client application includes the tag elements described in Creating, Modifying, or Deleting Configuration Elements Using the Junos XML Protocol. When using Junos XML tag elements, the client application includes the rename="rename" attribute and an attribute named after the identifier keyword in the object’s opening tag. The value of the attribute is the new identifier value. The application includes the identifier tag element to specify the current name. In the following, the identifier tag element is called <name>:

content_copy zoom_out_map
<configuration>
    <!-- opening tag for each parent of the object -->
        <object rename="rename" name="new-name">
            <name>current-name</name> 
        </object> 
    <!-- closing tag for each parent of the object -->
</configuration>

If the object has multiple identifiers, for each one the application includes both an attribute in the opening tag and an identifier tag element. If one or more of the identifiers is not changing, the attribute value for it is set to its current name. The opening tag appears on two lines for legibility only:

content_copy zoom_out_map
<configuration>
    <!-- opening tag for each parent of the object -->
        <object rename="rename" changing-identifier="new-name" \ 
                    unchanging-identifier="current-name"> 
            <changing-identifier>current-name</changing-identifier> 
            <unchanging-identifier>current-name</unchanging-identifier> 
        </object> 
    <!-- closing tag for each parent of the object -->
</configuration>

When using configuration mode commands to rename an object, the application specifies the rename command equivalent to the CLI configuration mode command. If the object has multiple identifiers, the application includes a separate rename command for each identifier.

content_copy zoom_out_map
<configuration-set>
    rename statement-path-to-object object current-name to object new-name 
</configuration-set>
Note:

The rename operation is not available when formatted ASCII text or JSON is used to represent the configuration data.

For Junos XML tag elements the rename attribute can be combined with the inactive or active attribute to deactivate or reactivate the configuration element as it is renamed. For more information, see Changing a Configuration Element’s Activation State Simultaneously with Other Changes Using the Junos XML Protocol.

The following example shows how to change the name of a firewall filter from access-control to new-access-control using Junos XML tag elements. This operation is equivalent to the following configuration mode command:

content_copy zoom_out_map
[edit firewall family inet]
user@host# rename filter access-control to filter new-access-control 

The following example shows how to change the name of a firewall filter from access-control to new-access-control using configuration mode commands:

content_copy zoom_out_map
<rpc>
    <load-configuration action="set" format="text">
        <configuration-set>
            rename firewall family inet filter access-control to filter new-access-control 
        </configuration-set>
    </load-configuration>
</rpc>

The following example shows how to change the identifiers for an OSPF virtual link (defined at the [edit protocols ospf area area] hierarchy level) from neighbor-id 192.168.0.3 and transit-area 10.10.10.1 to neighbor-id 192.168.0.7 and transit-area 10.10.10.5. This operation is equivalent to the following configuration mode command (which appears on two lines for legibility only):

content_copy zoom_out_map
[edit protocols ospf area area]
user@host# rename virtual-link neighbor-id 192.168.0.3 transit-area \ 
10.10.10.1 to virtual-link neighbor-id 192.168.0.7 transit-area 10.10.10.5 

Client Application

content_copy zoom_out_map
<rpc>
   <load-configuration>
      <configuration>
         <protocols>
            <ospf>
               <area>
                  <name>area</name>
                  <virtual-link rename="rename" neighbor-id="192.168.0.7 transit-area="10.10.10.5">
                     <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

content_copy zoom_out_map
<rpc-reply xmlns:junos="URL">
   <load-configuration-results>
      <load-success/>
   </load-configuration-results>
</rpc-reply>
external-footer-nav