|
| 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:[email protected]> |
| 12 | +
|
| 13 | + Author: Andy Bierman |
| 14 | + |
| 15 | +
|
| 16 | + Author: Martin Bjorklund |
| 17 | + |
| 18 | +
|
| 19 | + Author: Kent Watsen |
| 20 | + |
| 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 | + The module name and namespace values for the YANG module using |
| 82 | + the extension statement are assigned to instance document data |
| 83 | + conforming to the data definition statements within |
| 84 | + this extension. |
| 85 | +
|
| 86 | + The substatements of this extension MUST follow the |
| 87 | + 'data-def-stmt' rule in the YANG ABNF. |
| 88 | +
|
| 89 | + The XPath document root is the extension statement itself, |
| 90 | + such that the child nodes of the document root are |
| 91 | + represented by the data-def-stmt substatements within |
| 92 | + this extension. This conceptual document is the context |
| 93 | + for the following YANG statements: |
| 94 | +
|
| 95 | + - must-stmt |
| 96 | + - when-stmt |
| 97 | + - path-stmt |
| 98 | + - min-elements-stmt |
| 99 | + - max-elements-stmt |
| 100 | + - mandatory-stmt |
| 101 | + - unique-stmt |
| 102 | + - ordered-by |
| 103 | + - instance-identifier data type |
| 104 | +
|
| 105 | + The following data-def-stmt substatements are constrained |
| 106 | + when used within a 'yang-data' extension statement. |
| 107 | +
|
| 108 | + - The list-stmt is not required to have a key-stmt defined. |
| 109 | + - The if-feature-stmt is ignored if present. |
| 110 | + - The config-stmt is ignored if present. |
| 111 | + - The available identity values for any 'identityref' |
| 112 | + leaf or leaf-list nodes are limited to the module |
| 113 | + containing this extension statement and the modules |
| 114 | + imported into that module. |
| 115 | + "; |
| 116 | + } |
| 117 | + |
| 118 | + rc:yang-data yang-errors { |
| 119 | + uses errors; |
| 120 | + } |
| 121 | + |
| 122 | + rc:yang-data yang-api { |
| 123 | + uses restconf; |
| 124 | + } |
| 125 | + |
| 126 | + grouping errors { |
| 127 | + description |
| 128 | + "A grouping that contains a YANG container |
| 129 | + representing the syntax and semantics of a |
| 130 | + YANG Patch error report within a response message."; |
| 131 | + |
| 132 | + container errors { |
| 133 | + description |
| 134 | + "Represents an error report returned by the server if |
| 135 | + a request results in an error."; |
| 136 | + |
| 137 | + list error { |
| 138 | + description |
| 139 | + "An entry containing information about one |
| 140 | + specific error that occurred while processing |
| 141 | + a RESTCONF request."; |
| 142 | + reference |
| 143 | + "RFC 6241, Section 4.3."; |
| 144 | + |
| 145 | + leaf error-type { |
| 146 | + type enumeration { |
| 147 | + enum transport { |
| 148 | + description |
| 149 | + "The transport layer."; |
| 150 | + } |
| 151 | + enum rpc { |
| 152 | + description |
| 153 | + "The rpc or notification layer."; |
| 154 | + } |
| 155 | + enum protocol { |
| 156 | + description |
| 157 | + "The protocol operation layer."; |
| 158 | + } |
| 159 | + enum application { |
| 160 | + description |
| 161 | + "The server application layer."; |
| 162 | + } |
| 163 | + } |
| 164 | + mandatory true; |
| 165 | + description |
| 166 | + "The protocol layer where the error occurred."; |
| 167 | + } |
| 168 | + |
| 169 | + leaf error-tag { |
| 170 | + type string; |
| 171 | + mandatory true; |
| 172 | + description |
| 173 | + "The enumerated error-tag."; |
| 174 | + } |
| 175 | + |
| 176 | + leaf error-app-tag { |
| 177 | + type string; |
| 178 | + description |
| 179 | + "The application-specific error-tag."; |
| 180 | + } |
| 181 | + |
| 182 | + leaf error-path { |
| 183 | + type instance-identifier; |
| 184 | + description |
| 185 | + "The YANG instance identifier associated |
| 186 | + with the error node."; |
| 187 | + } |
| 188 | + |
| 189 | + leaf error-message { |
| 190 | + type string; |
| 191 | + description |
| 192 | + "A message describing the error."; |
| 193 | + } |
| 194 | + |
| 195 | + anydata error-info { |
| 196 | + description |
| 197 | + "This anydata value MUST represent a container with |
| 198 | + zero or more data nodes representing additional |
| 199 | + error information."; |
| 200 | + } |
| 201 | + } |
| 202 | + } |
| 203 | + } |
| 204 | + |
| 205 | + grouping restconf { |
| 206 | + description |
| 207 | + "Conceptual grouping representing the RESTCONF |
| 208 | + root resource."; |
| 209 | + |
| 210 | + container restconf { |
| 211 | + description |
| 212 | + "Conceptual container representing the RESTCONF |
| 213 | + root resource."; |
| 214 | + |
| 215 | + container data { |
| 216 | + description |
| 217 | + "Container representing the datastore resource. |
| 218 | + Represents the conceptual root of all state data |
| 219 | + and configuration data supported by the server. |
| 220 | + The child nodes of this container can be any data |
| 221 | + resources that are defined as top-level data nodes |
| 222 | + from the YANG modules advertised by the server in |
| 223 | + the 'ietf-yang-library' module."; |
| 224 | + } |
| 225 | + |
| 226 | + container operations { |
| 227 | + description |
| 228 | + "Container for all operation resources. |
| 229 | +
|
| 230 | + Each resource is represented as an empty leaf with the |
| 231 | + name of the RPC operation from the YANG 'rpc' statement. |
| 232 | +
|
| 233 | + For example, the 'system-restart' RPC operation defined |
| 234 | + in the 'ietf-system' module would be represented as |
| 235 | + an empty leaf in the 'ietf-system' namespace. This is |
| 236 | + a conceptual leaf and will not actually be found in |
| 237 | + the module: |
| 238 | +
|
| 239 | + module ietf-system { |
| 240 | + leaf system-reset { |
| 241 | + type empty; |
| 242 | + } |
| 243 | + } |
| 244 | +
|
| 245 | + To invoke the 'system-restart' RPC operation: |
| 246 | +
|
| 247 | + POST /restconf/operations/ietf-system:system-restart |
| 248 | +
|
| 249 | + To discover the RPC operations supported by the server: |
| 250 | +
|
| 251 | + GET /restconf/operations |
| 252 | +
|
| 253 | + In XML, the YANG module namespace identifies the module: |
| 254 | +
|
| 255 | + <system-restart |
| 256 | + xmlns='urn:ietf:params:xml:ns:yang:ietf-system'/> |
| 257 | +
|
| 258 | + In JSON, the YANG module name identifies the module: |
| 259 | +
|
| 260 | + { 'ietf-system:system-restart' : [null] } |
| 261 | + "; |
| 262 | + } |
| 263 | + leaf yang-library-version { |
| 264 | + type string { |
| 265 | + pattern '\d{4}-\d{2}-\d{2}'; |
| 266 | + } |
| 267 | + config false; |
| 268 | + mandatory true; |
| 269 | + description |
| 270 | + "Identifies the revision date of the 'ietf-yang-library' |
| 271 | + module that is implemented by this RESTCONF server. |
| 272 | + Indicates the year, month, and day in YYYY-MM-DD |
| 273 | + numeric format."; |
| 274 | + } |
| 275 | + } |
| 276 | + } |
| 277 | + |
| 278 | +} |
0 commit comments