Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Replace Elements in Configuration Data Using the Junos XML Protocol

A Junos XML protocol client application can use the <load-configuration> operation with the replace action to replace individual configuration elements, including hierarchy levels or configuration objects.

A Junos XML protocol client application can replace individual configuration elements (hierarchy levels or configuration objects) on a device running Junos OS or a device running Junos OS Evolved. To replace individual elements, a client application emits the <load-configuration> element with the action="replace" attribute in an <rpc> element.

Note:

Starting in Junos OS Release 18.1R1, the ephemeral configuration database supports loading configuration data using the <load-configuration> action attribute values of override and replace in addition to the previously supported values of merge and set.

Note:

Junos OS does not support using the replace operation when loading JSON configuration data. To replace configuration elements when using JSON, you must delete the existing element and then add the replacement element.

To perform replace operations, a client application must load configuration data as Junos XML elements or formatted ASCII text. The configuration data must specify which objects to replace. The following sections discuss how to replace configuration elements using the different formats.

Junos XML

To use Junos XML elements to define the data to replace, the application first includes the basic tag elements described in Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol. The application includes the replace="replace" attribute in the opening container tag of the object to replace. Within the container tag, the application includes the same child tag elements as for a new element: each of the replacement’s identifier tag elements (if it has them) and all child tag elements being defined for the replacement element.

In the following example, the application replaces the object that has the replace="replace" attribute and the identifier specified in the <name> element.

The following example replaces the configuration for the admin class at the [edit system login class] hierarchy level. The configuration data uses Junos XML-tagged format (the default).

Formatted ASCII Text

To use formatted ASCII text to replace the element, the application first includes the complete statement path described in Create, Modify, or Delete Configuration Elements Using the Junos XML Protocol. For the replacement element, the application includes each of the replacement’s identifiers (if it has them) and all child statements (with values if appropriate) that it is defining. The request includes the replace: statement on the line that just precedes the element’s container statement. To provide the configuration data as a data stream, enclose the data in a <configuration-text> element.

The following example uses formatted ASCII text to replace the configuration for the admin class at the [edit system login class] hierarchy level.

Change History Table

Feature support is determined by the platform and release you are using. Use Feature Explorer to determine if a feature is supported on your platform.

Release
Description
18.1R1
Starting in Junos OS Release 18.1R1, the ephemeral configuration database supports loading configuration data using the <load-configuration> action attribute values of override and replace in addition to the previously supported values of merge and set.