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