-
Notifications
You must be signed in to change notification settings - Fork 3
/
draft-verdt-netmod-yang-module-versioning.xml
1224 lines (1087 loc) · 60 KB
/
draft-verdt-netmod-yang-module-versioning.xml
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
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE rfc SYSTEM "rfc2629.dtd" [
<!ENTITY RFC6020 SYSTEM "reference.RFC.6020.xml">
<!ENTITY RFC7895 SYSTEM "reference.RFC.7895.xml">
<!ENTITY RFC7950 SYSTEM "reference.RFC.7950.xml">
<!ENTITY RFC8407 SYSTEM "reference.RFC.8407.xml">
<!ENTITY OPENCONFIG-YANG-CATALOG SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.openconfig-netmod-model-catalog.xml">
<!ENTITY CLAISE-SEMVER "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.claise-semver.xml">
<!ENTITY OPENCONFIG-YANG-CATALOG SYSTEM "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.openconfig-netmod-model-catalog.xml">
<!ENTITY CLACLA-NETMOD-MODEL-CATALOG "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.clacla-netmod-model-catalog.xml">
<!ENTITY VERDT-NETMOD-YANG-VERSIONING-REQS "http://xml.resource.org/public/rfc/bibxml3/reference.I-D.verdt-netmod-yang-versioning-reqs.xml">
]>
<?xml-stylesheet type="text/xsl" href="rfc2629.xslt" ?>
<?rfc toc="yes"?>
<?rfc tocompact="yes"?>
<?rfc tocdepth="4"?>
<?rfc tocindent="yes"?>
<?rfc symrefs="yes"?>
<?rfc sortrefs="yes"?>
<?rfc comments="yes"?>
<?rfc inline="yes"?>
<?rfc compact="yes"?>
<?rfc subcompact="no"?>
<rfc updates="7950,8407,8525" category="std" ipr="trust200902" docName="draft-verdt-netmod-yang-module-versioning-02">
<front>
<title abbrev="Updated YANG Module Revision Handling">Updated YANG Module Revision Handling</title>
<author initials="B." surname="Claise" fullname="Benoit Claise">
<organization abbrev="Cisco Systems, Inc.">
Cisco Systems, Inc.
</organization>
<address>
<postal>
<street>De Kleetlaan 6a b1</street>
<city>1831 Diegem</city>
<country>Belgium</country>
</postal>
<phone>+32 2 704 5622</phone>
<email>bclaise@cisco.com</email>
</address>
</author>
<author initials="J." surname="Clarke" fullname="Joe Clarke">
<organization>Cisco Systems, Inc.</organization>
<address>
<postal>
<street>7200-12 Kit Creek Rd</street>
<city>Research Triangle Park</city>
<region>North Carolina</region>
<country>United States of America</country>
</postal>
<phone>+1-919-392-2867</phone>
<email>jclarke@cisco.com</email>
</address>
</author>
<author initials="R." surname="Rahman" fullname="Reshad Rahman">
<organization abbrev="Cisco Systems, Inc.">
Cisco Systems, Inc.
</organization>
<address>
<email>rrahman@cisco.com</email>
</address>
</author>
<author initials="R." role="editor" surname="Wilton" fullname="Robert Wilton">
<organization abbrev="Cisco Systems, Inc.">
Cisco Systems, Inc.
</organization>
<address>
<email>rwilton@cisco.com</email>
</address>
</author>
<author initials="B." surname="Lengyel" fullname="Balazs Lengyel">
<organization abbrev="Ericsson"> Ericsson </organization>
<address>
<postal>
<street>Magyar Tudosok Korutja</street>
<city>1117 Budapest</city>
<country>Hungary</country>
</postal>
<phone>+36-70-330-7909</phone>
<email>balazs.lengyel@ericsson.com</email>
</address>
</author>
<author initials="J." surname="Sterne" fullname="Jason Sterne">
<organization abbrev="Nokia">
Nokia
</organization>
<address>
<email>jason.sterne@nokia.com</email>
</address>
</author>
<author initials="K." surname="D'Souza" fullname="Kevin D'Souza">
<organization>AT&T</organization>
<address>
<postal>
<street>200 S. Laurel Ave</street>
<city>Middletown</city>
<region>NJ</region>
<country>United States of America</country>
</postal>
<phone></phone>
<email>kd6913@att.com</email>
</address>
</author>
<date/>
<abstract>
<t>This document specifies a new YANG module update procedure that can document when non-backwards-compatible changes
have occurred during the evolution of a YANG module. It extends the YANG import statement with an earliest revision
filter to better represent inter-module dependencies. It provides help and guidelines for managing the lifecycle of
YANG modules and individual schema nodes. This document updates RFC 7950, RFC 8407 and RFC 8525.</t>
</abstract>
</front>
<middle>
<section anchor="intro" title="Introduction">
<t>This document defines a solution to the YANG module lifecycle problems described in <xref
target="I-D.verdt-netmod-yang-versioning-reqs"/>. Complementary documents provide a complete solution to the YANG
versioning requirements, with the overall relationship of the solution drafts described in <xref
target="I-D.verdt-netmod-yang-solutions"/>.</t>
<t>Specifically, this document recognises a need (within standards organizations, vendors, and the industry) to
sometimes allow YANG modules to evolve with non-backwards-compatible changes, which could cause breakage to clients
and importing YANG modules. Accepting that non-backwards-compatible changes do sometimes occur, it is important to
have mechanisms to report where these changes occur, and to manage their effect on clients and the broader YANG
ecosystem.</t>
<t>The solution comprises five parts:
<list style="bullets">
<t>Refinements to the YANG 1.1 module revision update procedure, supported by new extension statements to indicate
when a revision contains non-backwards-compatible changes, and an optional revision label.</t>
<t>A YANG extension statement allowing YANG module imports to specify an earliest module revision that may satisfy the
import dependency.</t>
<t>Updates and augmentations to ietf-yang-library to include the revision label in the module descriptions, to
report how "deprecated" and "obsolete" nodes are handled by a server, and to clarify how module imports are resolved
when multiple versions could otherwise be chosen.</t>
<t>Considerations of how versioning applies to YANG instance data.</t>
<t>Guidelines for how the YANG module update rules defined in this document should be used, along with examples.</t>
</list>
</t>
<t>Open issues are tracked at <eref target="https://github.com/netmod-wg/yang-ver-dt/issues"/>.</t>
<section anchor="changes" title="Updates to YANG RFCs">
<t>This document updates <xref target="RFC7950"/> section 11. <xref target="yang_revision_handling"/> describes modifications to
YANG revision handling and update rules, and <xref target="import"/> describes a YANG extension statement to do import by derived
revision.</t>
<t>This document updates <xref target="RFC8525"/> section 3. <xref target="ietf_yang_library_updates"/> defines how a client
of a YANG library datastore schema chooses which revision of an import-only module is used to resolve a module
import when the definition is otherwise ambiguous.</t>
<t>This document updates <xref target="RFC8407"/> section 4.7. <xref target="guidelines"/> provides guidelines on managing the
lifecycle of YANG modules that may contain non-backwards-compatible changes and a branched revision history.</t>
</section>
</section>
<section anchor="terminology" title="Terminology and Conventions">
<t>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 <xref
target="RFC2119"/> <xref target="RFC8174"/> when, and only when, they appear in all capitals, as shown here.</t>
<t>In addition, this document uses the terminology:
<list style="symbols">
<t>YANG module revision: An instance of a YANG module, uniquely identified with a revision date, with no implied
ordering or backwards compatibility between different revisions of the same module.</t>
<t>Backwards-compatible (BC) change: A backwards-compatible change between two YANG module revisions, as defined
in <xref target="bc_update_rules"/></t>
<t>Non-backwards-compatible (NBC) change: A non-backwards-compatible change between two YANG module revisions, as
defined in <xref target="nbc_update_rules"/></t>
</list>
</t>
</section>
<section anchor="yang_revision_handling" title="Refinements to YANG revision handling">
<t><xref target="RFC7950"/> assumes, but does not explicitly state, that the revision history for a YANG module is
strictly linear, i.e., it is prohibited to have two independent revisions of a YANG module that are both directly
derived from the same parent revision.</t>
<t>This document clarifies <xref target="RFC7950"/> to explicitly allow non linear development of YANG module
revisions, so modules MAY have multiple revisions that directly derive from the same parent revision. As per <xref
target="RFC7950"/>, YANG module revisions continue to be uniquely identified by the module's revision date, and hence
all revisions of a module MUST have unique revision dates.</t>
<t>A module's name and revision date identifies a specific immutable definition of that module within its revision
history. Hence, if a module includes submodules then the module's "include" statements MUST use "revision-date"
substatements to specify the exact revision date of each included submodule.</t>
<t><xref target="RFC7950"/> section 11 requires that all updates to a YANG module are BC to the previous revision of
the module. This document allows for more flexible evolution of YANG modules: NBC changes between module revisions
are allowed and are documented using a new "nbc-changes" YANG extension statement in the module revision history.</t>
<section title="Updating a YANG module with a new revision" anchor="update_rules">
<t>This section updates <xref target="RFC7950"/> section 11 to refine the rules for permissible changes when a new
YANG module revision is created.</t>
<t>Where pragmatic, updates to YANG modules SHOULD be backwards-compatible, following the definition in <xref
target="bc_update_rules"/>.</t>
<t>A new module revision MAY contain NBC changes, i.e., the semantics of an existing definition
MAY be changed in an NBC way without requiring a new definition with a new identifier. A new
module revision with NBC changes MUST include the "rev:nbc-changes" extension substatement to
signal the potential for incompatibility to existing module users and readers.</t>
<section anchor="bc_update_rules" title="Backwards-compatible changes">
<t>A change between two module revisions is defined as being "backwards-compatible" if the change conforms to
the module update rules specified in <xref target="RFC7950"/> section 11, updated by the following rules:
<list style="symbols">
<t>A "status" "deprecated" statement MAY be added, or changed from "current" to "deprecated", but adding or
changing "status" to "obsolete" is not a backwards-compatible change.</t>
<t>Obsolete definitions MAY be removed from published modules, and are classified as backwards-compatible
changes. In some circumstances it may be helpful to retain the obsolete definitions to ensure that their
identifiers are not reused with a different meaning.</t>
<t>In statements that have any data definition statements as substatements, those data definition substatements
MAY be reordered, as long as they do not change the ordering or any "rpc" "input" substatements. If new data
definition statements are added, they can be added anywhere in the sequence of existing substatements.</t>
</list></t>
</section>
<section anchor="nbc_update_rules" title="Non-backwards-compatible changes">
<t>Any changes to YANG modules that are not defined by <xref target="bc_update_rules"/> as being
backwards-compatible are classified as "non-backwards-compatible" changes.</t>
</section>
</section>
<section anchor="nbc_marker" title="nbc-changes revision extension statement">
<t>The "rev:nbc-changes" extension statement is used to indicate YANG module revisions that contain
NBC changes.</t>
<t>If a revision of a YANG module contains changes, relative to the preceding revision in the revision history,
that do not conform to the module update rules defined in <xref target="bc_update_rules"/>, then a
"rev:nbc-changes" extension statement MUST be added as a substatement to the "revision" statement.</t>
<t>Conversely, if a revision does not contain an "rev:nbc-changes" extension substatement then all changes, relative
to the preceding revision in the revision history, MUST be backwards-compatible.</t>
</section>
<section anchor="revision_label" title="Revision label">
<t>Each revision entry in a module or submodule MAY have a revision label associated with it, providing an
alternative alias to identify a particular revision of a module or submodule. The revision label could be used to
provide an additional versioning identifier associated with the revision.</t>
<t>YANG Semver <xref target="I-D.verdt-netmod-yang-semver"/> defines a versioning scheme based on Semver 2.0.0 <xref target="semver"/> that can
be used as a revision label. All revision labels that match the pattern for the "version" typedef in the
ietf-yang-semver YANG module MUST be interpreted as YANG semantic version numbers.</t>
<t>The revision date and revision label within a submodule's revision history have no effect on the including
module's revision. Submodules MUST NOT use revision label schemes that could be confused with the including
module's revision label scheme.</t>
<t>If a revision has an associated revision label, then it may be used instead of the revision date in two places:
<list>
<t>In an "rev:revision-or-derived" extension statement argument.</t>
<t>In the filename of a YANG module, where it takes the form:
module-or-submodule-name ['@' revision-label] ( '.yang' / '.yin' )</t>
</list>
</t>
</section>
<section title="YANG status description extension statement" anchor="deprecated_and_obsolete_reasons">
<t>The ietf-yang-revision module specifies the YANG extension statement "status-description" that can be used as a substatement of
the status statement. The argument to this extension statement can contain freeform text to help readers of the module
understand why the node was deprecated or made obsolete, when it is anticipated that the node will no longer be
available for use, and potentially reference other schema elements that can be used instead. An example is shown
below.</t>
<figure>
<artwork>
leaf imperial-temperature {
type int64;
units "degrees Fahrenheit";
status deprecated {
rev:status-description
"Imperial measurements are being phased out in favor
of their metric equivalents. Use metric-temperature
instead.";
}
description
"Temperature in degrees Fahrenheit.";
}
</artwork>
</figure>
</section>
<section anchor="example_versions" title="Examples for updating the YANG module revision history">
<t>The following diagram, explanation, and module history illustrates how the branched revision history,
"nbc-changes" extension statement, and "revision-label" extension statement could be used:</t>
<figure>
<preamble>Example YANG module with branched revision history.</preamble>
<artwork>
Module revision date Revision label
2019-01-01 <- 1.0.0
|
2019-02-01 <- 2.0.0
| \
2019-03-01 \ <- 3.0.0
| \
| 2019-04-01 <- 2.1.0
| |
| 2019-05-01 <- 2.2.0
|
2019-06-01 <- 3.1.0
</artwork>
</figure>
<t>The tree diagram above illustrates how an example module's version history might evolve, over time. For example,
the tree might represent the following changes, listed in chronological order from oldest revision to newest:</t>
<figure>
<preamble>Example module, revision 2019-06-01:</preamble>
<artwork>
module example-module {
namespace "name-space";
prefix "prefix-name";
import ietf-yang-revisions { prefix "rev"; }
description
"to be completed";
revision 2019-06-01 {
rev:revision-label 3.1.0;
description "Add new functionality.";
}
revision 2019-04-01 {
rev:revision-label 3.0.0;
rev:nbc-changes;
description
"Add new functionality. Remove some deprecated nodes.";
}
revision 2019-02-01 {
rev:revision-label 2.0.0;
rev:nbc-changes;
description "Apply bugfix to pattern statement";
}
revision 2019-01-01 {
rev:revision-label 1.0.0;
description "Initial revision";
}
//YANG module definition starts here
</artwork>
</figure>
<figure>
<preamble>Example module, revision 2019-05-01:</preamble>
<artwork>
module example-module {
namespace "name-space";
prefix "prefix-name";
import ietf-yang-revisions { prefix "rev"; }
description
"to be completed";
revision 2019-05-01 {
rev:revision-label 2.2.0;
description "Backwards-compatible bugfix to enhancement.";
}
revision 2019-03-01 {
rev:revision-label 2.1.0;
description "Apply enhancement to older release train.";
}
revision 2019-02-01 {
rev:revision-label 2.0.0;
rev:nbc-changes;
description "Apply bugfix to pattern statement";
}
revision 2019-01-01 {
rev:revision-label 1.0.0;
description "Initial revision";
}
//YANG module definition starts here
</artwork>
</figure>
</section>
</section>
<section title="Import by derived revision" anchor="import">
<t>RFC 7950 allows YANG module "import" statements to optionally require the imported module to have a particular
revision date. In practice, importing a module with an exact revision date is often too restrictive because it
requires the importing module to be updated whenever any change to the imported module occurs. The alternative choice
of using an import statement without any revision date statement is also not ideal because the importing module may
not work with all possible revisions of the imported module.</t>
<t>Instead, it is desirable for a importing module to specify a "minimum required revision" of a module that it is
compatible with, based on the assumption that later revisions derived from that "minimum required revision" are also
likely to be compatible. Many possible changes to a YANG module do not break importing modules, even if the changes
themselves are not strictly backwards-compatible. E.g., fixing an incorrect pattern statement or description for a
leaf would not break an import, changing the name of a leaf could break an import but frequently would not, but
removing a container would break imports if that container is augmented by another module.</t>
<t>The ietf-revisions module defines the "revision-or-derived" extension statement, a substatement to the YANG "import"
statement, to allow for a "minium required revision" to be specified during import:
<list>
<t>The argument to the "revision-or-derived" extension statement is a revision date or a revision label.</t>
<t>A particular revision of an imported module satisfies an import's "revision-or-derived" extension statement if
the imported module's revision history contains a revision statement with a matching revision date or
revision label.</t>
<t>An "import" statement MUST NOT contain both a "revision-or-derived" extension statement and a "revision-date"
statement.</t>
<t>The "revision-or-derived" extension statement MAY be specified multiple times, allowing the import to use any
module revision that satifies at least one of the "revision-or-derived" extension statements.</t>
<t>The "revision-or-derived" extension statement does not gaurantee that all module revisions that satisfy an import
statement are necessarily compatible, it only gives an indication that the revisions are more likely to be
compatible. Hence, NBC changes to an imported module may also require new revisions of any
importing modules, updated to accommodation those changes, along with updated import "revision-or-derived" extension
statements to depend on the updated imported module revision.</t>
</list>
</t>
<section title="Module import examples">
<t>Consider the example module "example-module" from <xref
target="example_versions"/> that is hypothetically available in
the following revision/label pairings: 2019-01-01/1.0.0,
2019-02-01/2.0.0, 2019-03-01/3.0.0, 2019-04-01/2.1.0,
2019-05-01/2.2.0 and 2019-06-01/3.1.0. The relationship between
the revisions is as before:</t>
<figure>
<artwork>
Module revision date Revision label
2019-01-01 <- 1.0.0
|
2019-02-01 <- 2.0.0
| \
2019-03-01 \ <- 3.0.0
| \
| 2019-04-01 <- 2.1.0
| |
| 2019-05-01 <- 2.2.0
|
2019-06-01 <- 3.1.0
</artwork>
</figure>
<section toc="exclude" title="Example 1">
<t>This example selects module revisions that match, or are derived from the revision 2019-02-01. E.g., this
dependency might be used if there was a new container added in revision 2019-02-01 that is augmented by the
importing module.It includes revisions/labels: 2019-02-01/2.0.0, 2019-03-01/3.0.0, 2019-04-01/2.1.0,
2019-05-01/2.2.0 and 2019-06-01/3.1.0. </t>
<figure>
<artwork>
import example-module {
rev:revision-or-derived 2019-02-01;
}
</artwork>
</figure>
<t>Alternatively, the first example could have used the revision label "1.0.0" instead, which selects the same set
of revisions/versions.</t>
<figure>
<artwork>
import example-module {
rev:revision-or-derived 1.0.0;
}
</artwork>
</figure>
</section>
<section toc="exclude" title="Example 2">
<t>This example selects module revisions that are derived from 2019-04-01 by using the revision label 2.1.0. It
includes revisions/labels: 2019-04-01/2.1.0 and 2019-05-01/2.2.0. Even though 2019-06-01/3.1.0 has a higher
revision label version number than 2019-04-01/2.1.0 it is not a derived revision, and hence it is not a valid
revision for import.</t>
<figure>
<artwork>
import example-module {
rev:revision-or-derived 2.1.0;
}
</artwork>
</figure>
</section>
<section toc="exclude" title="Example 3">
<t>This example selects revisions derived from either 2019-04-01 or 2019-06-01. It includes revisions/labels:
2019-04-01/2.1.0, 2019-05-01/2.2.0, and 2019-06-01/3.1.0.</t>
<figure>
<artwork>
import example-module {
rev:revision-or-derived 2019-04-01;
rev:revision-or-derived 2019-06-01;
}
</artwork>
</figure>
</section>
</section>
</section>
<section title="Updates to ietf-yang-library" anchor="ietf_yang_library_updates">
<t>This document updates YANG library <xref target="RFC7895"/> <xref target="RFC8525"/> to clarify how ambiguous
module imports are resolved. It also defines the YANG module, ietf-yl-revisions that augments YANG library with new
versioning related meta-data.</t>
<section title="Resolving ambiguous module imports">
<t>A YANG datastore schema, defined in <xref target="RFC8525"/>, can specify multiple revisions of a YANG module
in the schema using the "import-only" list, with the requirement from <xref target="RFC7950"/> that only a single
revision of a YANG module may be implemented.</t>
<t>If a YANG module import statement does not specify a specific revision within the datastore schema then it
could be ambiguous as to which module revision the import statement should resolve to. Hence, a datastore schema
constructed by a client using the information contained in YANG library may not exactly match the datastore schema
actually used by the server.</t>
<t>The following two rules remove the ambiguity:</t>
<t>If a module import statement could resolve to more than one module revision defined in the datastore schema,
and one of those revisions is implemented (i.e., not an "import-only" module), then the import statement MUST
resolve to the revision of the module that is defined as being implemented by the datastore schema.</t>
<t>If a module import statement could resolve to more than one module revision defined in the datastore schema,
and none of those revisions are implemented, then the import MUST resolve to the module revision with the latest
revision date.</t>
</section>
<section title="YANG library versioning augmentations">
<t></t>
<figure>
<preamble>The "ietf-yl-revisions" YANG module has the following
structure (using the notation defined in <xref target="RFC8340"/>):</preamble>
<artwork>
<![CDATA[
module: ietf-yl-revisions
augment /yanglib:yang-library/yanglib:module-set/yanglib:module:
+--ro revision-label? rev:revision-label
augment /yanglib:yang-library/yanglib:schema:
+--ro deprecated-nodes-implemented? empty
+--ro obsolete-nodes-absent? empty
]]>
</artwork>
</figure>
<section title="Advertising revision-label">
<t>The ietf-yl-revisions YANG module augments the "module" list in ietf-yang-library with a "revision-label"
leaf to optionally declare the revision label associated wth the particular revision of each module.</t>
</section>
<section title="Reporting how deprecated and obsolete nodes are handled">
<t>The ietf-yl-revisions YANG module augments YANG library with two leaves to allow a server to report how it
handles status "deprecated" and status "obsolete" nodes. The leaves are:
<list style="hanging">
<t hangText="deprecated-nodes-implemented:">If present, this leaf indicates that all schema nodes with a
status "deprecated" child statement are implemented equivalently as if they had status "current", or
otherwise deviations MUST be used to explicitly remove "deprecated" nodes from the schema. If this leaf is
absent then the behavior is unspecified.</t>
<t hangText="obsolete-nodes-absent:">If present, this leaf indicates that the server does not implement any
status "obsolete" nodes. If this leaf is absent then the behaviour is unspecified.</t>
</list>
</t>
<t>Servers SHOULD set both the "deprecated-nodes-implemented" and "obsolete-nodes-absent" leaves.</t>
<t>If a server does not set the "deprecated-nodes-implemented" leaf, then clients MUST NOT rely solely on the
"rev:nbc-changes" statements to determine whether two module revisions are backwards-compatible, and MUST also
consider whether the status of any nodes has changed to "deprecated" and whether those nodes are implemented by
the server.</t>
</section>
</section>
</section>
<section title="Versioning of YANG instance data">
<t>Instance data sets <xref target="I-D.ietf-netmod-yang-instance-file-format"/> do not directly make use of the
updated revision handling rules described in this document, as compatibility for instance data is undefined.</t>
<t>However, instance data specifies the content-schema of the data-set. This schema SHOULD make use of versioning
using revision dates and/or revision labels for the individual YANG modules that comprise the schema or
potentially for the entire schema itself (e.g., <xref target="I-D.rwilton-netmod-yang-packages"/> ).</t>
<t>In this way, the versioning of a content-schema associated with an instance data set may help a client to
determine whether the instance data could also be used in conjunction with other revisions of the YANG schema, or
other revisions of the modules that define the schema.</t>
</section>
<section anchor="guidelines" title="Guidelines for using the YANG module update rules">
<t>The following text updates section 4.7 of <xref target="RFC8407"/> to revise the guidelines for updating YANG modules.</t>
<section anchor="guidelines_authors" title="Guidelines for YANG module authors">
<t>All IETF YANG modules MUST include revision-label statements for all newly published YANG modules, and all newly published revisions of existing YANG modules. The revision-label MUST take the form of a YANG semantic version number <xref target="I-D.verdt-netmod-yang-semver"/>.</t>
<t>NBC changes to YANG modules may cause problems to clients, who are consumers of YANG models, and hence YANG module authors are
RECOMMENDED to minimize NBC changes and keep changes BC whenever possible.</t>
<t>When NBC changes are introduced, consideration should be given to the impact on clients and YANG module authors SHOULD
try to mitigate that impact.</t>
<t>A "rev:nbc-changes" statement SHOULD be added only if there are NBC changes relative to the previous revision.</t>
<t>Removing old revision statements from a module's revision history could break import by revision, and hence it is RECOMMENDED to retain them.
If all depencencies have been updated to not import specific revisions of a module, then the corresponding revision statements can be removed from that module.
An alternative solution, if the revision section is too long, would be remove, or curtail, the older description statements associated with the previous revisions.</t>
<t>The "rev:revision-or-derived" extension should be used in YANG module imports to indicate revision dependencies
between modules in preference to the "revision-date" statement, which causes overly strict import dependencies and
SHOULD NOT be used.</t>
<t>A module that includes submodules MUST use the "revision-date" statement to include specific submodule
revisions. Changing a module's include statements to include different submodule revisions requires a new
revision of the module.</t>
<section title="Making non-backwards-compatible changes to a YANG module">
<t>There are various valid situations where a YANG module has to be modified in an NBC
way. Here are the different ways in which this can be done:
<list style="symbols">
<t>NBC changes can be sometimes be done incrementally using the "deprecated" status to provide clients time to adapt to NBC changes.</t>
<t>NBC changes are done at once, i.e. without using "status" statements. Depending on the change, this may have a big impact on clients.</t>
<t>If the server can support multiple versions of the YANG module or of YANG packages(as specified in <xref target="I-D.rwilton-netmod-yang-packages"/>), and allows the client to select the version (as per <xref target="I-D.wilton-netmod-yang-ver-selection"/>), then NBC changes MAY be done without using "status" statements. Clients would be required to select the version which they support and the NBC change would have no impact on them</t>
</list>
</t>
<t>Here are some guidelines on how non-backwards-compatible changes can be made incrementally, with the assumption that deprecated nodes are implemented by the server, and obsolete nodes are not:
<list style ="numbers">
<t>The changes should be made gradually, e.g. a data node's status SHOULD NOT be changed directly from
"current" to "obsolete" (see Section 4.7 of <xref target="RFC8407"/>), instead the status SHOULD first be
marked "deprecated" and then when support is removed its status MUST be changed to "obsolete". Instead of
using the "obsolete" status, the data node MAY be removed from the model but this has the risk of breaking
modules which import the modified module.</t>
<t>The new "status-description" extension statement SHOULD be used for nodes which are "obsolete" or
"deprecated".</t>
<t>For status "deprecated", the "status-description" SHOULD also indicate until when support for the node
is guaranteed (if known). If there is a replacement data node, rpc, action or notification for the deprecated node,
this SHOULD be stated in the "status-description". The reason for deprecating the node can also be included in the
"status-description" if it is deemed to be of potential interest to the user.</t>
<t>For status "obsolete", it is RECOMMENDED to keep the "status-description" information, from when the node had status "deprecated, which is still relevant.</t>
<t>When obsoleting or deprecating data nodes, the "deprecated" or "obsolete" status SHOULD be applied at
the highest possible level in the data tree with an appropriate "status-description" statement. For clarity, the "status" statement SHOULD also be applied to all
descendent data nodes, but the "status-description" statement does not need to be repeated if it does not introduce any additional information.</t>
</list>
</t>
<t>See <xref target="example_guidelines"/> for examples on how NBC changes can be made.</t>
</section>
</section>
<section anchor="guidelines_clients" title="Versioning Considerations for Clients">
<t>Guidelines for clients of modules using the new module revision update procedure:
<list style="symbols">
<t>Clients SHOULD be liberal when processing data received from a server. For example, the server may have
increased the range of an operational node causing the client to receive a value which is outside the range
of the YANG model revision it was coded against.</t>
<t>Clients SHOULD monitor changes to published YANG modules through their revision history, and use
appropriate tooling to understand the specific changes between module revision. In particular, clients
SHOULD NOT migrate to NBC revisions of a module without understanding any potential impact of the specific NBC changes.</t>
<t>Clients SHOULD plan to make changes to match published status changes. When a node's status changes from
"current" to "deprecated", clients SHOULD plan to stop using that node in a timely fashion. When a node's
status changes to "obsolete", clients MUST stop using that node.</t>
</list>
</t>
</section>
</section>
<section anchor="yang_modules" title="Module Versioning Extension YANG Modules">
<t>
<figure>
<preamble> YANG module with extension statements for annotating NBC changes, revision label, status description,
and importing by version.</preamble>
<artwork><![CDATA[
<CODE BEGINS> file "ietf-yang-revisions@2019-09-18.yang"
module ietf-yang-revisions {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yang-revisions";
prefix rev;
import ietf-yang-types {
prefix yang;
reference
"XXXX [ietf-netmod-rfc6991-bis]: Common YANG Data Types";
}
organization
"IETF NETMOD (Network Modeling) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
Author: Benoit Claise
<mailto:bclaise@cisco.com>
Author: Joe Clarke
<mailto:jclarke@cisco.com>
Author: Reshad Rahman
<mailto:rrahman@cisco.com>
Author: Robert Wilton
<mailto:rwilton@cisco.com>
Author: Kevin D'Souza
<mailto:kd6913@att.com>
Author: Balazs Lengyel
<mailto:balazs.lengyel@ericsson.com>
Author: Jason Sterne
<mailto:jason.sterne@nokia.com>";
description
"This YANG 1.1 module contains definitions and extensions to
support updated YANG revision handling.
Copyright (c) 2019 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
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; 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.";
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
// RFC Ed.: replace XXXX (inc above) with actual RFC number and
// remove this note.
revision 2019-09-18 {
description
"Initial version.";
reference
"XXXX: Updated YANG Module Revision Handling";
}
typedef revision-label {
type string {
length "1..255";
pattern '[^\s@]+';
pattern '\d{4}-\d{2}-\d{2}' {
modifier invert-match;
}
}
description
"A label associated with a YANG revision.
Excludes spaces and '@'. MUST NOT match revision-date.
Revision labels that classify as YANG semantic versions,
as defined by the ietf-yang-semver:version typedef,
MUST conform to the versioning behaviour defined in
XXXX [verdt]: YANG Semantic Versioning.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 3.3, Revision label";
}
typedef revision-date-or-label {
type union {
type yang:revision-identifier;
type revision-label;
}
description
"Represents either a YANG revision date or a revision label";
}
extension nbc-changes {
description
"This statement is used to indicate YANG module revisions that
contain non-backwards-compatible changes.
Each 'revision' statement MAY have a single 'nbc-changes'
substatement.
If a revision of a YANG module contains changes, relative to
the preceding revision in the revision history, that do not
conform to the module update rules defined in RFC-XXX, then
the 'nbc-changes' statement MUST be added as a substatement to
the revision statement.
Conversely, if a revision of a YANG module only contains
changes, relative to the preceding revision in the revision
history, that are classified as 'backwards-compatible' then
the revision statement MUST NOT contain any 'nbc-changes'
substatement.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 3.2, nbc-changes revision extension statement";
}
extension revision-label {
argument revision-label;
description
"The revision label can be used to provide an additional
versioning identifier associated with the revision. E.g., one
option for a versioning scheme that could be used is [TODO -
Reference semver draft].
The format of the revision-label argument MUST conform to the
pattern defined for the revision-label typedef.
Each 'revision' statement MAY have a single 'revision-label'
substatement.
Revision labels MUST be unique amongst all revisions of a
module.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 3.3, Revision label";
}
extension revision-or-derived {
argument revision-date-or-label;
description
"Restricts the revision of the module that may be imported to
one that matches or is derived from the specified
revision-date or revision-ñlabel.
The argument value MUST conform to the
'revision-date-or-label' defined type.
Each 'import' statement MAY have one or more
'revision-or-derived' substatements. If specified multiple
times, then any module revision that satifies at least one of
the 'revision-or-derived' statements is an acceptable revision
for import.
An 'import' statement MUST NOT contain both a
'revision-or-derived' extension statement and a
'revision-date' statement.
A particular revision of an imported module satisfies an
import's 'revision-or-derived' extension statement if the
imported module's revision history contains a revision
statement with a matching revision date or revision label.
The 'revision-or-derived' extension statement does not
gaurantee that all module revisions that satisfy an import
statement are necessarily compatible, it only gives an
indication that the revisions are more likely to be
compatible.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 4, Import by derived revision";
}
extension status-description {
argument description;
description
"Freeform text that describes why a given node has been
deprecated or made obsolete. E.g., the description could be
used to give the reason for removal, or it could point to an
alternative schema elements that can be used in lieu of the
given node.
Each 'status' statement MAY have a single 'status-description'
substatement.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 3.4, YANG status description extension statement";
}
}
<CODE ENDS>
]]></artwork>
</figure>
<figure>
<preamble>YANG module with augmentations to YANG Library to revision labels</preamble>
<artwork><![CDATA[
<CODE BEGINS> file "ietf-yl-revisions@2019-09-18.yang"
module ietf-yl-revisions {
yang-version 1.1;
namespace "urn:ietf:params:xml:ns:yang:ietf-yl-revisions";
prefix yl-rev;
import ietf-yang-revisions {
prefix rev;
reference
"XXXX: Updated YANG Module Revision Handling";
}
import ietf-yang-library {
prefix yanglib;
reference "RFC 8525: YANG Libary";
}
organization
"IETF NETMOD (Network Modeling) Working Group";
contact
"WG Web: <https://datatracker.ietf.org/wg/netmod/>
WG List: <mailto:netmod@ietf.org>
Author: Benoit Claise
<mailto:bclaise@cisco.com>
Author: Joe Clarke
<mailto:jclarke@cisco.com>
Author: Reshad Rahman
<mailto:rrahman@cisco.com>
Author: Robert Wilton
<mailto:rwilton@cisco.com>
Author: Kevin D'Souza
<mailto:kd6913@att.com>
Author: Balazs Lengyel
<mailto:balazs.lengyel@ericsson.com>
Author: Jason Sterne
<mailto:jason.sterne@nokia.com>";
description
"This module contains augmentations to YANG Library to add module
level revision label and to provide an indication of how
deprecated and obsolete nodes are handled by the server.
Copyright (c) 2019 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
(http://trustee.ietf.org/license-info).
This version of this YANG module is part of RFC XXXX; 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.";
// RFC Ed.: update the date below with the date of RFC publication
// and remove this note.
// RFC Ed.: replace XXXX (including in the imports above) with
// actual RFC number and remove this note.
// RFC Ed.: please replace revision-label version with 1.0.0 and
// remove this note.
revision 2019-09-18 {
rev:revision-label 0.1.0;
description
"Initial revision";
reference
"XXXX: Updated YANG Module Revision Handling";
}
augment "/yanglib:yang-library/yanglib:module-set/yanglib:module" {
description
"Augmentation modules with a revision label";
leaf revision-label {
type rev:revision-label;
description
"The revision label associated with this module revision.
The label MUST match the rev:label value in the specific
revision of the module loaded in this module-set.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 5.2.1, Advertising revision-label";
}
}
augment "/yanglib:yang-library/yanglib:schema" {
description
"Augmentations to the ietf-yang-library module to indicate how
deprecated and obsoleted nodes are handled for each datastore
schema supported by the server.";
leaf deprecated-nodes-implemented {
type empty;
description
"If present, this leaf indicates that all schema nodes with a
status 'deprecated' child statement are implemented
equivalently as if they had status 'current', or otherwise
deviations MUST be used to explicitly remove 'deprecated'
nodes from the schema. If this leaf is absent then the
behavior is unspecified.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 5.2.2, Reporting how deprecated and obsolete nodes
are handled";
}
leaf obsolete-nodes-absent {
type empty;
description
"If present, this leaf indicates that the server does not
implement any status 'obsolete' nodes. If this leaf is
absent then the behaviour is unspecified.";
reference
"XXXX: Updated YANG Module Revision Handling;
Section 5.2.2, Reporting how deprecated and obsolete nodes
are handled";
}
}
}
CODE ENDS>
]]></artwork>
</figure>
</t>
</section>
<section anchor="contributor" title="Contributors">
<t>This document grew out of the YANG module versioning design team that started after IETF 101. The following
individuals are (or have been) members of the design team and have worked on the YANG versioning project:</t>
<t>
<list style="symbols">
<t>Balazs Lengyel</t>
<t>Benoit Claise</t>
<t>Ebben Aries</t>
<t>Jason Sterne</t>