Replace Configuration Elements Using NETCONF
In a NETCONF session with a device running Junos OS, to replace configuration elements, including hierarchy levels or configuration objects, in the candidate configuration, a client application emits the basic tag elements described in Change Individual Configuration Elements Using NETCONF.
To represent the new definition for each configuration element
being replaced (either within the <config>
or <config-text>
tag elements or in
the file specified by the <url>
tag
element), the application emits the tag elements representing its
parent hierarchy levels and its container tag element, as described
in Change Individual Configuration Elements Using NETCONF. Within the container tag, the application
includes each of the element’s identifier tag elements (if it
has them) and all child tag elements (with values, if appropriate)
that are being defined for the new version of the element. In the
following example, the identifier tag element is called <name>
. The application includes the operation="replace"
attribute in the opening container
tag:
<configuration> <!-- opening tags for each parent of the element --> <container-tag operation="replace"> <name>identifier</name> <!-- other child tag elements --> </container-tag> <!-- closing tags for each parent of the element --> </configuration>
The NETCONF server removes the existing element that has the specified identifiers and inserts the new element.
The operation="replace"
attribute
is not supported when loading configuration data into the ephemeral
configuration database.
The application can also replace all objects in the configuration in one operation. For instructions, see Replace the Candidate Configuration Using NETCONF.
The following example shows how to grant new permissions for
the object named operator
at the [edit system login class]
hierarchy
level.