dc54388b1075866d0c5118710d469afaeb08a85f
[netconf.git] / restconf / restconf-nb-bierman02 / src / test / resources / restconf / impl / ietf-restconf@2017-01-26.yang
1 module ietf-restconf {
2      yang-version 1.1;
3      namespace "urn:ietf:params:xml:ns:yang:ietf-restconf";
4      prefix "rc";
5
6      organization
7        "IETF NETCONF (Network Configuration) Working Group";
8
9      contact
10        "WG Web:   <https://datatracker.ietf.org/wg/netconf/>
11         WG List:  <mailto:netconf@ietf.org>
12
13         Author:   Andy Bierman
14                   <mailto:andy@yumaworks.com>
15
16         Author:   Martin Bjorklund
17                   <mailto:mbj@tail-f.com>
18
19         Author:   Kent Watsen
20                   <mailto:kwatsen@juniper.net>";
21
22      description
23        "This module contains conceptual YANG specifications
24         for basic RESTCONF media type definitions used in
25         RESTCONF protocol messages.
26
27         Note that the YANG definitions within this module do not
28         represent configuration data of any kind.
29         The 'restconf-media-type' YANG extension statement
30         provides a normative syntax for XML and JSON
31         message-encoding purposes.
32
33         Copyright (c) 2017 IETF Trust and the persons identified as
34         authors of the code.  All rights reserved.
35
36         Redistribution and use in source and binary forms, with or
37         without modification, is permitted pursuant to, and subject
38         to the license terms contained in, the Simplified BSD License
39         set forth in Section 4.c of the IETF Trust's Legal Provisions
40         Relating to IETF Documents
41         (http://trustee.ietf.org/license-info).
42
43         This version of this YANG module is part of RFC 8040; see
44         the RFC itself for full legal notices.";
45
46      revision 2017-01-26 {
47        description
48          "Initial revision.";
49        reference
50          "RFC 8040: RESTCONF Protocol.";
51      }
52
53      extension yang-data {
54        argument name {
55          yin-element true;
56        }
57        description
58          "This extension is used to specify a YANG data template that
59           represents conceptual data defined in YANG.  It is
60           intended to describe hierarchical data independent of
61           protocol context or specific message-encoding format.
62           Data definition statements within a yang-data extension
63           specify the generic syntax for the specific YANG data
64           template, whose name is the argument of the 'yang-data'
65           extension statement.
66
67           Note that this extension does not define a media type.
68           A specification using this extension MUST specify the
69           message-encoding rules, including the content media type.
70
71           The mandatory 'name' parameter value identifies the YANG
72           data template that is being defined.  It contains the
73           template name.
74
75           This extension is ignored unless it appears as a top-level
76           statement.  It MUST contain data definition statements
77           that result in exactly one container data node definition.
78           An instance of a YANG data template can thus be translated
79           into an XML instance document, whose top-level element
80           corresponds to the top-level container.
81
82           The module name and namespace values for the YANG module using
83           the extension statement are assigned to instance document data
84           conforming to the data definition statements within
85           this extension.
86
87           The substatements of this extension MUST follow the
88           'data-def-stmt' rule in the YANG ABNF.
89
90           The XPath document root is the extension statement itself,
91           such that the child nodes of the document root are
92           represented by the data-def-stmt substatements within
93           this extension.  This conceptual document is the context
94           for the following YANG statements:
95
96             - must-stmt
97             - when-stmt
98             - path-stmt
99             - min-elements-stmt
100             - max-elements-stmt
101             - mandatory-stmt
102             - unique-stmt
103             - ordered-by
104             - instance-identifier data type
105
106           The following data-def-stmt substatements are constrained
107           when used within a 'yang-data' extension statement.
108
109             - The list-stmt is not required to have a key-stmt defined.
110             - The if-feature-stmt is ignored if present.
111             - The config-stmt is ignored if present.
112             - The available identity values for any 'identityref'
113               leaf or leaf-list nodes are limited to the module
114               containing this extension statement and the modules
115               imported into that module.
116          ";
117      }
118
119      rc:yang-data yang-errors {
120        uses errors;
121      }
122
123      rc:yang-data yang-api {
124        uses restconf;
125      }
126
127      grouping errors {
128        description
129          "A grouping that contains a YANG container
130           representing the syntax and semantics of a
131           YANG Patch error report within a response message.";
132
133        container errors {
134          description
135            "Represents an error report returned by the server if
136             a request results in an error.";
137
138          list error {
139            description
140              "An entry containing information about one
141               specific error that occurred while processing
142               a RESTCONF request.";
143            reference
144              "RFC 6241, Section 4.3.";
145
146            leaf error-type {
147              type enumeration {
148                enum transport {
149                  description
150                    "The transport layer.";
151                }
152                enum rpc {
153                  description
154                    "The rpc or notification layer.";
155                }
156                enum protocol {
157                  description
158                    "The protocol operation layer.";
159                }
160                enum application {
161                  description
162                    "The server application layer.";
163                }
164              }
165              mandatory true;
166              description
167                "The protocol layer where the error occurred.";
168            }
169
170            leaf error-tag {
171              type string;
172              mandatory true;
173              description
174                "The enumerated error-tag.";
175            }
176
177            leaf error-app-tag {
178              type string;
179              description
180                "The application-specific error-tag.";
181            }
182
183            leaf error-path {
184              type instance-identifier;
185              description
186                "The YANG instance identifier associated
187                 with the error node.";
188            }
189
190            leaf error-message {
191              type string;
192              description
193                "A message describing the error.";
194            }
195
196            anydata error-info {
197               description
198                 "This anydata value MUST represent a container with
199                  zero or more data nodes representing additional
200                  error information.";
201            }
202          }
203        }
204      }
205
206      grouping restconf {
207        description
208          "Conceptual grouping representing the RESTCONF
209           root resource.";
210
211        container restconf {
212          description
213            "Conceptual container representing the RESTCONF
214             root resource.";
215
216          container data {
217            description
218              "Container representing the datastore resource.
219               Represents the conceptual root of all state data
220               and configuration data supported by the server.
221               The child nodes of this container can be any data
222               resources that are defined as top-level data nodes
223               from the YANG modules advertised by the server in
224               the 'ietf-yang-library' module.";
225          }
226
227          container operations {
228            description
229              "Container for all operation resources.
230
231               Each resource is represented as an empty leaf with the
232               name of the RPC operation from the YANG 'rpc' statement.
233
234               For example, the 'system-restart' RPC operation defined
235               in the 'ietf-system' module would be represented as
236               an empty leaf in the 'ietf-system' namespace.  This is
237               a conceptual leaf and will not actually be found in
238               the module:
239
240                  module ietf-system {
241                    leaf system-reset {
242                      type empty;
243                    }
244                  }
245
246               To invoke the 'system-restart' RPC operation:
247
248                  POST /restconf/operations/ietf-system:system-restart
249
250               To discover the RPC operations supported by the server:
251
252                  GET /restconf/operations
253
254               In XML, the YANG module namespace identifies the module:
255
256                 <system-restart
257                    xmlns='urn:ietf:params:xml:ns:yang:ietf-system'/>
258
259               In JSON, the YANG module name identifies the module:
260
261                 { 'ietf-system:system-restart' : [null] }
262              ";
263          }
264
265          leaf yang-library-version {
266            type string {
267              pattern '\d{4}-\d{2}-\d{2}';
268            }
269            config false;
270            mandatory true;
271            description
272              "Identifies the revision date of the 'ietf-yang-library'
273               module that is implemented by this RESTCONF server.
274               Indicates the year, month, and day in YYYY-MM-DD
275               numeric format.";
276          }
277        }
278      }
279 }