Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Set the Edit Configuration Mode in a NETCONF Session

When sending configuration data to the NETCONF server, you can specify how the device should handle the configuration changes. This is known as the edit configuration mode. You can set the edit configuration mode globally for the entire session. You can also set the edit mode for only specific elements within the session.

Devices running Junos OS have the following edit configuration modes:

  • merge—The device merges new configuration data into the existing configuration data. This is the default.

  • replace—The device replaces existing configuration data with the new configuration data.

  • none—The device does not change the existing configuration unless the new configuration element includes an operation attribute.

To set the edit configuration mode globally for the session, include the <default-operation> element with the desired mode as a child element of <edit-config>.

To specify the edit configuration mode for an individual element, include the operation attribute and desired mode in that element’s tag.

You can also set a global edit configuration mode for an entire set of configuration changes and specify a different mode for individual elements that you want handled in a different manner. For example:

The edit configuration modes are discussed in more detail in the following sections:

Specifying the merge Data Mode

By default, the NETCONF server merges new configuration data into the candidate configuration or open configuration database. Thus, if you do not specify an edit configuration mode, the device merges the new configuration elements into the existing configuration.

Merging configurations is performed according to the following rules. (The rules also apply when updating configuration data in an open configuration database, for example, the ephemeral database, but for simplicity the following discussion refers to the candidate configuration only.)

  • A configuration element (hierarchy level or configuration object) that exists in the candidate configuration but not in the new configuration remains unchanged.

  • A configuration element that exists in the new configuration but not in the candidate configuration is added to the candidate configuration.

  • If a configuration element exists in both configurations, the following results occur:

    • If a child statement of the configuration element (represented by a child tag element) exists in the candidate configuration but not in the new configuration, it remains unchanged.

    • If a child statement exists in the new configuration but not in the candidate, it is added to the candidate configuration.

    • If a child statement exists in both configurations, the value in the new data replaces the value in the candidate configuration.

To explicitly specify that data be merged, the application includes the <default-operation> tag element with the value merge in the <edit-config> tag element.

Specifying the replace Data Mode

In the replace edit configuration mode, the new configuration data completely replaces the data in the candidate configuration or open configuration database. To specify that the data be replaced, the application includes the <default-operation> tag element with the value replace in the <edit-config> tag element.

We recommend using the global replace mode only when you plan to completely overwrite the existing configuration with new configuration data. Furthermore, when the edit configuration mode is set to replace, we do not recommend using the operation attribute for individual configuration elements.

You can also replace individual configuration elements while merging or creating others. See Replace Configuration Elements Using NETCONF.

Specifying the none (no-change) Data Mode

In the none (no-change) edit configuration mode, changes to the configuration are ignored. This mode is useful when you are deleting elements, and it prevents the NETCONF server from creating parent hierarchy levels for an element that is being deleted. For more information, see Delete Configuration Elements Using NETCONF.

To set the no-change edit configuration mode globally, the application includes the <default-operation> tag element with the value none in the <edit-config> tag element.

Note:

If the new configuration data includes a configuration element that is not in the existing configuration, the NETCONF server returns an error. We recommend using mode none only when removing configuration elements from the configuration. When creating or modifying elements, applications must use merge mode.

When you use the <default-operation> tag to globally set the edit configuration mode to none to indicate the no-change mode, you can still override this mode and specify a different edit configuration mode for individual elements by including the operation attribute in the element’s tag. For example:

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
21.1R1 and 21.1R1-EVO
Starting in Junos OS Release 21.1R1 and Junos OS Evolved Release 21.1R1,when you set <default-operation> to replace, the device uses a load update operation instead of a load override operation to replace the configuration. In load update operations, the device notifies only the Junos processes that correspond to changed statements, thus minimizing possible disruptions to the network.