blob: e506127811e9fb5f2d7deeee4b1cbbb790148a02 [file] [log] [blame]
Michal Vaskoe893ddd2020-06-23 13:35:20 +02001module yang {
2 namespace "urn:ietf:params:xml:ns:yang:1";
3 prefix yang;
Michal Vasko1bdfab62023-05-12 08:31:12 +02004 yang-version 1.1;
Michal Vaskoe893ddd2020-06-23 13:35:20 +02005
6 import ietf-yang-metadata {
7 prefix md;
8 revision-date 2016-08-05;
9 }
10
11 organization
12 "libyang";
13
14 contact
15 "Web: <https://github.com/CESNET/libyang/>
Michal Vasko79a7a872022-06-17 09:00:48 +020016 Author: Radek Krejci <rkrejci@cesnet.cz>
17 Author: Michal Vasko <mvasko@cesnet.cz>";
Michal Vaskoe893ddd2020-06-23 13:35:20 +020018
19 description
Michal Vasko79a7a872022-06-17 09:00:48 +020020 "This is a dummy module with no data formally supplying the definitions
21 of various metadata defined in RFC 6020 and RFC 7950. There are
22 additional metadata used in libyang diff data format.";
23
24 revision 2022-06-16 {
25 description
26 "Added typedef for key metadata type.";
27 }
Michal Vaskoe893ddd2020-06-23 13:35:20 +020028
Michal Vaskoe78faec2021-04-08 17:24:43 +020029 revision 2021-04-07 {
30 description
31 "Added metadata for key-less list and state leaf-list diff.";
32 }
33
Michal Vaskoe893ddd2020-06-23 13:35:20 +020034 revision 2020-06-17 {
35 description
36 "Added metadata for diff.";
37 }
38
39 revision 2017-02-20 {
40 description
41 "Added metadata for NETCONF's edit-config manipulation with ordered
42 lists and leaf-lists.";
43 reference
44 "RFC 7950: The YANG 1.1 Data Modeling Language";
45 }
46
47 revision 2016-02-11 {
48 description
49 "Initial revision";
50 reference
51 "RFC 6020: YANG - A Data Modeling Language for
52 the Network Configuration Protocol (NETCONF)";
53 }
54
Michal Vasko79a7a872022-06-17 09:00:48 +020055 typedef instance-identifier-keys {
56 type string;
57 reference "RFC7950 section 7.8.6.";
58 description
59 "The key predicates of the full instance-identifier built-in type.";
60 }
61
Michal Vaskoe893ddd2020-06-23 13:35:20 +020062 md:annotation insert {
63 type enumeration {
64 enum first;
65 enum last;
66 enum before;
67 enum after;
68 }
69 reference "RFC7950 section 7.8.6. and section 7.7.9.";
70 description
Michal Vaskoe78faec2021-04-08 17:24:43 +020071 "In user ordered leaf-list, this attribute can be used to control
Michal Vaskoe893ddd2020-06-23 13:35:20 +020072 where in the leaf-list the entry is inserted. It can be used during
73 the NETCONF <edit-config> \"create\" operations to insert a new list or
74 leaf-list entry, or during \"merge\" or \"replace\" operations to insert
75 a new list or leaf-list entry or move an existing one.
76
77 If the value is \"before\" or \"after\", the \"value\"/\"key\" attribute
78 MUST also be used to specify an existing entry in the list or leaf-list.
79
80 If no \"insert\" attribute is present in the \"create\" operation, it
81 defaults to \"last\".";
82 }
83
84 md:annotation value {
85 type string;
86 reference "RFC7950 section 7.7.9.";
87 description
Michal Vaskoe78faec2021-04-08 17:24:43 +020088 "In user ordered leaf-list, this attribute must be used if the attribute
Michal Vaskoe893ddd2020-06-23 13:35:20 +020089 insert is used and specifies before/after which existing instance the
90 new instance should be inserted.";
91 }
92
93 md:annotation key {
Michal Vasko79a7a872022-06-17 09:00:48 +020094 type union {
95 type empty;
96 type instance-identifier-keys;
97 }
Michal Vaskoe893ddd2020-06-23 13:35:20 +020098 reference "RFC7950 section 7.8.6.";
99 description
Michal Vaskoe78faec2021-04-08 17:24:43 +0200100 "In user ordered list, this attribute must be used if the attribute
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200101 insert is used and specifies before/after which existing instance the
102 new instance should be inserted.";
103 }
104
Michal Vaskoe78faec2021-04-08 17:24:43 +0200105 md:annotation position {
106 type union {
107 type empty;
108 type uint32 {
109 range 1..max;
110 }
111 }
112 description
113 "In key-less list or state leaf-list, this attribute must be used if
114 the attribute insert is used and specifies the instance position
115 before/after which the new instance should be inserted.";
116 }
117
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200118 md:annotation operation {
119 type enumeration {
120 enum none {
121 description
122 "The node existed in both data trees but there is a nested node
123 with another operation. In case of a leaf, only its default
124 flag changed.";
125 }
126 enum create {
127 description
128 "The node did not exist in the first tree and was created in the
129 second tree.";
130 }
131 enum delete {
132 description
133 "The node existed in the first tree and was deleted in the second
134 tree.";
135 }
136 enum replace {
137 description
138 "The node value was changed or the node was moved for
139 leaves/anyxml/anydata and user-ordered lists/leaf-lists,
140 respectively.";
141 }
142 }
143 reference "RFC6241 section 7.2.";
144 description
145 "Operation of a node in a diff. If a node has no operation,
146 it is inherited from its nearest parent with an operation.
147 Top-level nodes must always have an operation.
148
149 User-ordered lists/leaf-lists with operation 'create' and
Michal Vaskoe78faec2021-04-08 17:24:43 +0200150 'replace' MUST also have the 'key', 'value', or 'position'
151 metadata defined. It specifies the preceding instance.
152 In case the value of this metadata is empty, the node was
153 created/moved on the first position.
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200154
155 All the operations keep the meaning of edit-config operations
156 with similar names but some are further restricted, meaning
157 they are used for only a subset of use-cases.";
158 }
159
160 md:annotation orig-default {
161 type boolean;
162 description
163 "Information about the previous default state of the node.";
164 }
165
166 md:annotation orig-value {
167 type string;
168 description
Michal Vaskoe78faec2021-04-08 17:24:43 +0200169 "Previous value of a changed leaf. Alternatively, its meaning
170 is the same as the \"value\" attribute but identifies the original
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200171 leaf-list instance rather than the new one.";
172 }
173
174 md:annotation orig-key {
Michal Vasko79a7a872022-06-17 09:00:48 +0200175 type union {
176 type empty;
177 type instance-identifier-keys;
178 }
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200179 description
Michal Vaskoe78faec2021-04-08 17:24:43 +0200180 "Its meaning is the same as the \"key\" attribute but identifies
181 the original list instance rather than the new one.";
182 }
183
184 md:annotation orig-position {
185 type union {
186 type empty;
187 type uint32 {
188 range 1..max;
189 }
190 }
191 description
192 "Its meaning is the same as the \"position\" attribute but identifies
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200193 the original list instance rather than the new one.";
194 }
195}