Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

Navigation

Editing the Candidate Configuration Using NETCONF

In a NETCONF session with a device running Junos OS, you can use NETCONF XML management protocol operations along with Junos XML or command-line interface (CLI) configuration statements to change the configuration on a routing, switching, or security platform. The NETCONF protocol operations<copy-config>, <edit-config>, and <discard-changes> offer functionality that is analogous to configuration mode commands in the Junos OS CLI. The Junos XML tag elements described here correspond to configuration statements, which are described in the Junos OS configuration guides.

To change the candidate configuration on a device, a client application emits the <copy-config>, the <edit-config>, or the <discard-changes> tag element and the corresponding tag subelements within the <rpc> tag element.

The following examples shows the various tag elements available:

<rpc>
    <copy-config>
        <target><candidate/></target>
        <error-operation> (ignore-error | stop-on-error) </error-operation>
        <source><url>location</url></source>
    </copy-config>
</rpc>
]]>]]>
<rpc>
     <edit-config>
        <target><candidate/></target>
        <default-operation>operation</default-operation>
        <error-operation>error</error-operation>
        <(config | config-text | url)>
            <!-- configuration change file or data -->
        </(config | config-text | url)>
    </edit-config>
</rpc>
]]>]]>
<rpc>
    <discard-changes/>
</rpc>
]]>]]>

The three tags—<copy-config>, <edit-config>, and <discard-changes>—correspond to the three basic configuration tasks available to you:

  • Overwriting the candidate configuration with a new configuration—Using the <copy-config> tag element, you can replace the current candidate configuration with a new configuration.
  • Editing the candidate configuration elements—Using the <edit-config> tag element, you can add, change, or delete specific configuration elements within the candidate configuration. To specify how the device should handle configuration changes, see Setting the Edit Configuration Mode in a NETCONF Session.
  • Rolling back changes to the current configuration—Using the <discard-changes> tag element, you can roll back the candidate configuration to a previously committed configuration. This tag element provides functionality analogous to the CLI command rollback.

Published: 2013-07-26