Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 

XML Syntax for Common Commit Script Tasks

 

Junos OS commit scripts can generate persistent or transient changes to the configuration during the commit process. A commit script can perform common configuration tasks by adding the appropriate attribute to a specific XML tag in the configuration data. Table 1 summarizes the tasks and the syntax for each task.

Table 1: XML Syntax for Common Commit Script Tasks

Action

Syntax

Example

Add a data element

normal XML

<address>
     <name>192.168.1.1</name>
</address>

Remove the inactive tag from a statement

active="active"

<address active="active">
     <name>192.168.1.1/30</name>
</address>

Delete a data element

delete="delete"

<address delete="delete">
     <name>192.168.1.1/30</name>
</address>

Add the inactive tag to a statement

inactive="inactive"

<address inactive="inactive">
     <name>192.168.1.1/30</name>
</address>

Insert a new ordered data element

insert="(before | after)" name="reference-value"

<address insert="before" name="192.168.1.5/30">
     <name>192.168.1.1/30</name>
</address>

Add the protect tag to a statement or node to prevent configuration changes to that element

protect="protect"

<address protect="protect"">
     <name>192.168.1.1/30</name>
</address>

Rename a statement

rename="rename" name="new-name"

<address rename="rename" name="192.168.1.1/30">
     <name>192.168.1.5/30</name>
</address>

Replace a node or statement in the hierarchy

replace="replace"

<system>
     <services replace="replace">
          [...]
     </services>
</system>

Unprotect a statement or node in the hierarchy

unprotect="unprotect"

<address unprotect="unprotect">
     <name>192.168.1.1/30</name>
</address>

Annotate a configuration statement with a comment

<junos:comment>

<system>
     <junos:comment>
           /* added by username */
     </junos:comment>
     <services>
          [...]
     </services>
</system>