blob: 25a5a1640d2e0ba0f27a64ba625f504945b2421a [file] [log] [blame]
sonugupta-huaweib5189f12017-12-11 17:28:58 +05301module yrt-ietf-yang-patch {
sonugupta-huaweib5189f12017-12-11 17:28:58 +05302
sonugupta-huawei99c0a012017-12-23 00:44:15 +05303 yang-version 1.1;
sonugupta-huaweib5189f12017-12-11 17:28:58 +05304
sonugupta-huawei99c0a012017-12-23 00:44:15 +05305 namespace
6 "urn:ietf:params:xml:ns:yang:yrt-ietf-yang-patch";
sonugupta-huaweib5189f12017-12-11 17:28:58 +05307
sonugupta-huawei99c0a012017-12-23 00:44:15 +05308 prefix ypatch;
9
10 import yrt-ietf-restconf {
11 prefix rc;
12 }
13
14 organization
15 "IETF NETCONF (Network Configuration) Working Group";
16
17 contact
18 "WG Web: <https://datatracker.ietf.org/wg/netconf/>
sonugupta-huaweib5189f12017-12-11 17:28:58 +053019 WG List: <mailto:netconf@ietf.org>
sonugupta-huawei99c0a012017-12-23 00:44:15 +053020
sonugupta-huaweib5189f12017-12-11 17:28:58 +053021 Author: Andy Bierman
22 <mailto:andy@yumaworks.com>
sonugupta-huawei99c0a012017-12-23 00:44:15 +053023
sonugupta-huaweib5189f12017-12-11 17:28:58 +053024 Author: Martin Bjorklund
25 <mailto:mbj@tail-f.com>
sonugupta-huawei99c0a012017-12-23 00:44:15 +053026
sonugupta-huaweib5189f12017-12-11 17:28:58 +053027 Author: Kent Watsen
28 <mailto:kwatsen@juniper.net>";
29
sonugupta-huawei99c0a012017-12-23 00:44:15 +053030 description
31 "This module contains conceptual YANG specifications
sonugupta-huaweib5189f12017-12-11 17:28:58 +053032 for the YANG Patch and YANG Patch Status data structures.
sonugupta-huawei99c0a012017-12-23 00:44:15 +053033
sonugupta-huaweib5189f12017-12-11 17:28:58 +053034 Note that the YANG definitions within this module do not
35 represent configuration data of any kind.
36 The YANG grouping statements provide a normative syntax
37 for XML and JSON message-encoding purposes.
sonugupta-huawei99c0a012017-12-23 00:44:15 +053038
sonugupta-huaweib5189f12017-12-11 17:28:58 +053039 Copyright (c) 2017 IETF Trust and the persons identified as
40 authors of the code. All rights reserved.
sonugupta-huawei99c0a012017-12-23 00:44:15 +053041
sonugupta-huaweib5189f12017-12-11 17:28:58 +053042 Redistribution and use in source and binary forms, with or
43 without modification, is permitted pursuant to, and subject
44 to the license terms contained in, the Simplified BSD License
45 set forth in Section 4.c of the IETF Trust's Legal Provisions
46 Relating to IETF Documents
47 (http://trustee.ietf.org/license-info).
sonugupta-huawei99c0a012017-12-23 00:44:15 +053048
sonugupta-huaweib5189f12017-12-11 17:28:58 +053049 This version of this YANG module is part of RFC 8072; see
50 the RFC itself for full legal notices.";
51
sonugupta-huawei99c0a012017-12-23 00:44:15 +053052 revision "2017-02-22" {
53 description "Initial revision.";
54 reference
55 "RFC 8072: YANG Patch Media Type.";
sonugupta-huaweib5189f12017-12-11 17:28:58 +053056
sonugupta-huawei99c0a012017-12-23 00:44:15 +053057 }
58
59 rc:yang-data "yang-patch";
60 rc:yang-data "yang-patch-status";
61
62 typedef target-resource-offset {
63 type string;
64 description
65 "Contains a data resource identifier string representing
sonugupta-huaweib5189f12017-12-11 17:28:58 +053066 a sub-resource within the target resource.
67 The document root for this expression is the
68 target resource that is specified in the
69 protocol operation (e.g., the URI for the PATCH request).
sonugupta-huawei99c0a012017-12-23 00:44:15 +053070
sonugupta-huaweib5189f12017-12-11 17:28:58 +053071 This string is encoded according to the same rules as those
72 for a data resource identifier in a RESTCONF request URI.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +053073 reference
74 "RFC 8040, Section 3.5.3.";
75
76 }
77
sonugupta-huaweib5189f12017-12-11 17:28:58 +053078 uses yang-patch;
sonugupta-huaweib5189f12017-12-11 17:28:58 +053079
sonugupta-huaweib5189f12017-12-11 17:28:58 +053080 uses yang-patch-status;
sonugupta-huaweib5189f12017-12-11 17:28:58 +053081
sonugupta-huawei99c0a012017-12-23 00:44:15 +053082 grouping yang-patch {
sonugupta-huaweib5189f12017-12-11 17:28:58 +053083 description
sonugupta-huawei99c0a012017-12-23 00:44:15 +053084 "A grouping that contains a YANG container representing the
85 syntax and semantics of a YANG Patch edit request message.";
86 container yang-patch {
87 description
88 "Represents a conceptual sequence of datastore edits,
sonugupta-huaweib5189f12017-12-11 17:28:58 +053089 called a patch. Each patch is given a client-assigned
90 patch identifier. Each edit MUST be applied
91 in ascending order, and all edits MUST be applied.
92 If any errors occur, then the target datastore MUST NOT
93 be changed by the YANG Patch operation.
sonugupta-huawei99c0a012017-12-23 00:44:15 +053094
sonugupta-huaweib5189f12017-12-11 17:28:58 +053095 It is possible for a datastore constraint violation to occur
96 due to any node in the datastore, including nodes not
97 included in the 'edit' list. Any validation errors MUST
98 be reported in the reply message.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +053099 reference
100 "RFC 7950, Section 8.3.";
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530101
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530102 leaf patch-id {
103 type string;
104 mandatory true;
105 description
106 "An arbitrary string provided by the client to identify
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530107 the entire patch. Error messages returned by the server
108 that pertain to this patch will be identified by this
109 'patch-id' value. A client SHOULD attempt to generate
110 unique 'patch-id' values to distinguish between
111 transactions from multiple clients in any audit logs
112 maintained by the server.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530113 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530114
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530115 leaf comment {
116 type string;
117 description
118 "An arbitrary string provided by the client to describe
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530119 the entire patch. This value SHOULD be present in any
120 audit logging records generated by the server for the
121 patch.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530122 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530123
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530124 list edit {
125 key "edit-id";
126 ordered-by user;
127 description
128 "Represents one edit within the YANG Patch request message.
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530129 The 'edit' list is applied in the following manner:
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530130
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530131 - The first edit is conceptually applied to a copy
132 of the existing target datastore, e.g., the
133 running configuration datastore.
134 - Each ascending edit is conceptually applied to
135 the result of the previous edit(s).
136 - After all edits have been successfully processed,
137 the result is validated according to YANG constraints.
138 - If successful, the server will attempt to apply
139 the result to the target datastore.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530140 leaf edit-id {
141 type string;
142 description
143 "Arbitrary string index for the edit.
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530144 Error messages returned by the server that pertain
145 to a specific edit will be identified by this value.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530146 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530147
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530148 leaf operation {
149 type enumeration {
150 enum "create" {
151 value 0;
152 description
153 "The target data node is created using the supplied
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530154 value, only if it does not already exist. The
155 'target' leaf identifies the data node to be
156 created, not the parent data node.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530157 }
158 enum "delete" {
159 value 1;
160 description
161 "Delete the target node, only if the data resource
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530162 currently exists; otherwise, return an error.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530163 }
164 enum "insert" {
165 value 2;
166 description
167 "Insert the supplied value into a user-ordered
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530168 list or leaf-list entry. The target node must
169 represent a new data resource. If the 'where'
170 parameter is set to 'before' or 'after', then
171 the 'point' parameter identifies the insertion
172 point for the target node.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530173 }
174 enum "merge" {
175 value 3;
176 description
177 "The supplied value is merged with the target data
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530178 node.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530179 }
180 enum "move" {
181 value 4;
182 description
183 "Move the target node. Reorder a user-ordered
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530184 list or leaf-list. The target node must represent
185 an existing data resource. If the 'where' parameter
186 is set to 'before' or 'after', then the 'point'
187 parameter identifies the insertion point to move
188 the target node.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530189 }
190 enum "replace" {
191 value 5;
192 description
193 "The supplied value is used to replace the target
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530194 data node.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530195 }
196 enum "remove" {
197 value 6;
198 description
199 "Delete the target node if it currently exists.";
200 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530201 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530202 mandatory true;
203 description
204 "The datastore operation requested for the associated
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530205 'edit' entry.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530206 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530207
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530208 leaf target {
209 type target-resource-offset;
210 mandatory true;
211 description
212 "Identifies the target data node for the edit
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530213 operation. If the target has the value '/', then
214 the target data node is the target resource.
215 The target node MUST identify a data resource,
216 not the datastore resource.";
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530217 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530218
219 leaf point {
220 when
221 "(../operation = 'insert' or ../operation = 'move')"
222 + "and (../where = 'before' or ../where = 'after')" {
223 description
224 "This leaf only applies for 'insert' or 'move'
225 operations, before or after an existing entry.";
226 }
227 type target-resource-offset;
228 description
229 "The absolute URL path for the data node that is being
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530230 used as the insertion point or move point for the
231 target of this 'edit' entry.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530232 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530233
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530234 leaf where {
235 when
236 "../operation = 'insert' or ../operation = 'move'" {
237 description
238 "This leaf only applies for 'insert' or 'move'
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530239 operations.";
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530240 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530241 type enumeration {
242 enum "before" {
243 value 0;
244 description
245 "Insert or move a data node before the data resource
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530246 identified by the 'point' parameter.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530247 }
248 enum "after" {
249 value 1;
250 description
251 "Insert or move a data node after the data resource
252 identified by the 'point' parameter.";
253 }
254 enum "first" {
255 value 2;
256 description
257 "Insert or move a data node so it becomes ordered
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530258 as the first entry.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530259 }
260 enum "last" {
261 value 3;
262 description
263 "Insert or move a data node so it becomes ordered
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530264 as the last entry.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530265 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530266 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530267 default 'last';
268 description
269 "Identifies where a data resource will be inserted
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530270 or moved. YANG only allows these operations for
271 list and leaf-list data nodes that are
272 'ordered-by user'.";
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530273 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530274
275 anydata value {
276 when
277 "../operation = 'create' "
278 + "or ../operation = 'merge' "
279 + "or ../operation = 'replace' "
280 + "or ../operation = 'insert'" {
281 description
282 "The anydata 'value' is only used for 'create',
283 'merge', 'replace', and 'insert' operations.";
284 }
285 description
286 "Value used for this edit operation. The anydata 'value'
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530287 contains the target resource associated with the
288 'target' leaf.
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530289
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530290 For example, suppose the target node is a YANG container
291 named foo:
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530292
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530293 container foo {
294 leaf a { type string; }
295 leaf b { type int32; }
296 }
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530297
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530298 The 'value' node contains one instance of foo:
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530299
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530300 <value>
301 <foo xmlns='example-foo-namespace'>
302 <a>some value</a>
303 <b>42</b>
304 </foo>
305 </value>
306 ";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530307 }
308 } // list edit
309 } // container yang-patch
310 } // grouping yang-patch
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530311
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530312 grouping yang-patch-status {
313 description
314 "A grouping that contains a YANG container representing the
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530315 syntax and semantics of a YANG Patch Status response
316 message.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530317 container yang-patch-status {
318 description
319 "A container representing the response message sent by the
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530320 server after a YANG Patch edit request message has been
321 processed.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530322 leaf patch-id {
323 type string;
324 mandatory true;
325 description
326 "The 'patch-id' value used in the request.";
327 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530328
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530329 choice global-status {
330 description
331 "Report global errors or complete success.
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530332 If there is no case selected, then errors
333 are reported in the 'edit-status' container.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530334 case global-errors {
335 description
336 "This container will be present if global errors that
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530337 are unrelated to a specific edit occurred.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530338 uses rc:errors;
339 } // case global-errors
340 leaf ok {
341 type empty;
342 description
343 "This leaf will be present if the request succeeded
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530344 and there are no errors reported in the 'edit-status'
345 container.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530346 }
347 } // choice global-status
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530348
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530349 container edit-status {
350 description
351 "This container will be present if there are
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530352 edit-specific status responses to report.
353 If all edits succeeded and the 'global-status'
354 returned is 'ok', then a server MAY omit this
355 container.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530356 list edit {
357 key "edit-id";
358 description
359 "Represents a list of status responses,
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530360 corresponding to edits in the YANG Patch
361 request message. If an 'edit' entry was
362 skipped or not reached by the server,
363 then this list will not contain a corresponding
364 entry for that edit.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530365 leaf edit-id {
366 type string;
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530367 description
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530368 "Response status is for the 'edit' list entry
369 with this 'edit-id' value.";
370 }
371
372 choice edit-status-choice {
373 description
374 "A choice between different types of status
375 responses for each 'edit' entry.";
376 leaf ok {
377 type empty;
378 description
379 "This 'edit' entry was invoked without any
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530380 errors detected by the server associated
381 with this edit.";
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530382 }
sonugupta-huaweib5189f12017-12-11 17:28:58 +0530383
sonugupta-huawei99c0a012017-12-23 00:44:15 +0530384 case errors {
385 description
386 "The server detected errors associated with the
387 edit identified by the same 'edit-id' value.";
388 uses rc:errors;
389 } // case errors
390 } // choice edit-status-choice
391 } // list edit
392 } // container edit-status
393 } // container yang-patch-status
394 } // grouping yang-patch-status
395 } // module ietf-yang-patch