2 namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
5 import ietf-yang-types { prefix yang; revision-date 2013-07-15; }
6 import ietf-inet-types { prefix inet; }
9 "IETF NETCONF (Network Configuration) Working Group";
13 <mailto:andy@yumaworks.com>
15 Editor: Martin Bjorklund
16 <mailto:mbj@tail-f.com>
19 <mailto:kwatsen@juniper.net>
22 <mailto:rex@cisco.com>";
25 "This module contains conceptual YANG specifications
26 for the YANG Patch and error content that is used in
27 RESTCONF protocol messages. A conceptual container
28 representing the RESTCONF API nodes (media type
29 application/yang.api).
31 Note that the YANG definitions within this module do not
32 represent configuration data of any kind.
33 The YANG grouping statements provide a normative syntax
34 for XML and JSON message encoding purposes.
36 Copyright (c) 2013 IETF Trust and the persons identified as
37 authors of the code. All rights reserved.
39 Redistribution and use in source and binary forms, with or
40 without modification, is permitted pursuant to, and subject
41 to the license terms contained in, the Simplified BSD License
42 set forth in Section 4.c of the IETF Trust's Legal Provisions
43 Relating to IETF Documents
44 (http://trustee.ietf.org/license-info).
46 This version of this YANG module is part of RFC XXXX; see
47 the RFC itself for full legal notices.";
49 // RFC Ed.: replace XXXX with actual RFC number and remove this
52 // RFC Ed.: remove this note
53 // Note: extracted from draft-bierman-netconf-restconf-02.txt
55 // RFC Ed.: update the date below with the date of RFC publication
56 // and remove this note.
61 "RFC XXXX: RESTCONF Protocol.";
64 typedef data-resource-identifier {
69 "Contains a Data Resource Identifier formatted string
70 to identify a specific data node. The data node that
71 uses this data type SHOULD define the document root
72 for data resource identifiers. The default document
73 root is the target datastore conceptual root node.
74 Data resource identifiers are defined relative to
77 "RFC XXXX: [sec. 5.3.1.1 ABNF For Data Resource Identifiers]";
80 // this typedef is TBD; not currently used
81 typedef datastore-identifier {
86 "Identifies the NETCONF shared candidate datastore.";
88 "RFC 6241, section 8.3";
92 "Identifies the NETCONF running datastore.";
94 "RFC 6241, section 5.1";
98 "Identifies the NETCONF startup datastore.";
100 "RFC 6241, section 8.7";
106 "Contains a string to identify a specific datastore.
107 The enumerated datastore identifier values are
108 reserved for standard datastore names.";
111 typedef revision-identifier {
113 pattern '\d{4}-\d{2}-\d{2}';
116 "Represents a specific date in YYYY-MM-DD format.
117 TBD: make pattern more precise to exclude leading zeros.";
120 grouping yang-patch {
123 "A grouping that contains a YANG container
124 representing the syntax and semantics of a
125 YANG Patch edit request message.";
127 container yang-patch {
129 "Represents a conceptual sequence of datastore edits,
130 called a patch. Each patch is given a client-assigned
131 patch identifier. Each edit MUST be applied
132 in ascending order, and all edits MUST be applied.
133 If any errors occur, then the target datastore MUST NOT
134 be changed by the patch operation.
136 A patch MUST be validated by the server to be a
137 well-formed message before any of the patch edits
138 are validated or attempted.
140 YANG datastore validation (defined in RFC 6020, section
141 8.3.3) is performed after all edits have been
142 individually validated.
144 It is possible for a datastore constraint violation to occur
145 due to any node in the datastore, including nodes not
146 included in the edit list. Any validation errors MUST
147 be reported in the reply message.";
150 "RFC 6020, section 8.3.";
155 "An arbitrary string provided by the client to identify
156 the entire patch. This value SHOULD be present in any
157 audit logging records generated by the server for the
158 patch. Error messages returned by the server pertaining
159 to this patch will be identified by this patch-id value.";
167 "An arbitrary string provided by the client to describe
168 the entire patch. This value SHOULD be present in any
169 audit logging records generated by the server for the
178 "Represents one edit within the YANG Patch
184 "Arbitrary string index for the edit.
185 Error messages returned by the server pertaining
186 to a specific edit will be identified by this
194 "The target data node is created using the
195 supplied value, only if it does not already
200 "Delete the target node, only if the data resource
201 currently exists, otherwise return an error.";
205 "Insert the supplied value into a user-ordered
206 list or leaf-list entry. The target node must
207 represent a new data resource.";
211 "The supplied value is merged with the target data
216 "Move the target node. Reorder a user-ordered
217 list or leaf-list. The target node must represent
218 an existing data resource.";
222 "The supplied value is used to replace the target
227 "Delete the target node if it currently exists.";
232 "The datastore operation requested for the associated
237 type data-resource-identifier;
240 "Identifies the target data resource for the edit
245 when "(../operation = 'insert' or " +
246 "../operation = 'move') and " +
247 "(../where = 'before' or ../where = 'after')" {
249 "Point leaf only applies for insert or move
250 operations, before or after an existing entry.";
252 type data-resource-identifier;
254 "The absolute URL path for the data node that is being
255 used as the insertion point or move point for the
256 target of this edit entry.";
260 when "../operation = 'insert' or ../operation = 'move'" {
262 "Where leaf only applies for insert or move
268 "Insert or move a data node before the data resource
269 identified by the 'point' parameter.";
273 "Insert or move a data node after the data resource
274 identified by the 'point' parameter.";
278 "Insert or move a data node so it becomes ordered
279 as the first entry.";
283 "Insert or move a data node so it becomes ordered
290 "Identifies where a data resource will be inserted or
291 moved. YANG only allows these operations for
292 list and leaf-list data nodes that are ordered-by
297 when "(../operation = 'create' or " +
298 "../operation = 'merge' " +
299 "or ../operation = 'replace' or " +
300 "../operation = 'insert')" {
302 "Value node only used for create, merge,
303 replace, and insert operations";
306 "Value used for this edit operation.";
311 } // grouping yang-patch
314 grouping yang-patch-status {
317 "A grouping that contains a YANG container
318 representing the syntax and semantics of
319 YANG Patch status response message.";
321 container yang-patch-status {
323 "A container representing the response message
324 sent by the server after a YANG Patch edit
325 request message has been processed.";
330 "The patch-id value used in the request";
333 choice global-status {
335 "Report global errors or complete success.
336 If there is no case selected then errors
337 are reported in the edit-status container.";
342 "This container will be present if global
343 errors unrelated to a specific edit occurred.";
348 "This leaf will be present if the request succeeded
349 and there are no errors reported in the edit-status
354 container edit-status {
356 "This container will be present if there are
357 edit-specific status responses to report.";
363 "Represents a list of status responses,
364 corresponding to edits in the YANG Patch
365 request message. If an edit entry was
366 skipped or not reached by the server,
367 then this list will not contain a corresponding
368 entry for that edit.";
373 "Response status is for the edit list entry
374 with this edit-id value.";
376 choice edit-status-choice {
378 "A choice between different types of status
379 responses for each edit entry.";
383 "This edit entry was invoked without any
384 errors detected by the server associated
390 "Contains the Location header value that would be
391 returned if this edit causes a new resource to be
392 created. If the edit identified by the same edit-id
393 value was successfully invoked and a new resource
394 was created, then this field will be returned
400 "The server detected errors associated with the
401 edit identified by the same edit-id value.";
407 } // grouping yang-patch-status
413 "A grouping that contains a YANG container
414 representing the syntax and semantics of a
415 YANG Patch errors report within a response message.";
418 config false; // needed so list error does not need a key
420 "Represents an error report returned by the server if
421 a request results in an error.";
425 "An entry containing information about one
426 specific error that occurred while processing
427 a RESTCONF request.";
428 reference "RFC 6241, Section 4.3";
433 description "The transport layer";
436 description "The rpc or notification layer";
439 description "The protocol operation layer";
442 description "The server application layer";
447 "The protocol layer where the error occurred.";
454 "The enumerated error tag.";
460 "The application-specific error tag.";
464 type data-resource-identifier;
466 "The target data resource identifier associated
467 with the error, if any.";
473 "A message describing the error.";
476 container error-info {
478 "A container allowing additional information
479 to be included in the error report.";
480 // arbitrary anyxml content here
490 "A grouping that contains a YANG container
491 representing the syntax and semantics of
492 the RESTCONF API resource.";
496 "Conceptual container representing the
497 application/yang.api resource type.";
501 "Container representing the application/yang.datastore
502 resource type. Represents the conceptual root of the
503 unified configuration datastore containing YANG data
504 nodes. The child nodes of this container are
505 configuration data resources (application/yang.data)
506 defined as top-level YANG data nodes from the modules
507 advertised by the server in /restconf/modules.";
510 container operational {
512 "Container representing the application/yang.datastore
513 resource type. Represents the conceptual root of the
514 operational data supported by the server. The child
515 nodes of this container are operational data resources
516 (application/yang.data) defined as top-level
517 YANG data nodes from the modules advertised by
518 the server in /restconf/modules.";
523 "Contains a list of module description entries.
524 These modules are currently loaded into the server.";
529 "Each entry represents one module currently
530 supported by the server.";
533 type yang:yang-identifier;
534 description "The YANG module name.";
538 type revision-identifier;
539 type string { length 0; }
542 "The YANG module revision date. An empty string is
543 used if no revision statement is present in the
550 "The XML namespace identifier for this module.";
553 type yang:yang-identifier;
555 "List of YANG feature names from this module that are
556 supported by the server.";
558 leaf-list deviation {
559 type yang:yang-identifier;
561 "List of YANG deviation module names used by this
562 server to modify the conformance of the module
563 associated with this entry.";
568 container operations {
570 "Container for all operation resources
571 (application/yang.operation),
573 Each resource is represented as an empty leaf with the
574 name of the RPC operation from the YANG rpc statement.
578 POST /restconf/operations/show-log-errors
580 leaf show-log-errors {
588 "Container representing the notification event streams
589 supported by the server.";
591 "RFC 5277, Section 3.4, <streams> element.";
596 "Each entry describes an event stream supported by
601 description "The stream name";
602 reference "RFC 5277, Section 3.4, <name> element.";
607 description "Description of stream content";
609 "RFC 5277, Section 3.4, <description> element.";
612 leaf replay-support {
615 "Indicates if replay buffer supported for this stream";
617 "RFC 5277, Section 3.4, <replaySupport> element.";
620 leaf replay-log-creation-time {
621 type yang:date-and-time;
623 "Indicates the time the replay log for this stream
626 "RFC 5277, Section 3.4, <replayLogCreationTime>
633 "Represents the entry point for establishing
634 notification delivery via server sent events.";
643 "Version 1.0 of the RESTCONF protocol.";
648 "Contains the RESTCONF protocol version.";
651 } // grouping restconf
654 grouping notification {
656 "Contains the notification message wrapper definition.";
658 container notification {
660 "RESTCONF notification message wrapper.";
663 type yang:date-and-time;
666 "The time the event was generated by the
669 "RFC 5277, section 4, <eventTime> element.";
672 /* The YANG-specific notification container is encoded
673 * after the 'event-time' element. The format
674 * corresponds to the notificationContent element
675 * in RFC 5277, section 4. For example:
677 * module example-one {
679 * notification event1 { ... }
683 * Encoded as element 'event1' in the namespace
684 * for module 'example-one'.
687 } // grouping notification