Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Commit the Candidate Configuration Using NETCONF

When you commit the candidate configuration on a device running Junos OS, it becomes the active configuration on the routing, switching, or security platform. For more detailed information about commit operations, including a discussion of the interaction among different variants of the operation, see the CLI User Guide.

In a NETCONF session with a device running Junos OS, to commit the candidate configuration, a client application encloses the <commit/> tag in an <rpc> tag element.

We recommend that the client application lock the candidate configuration before modifying it and emit the <commit/> tag while the configuration is still locked. This process avoids inadvertently committing changes made by other users or applications. After committing the configuration, the application must unlock it in order for other users and applications to make changes.

The NETCONF server confirms that the commit operation was successful by returning the <ok/> tag in the <rpc-reply> tag element.

If the commit operation fails, the server returns the <rpc-reply> element and <rpc-error> child element, which explains the reason for the failure. The most common causes are semantic or syntactic errors in the candidate configuration.

You can configure the rfc-compliant statement at the [edit system services netconf] hierarchy level to enforce certain behaviors by the NETCONF server, which includes changes in the NETCONF server's response to <commit> operations. Table 1 describes the changes in RFC-compliant sessions.

Table 1: Commit RPC Response Differences in RFC-Compliant Sessions
Commit RPC Response Default Response RFC-Compliant Session Response
A successful <commit> operation returns a response with warnings. The NETCONF server returns an <ok/> element and can also return one or more <rpc-error> elements with a severity level of warning. Starting in Junos OS Release 17.4R3, 18.2R2, 18.3R2, and 18.4R1, the NETCONF server returns an <ok/> element but omits any warnings. In Junos OS Release 21.2R1 and later, the warnings are also redirected to the system log file.
A <commit> operation response returns an <rpc-error> element that includes a <source-daemon> element. The NETCONF server response emits the <source-daemon> element as a child of <rpc-error>. Starting in Junos OS Release 21.2R1, the NETCONF server response emits the <source-daemon> element as a child of <error-info>.
A <commit> operation response includes a <commit-results> element. The NETCONF server includes the <commit-results> XML subtree in addition to an <ok/> element or <rpc-error> child element. If you also configure the flatten-commit-results statement at the [edit system services netconf] hierarchy level, the NETCONF server suppresses the <commit-results> XML subtree and only emits an <ok/> or <rpc-error> element in its response.