blob: e3452a46bbefe2ea54df6bf7253e6cecb9482093 [file] [log] [blame]
Michal Vaskoedb0fa52022-10-04 10:36:00 +02001module ietf-yang-structure-ext {
2 yang-version 1.1;
3 namespace "urn:ietf:params:xml:ns:yang:ietf-yang-structure-ext";
4 prefix sx;
5
6 organization
7 "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
8 contact
9 "WG Web: <https://datatracker.ietf.org/wg/netmod/>
10 WG List: <mailto:netmod@ietf.org>
11
12 Author: Andy Bierman
13 <mailto:andy@yumaworks.com>
14
15 Author: Martin Bjorklund
16 <mailto:mbj+ietf@4668.se>
17
18 Author: Kent Watsen
19 <mailto:kent+ietf@watsen.net>";
20 description
21 "This module contains conceptual YANG specifications for defining
22 abstract data structures.
23
24 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
25 NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
26 'MAY', and 'OPTIONAL' in this document are to be interpreted as
27 described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
28 they appear in all capitals, as shown here.
29
30 Copyright (c) 2020 IETF Trust and the persons identified as
31 authors of the code. All rights reserved.
32
33 Redistribution and use in source and binary forms, with or
34 without modification, is permitted pursuant to, and subject to
35 the license terms contained in, the Simplified BSD License set
36 forth in Section 4.c of the IETF Trust's Legal Provisions
37 Relating to IETF Documents
38 (http://trustee.ietf.org/license-info).
39
40 This version of this YANG module is part of RFC 8791
41 (https://www.rfc-editor.org/info/rfc8791); see the RFC itself
42 for full legal notices.";
43
44 revision 2020-06-17 {
45 description
46 "Initial revision.";
47 reference
48 "RFC 8791: YANG Data Structure Extensions.";
49 }
50
51 extension structure {
52 argument name {
53 yin-element true;
54 }
55 description
56 "This extension is used to specify a YANG data structure that
57 represents conceptual data defined in YANG. It is intended to
58 describe hierarchical data independent of protocol context or
59 specific message encoding format. Data definition statements
60 within a 'structure' extension statement specify the generic
61 syntax for the specific YANG data structure, whose name is the
62 argument of the 'structure' extension statement.
63
64 Note that this extension does not define a media type. A
65 specification using this extension MUST specify the message
66 encoding rules, including the content media type, if
67 applicable.
68
69 The mandatory 'name' parameter value identifies the YANG data
70 structure that is being defined.
71
72 This extension is only valid as a top-level statement, i.e.,
73 given as a substatement to 'module' or 'submodule'.
74
75 The substatements of this extension MUST follow the ABNF
76 rules below, where the rules are defined in RFC 7950:
77
78 *must-stmt
79 [status-stmt]
80 [description-stmt]
81 [reference-stmt]
82 *(typedef-stmt / grouping-stmt)
83 *data-def-stmt
84
85 A YANG data structure defined with this extension statement is
86 encoded in the same way as an 'anydata' node. This means
87 that the name of the structure is encoded as a 'container',
88 with the instantiated child statements encoded as child nodes
89 to this node.
90
91 The module name and namespace value for the YANG module using
92 the extension statement are assigned to each of the data
93 definition statements resulting from the YANG data structure.
94
95 The XPath document element is the extension statement itself,
96 such that the child nodes of the document element are
97 represented by the data-def-stmt substatements within this
98 extension. This conceptual document is the context for the
99 following YANG statements:
100
101 - must-stmt
102 - when-stmt
103 - path-stmt
104 - min-elements-stmt
105 - max-elements-stmt
106 - mandatory-stmt
107 - unique-stmt
108 - ordered-by
109 - instance-identifier data type
110
111 The following data-def-stmt substatements are constrained
112 when used within a 'structure' extension statement.
113
114 - The list-stmt is not required to have a key-stmt defined.
115 - The config-stmt is ignored if present.
116 ";
117 }
118
119 extension augment-structure {
120 argument path {
121 yin-element true;
122 }
123 description
124 "This extension is used to specify an augmentation to a YANG
125 data structure defined with the 'structure' statement. It is
126 intended to describe hierarchical data independent of protocol
127 context or specific message encoding format.
128
129 This statement has almost the same structure as the
130 'augment-stmt'. Data definition statements within this
131 statement specify the semantics and generic syntax for the
132 additional data to be added to the specific YANG data
133 structure, identified by the 'path' argument.
134
135 The mandatory 'path' parameter value identifies the YANG
136 conceptual data node that is being augmented and is
137 represented as an absolute-schema-nodeid string, where the
138 first node in the absolute-schema-nodeid string identifies the
139 YANG data structure to augment, and the rest of the nodes in
140 the string identifies the node within the YANG structure to
141 augment.
142
143 This extension is only valid as a top-level statement, i.e.,
144 given as a substatement to 'module' or 'submodule'.
145
146 The substatements of this extension MUST follow the ABNF
147 rules below, where the rules are defined in RFC 7950:
148
149 [status-stmt]
150 [description-stmt]
151 [reference-stmt]
152 1*(data-def-stmt / case-stmt)
153
154 The module name and namespace value for the YANG module using
155 the extension statement are assigned to instance document data
156 conforming to the data definition statements within this
157 extension.
158
159 The XPath document element is the augmented extension
160 statement itself, such that the child nodes of the document
161 element are represented by the data-def-stmt substatements
162 within the augmented 'structure' statement.
163
164 The context node of the 'augment-structure' statement is
165 derived in the same way as the 'augment' statement, as defined
166 in Section 6.4.1 of [RFC7950]. This conceptual node is
167 considered the context node for the following YANG statements:
168
169 - must-stmt
170 - when-stmt
171 - path-stmt
172 - min-elements-stmt
173 - max-elements-stmt
174 - mandatory-stmt
175 - unique-stmt
176 - ordered-by
177 - instance-identifier data type
178
179 The following data-def-stmt substatements are constrained
180 when used within an 'augment-structure' extension statement.
181
182 - The list-stmt is not required to have a key-stmt defined.
183 - The config-stmt is ignored if present.
184
185 Example:
186
187 module foo {
188 import ietf-yang-structure-ext { prefix sx; }
189
190 sx:structure foo-data {
191 container foo-con { }
192 }
193 }
194
195 module bar {
196 import ietf-yang-structure-ext { prefix sx; }
197 import foo { prefix foo; }
198
199 sx:augment-structure /foo:foo-data/foo:foo-con {
200 leaf add-leaf1 { type int32; }
201 leaf add-leaf2 { type string; }
202 }
203 }
204 ";
205 }
206}