blob: fafa4f23912ec2500812f2aff2dfbaf67a0ca727 [file] [log] [blame]
Michal Vaskoe893ddd2020-06-23 13:35:20 +02001module yang {
2 namespace "urn:ietf:params:xml:ns:yang:1";
3 prefix yang;
4
5 import ietf-yang-metadata {
6 prefix md;
7 revision-date 2016-08-05;
8 }
9
10 organization
11 "libyang";
12
13 contact
14 "Web: <https://github.com/CESNET/libyang/>
15 Author: Radek Krejci <rkrejci@cesnet.cz>";
16
17 description
18 "This is a kind of fake model with no data, typedefs or anything
19 else. libyang uses this module to implement various YANG attributes
20 defined in RFC 6020.";
21
Michal Vaskoe78faec2021-04-08 17:24:43 +020022 revision 2021-04-07 {
23 description
24 "Added metadata for key-less list and state leaf-list diff.";
25 }
26
Michal Vaskoe893ddd2020-06-23 13:35:20 +020027 revision 2020-06-17 {
28 description
29 "Added metadata for diff.";
30 }
31
32 revision 2017-02-20 {
33 description
34 "Added metadata for NETCONF's edit-config manipulation with ordered
35 lists and leaf-lists.";
36 reference
37 "RFC 7950: The YANG 1.1 Data Modeling Language";
38 }
39
40 revision 2016-02-11 {
41 description
42 "Initial revision";
43 reference
44 "RFC 6020: YANG - A Data Modeling Language for
45 the Network Configuration Protocol (NETCONF)";
46 }
47
48 md:annotation insert {
49 type enumeration {
50 enum first;
51 enum last;
52 enum before;
53 enum after;
54 }
55 reference "RFC7950 section 7.8.6. and section 7.7.9.";
56 description
Michal Vaskoe78faec2021-04-08 17:24:43 +020057 "In user ordered leaf-list, this attribute can be used to control
Michal Vaskoe893ddd2020-06-23 13:35:20 +020058 where in the leaf-list the entry is inserted. It can be used during
59 the NETCONF <edit-config> \"create\" operations to insert a new list or
60 leaf-list entry, or during \"merge\" or \"replace\" operations to insert
61 a new list or leaf-list entry or move an existing one.
62
63 If the value is \"before\" or \"after\", the \"value\"/\"key\" attribute
64 MUST also be used to specify an existing entry in the list or leaf-list.
65
66 If no \"insert\" attribute is present in the \"create\" operation, it
67 defaults to \"last\".";
68 }
69
70 md:annotation value {
71 type string;
72 reference "RFC7950 section 7.7.9.";
73 description
Michal Vaskoe78faec2021-04-08 17:24:43 +020074 "In user ordered leaf-list, this attribute must be used if the attribute
Michal Vaskoe893ddd2020-06-23 13:35:20 +020075 insert is used and specifies before/after which existing instance the
76 new instance should be inserted.";
77 }
78
79 md:annotation key {
80 type string;
81 reference "RFC7950 section 7.8.6.";
82 description
Michal Vaskoe78faec2021-04-08 17:24:43 +020083 "In user ordered list, this attribute must be used if the attribute
Michal Vaskoe893ddd2020-06-23 13:35:20 +020084 insert is used and specifies before/after which existing instance the
85 new instance should be inserted.";
86 }
87
Michal Vaskoe78faec2021-04-08 17:24:43 +020088 md:annotation position {
89 type union {
90 type empty;
91 type uint32 {
92 range 1..max;
93 }
94 }
95 description
96 "In key-less list or state leaf-list, this attribute must be used if
97 the attribute insert is used and specifies the instance position
98 before/after which the new instance should be inserted.";
99 }
100
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200101 md:annotation operation {
102 type enumeration {
103 enum none {
104 description
105 "The node existed in both data trees but there is a nested node
106 with another operation. In case of a leaf, only its default
107 flag changed.";
108 }
109 enum create {
110 description
111 "The node did not exist in the first tree and was created in the
112 second tree.";
113 }
114 enum delete {
115 description
116 "The node existed in the first tree and was deleted in the second
117 tree.";
118 }
119 enum replace {
120 description
121 "The node value was changed or the node was moved for
122 leaves/anyxml/anydata and user-ordered lists/leaf-lists,
123 respectively.";
124 }
125 }
126 reference "RFC6241 section 7.2.";
127 description
128 "Operation of a node in a diff. If a node has no operation,
129 it is inherited from its nearest parent with an operation.
130 Top-level nodes must always have an operation.
131
132 User-ordered lists/leaf-lists with operation 'create' and
Michal Vaskoe78faec2021-04-08 17:24:43 +0200133 'replace' MUST also have the 'key', 'value', or 'position'
134 metadata defined. It specifies the preceding instance.
135 In case the value of this metadata is empty, the node was
136 created/moved on the first position.
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200137
138 All the operations keep the meaning of edit-config operations
139 with similar names but some are further restricted, meaning
140 they are used for only a subset of use-cases.";
141 }
142
143 md:annotation orig-default {
144 type boolean;
145 description
146 "Information about the previous default state of the node.";
147 }
148
149 md:annotation orig-value {
150 type string;
151 description
Michal Vaskoe78faec2021-04-08 17:24:43 +0200152 "Previous value of a changed leaf. Alternatively, its meaning
153 is the same as the \"value\" attribute but identifies the original
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200154 leaf-list instance rather than the new one.";
155 }
156
157 md:annotation orig-key {
158 type string;
159 description
Michal Vaskoe78faec2021-04-08 17:24:43 +0200160 "Its meaning is the same as the \"key\" attribute but identifies
161 the original list instance rather than the new one.";
162 }
163
164 md:annotation orig-position {
165 type union {
166 type empty;
167 type uint32 {
168 range 1..max;
169 }
170 }
171 description
172 "Its meaning is the same as the \"position\" attribute but identifies
Michal Vaskoe893ddd2020-06-23 13:35:20 +0200173 the original list instance rather than the new one.";
174 }
175}