blob: 31dce50a80b834987e44ef1fb9d5e99044f80436 [file] [log] [blame]
Michal Vaskobbdadda2022-01-06 11:40:10 +01001 module ietf-netconf-nmda {
2 yang-version 1.1;
3 namespace "urn:ietf:params:xml:ns:yang:ietf-netconf-nmda";
4 prefix ncds;
5
6 import ietf-yang-types {
7 prefix yang;
8 reference
9 "RFC 6991: Common YANG Data Types";
10 }
11 import ietf-inet-types {
12 prefix inet;
13 reference
14 "RFC 6991: Common YANG Data Types";
15 }
16 import ietf-datastores {
17 prefix ds;
18 reference
19 "RFC 8342: Network Management Datastore Architecture
20 (NMDA)";
21 }
22 import ietf-origin {
23 prefix or;
24 reference
25 "RFC 8342: Network Management Datastore Architecture
26 (NMDA)";
27 }
28 import ietf-netconf {
29 prefix nc;
30 reference
31 "RFC 6241: Network Configuration Protocol (NETCONF)";
32 }
33 import ietf-netconf-with-defaults {
34 prefix ncwd;
35 reference
36 "RFC 6243: With-defaults Capability for NETCONF";
37 }
38
39 organization
40 "IETF NETCONF Working Group";
41
42 contact
43 "WG Web: <https://datatracker.ietf.org/wg/netconf/>
44
45 WG List: <mailto:netconf@ietf.org>
46
47 Author: Martin Bjorklund
48 <mailto:mbj@tail-f.com>
49
50 Author: Juergen Schoenwaelder
51 <mailto:j.schoenwaelder@jacobs-university.de>
52
53 Author: Phil Shafer
54 <mailto:phil@juniper.net>
55
56 Author: Kent Watsen
57 <mailto:kent+ietf@watsen.net>
58
59 Author: Robert Wilton
60 <mailto:rwilton@cisco.com>";
61 description
62 "This YANG module defines a set of NETCONF operations to support
63 the Network Management Datastore Architecture (NMDA).
64
65 The key words 'MUST', 'MUST NOT', 'REQUIRED', 'SHALL', 'SHALL
66 NOT', 'SHOULD', 'SHOULD NOT', 'RECOMMENDED', 'NOT RECOMMENDED',
67 'MAY', and 'OPTIONAL' in this document are to be interpreted as
68 described in BCP 14 (RFC 2119) (RFC 8174) when, and only when,
69 they appear in all capitals, as shown here.
70
71 Copyright (c) 2019 IETF Trust and the persons identified as
72 authors of the code. All rights reserved.
73
74 Redistribution and use in source and binary forms, with or
75 without modification, is permitted pursuant to, and subject to
76 the license terms contained in, the Simplified BSD License set
77 forth in Section 4.c of the IETF Trust's Legal Provisions
78 Relating to IETF Documents
79 (https://trustee.ietf.org/license-info).
80
81 This version of this YANG module is part of RFC 8526; see
82 the RFC itself for full legal notices.";
83
84 revision 2019-01-07 {
85 description
86 "Initial revision.";
87 reference
88 "RFC 8526: NETCONF Extensions to Support the Network Management
89 Datastore Architecture";
90 }
91
92 feature origin {
93 description
94 "Indicates that the server supports the 'origin' annotation.";
95 reference
96 "RFC 8342: Network Management Datastore Architecture (NMDA)";
97 }
98
99 feature with-defaults {
100 description
101 "NETCONF :with-defaults capability. If the server advertises
102 the :with-defaults capability for a session, then this
103 feature must also be enabled for that session. Otherwise,
104 this feature must not be enabled.";
105 reference
106 "RFC 6243: With-defaults Capability for NETCONF, Section 4; and
107 RFC 8526: NETCONF Extensions to Support the Network Management
108 Datastore Architecture, Section 3.1.1.2";
109 }
110
111 rpc get-data {
112 description
113 "Retrieve data from an NMDA datastore. The content returned
114 by get-data must satisfy all filters, i.e., the filter
115 criteria are logically ANDed.
116
117 Any ancestor nodes (including list keys) of nodes selected by
118 the filters are included in the response.
119
120 The 'with-origin' parameter is only valid for an operational
121 datastore. If 'with-origin' is used with an invalid
122 datastore, then the server MUST return an <rpc-error> element
123 with an <error-tag> value of 'invalid-value'.
124
125 The 'with-defaults' parameter only applies to the operational
126 datastore if the NETCONF :with-defaults and
127 :with-operational-defaults capabilities are both advertised.
128 If the 'with-defaults' parameter is present in a request for
129 which it is not supported, then the server MUST return an
130 <rpc-error> element with an <error-tag> value of
131 'invalid-value'.";
132 input {
133 leaf datastore {
134 type ds:datastore-ref;
135 mandatory true;
136 description
137 "Datastore from which to retrieve data.
138
139 If the datastore is not supported by the server, then the
140 server MUST return an <rpc-error> element with an
141 <error-tag> value of 'invalid-value'.";
142 }
143 choice filter-spec {
144 description
145 "The content filter specification for this request.";
146 anydata subtree-filter {
147 description
148 "This parameter identifies the portions of the
149 target datastore to retrieve.";
150 reference
151 "RFC 6241: Network Configuration Protocol (NETCONF),
152 Section 6";
153 }
154 leaf xpath-filter {
155 if-feature "nc:xpath";
156 type yang:xpath1.0;
157 description
158 "This parameter contains an XPath expression identifying
159 the portions of the target datastore to retrieve.
160
161 If the expression returns a node-set, all nodes in the
162 node-set are selected by the filter. Otherwise, if the
163 expression does not return a node-set, then the
164 <get-data> operation fails.
165
166 The expression is evaluated in the following XPath
167 context:
168
169 o The set of namespace declarations are those in
170 scope on the 'xpath-filter' leaf element.
171
172 o The set of variable bindings is empty.
173
174 o The function library is the core function library,
175 and the XPath functions are defined in Section 10
176 of RFC 7950.
177
178 o The context node is the root node of the target
179 datastore.";
180 }
181 }
182 leaf config-filter {
183 type boolean;
184 description
185 "Filter for nodes with the given value for their 'config'
186 property. When this leaf is set to 'true', only 'config
187 true' nodes are selected, and when set to 'false', only
188 'config false' nodes are selected. If this leaf is not
189 present, no nodes are filtered.";
190 }
191 choice origin-filters {
192 when 'derived-from-or-self(datastore, "ds:operational")';
193 if-feature "origin";
194 description
195 "Filters configuration nodes based on the 'origin'
196 annotation. Configuration nodes that do not have an
197 'origin' annotation are treated as if they have the
198 'origin' annotation 'or:unknown'.
199
200 System state nodes are not affected by origin-filters and
201 thus not filtered. Note that system state nodes can be
202 filtered with the 'config-filter' leaf.";
203
204 leaf-list origin-filter {
205 type or:origin-ref;
206 description
207 "Filter based on the 'origin' annotation. A
208 configuration node matches the filter if its 'origin'
209 annotation is derived from or equal to any of the given
210 filter values.";
211 }
212 leaf-list negated-origin-filter {
213 type or:origin-ref;
214 description
215 "Filter based on the 'origin' annotation. A
216 configuration node matches the filter if its 'origin'
217 annotation is neither derived from nor equal to any of
218 the given filter values.";
219 }
220 }
221 leaf max-depth {
222 type union {
223 type uint16 {
224 range "1..65535";
225 }
226 type enumeration {
227 enum unbounded {
228 description
229 "All descendant nodes are included.";
230 }
231 }
232 }
233 default "unbounded";
234 description
235 "For each node selected by the filters, this parameter
236 selects how many conceptual subtree levels should be
237 returned in the reply. If the depth is 1, the reply
238 includes just the selected nodes but no children. If the
239 depth is 'unbounded', all descendant nodes are included.";
240 }
241 leaf with-origin {
242 when 'derived-from-or-self(../datastore, "ds:operational")';
243 if-feature "origin";
244 type empty;
245 description
246 "If this parameter is present, the server will return
247 the 'origin' annotation for the nodes that have one.";
248 }
249 uses ncwd:with-defaults-parameters {
250 if-feature "with-defaults";
251 }
252 }
253 output {
254 anydata data {
255 description
256 "Copy of the source datastore subset that matched
257 the filter criteria (if any). An empty data
258 container indicates that the request did not
259 produce any results.";
260 }
261 }
262 }
263
264 rpc edit-data {
265 description
266 "Edit data in an NMDA datastore.
267
268 If an error condition occurs such that an error severity
269 <rpc-error> element is generated, the server will stop
270 processing the <edit-data> operation and restore the
271 specified configuration to its complete state at
272 the start of this <edit-data> operation.";
273 input {
274 leaf datastore {
275 type ds:datastore-ref;
276 mandatory true;
277 description
278 "Datastore that is the target of the <edit-data> operation.
279
280 If the target datastore is not writable, or is not
281 supported by the server, then the server MUST return an
282 <rpc-error> element with an <error-tag> value of
283 'invalid-value'.";
284 }
285 leaf default-operation {
286 type enumeration {
287 enum merge {
288 description
289 "The default operation is merge.";
290 }
291 enum replace {
292 description
293 "The default operation is replace.";
294 }
295 enum none {
296 description
297 "There is no default operation.";
298 }
299 }
300 default "merge";
301 description
302 "The default operation to use.";
303 }
304 choice edit-content {
305 mandatory true;
306 description
307 "The content for the edit operation.";
308 anydata config {
309 description
310 "Inline config content.";
311 }
312 leaf url {
313 if-feature "nc:url";
314 type inet:uri;
315 description
316 "URL-based config content.";
317 }
318 }
319 }
320 }
321
322 /*
323 * Augment the <lock> and <unlock> operations with a
324 * "datastore" parameter.
325 */
326
327 augment "/nc:lock/nc:input/nc:target/nc:config-target" {
328 description
329 "Add NMDA datastore as target.";
330 leaf datastore {
331 type ds:datastore-ref;
332 description
333 "Datastore to lock.
334
335 The <lock> operation is only supported on writable
336 datastores.
337
338 If the <lock> operation is not supported by the server on
339 the specified target datastore, then the server MUST return
340 an <rpc-error> element with an <error-tag> value of
341 'invalid-value'.";
342 }
343 }
344
345 augment "/nc:unlock/nc:input/nc:target/nc:config-target" {
346 description
347 "Add NMDA datastore as target.";
348 leaf datastore {
349 type ds:datastore-ref;
350 description
351 "Datastore to unlock.
352
353 The <unlock> operation is only supported on writable
354 datastores.
355
356 If the <unlock> operation is not supported by the server on
357 the specified target datastore, then the server MUST return
358 an <rpc-error> element with an <error-tag> value of
359 'invalid-value'.";
360 }
361 }
362
363 /*
364 * Augment the <validate> operation with a
365 * "datastore" parameter.
366 */
367
368 augment "/nc:validate/nc:input/nc:source/nc:config-source" {
369 description
370 "Add NMDA datastore as source.";
371 leaf datastore {
372 type ds:datastore-ref;
373 description
374 "Datastore to validate.
375
376 The <validate> operation is supported only on configuration
377 datastores.
378
379 If the <validate> operation is not supported by the server
380 on the specified target datastore, then the server MUST
381 return an <rpc-error> element with an <error-tag> value of
382 'invalid-value'.";
383 }
384 }
385 }