[Contents] [Prev] [Next] [Index] [Report an Error]

Replacing Configuration Elements

To replace individual configuration elements (hierarchy levels or configuration objects), a client application emits the <load-configuration> tag element with the action="replace" attribute in an <rpc> tag element:

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

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

For more information about the url and format attributes, see Providing Configuration Data in a File.

To use JUNOS XML tag elements to represent the replacement, the application includes the basic tag elements described in Creating, Modifying, or Deleting Configuration Elements. Within the container tag, it 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, the identifier tag element is called <name>. The application also includes the replace= “replace” attribute in the opening container tag:

<configuration>
<!- - opening tag for each parent of the element - ->
<container-tag replace="replace">
<name>identifier</name>
<!- - tag elements for other children, if any - ->
</container-tag>
<!- - closing tag for each parent of the element - ->
</configuration>

To use formatted ASCII text to represent the element, the application includes the complete statement path described in Creating, Modifying, or Deleting Configuration Elements. As for a new element, it includes each of the replacement’s identifiers (if it has them) and all child statements (with values if appropriate) that it is defining for the replacement. It places the replace: statement above the element’s container statement.

<configuration-text>
/* statements for parent levels of the element */
replace:
element  identifier {
/* child statements if any */
}
/* closing braces for parent levels for the element */
</configuration-text>

The following example shows how to grant new permissions for the object named operator at the [edit system login class] hierarchy level. The information is provided in JUNOS XML-tagged format (the default).

Image t1135.gif

The following example shows how to use formatted ASCII text to make the same change.

Image t1136.gif
[Contents] [Prev] [Next] [Index] [Report an Error]