Changing Individual Configuration Elements Using NETCONF
In a NETCONF session with a device running Junos OS, you change individual configuration elements within a candidate configuration using the <edit-config> tag element within the <rpc> tag. By default, the NETCONF server merges new configuration data into the existing candidate configuration. However, a client application can also replace, create, or delete individual configuration elements (hierarchy levels or configuration objects). The same basic tag elements are emitted for all operations: <config>, <config-text>, or <url> tag sub-elements within the <edit-config> tag element:
<rpc>
<edit-config>
<target>
<candidate/>
</target>
<!-- EITHER -->
<config>
<configuration>
<!-- tag elements representing the configuration elements to change -->
</configuration>
</config>
<!-- OR -->
<config-text>
<configuration-text>
<!-- CLI configuration statements representing the configuration elements to change -->
</configuration-text>
</config-text>
<!-- OR -->
<url>
<!-- location specifier for file containing changes -->
</url>
</edit-config>
</rpc>
]]>]]>
Using configuration data within the <config> or <config-text> tag elements or in the file specified by <url> tag element, the application defines a configuration element by including the tag elements representing all levels of the configuration hierarchy from the root down to the immediate parent level for the element. To represent the element, the application includes its container tag element. The child tag elements included within the container tag element depend on the operation.
For more information about the tag elements that represent configuration statements, see Mapping Configuration Statements to Junos XML Tag Elements. For information about the tag elements for a specific configuration element, see the Junos XML API Configuration Reference.
The NETCONF server indicates that it changed the configuration in the requested way by enclosing the <ok/> tag in the <rpc-reply> tag element:
<rpc-reply xmlns="URN" xmlns:junos="URL">
<ok/>
</rpc-reply>
]]>]]>