Replacing the Entire Configuration

A client application can completely replace the current candidate configuration or a private copy of it, either with new data or by rolling back to a previous configuration. See the following sections:

For instructions about modifying individual configuration elements, see Creating, Modifying, or Deleting Configuration Elements.

Replacing the Configuration with New Data

To discard the entire candidate configuration or private copy and replace it with new configuration data, a client application includes the action="override" attribute in the <load-configuration/> tag or opening <load-configuration> tag:

<rpc>
<!-- For a file -->
<load-configuration action="override" url="file" [format="text"]/>

<!-- For a data stream -->
<load-configuration action="override" [format="text"]>
<!-- configuration data -->
</load-configuration>
</rpc>

For more information about the url and format attributes and the syntax for the new configuration data, see Specifying the Source and Format of New Configuration Data.

The following example shows how to specify that the contents of the file /tmp/new.conf replace the entire candidate configuration. The file contains Junos XML tag elements (the default), so the format attribute is omitted.

Image t1133.gif

Rolling Back to a Previous or Rescue Configuration

The routing, switching, or security platform stores a copy of the most recently committed configuration and up to 49 additional previous configurations. To replace the candidate configuration or private copy with a previously committed configuration, a client application includes the rollback="index" attribute in the <load-configuration/> tag, where index is the numerical index of the appropriate previous configuration. The index for the most recently committed configuration is 0 (zero), and the index for the oldest possible previous configuration is 49.

<rpc><load-configuration rollback="index"></rpc>

To replace the configuration with the rescue configuration, include the rescue="rescue" attribute in the <load-configuration/> tag.

<rpc><load-configuration rescue="rescue"/></rpc>

For more information about rollback and rescue configurations, see the Junos CLI User Guide.