Internet-Draft | NCTID | June 2022 |
Lindblad | Expires 10 December 2022 | [Page] |
NETCONF clients and servers often need to have a synchronized view of the server's configuration data stores. The volume of configuration data in a server may be very large, while data store changes typically are small when observed at typical client resynchronization intervals.¶
Rereading the entire data store and analyzing the response for changes is an inefficient mechanism for synchronization. This document specifies an extension to NETCONF that allows clients and servers to keep synchronized with a much smaller data exchange and without any need for servers to store information about the clients.¶
This note is to be removed before publishing as an RFC.¶
Source for this draft and an issue tracker can be found at https://github.com/netconf-wg/netconf-etag.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 10 December 2022.¶
Copyright (c) 2022 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
When a NETCONF client connects with a NETCONF server, a frequently occurring use case is for the client to find out if the configuration has changed since it was last connected. Such changes could occur for example if another NETCONF client has made changes, or another system or operator made changes through other means than NETCONF.¶
One way of detecting a change for a client would be to retrieve the entire configuration from the server, then compare the result with a previously stored copy at the client side. This approach is not popular with most NETCONF users, however, since it would often be very expensive in terms of communications and computation cost.¶
Furthermore, even if the configuration is reported to be unchanged, that will not guarantee that the configuration remains unchanged when a client sends a subsequent change request, a few moments later.¶
In order to simplify the task of tracking changes, a NETCONF server could implement a meta level checksum over the configuration over a datastore or YANG subtree, and offer clients a way to read and compare this checksum. If the checksum is unchanged, clients can avoid performing expensive operations. Such checksums are often referred to as a configuration id or transaction id (txid).¶
Evidence of a transaction id feature being demanded by clients is that several server implementors have built proprietary and mutually incompatible mechanisms for obtaining a transaction id from a NETCONF server.¶
RESTCONF, RFC 8040, defines a mechanism for detecting changes in configuration subtrees based on Entity-Tags (ETags) and Last-Modified txid values.¶
In conjunction with this, RESTCONF provides a way to make configuration changes conditional on the server confiuguration being untouched by others. This mechanism leverages RFC 7232 "Hypertext Transfer Protocol (HTTP/1.1): Conditional Requests".¶
This document defines similar functionality for NETCONF, RFC 6241, and ties this in with YANG-Push, RFC 8641.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
This document uses the terminology defined in RFC6241, RFC7950, RFC8040, and RFC8641.¶
In addition, this document defines the following terms:¶
This document describes a NETCONF extension which modifies the behavior of get-config, get-data, edit-config, edit-data, discard-changes, copy-config, delete-config and commit such that clients are able to conditionally retrieve and update the configuration in a NETCONF server.¶
For servers implementing YANG-Push, an extension for conveying txid updates as part of subscription updates is also defined.¶
Several low level mechanisms could be defined to fulfill the requirements for efficient client-server txid synchronization. This document defines two such mechanisms, the etag txid mechanism and the last-modified txid mechanism. Additional mechanisms could be added in future.¶
The common use cases for such mecahnisms are briefly discussed here.¶
All servers implementing a txid mechanism MUST maintain a txid meta data value for each configuration datastore supported by the server. Txid mechanism implementations MAY also maintain txid meta data values for nodes deeper in the YANG data tree. The nodes for which the server maintains txids are collectively referred to as the "versioned nodes".¶
The server returning txid values for the versioned nodes MUST ensure the txid values are changed every time there has been a configuration change at or below the node associated with the txid value. This means any update of a config true node will result in a new txid value for all ancestor versioned node, up to and including the datastore root itself.¶
This also means a server MUST update the txid value for any nodes that change as a result of a configuration change, regardless of source, even if the changed nodes are not explicitly part of the change payload. An example of this is dependent data under YANG RFC 7950 when- or choice-statements.¶
The server MUST NOT change the txid value of a versioned node unless the node itself or a child node of that node has been changed. The server MUST NOT change any txid values due to changes in config false data.¶
When a NETCONF server receives a get-config or get-data request containing requests for txid values, it MUST return txid values for all versioned nodes below the point requested by the client in the reply.¶
The exact encoding varies by mechanism, but all txid mechanisms would have a special "txid-request" txid value (e.g. "?") which is guaranteed to never be used as a normal txid value. Clients MAY use this special txid value associated with one or more nodes in the data tree to indicate to the server that they are interested in txid values below that point of the data tree.¶
NOTE: In the call flow examples we are using a 4-digit, monotonously increasing integer as txid. This is convenient and enhances readability of the examples, but does not reflect a typical implementation. In general, the only operation defined on a pair of txid values is testing them for equality.¶
Clients MAY request the server to return txid values in the response by adding one or more txid values received previously in get-config or get-data requests.¶
When a NETCONF server receives a get-config or get-data request containing a node with a client specified txid value, there are several different cases:¶
For list elements, pruning child nodes means that top-level key nodes MUST be included in the response, and other child nodes MUST NOT be included. For containers, child nodes MUST NOT be included.¶
Conditional transactions are useful when a client is interested to make a configuration change, being sure that relevant parts of the server configuration have not changed since the client last inspected it.¶
By supplying the latest txid values known to the client in its change requests (edit-config etc.), it can request the server to reject the transaction in case any relevant changes have occurred at the server that the client is not yet aware of.¶
This allows a client to reliably compute and send confiuguration changes to a server without either acquiring a global datastore lock for a potentially extended period of time, or risk that a change from another client disrupts the intent in the time window between a read (get-config etc.) and write (edit-config etc.) operation.¶
Clients that are also interested to know the txid assigned to the modified versioned nodes in the model immediately in the response could set a flag in the rpc message to request the server to return the new txid with the ok message.¶
If the server rejects the transaction because the configuration txid value differs from the client's expectation, the server MUST return an rpc-error with the following values:¶
error-tag: operation-failed error-type: protocol error-severity: error¶
Additionally, the error-info tag SHOULD contain an sx:structure containing relevant details about the mismatching txids.¶
When working with the Candidate datastore, the txid validation happens at commit time, rather than at individual edit-config or edit-data operations. Clients add their txid attributes to the configuration payload the same way. In case a client specifies different txid values for the same element in successive edit-config or edit-data operations, the txid value specified last MUST be used by the server at commit time.¶
YANG modules that contain when-statements referencing remote parts of the model will cause the txid to change even in parts of the data tree that were not modified directly.¶
Let's say there is an energy-example.yang module that defines a mechanism for clients to request the server to measure the amount of energy that is consumed by a given access control rule. The energy-example module augments the access control module as follows:¶
augment /acl:acls/acl:acl { when /energy-example:energy/energy-example:metering-enabled; leaf energy-tracing { type boolean; default false; } leaf energy-consumption { config false; type uint64; units J; } }¶
This means there is a system wide switch leaf metering-enabled in energy-example which disables all energy measurements in the system when set to false, and that there is a boolean leaf energy-tracing that controls whether energy measurement is happening for each acl rule individually.¶
In this example, we have an initial configuration like this:¶
At this point, a client updates metering-enabled to false. This causes the when-expression on energy-tracing to turn false, removing the leaf entirely. This counts as a configuration change, and the txid MUST be updated appropriately.¶
After the transaction above, the new configuration state has the energy-tracing leafs removed.¶
A client issuing a YANG-Push establish-subscription or modify-subscription request towards a server that supports both YANG-Push RFC 8641 and a txid mechanism MAY request that the server provides updated txid values in YANG-Push subscription updates.¶
This document defines two txid mechanisms:¶
Servers implementing this specification MUST support the etag attribute txid mechanism and MAY support the last-modified attribute txid mechanism.¶
Section NETCONF Txid Extension (Section 3) describes the logic that governs all txid mechanisms. This section describes the mapping from the generic logic to specific mechanism and encoding.¶
If a client uses more than one txid mechanism, such as both etag and last-modified in a particular message to a server, or patricular commit, the result is undefined.¶
The etag txid mechanism described in this section is centered around a meta data XML attribute called "etag". The etag attribute is defined in the namespace "urn:ietf:params:xml:ns:netconf:txid:1.0". The etag attribute is added to XML elements in the NETCONF payload in order to indicate the txid value for the YANG node represented by the element.¶
NETCONF servers that support this extension MUST announce the capability "urn:ietf:params:netconf:capability:txid:etag:1.0".¶
The etag attribute values are opaque UTF-8 strings chosen freely, except that the etag string must not contain space, backslash or double quotes. The point of this restriction is to make it easy to reuse implementations that adhere to section 2.3.1 in RFC 7232. The probability SHOULD be made very low that an etag value that has been used historically by a server is used again by that server if the configuration is different.¶
It is RECOMMENDED that the same etag txid values are used across all management interfaces (i.e. NETCONF, RESTCONF and any other the server might implement), if it implements more than one.¶
The detailed rules for when to update the etag value are described in section General Txid Principles (Section 3.2). These rules are chosen to be consistent with the ETag mechanism in RESTCONF, RFC 8040, specifically sections 3.4.1.2, 3.4.1.3 and 3.5.2.¶
The last-modified txid mechanism described in this section is centered around a meta data XML attribute called "last-modified". The last-modified attribute is defined in the namespace "urn:ietf:params:xml:ns:netconf:txid:1.0". The last-modified attribute is added to XML elements in the NETCONF payload in order to indicate the txid value for the YANG node represented by the element.¶
NETCONF servers that support this extension MUST announce the capability "urn:ietf:params:netconf:capability:txid:last-modified:1.0".¶
The last-modified attribute values are yang:date-and-time values as defined in ietf-yang-types.yang, RFC 6991.¶
"2022-04-01T12:34:56.123456Z" is an example of what this time stamp format looks like. It is RECOMMENDED that the time stamps provided by the server to closely match the real world clock. Servers MUST ensure the timestamps provided are monotonously increasing for as long as the server's operation is maintained.¶
It is RECOMMENDED that server implementors choose the number of digits of precision used for the fractional second timestamps high enough so that there is no risk that multiple transactions on the server would get the same timestamp.¶
It is RECOMMENDED that the same last-modified txid values are used across all management interfaces (i.e. NETCONF and any other the server might implement), except RESTCONF.¶
RESTCONF, as defined in RFC 8040, is using a different format for the time stamps which is limited to one second resolution. Server implementors that support the Last-Modified txid mechanism over both RESTCONF and other management protocols are RECOMMENDED to use Last-Modified timestamps that match the point in time referenced over RESTCONF, with the fractional seconds part added.¶
The detailed rules for when to update the last-modified value are described in section General Txid Principles (Section 3.2). These rules are chosen to be consistent with the Last-Modified mechanism in RESTCONF, RFC 8040, specifically sections 3.4.1.1, 3.4.1.3 and 3.5.1.¶
Clients MAY add etag or last-modified attributes to zero or more individual elements in the get-config or get-data filter, in which case they pertain to the subtree(s) rooted at the element(s) with the attributes.¶
Clients MAY also add such attributes directly to the get-config or get-data tags (e.g. if there is no filter), in which case it pertains to the txid value of the datastore root.¶
Clients might wish to send a txid value that is guaranteed to never match a server constructed txid. With both the etag and last-modified txid mechanisms, such a txid-request value is "?".¶
Clients MAY add etag or last-modified attributes to the payload of edit-config or edit-data requests, in which case they indicate the client's txid value of that element.¶
Clients MAY request servers that also implement YANG-Push to return configuration change subsription updates with etag or last-modified txid attributes. The client requests this service by adding a with-etag or with-last-modified flag with the value 'true' to the subscription request or yang-push configuration. The server MUST then return such txids on the YANG Patch edit tag and to the child elements of the value tag. The txid attribute on the edit tag reflects the txid associated with the changes encoded in this edit section, as well as parent nodes. Later edit sections in the same push-update or push-change-update may still supercede the txid value for some or all of the nodes in the current edit section.¶
Servers returning txid values in get-config, edit-config, get-data, edit-data and commit operations MUST do so by adding etag and/or last-modified txid attributes to the data and ok tags. When servers prune output due to a matching txid value, the server MUST add a txid-match attribute to the pruned element, and MUST set the attribute value to "=", and MUST NOT send any element value.¶
Servers returning a txid mismatch error MUST return an rpc-error as defined in section Conditional Transactions (Section 3.5) with an error-info tag containing a txid-value-mismatch-error-info structure.¶
The txid attributes are valid on the following NETCONF tags, where xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0", xmlns:ncds="urn:ietf:params:xml:ns:yang:ietf-netconf-nmda", xmlns:sn="urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications", xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-patch" and xmlns:ypatch="urn:ietf:params:xml:ns:yang:ietf-yang-patch":¶
In client messages sent to a server:¶
In server messages sent to a client:¶
NOTE: In the etag examples below, we have chosen to use a txid value consisting of "nc" followed by a monotonously increasing integer. This is convenient for the reader trying to make sense of the examples, but is not an implementation requirement. An etag would often be implemented as a "random" string of characters, with no comes-before/after relation defined.¶
To retrieve etag attributes across the entire NETCONF server configuration, a client might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config txid:etag="?"/> </rpc>¶
The server's reply might then be:¶
<rpc-reply message-id="1" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data txid:etag="nc5152"> <acls xmlns= "urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc5152"> <acl txid:etag="nc4711"> <name>A1</name> <aces txid:etag="nc4711"> <ace txid:etag="nc4711"> <name>R1</name> <matches> <ipv4> <protocol>udp</protocol> </ipv4> </matches> </ace> </aces> </acl> <acl txid:etag="nc5152"> <name>A2</name> <aces txid:etag="nc5152"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> <ace txid:etag="nc5152"> <name>R8</name> <matches> <udp> <source-port> <port>22</port> </source-port> </udp> </matches> </ace> <ace txid:etag="nc5152"> <name>R9</name> <matches> <tcp> <source-port> <port>22</port> </source-port> </tcp> </matches> </ace> </aces> </acl> </acls> <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm" txid:etag="nc3072"> <groups txid:etag="nc3072"> <group txid:etag="nc3072"> <name>admin</name> <user-name>sakura</user-name> <user-name>joe</user-name> </group> </groups> </nacm> </data> </rpc>¶
To retrieve etag attributes for a specific ACL using an xpath filter, a client might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="2" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config> <source> <running/> </source> <filter type="xpath" xmlns:acl= "urn:ietf:params:xml:ns:yang:ietf-access-control-list" select="/acl:acls/acl:acl[acl:name='A1']" txid:etag="?"/> </get-config> </rpc>¶
To retrieve etag attributes for "acls", but not for "nacm", a client might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="3" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config> <source> <running/> </source> <filter> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="?"/> <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm"/> </filter> </get-config> </rpc>¶
If the server considers "acls", "acl", "aces" and "acl" to be versioned nodes, the server's response to the request above might look like:¶
<rpc-reply message-id="3" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns= "urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc5152"> <acl txid:etag="nc4711"> <name>A1</name> <aces txid:etag="nc4711"> <ace txid:etag="nc4711"> <name>R1</name> <matches> <ipv4> <protocol>udp</protocol> </ipv4> </matches> </ace> </aces> </acl> <acl txid:etag="nc5152"> <name>A2</name> <aces txid:etag="nc5152"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> <ace txid:etag="nc5152"> <name>R8</name> <matches> <udp> <source-port> <port>22</port> </source-port> </udp> </matches> </ace> <ace txid:etag="nc5152"> <name>R9</name> <matches> <tcp> <source-port> <port>22</port> </source-port> </tcp> </matches> </ace> </aces> </acl> </acls> <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm"/> <groups> <group> <name>admin</name> <user-name>sakura</user-name> <user-name>joe</user-name> </group> </groups> </nacm> </data> </rpc>¶
To retrieve last-modified attributes for "acls", but not for "nacm", a client might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="4" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config> <source> <running/> </source> <filter> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:last-modified="?"/> <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm"/> </filter> </get-config> </rpc>¶
If the server considers "acls", "acl", "aces" and "acl" to be versioned nodes, the server's response to the request above might look like:¶
<rpc-reply message-id="4" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:last-modified="2022-04-01T12:34:56.789012Z"> <acl txid:last-modified="2022-03-20T16:20:11.333444Z"> <name>A1</name> <ace txid:last-modified="2022-03-20T16:20:11.333444Z"> <name>R1</name> <matches> <ipv4> <protocol>udp</protocol> </ipv4> </matches> </ace> </acl> <acl txid:last-modified="2022-04-01T12:34:56.789012Z"> <name>A2</name> <aces txid:last-modified="2022-04-01T12:34:56.789012Z"> <ace txid:last-modified="2022-03-20T16:20:11.333444Z"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> <ace txid:last-modified="2022-04-01T12:34:56.789012Z"> <name>R8</name> <matches> <udp> <source-port> <port>22</port> </source-port> </udp> </matches> </ace> <ace txid:last-modified="2022-04-01T12:34:56.789012Z"> <name>R9</name> <matches> <tcp> <source-port> <port>22</port> </source-port> </tcp> </matches> </ace> </aces> </acl> </acls> <nacm xmlns="urn:ietf:params:xml:ns:yang:ietf-netconf-acm"/> <groups> <group> <name>admin</name> <user-name>sakura</user-name> <user-name>joe</user-name> </group> </groups> </nacm> </data> </rpc>¶
A NETCONF client that already knows some txid values MAY request that the configuration retrieval request is pruned with respect to the client's prior knowledge.¶
To retrieve only changes for "acls" that do not have the last known etag txid value, a client might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="6" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config> <source> <running/> </source> <filter> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc5152"> <acl txid:etag="nc4711"> <name>A1</name> <aces txid:etag="nc4711"/> </acl> <acl txid:etag="nc5152"> <name>A2</name> <aces txid:etag="nc5152"/> </acl> </filter> </get-config> </rpc>¶
Assuming the NETCONF server configuration is the same as in the previous rpc-reply example, the server's response to request above might look like:¶
<rpc-reply message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="="/> </data> </rpc>¶
Or, if a configuration change has taken place under /acls since the client was last updated, the server's response may look like:¶
<rpc-reply message-id="6" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc6614"> <acl txid:etag="="> <name>A1</name> </acl> <acl txid:etag="nc6614"> <name>A2</name> <aces txid:etag="nc6614"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> <ace txid:etag="nc5152"> <name>R8</name> <matches> <ipv4> <source-port> <port>22</port> </source-port> </ipv4> </matches> </ace> <ace txid:etag="nc6614"> <name>R9</name> <matches> <ipv4> <source-port> <port>830</port> </source-port> </ipv4> </matches> </ace> </aces> </acl> </acls> </data> </rpc>¶
In case the client provides a txid value for a non-versioned node, the server needs to treat the node as having the same txid value as the closest ancestor that does have a txid value.¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="7" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <get-config> <source> <running/> </source> <filter> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list"> <acl> <name>A2</name> <aces> <ace> <name>R7</name> <matches> <ipv4> <dscp txid:etag="nc4711"/> </ipv4> </matches> </ace> </aces> </acl> </acls> </filter> </get-config> </rpc>¶
If a txid value is specified for a leaf, and the txid value matches, the leaf value is pruned.¶
<rpc-reply message-id="7" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list"> <acl> <name>A2</name> <aces> <ace> <name>R7</name> <matches> <ipv4> <dscp txid:etag="="/> </ipv4> </matches> </ace> </aces> </acl> </acls> </data> </rpc-reply>¶
A client that wishes to update the ace R1 protocol to tcp might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="8"> <edit-config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:ietf-netconf-txid= "urn:ietf:params:xml:ns:yang:ietf-netconf-txid"> <target> <running/> </target> <test-option>test-then-set</test-option> <ietf-netconf-txid:with-etag>true<ietf-netconf-txid:with-etag> <config> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc5152"> <acl txid:etag="nc4711"> <name>A1</name> <aces txid:etag="nc4711"> <ace txid:etag="nc4711"> <matches> <ipv4> <protocol>tcp</protocol> </ipv4> </matches> </ace> </aces> </acl> </acls> </config> </edit-config> </rpc>¶
The server would update the protocol leaf in the running datastore, and return an rpc-reply as follows:¶
<rpc-reply message-id="8" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <ok txid:etag="nc7688"/> </rpc-reply>¶
A subsequent get-config request for "acls", with txid:etag="?" might then return:¶
<rpc-reply message-id="9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc7688"> <acl txid:etag="nc7688"> <name>A1</name> <aces txid:etag="nc7688"> <ace txid:etag="nc7688"> <name>R1</name> <matches> <ipv4> <protocol>tcp</protocol> </ipv4> </matches> </ace> </aces> </acl> <acl txid:etag="nc6614"> <name>A2</name> <aces txid:etag="nc6614"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> <ace txid:etag="nc5152"> <name>R8</name> <matches> <udp> <source-port> <port>22</port> </source-port> </udp> </matches> </ace> <ace txid:etag="nc6614"> <name>R9</name> <matches> <tcp> <source-port> <port>830</port> </source-port> </tcp> </matches> </ace> </aces> </acl> </acls> </data> </rpc>¶
In case the server at this point received a configuration change from another source, such as a CLI operator, removing ace R8 and R9 in acl A2, a subsequent get-config request for acls, with txid:etag="?" might then return:¶
<rpc-reply message-id="9" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="cli2222"> <acl txid:etag="nc7688"> <name>A1</name> <aces txid:etag="nc7688"> <ace txid:etag="nc7688"> <name>R1</name> <matches> <ipv4> <protocol>tcp</protocol> </ipv4> </matches> </ace> </aces> </acl> <acl txid:etag="cli2222"> <name>A2</name> <aces txid:etag="cli2222"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> </aces> </acl> </acls> </data> </rpc>¶
If a client wishes to delete acl A1 if and only if its configuration has not been altered since this client last synchronized its configuration with the server, at which point it received the etag "nc7688" for acl A1, regardless of any possible changes to other acls, it might send:¶
<rpc xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="10" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0" xmlns:ietf-netconf-txid= "urn:ietf:params:xml:ns:yang:ietf-netconf-txid"> <edit-config> <target> <runnign/> </target> <test-option>test-then-set</test-option> <ietf-netconf-txid:with-etag>true<ietf-netconf-txid:with-etag> <config> <acls xmlns= "urn:ietf:params:xml:ns:yang:ietf-access-control-list"> <acl nc:operation="delete" txid:etag="nc7688"> <name>A1</name> </acl> </acls> </config> </edit-config> </rpc>¶
If acl A1 now has the etag txid value "nc7688", as expected by the client, the transaction goes through, and the server responds something like:¶
<rpc-reply message-id="10" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <ok txid:etag="nc8008"/> </rpc-reply>¶
A subsequent get-config request for acls, with txid:etag="?" might then return:¶
<rpc-reply message-id="11" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:txid="urn:ietf:params:xml:ns:netconf:txid:1.0"> <data> <acls xmlns="urn:ietf:params:xml:ns:yang:ietf-access-control-list" txid:etag="nc8008"> <acl txid:etag="cli2222"> <name>A2</name> <aces txid:etag="cli2222"> <ace txid:etag="nc4711"> <name>R7</name> <matches> <ipv4> <dscp>AF11</dscp> </ipv4> </matches> </ace> </aces> </acl> </acls> </data> </rpc>¶
In case acl A1 did not have the expected etag txid value "nc7688", when the server processed this request, it rejects the transaction, and might send:¶
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:acl= "urn:ietf:params:xml:ns:yang:ietf-access-control-list" xmlns:ietf-netconf-txid= "urn:ietf:params:xml:ns:yang:ietf-netconf-txid" message-id="11"> <rpc-error> <error-type>protocol</error-type> <error-tag>operation-failed</error-tag> <error-severity>error</error-severity> <error-info> <ietf-netconf-txid:txid-value-mismatch-error-info> <ietf-netconf-txid:mismatch-path> /acl:acls/acl:acl[acl:name="A1"] </ietf-netconf-txid:mismatch-path> <ietf-netconf-txid:mismatch-etag-value> cli6912 </ietf-netconf-txid:mismatch-etag-value> </ietf-netconf-txid:txid-value-mismatch-error-info> </error-info> </rpc-error> </rpc-reply>¶
A client MAY request that the updates for one or more YANG Push subscriptions are annotated with the txid values. The request might look like this:¶
<netconf:rpc message-id="13" xmlns:netconf="urn:ietf:params:xml:ns:netconf:base:1.0"> <establish-subscription xmlns= "urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications" xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-push" xmlns:ietf-netconf-txid-yp= "urn:ietf:params:xml:ns:yang:ietf-txid-yang-push"> <yp:datastore xmlns:ds="urn:ietf:params:xml:ns:yang:ietf-datastores"> ds:running </yp:datastore> <yp:datastore-xpath-filter xmlns:acl= "urn:ietf:params:xml:ns:yang:ietf-access-control-list"> /acl:acls </yp:datastore-xpath-filter> <yp:periodic> <yp:period>500</yp:period> </yp:periodic> <ietf-netconf-txid-yp:with-etag> true </ietf-netconf-txid-yp:with-etag> </establish-subscription> </netconf:rpc>¶
In case a client wishes to modify a previous subscription request in order to no longer receive YANG Push subscription updates, the request might look like this:¶
<rpc message-id="14" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"> <modify-subscription xmlns= "urn:ietf:params:xml:ns:yang:ietf-subscribed-notifications" xmlns:yp="urn:ietf:params:xml:ns:yang:ietf-yang-push" xmlns:ietf-netconf-txid-yp= "urn:ietf:params:xml:ns:yang:ietf-txid-yang-push"> <id>1011</id> <yp:datastore xmlns:ds="urn:ietf:params:xml:ns:yang:ietf-datastores"> ds:running </yp:datastore> <ietf-netconf-txid-yp:with-etag> false </ietf-netconf-txid-yp:with-etag> </modify-subscription> </rpc>¶
A server might send a subscription update like this:¶
<notification xmlns="urn:ietf:params:xml:ns:netconf:notification:1.0"> <eventTime>2022-04-04T06:00:24.16Z</eventTime> <push-change-update xmlns="urn:ietf:params:xml:ns:yang:ietf-yang-push"> <id>89</id> <datastore-changes> <yang-patch> <patch-id>0</patch-id> <edit txid:etag="nc8008"> <edit-id>edit1</edit-id> <operation>delete</operation> <target xmlns:acl= "urn:ietf:params:xml:ns:yang:ietf-access-control-list"> /acl:acls </target> <value> <acl xmlns= "urn:ietf:params:xml:ns:yang:ietf-access-control-list"> <name>A1</name> </acl> </value> </edit> </yang-patch> </datastore-changes> </push-change-update> </notification>¶
module ietf-netconf-txid { yang-version 1.1; namespace 'urn:ietf:params:xml:ns:yang:ietf-netconf-txid'; prefix ietf-netconf-txid; import ietf-netconf { prefix nc; } import ietf-netconf-nmda { prefix ncds; } import ietf-yang-structure-ext { prefix sx; } import ietf-yang-types { prefix yang; } organization "IETF NETCONF (Network Configuration) Working Group"; contact "WG Web: <http://tools.ietf.org/wg/netconf/> WG List: <netconf@ietf.org> Author: Jan Lindblad <mailto:jlindbla@cisco.com>"; description "NETCONF Transaction ID aware operations for NMDA. Copyright (c) 2022 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info). This version of this YANG module is part of RFC XXXX (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself for full legal notices. The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document are to be interpreted as described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, they appear in all capitals, as shown here. "; revision 2022-04-01 { description "Initial revision"; reference "RFC XXXX: Xxxxxxxxx"; } typedef etag-t { type string { pattern ".* .*" { modifier invert-match; } pattern '.*".*' { modifier invert-match; } pattern ".*\\.*" { modifier invert-match; } } description "Unique Entity-tag txid value representing a specific transaction. Could be any string that does not contain spaces, double quotes or backslash. The txid values '?' and '=' have special meaning."; } typedef last-modified-t { type union { type yang:date-and-time; type enumeration { enum ? { description "Txid value used by clients that is guaranteed not to match any txid on the server."; } enum = { description "Txid value used by servers to indicate that contents has been pruned due to txid match between client and server."; } } } description "Last-modified txid value representing a specific transaction. The txid values '?' and '=' have special meaning."; } grouping txid-grouping { leaf with-etag { type boolean; description "Indicates whether the client requests the server to include a txid:etag txid attribute when the configuration has changed."; } leaf with-last-modified { type boolean; description "Indicates whether the client requests the server to include a txid:last-modified attribute when the configuration has changed."; } description "Grouping for txid mechanisms, to be augmented into rpcs that modify configuration data stores."; } augment /nc:edit-config/nc:input { uses txid-grouping; description "Injects the txid mechanisms into the edit-config operation"; } augment /nc:commit/nc:input { uses txid-grouping; description "Injects the txid mechanisms into the commit operation"; } augment /ncds:edit-data/ncds:input { uses txid-grouping; description "Injects the txid mechanisms into the edit-data operation"; } sx:structure txid-value-mismatch-error-info { container txid-value-mismatch-error-info { description "This error is returned by a NETCONF server when a client sends a configuration change request, with the additonal condition that the server aborts the transaction if the server's configuration has changed from what the client expects, and the configuration is found not to actually not match the client's expectation."; leaf mismatch-path { type instance-identifier; description "Indicates the YANG path to the element with a mismatching etag txid value."; } leaf mismatch-etag-value { type etag-t; description "Indicates server's txid value of the etag attribute for one mismatching element."; } leaf mismatch-last-modified-value { type last-modified-t; description "Indicates server's txid value of the last-modified attribute for one mismatching element."; } } } }¶
module ietf-netconf-txid-yang-push { yang-version 1.1; namespace 'urn:ietf:params:xml:ns:yang:ietf-netconf-txid-yang-push'; prefix ietf-netconf-txid-yp; import ietf-subscribed-notifications { prefix sn; reference "RFC 8639: Subscription to YANG Notifications"; } import ietf-netconf-txid { prefix ietf-netconf-txid; reference "RFC XXXX: Xxxxxxxxx"; } organization "IETF NETCONF (Network Configuration) Working Group"; contact "WG Web: <http://tools.ietf.org/wg/netconf/> WG List: <netconf@ietf.org> Author: Jan Lindblad <mailto:jlindbla@cisco.com>"; description "NETCONF Transaction ID aware operations for YANG Push. Copyright (c) 2022 IETF Trust and the persons identified as authors of the code. All rights reserved. Redistribution and use in source and binary forms, with or without modification, is permitted pursuant to, and subject to the license terms contained in, the Simplified BSD License set forth in Section 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info). This version of this YANG module is part of RFC XXXX (https://www.rfc-editor.org/info/rfcXXXX); see the RFC itself for full legal notices. The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED', 'MAY', and 'OPTIONAL' in this document are to be interpreted as described in BCP 14 (RFC 2119) (RFC 8174) when, and only when, they appear in all capitals, as shown here. "; revision 2022-04-01 { description "Initial revision"; reference "RFC XXXX: Xxxxxxxxx"; } augment "/sn:establish-subscription/sn:input" { description "This augmentation adds additional subscription parameters that apply specifically to datastore updates to RPC input."; uses ietf-netconf-txid:txid-grouping; } augment "/sn:modify-subscription/sn:input" { description "This augmentation adds additional subscription parameters specific to datastore updates."; uses ietf-netconf-txid:txid-grouping; } augment "/sn:subscriptions/sn:subscription" { description "This augmentation adds additional subscription parameters specific to datastore updates."; uses ietf-netconf-txid:txid-grouping; } }¶
TODO Security¶
This document registers the following capability identifier URN in the 'Network Configuration Protocol (NETCONF) Capability URNs' registry:¶
urn:ietf:params:netconf:capability:txid:1.0¶
This document registers three XML namespace URNs in the 'IETF XML registry', following the format defined in RFC 3688.¶
URI: urn:ietf:params:xml:ns:netconf:txid:1.0 URI: urn:ietf:params:xml:ns:yang:ietf-netconf-txid URI: urn:ietf:params:xml:ns:yang:ietf-netconf-txid-yang-push Registrant Contact: The NETCONF WG of the IETF. XML: N/A, the requested URIs are XML namespaces.¶
This document registers two module names in the 'YANG Module Names' registry, defined in RFC 6020.¶
name: ietf-netconf-txid prefix: ietf-netconf-txid namespace: urn:ietf:params:xml:ns:yang:ietf-netconf-txid RFC: XXXX¶
and¶
name: ietf-netconf-txid-yp prefix: ietf-netconf-txid-yp namespace: urn:ietf:params:xml:ns:yang:ietf-netconf-txid-yang-push RFC: XXXX¶
The author wishes to thank Benoit Claise for making this work happen, and the following individuals, who all provided helpful comments: Per Andersson, Kent Watsen, Andy Bierman, Robert Wilton, Qiufang Ma.¶