-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraft-lindblad-netconf-transaction-id.txt
2101 lines (1787 loc) · 79.8 KB
/
draft-lindblad-netconf-transaction-id.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
NETCONF J. Lindblad
Internet-Draft Cisco Systems
Intended status: Standards Track 8 June 2022
Expires: 10 December 2022
Transaction ID Mechanism for NETCONF
draft-lindblad-netconf-transaction-id-latest
Abstract
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.
Discussion Venues
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.
Status of This Memo
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 Notice
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.
Table of Contents
1. Introduction
2. Conventions and Definitions
3. NETCONF Txid Extension
3.1. Use Cases
3.2. General Txid Principles
3.3. Initial Configuration Retrieval
3.4. Subsequent Configuration Retrieval
3.5. Conditional Transactions
3.5.1. Transactions toward the Candidate Datastore
3.6. Dependencies within Transactions
3.7. Other NETCONF Operations
3.8. YANG-Push Subscriptions
4. Txid Mechanisms
4.1. The etag attribute txid mechanism
4.2. The last-modified attribute txid mechanism
4.3. Common features to both etag and last-modified txid
mechanisms
5. Txid Mechanism Examples
5.1. Initial Configuration Response
5.1.1. With etag
5.1.2. With last-modified
5.2. Configuration Response Pruning
5.3. Configuration Change
5.4. Conditional Configuration Change
5.5. Using etags with Other NETCONF Operations
5.6. YANG-Push
6. YANG Modules
6.1. Base module for txid in NETCONF
6.2. Additional support for txid in YANG-Push
7. Security Considerations
8. IANA Considerations
9. Changes
9.1. Major changes in -02 since -01
9.2. Major changes in -01 since -00
10. Normative References
Acknowledgments
Author's Address
1. Introduction
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 (https://tools.ietf.org/html/rfc8040), 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
(https://tools.ietf.org/html/rfc7232) "Hypertext Transfer Protocol
(HTTP/1.1): Conditional Requests".
This document defines similar functionality for NETCONF, RFC 6241
(https://tools.ietf.org/html/rfc6241), and ties this in with YANG-
Push, RFC 8641 (https://tools.ietf.org/html/rfc8641).
2. Conventions and Definitions
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
(https://tools.ietf.org/html/rfc6241), RFC7950
(https://tools.ietf.org/html/rfc7950), RFC8040
(https://tools.ietf.org/html/rfc8040), and RFC8641
(https://tools.ietf.org/html/rfc8641).
In addition, this document defines the following terms:
Versioned node A node in the instantiated YANG data tree for which
the server maintains a transaction id (txid) value.
3. NETCONF Txid Extension
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.
3.1. Use Cases
The common use cases for such mecahnisms are briefly discussed here.
Initial configuration retrieval When the client initially connects
to a server, it may be interested to acquire a current view of
(parts of) the server's configuration. In order to be able to
efficiently detect changes later, it may also be interested to
store meta level txid information for subtrees of the
configuration.
Subsequent configuration retrieval When a client needs to reread
(parts of) the server's configuration, it may be interested to
leverage the txid meta data it has stored by requesting the server
to prune the response so that it does not repeat configuration
data that the client is already aware of.
Configuration update with txid return When a client issues a
transaction towards a server, it may be interested to also learn
the new txid meta data the server has stored for the updated parts
of the configuration.
Configuration update with txid specification When a client issues a
transaction towards a server, it may be interested to also specify
the new txid meta data that the server stores for the updated
parts of the configuration.
Conditional configuration change When a client issues a transaction
towards a server, it may specify txid meta data for the
transaction in order to allow the server to verify that the client
is up to date with any changes in the parts of the configuration
that it is concerned with. If the txid meta data in the server is
different than the client expected, the server rejects the
transaction with a specific error message.
Subscribe to configuration changes with txid return When a client
subscribes to configuration change updates through YANG-Push, it
may be interested to also learn the the updated txid meta data for
the changed data trees.
3.2. General Txid Principles
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 (https://tools.ietf.org/html/rfc7950) 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.
3.3. Initial Configuration Retrieval
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.
Client Server
| |
| ------------------------------------------> |
| get-config |
| acls (txid: ?) |
| |
| <------------------------------------------ |
| data |
| acls (txid: 5152) |
| acl A1 (txid: 4711) |
| aces (txid: 4711) |
| ace R1 (txid: 4711) |
| matches ipv4 protocol udp |
| acl A2 (txid: 5152) |
| aces (txid: 5152) |
| ace R7 (txid: 4711) |
| matches ipv4 dscp AF11 |
| ace R8 (txid: 5152) |
| matches udp source-port port 22 |
| ace R9 (txid: 5152) |
| matches tcp source-port port 22 |
v v
Figure 1: Initial Configuration Retrieval. The server returns
the requested configuration, annotated with txid values. The
most recent change seems to have been an update to the R8 and R9
source-port.
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.
3.4. Subsequent Configuration Retrieval
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:
* The node is not a versioned node, i.e. the server does not
maintain a txid value for this node. In this case, the server
MUST look up the closest ancestor that is a versioned node, and
use the txid value of that node as the txid value of this node in
the further handling below. The datastore root is always a
versioned node.
* The client specified txid value is different than the server's
txid value for this node. In this case the server MUST return the
contents as it would otherwise have done, adding the txid values
of all child versioned nodes to the response. In case the client
has specified txid values for some child nodes, then these cases
MUST be re-evaluated for those child nodes.
* The node is a versioned node, and the client specified txid value
matches the server's txid value. In this case the server MUST
return the node decorated with a special "txid-match" txid value
(e.g. "=") to the matching node, pruning any value and child
nodes. A server MUST NOT ever use the txid-match value (e.g. "=")
as an actual txid value.
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.
Client Server
| |
| ------------------------------------------> |
| get-config |
| acls (txid: 5152) |
| acl A1 (txid: 4711) |
| aces (txid: 4711) |
| acl A2 (txid: 5152) |
| aces (txid: 5152) |
| |
| <------------------------------------------ |
| data |
| acls (txid: =) |
v v
Figure 2: Response Pruning. Client sends get-config request with
known txid values. Server prunes response where txid matches
expectations.
Client Server
| |
| ------------------------------------------> |
| get-config |
| acls (txid: 5152) |
| acl A1 (txid: 4711) |
| acl A2 (txid: 5152) |
| |
| <------------------------------------------ |
| data |
| acls (txid: 6614) |
| acl A1 (txid: =) |
| acl A2 (txid: 6614) |
| aces (txid: 6614) |
| ace R7 (txid: 4711) |
| matches ipv4 dscp AF11 |
| ace R8 (txid: 5152) |
| matches udp source-port port 22 |
| ace R9 (txid: 6614) |
| matches tcp source-port port 830 |
v v
Figure 3: Out of band change detected. Client sends get-config
request with known txid values. Server provides update where
changes have happened.
Client Server
| |
| ------------------------------------------> |
| get-config |
| acls |
| acls A2 |
| aces |
| ace R7 |
| matches |
| ipv4 |
| dscp (txid: 4711) |
| |
| <------------------------------------------ |
| data |
| acls |
| acl A2 |
| aces |
| ace R7 |
| matches |
| ipv4 |
| dscp (txid: =) |
v v
Figure 4: Versioned nodes. Server lookup of dscp txid gives
4711, as closest ancestor is ace R7 with txid 4711. Since the
server's and client's txid match, the etag value is '=', and the
leaf value is pruned.
3.5. Conditional Transactions
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.
Client Server
| |
| ------------------------------------------> |
| edit-config (request new txid in response) |
| config (txid: 5152) |
| acls (txid: 5152) |
| acl A1 (txid: 4711) |
| aces (txid: 4711) |
| ace R1 (txid: 4711) |
| matches ipv4 protocol tcp |
| |
| <------------------------------------------ |
| ok (txid: 7688) |
v v
Figure 5: Conditional transaction towards the Running datastore
successfully executed. As all the txid values specified by the
client matched those on the server, the transaction was
successfully executed.
Client Server
| |
| ------------------------------------------> |
| get-config |
| acls (txid: ?) |
| |
| <------------------------------------------ |
| data (txid: 7688) |
| acls (txid: 7688) |
| acl A1 (txid: 7688) |
| aces (txid: 7688) |
| ace R1 (txid: 7688) |
| matches ipv4 protocol tcp |
| acl A2 (txid: 6614) |
| aces (txid: 6614) |
| ace R7 (txid: 4711) |
| matches ipv4 dscp AF11 |
| ace R8 (txid: 5152) |
| matches udp source-port port 22 |
| ace R9 (txid: 6614) |
| matches tcp source-port port 830 |
v v
Figure 6: For all leaf objects that were changed, and all their
ancestors, the txids are updated to the value returned in 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.
Client Server
| |
| ------------------------------------------> |
| edit-config |
| config |
| acls |
| acl A1 (txid: 4711) |
| aces (txid: 4711) |
| ace R1 (txid: 4711) |
| ipv4 dscp AF22 |
| |
| <------------------------------------------ |
| rpc-error |
| error-tag operation-failed |
| error-type protocol |
| error-severity error |
| error-info |
| mismatch-path /acls/acl[A1] |
| mismatch-etag-value 6912 |
v v
Figure 7: Conditional transaction that fails a txid check. The
client wishes to ensure there has been no changes to the
particular acl entry it edits, and therefore sends the txid it
knows for this part of the configuration. Since the txid has
changed (out of band), the server rejects the configuration
change request and reports an error with details about where the
mismatch was detected.
3.5.1. Transactions toward the Candidate Datastore
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.
Client Server
| |
| ------------------------------------------> |
| edit-config |
| config (txid: 5152) |
| acls (txid: 5152) |
| acl A1 (txid: 4711) |
| type ipv4 |
| |
| <------------------------------------------ |
| ok |
| |
| ------------------------------------------> |
| edit-config |
| config |
| acls |
| acl A1 |
| aces (txid: 4711) |
| ace R1 (txid: 4711) |
| matches ipv4 protocol tcp |
| |
| <------------------------------------------ |
| ok |
| |
| ------------------------------------------> |
| commit (request new txid in response) |
| |
| <------------------------------------------ |
| ok (txid: 7688) |
v v
Figure 8: Conditional transaction towards the Candidate datastore
successfully executed. As all the txid values specified by the
client matched those on the server, the transaction was
successfully executed.
3.6. Dependencies within Transactions
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:
Client Server
| |
| ------------------------------------------> |
| get-config |
| energy (txid: ?) |
| acls (txid: ?) |
| |
| <------------------------------------------ |
| data (txid: 7688) |
| energy metering-enabled true (txid: 4711) |
| acls (txid: 7688) |
| acl A1 (txid: 7688) |
| energy-tracing false |
| aces (txid: 7688) |
| ace R1 (txid: 7688) |
| matches ipv4 protocol tcp |
| acl A2 (txid: 6614) |
| energy-tracing true |
| aces (txid: 6614) |
| ace R7 (txid: 4711) |
| matches ipv4 dscp AF11 |
| ace R8 (txid: 5152) |
| matches udp source-port port 22 |
| ace R9 (txid: 6614) |
| matches tcp source-port port 830 |
v v
Figure 9: Initial configuration for the energy example. Note the
energy metering-enabled leaf at the top and energy-tracing leafs
under each acl.
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.
Client Server
| |
| ------------------------------------------> |
| edit-config (request new txid in response) |
| config |
| energy metering-enabled false |
| |
| <------------------------------------------ |
| ok (txid: 9118) |
v v
Figure 10: Transaction changing a single leaf. This leaf is the
target of a when-statement, however, which means other leafs
elsewhere may be indirectly modified by this change. Such
indirect changes will also result in txid changes.
After the transaction above, the new configuration state has the
energy-tracing leafs removed.
Client Server
| |
| ------------------------------------------> |
| get-config |
| energy (txid: ?) |
| acls (txid: ?) |
| |
| <------------------------------------------ |
| data (txid: 9118) |
| energy metering-enabled false (txid: 9118) |
| acls (txid: 9118) |
| acl A1 (txid: 9118) |
| aces (txid: 7688) |
| ace R1 (txid: 7688) |
| matches ipv4 protocol tcp |
| acl A2 (txid: 9118) |
| aces (txid: 6614) |
| ace R7 (txid: 4711) |
| matches ipv4 dscp AF11 |
| ace R8 (txid: 5152) |
| matches udp source-port port 22 |
| ace R9 (txid: 6614) |
| matches tcp source-port port 830 |
v v
Figure 11: The txid for the energy subtree has changed since that
was the target of the edit-config. The txids of the ACLs have
also changed since the energy-tracing leafs are now removed by
the now false when- expression.
3.7. Other NETCONF Operations
discard-changes The discard-changes operation resets the candidate
datastore to the contents of the running datastore. The server
MUST ensure the txid values in the candidate datastore get the
same txid values as in the running datastore when this operation
runs.
copy-config The copy-config operation can be used to copy contents
between datastores. The server MUST ensure the txid values retain
the same txid values as in the soruce datastore.
If copy-config is used to copy from a file, URL or other source
that is not a datastore, the server MUST ensure the txid values
are changed for the versioned nodes that are changed or have child
nodes changed by the operation.
delete-config The server MUST ensure the datastore txid value is
changed, unless it was already empty.
commit At commit, with regards to the txid values, the server MUST
treat the contents of the candidate datastore as if any txid value
provided by the client when updating the candidate was provided in
a single edit-config towards the running datastore. If the
transaction is rejected due to txid value mismatch, an rpc-error
as described in section Conditional Transactions (Section 3.5)
MUST be sent.
3.8. YANG-Push Subscriptions
A client issuing a YANG-Push establish-subscription or modify-
subscription request towards a server that supports both YANG-Push
RFC 8641 (https://tools.ietf.org/html/rfc8641) and a txid mechanism
MAY request that the server provides updated txid values in YANG-Push
subscription updates.
4. Txid Mechanisms
This document defines two txid mechanisms:
* The etag attribute txid mechanism
* The last-modified attribute txid mechanism
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.
4.1. The etag attribute txid mechanism
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
(https://tools.ietf.org/html/rfc7232). 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
(https://tools.ietf.org/html/rfc8040), specifically sections 3.4.1.2,
3.4.1.3 and 3.5.2.
4.2. The last-modified attribute txid mechanism
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
(https://datatracker.ietf.org/doc/html/rfc6991).
"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 (https://tools.ietf.org/html/
rfc8040), 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 (https://tools.ietf.org/html/rfc8040),
specifically sections 3.4.1.1, 3.4.1.3 and 3.5.1.
4.3. Common features to both etag and last-modified txid mechanisms
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:
* /nc:rpc/nc:get-config
* /nc:rpc/nc:get-config/nc:filter//*
* /nc:rpc/ncds:get-data
* /nc:rpc/ncds:get-data/ncds:subtree-filter//*
* /nc:rpc/ncds:get-data/ncds:xpath-filter//*
* /nc:rpc/nc:edit-config/nc:config
* /nc:rpc/nc:edit-config/nc:config//*
* /nc:rpc/ncds:edit-data/ncds:config
* /nc:rpc/ncds:edit-data/ncds:config//*
In server messages sent to a client:
* /nc:rpc-reply/nc:data
* /nc:rpc-reply/nc:data//*
* /nc:rpc-reply/ncds:data
* /nc:rpc-reply/ncds:data//*
* /nc:rpc-reply/nc:ok
* /yp:push-update/yp:datastore-contents/ypatch:yang-patch/
ypatch:edit
* /yp:push-update/yp:datastore-contents/ypatch:yang-patch/
ypatch:edit/ypatch:value//*
* /yp:push-change-update/yp:datastore-contents/ypatch:yang-patch/
ypatch:edit
* /yp:push-change-update/yp:datastore-contents/ypatch:yang-patch/
ypatch:edit/ypatch:value//*
5. Txid Mechanism Examples
5.1. Initial Configuration Response
5.1.1. With etag
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: