blob: 210b95edcec8e2f21fcc99ca21eda5550b327514 [file] [log] [blame]
sonugupta-huaweib5189f12017-12-11 17:28:58 +05301module yrt-ietf-yang-patch {
2 yang-version 1.1;
3 namespace "urn:ietf:params:xml:ns:yang:yrt-ietf-yang-patch";
4 prefix "ypatch";
5
6 import yrt-ietf-restconf { prefix rc; }
7
8 organization
9 "IETF NETCONF (Network Configuration) Working Group";
10
11 contact
12 "WG Web: <https://datatracker.ietf.org/wg/netconf/>
13 WG List: <mailto:netconf@ietf.org>
14 Author: Andy Bierman
15 <mailto:andy@yumaworks.com>
16 Author: Martin Bjorklund
17 <mailto:mbj@tail-f.com>
18 Author: Kent Watsen
19 <mailto:kwatsen@juniper.net>";
20
21 description
22 "This module contains conceptual YANG specifications
23 for the YANG Patch and YANG Patch Status data structures.
24 Note that the YANG definitions within this module do not
25 represent configuration data of any kind.
26 The YANG grouping statements provide a normative syntax
27 for XML and JSON message-encoding purposes.
28 Copyright (c) 2017 IETF Trust and the persons identified as
29 authors of the code. All rights reserved.
30 Redistribution and use in source and binary forms, with or
31 without modification, is permitted pursuant to, and subject
32 to the license terms contained in, the Simplified BSD License
33 set forth in Section 4.c of the IETF Trust's Legal Provisions
34 Relating to IETF Documents
35 (http://trustee.ietf.org/license-info).
36 This version of this YANG module is part of RFC 8072; see
37 the RFC itself for full legal notices.";
38
39 revision 2017-02-22 {
40 description
41 "Initial revision.";
42 reference
43 "RFC 8072: YANG Patch Media Type.";
44 }
45
46 typedef target-resource-offset {
47 type string;
48 description
49 "Contains a data resource identifier string representing
50 a sub-resource within the target resource.
51 The document root for this expression is the
52 target resource that is specified in the
53 protocol operation (e.g., the URI for the PATCH request).
54 This string is encoded according to the same rules as those
55 for a data resource identifier in a RESTCONF request URI.";
56 reference
57 "RFC 8040, Section 3.5.3.";
58 }
59/*
60 rc:yang-data "yang-patch" {
61 uses yang-patch;
62 }
63
64 rc:yang-data "yang-patch-status" {
65 uses yang-patch-status;
66 }
67*/
68 grouping yang-patch {
69
70 description
71 "A grouping that contains a YANG container representing the
72 syntax and semantics of a YANG Patch edit request message.";
73
74 container yang-patch {
75 description
76 "Represents a conceptual sequence of datastore edits,
77 called a patch. Each patch is given a client-assigned
78 patch identifier. Each edit MUST be applied
79 in ascending order, and all edits MUST be applied.
80 If any errors occur, then the target datastore MUST NOT
81 be changed by the YANG Patch operation.
82 It is possible for a datastore constraint violation to occur
83 due to any node in the datastore, including nodes not
84 included in the 'edit' list. Any validation errors MUST
85 be reported in the reply message.";
86
87 reference
88 "RFC 7950, Section 8.3.";
89
90 leaf patch-id {
91 type string;
92 mandatory true;
93 description
94 "An arbitrary string provided by the client to identify
95 the entire patch. Error messages returned by the server
96 that pertain to this patch will be identified by this
97 'patch-id' value. A client SHOULD attempt to generate
98 unique 'patch-id' values to distinguish between
99 transactions from multiple clients in any audit logs
100 maintained by the server.";
101 }
102
103 leaf comment {
104 type string;
105 description
106 "An arbitrary string provided by the client to describe
107 the entire patch. This value SHOULD be present in any
108 audit logging records generated by the server for the
109 patch.";
110 }
111
112 list edit {
113 key edit-id;
114 ordered-by user;
115
116 description
117 "Represents one edit within the YANG Patch request message.
118 The 'edit' list is applied in the following manner:
119 - The first edit is conceptually applied to a copy
120 of the existing target datastore, e.g., the
121 running configuration datastore.
122 - Each ascending edit is conceptually applied to
123 the result of the previous edit(s).
124 - After all edits have been successfully processed,
125 the result is validated according to YANG constraints.
126 - If successful, the server will attempt to apply
127 the result to the target datastore.";
128
129 leaf edit-id {
130 type string;
131 description
132 "Arbitrary string index for the edit.
133 Error messages returned by the server that pertain
134 to a specific edit will be identified by this value.";
135 }
136
137 leaf operation {
138 type enumeration {
139 enum create {
140 description
141 "The target data node is created using the supplied
142 value, only if it does not already exist. The
143 'target' leaf identifies the data node to be
144 created, not the parent data node.";
145 }
146 enum delete {
147 description
148 "Delete the target node, only if the data resource
149 currently exists; otherwise, return an error.";
150 }
151
152 enum insert {
153 description
154 "Insert the supplied value into a user-ordered
155 list or leaf-list entry. The target node must
156 represent a new data resource. If the 'where'
157 parameter is set to 'before' or 'after', then
158 the 'point' parameter identifies the insertion
159 point for the target node.";
160 }
161 enum merge {
162 description
163 "The supplied value is merged with the target data
164 node.";
165 }
166 enum move {
167 description
168 "Move the target node. Reorder a user-ordered
169 list or leaf-list. The target node must represent
170 an existing data resource. If the 'where' parameter
171 is set to 'before' or 'after', then the 'point'
172 parameter identifies the insertion point to move
173 the target node.";
174 }
175 enum replace {
176 description
177 "The supplied value is used to replace the target
178 data node.";
179 }
180 enum remove {
181 description
182 "Delete the target node if it currently exists.";
183 }
184 }
185 mandatory true;
186 description
187 "The datastore operation requested for the associated
188 'edit' entry.";
189 }
190
191 leaf target {
192 type target-resource-offset;
193 mandatory true;
194 description
195 "Identifies the target data node for the edit
196 operation. If the target has the value '/', then
197 the target data node is the target resource.
198 The target node MUST identify a data resource,
199 not the datastore resource.";
200 }
201
202 leaf point {
203 when "(../operation = 'insert' or ../operation = 'move')"
204 + "and (../where = 'before' or ../where = 'after')" {
205 description
206 "This leaf only applies for 'insert' or 'move'
207 operations, before or after an existing entry.";
208 }
209 type target-resource-offset;
210 description
211 "The absolute URL path for the data node that is being
212 used as the insertion point or move point for the
213 target of this 'edit' entry.";
214 }
215
216 leaf where {
217 when "../operation = 'insert' or ../operation = 'move'" {
218 description
219 "This leaf only applies for 'insert' or 'move'
220 operations.";
221 }
222 type enumeration {
223 enum before {
224 description
225 "Insert or move a data node before the data resource
226 identified by the 'point' parameter.";
227 }
228 enum after {
229 description
230 "Insert or move a data node after the data resource
231 identified by the 'point' parameter.";
232 }
233
234 enum first {
235 description
236 "Insert or move a data node so it becomes ordered
237 as the first entry.";
238 }
239 enum last {
240 description
241 "Insert or move a data node so it becomes ordered
242 as the last entry.";
243 }
244 }
245 default last;
246 description
247 "Identifies where a data resource will be inserted
248 or moved. YANG only allows these operations for
249 list and leaf-list data nodes that are
250 'ordered-by user'.";
251 }
252
253 anydata value {
254 when "../operation = 'create' "
255 + "or ../operation = 'merge' "
256 + "or ../operation = 'replace' "
257 + "or ../operation = 'insert'" {
258 description
259 "The anydata 'value' is only used for 'create',
260 'merge', 'replace', and 'insert' operations.";
261 }
262 description
263 "Value used for this edit operation. The anydata 'value'
264 contains the target resource associated with the
265 'target' leaf.
266 For example, suppose the target node is a YANG container
267 named foo:
268 container foo {
269 leaf a { type string; }
270 leaf b { type int32; }
271 }
272 The 'value' node contains one instance of foo:
273 <value>
274 <foo xmlns='example-foo-namespace'>
275 <a>some value</a>
276 <b>42</b>
277 </foo>
278 </value>
279 ";
280 }
281 }
282 }
283
284 } // grouping yang-patch
285
286 grouping yang-patch-status {
287
288 description
289 "A grouping that contains a YANG container representing the
290 syntax and semantics of a YANG Patch Status response
291 message.";
292
293 container yang-patch-status {
294 description
295 "A container representing the response message sent by the
296 server after a YANG Patch edit request message has been
297 processed.";
298
299 leaf patch-id {
300 type string;
301 mandatory true;
302 description
303 "The 'patch-id' value used in the request.";
304 }
305
306 choice global-status {
307 description
308 "Report global errors or complete success.
309 If there is no case selected, then errors
310 are reported in the 'edit-status' container.";
311
312 case global-errors {
313 uses rc:errors;
314 description
315 "This container will be present if global errors that
316 are unrelated to a specific edit occurred.";
317 }
318 leaf ok {
319 type empty;
320 description
321 "This leaf will be present if the request succeeded
322 and there are no errors reported in the 'edit-status'
323 container.";
324 }
325 }
326
327 container edit-status {
328 description
329 "This container will be present if there are
330 edit-specific status responses to report.
331 If all edits succeeded and the 'global-status'
332 returned is 'ok', then a server MAY omit this
333 container.";
334
335 list edit {
336 key edit-id;
337
338 description
339 "Represents a list of status responses,
340 corresponding to edits in the YANG Patch
341 request message. If an 'edit' entry was
342 skipped or not reached by the server,
343 then this list will not contain a corresponding
344 entry for that edit.";
345
346 leaf edit-id {
347 type string;
348 description
349 "Response status is for the 'edit' list entry
350 with this 'edit-id' value.";
351 }
352
353 choice edit-status-choice {
354 description
355 "A choice between different types of status
356 responses for each 'edit' entry.";
357 leaf ok {
358 type empty;
359 description
360 "This 'edit' entry was invoked without any
361 errors detected by the server associated
362 with this edit.";
363 }
364 case errors {
365 uses rc:errors;
366 description
367 "The server detected errors associated with the
368 edit identified by the same 'edit-id' value.";
369 }
370 }
371 }
372 }
373 }
374 } // grouping yang-patch-status
375
376}