8. RESTCONF模块

ietf-restconf”模块定义了一个扩展和两个分组中的概念性定义,这些分组并不意味着被服务器实现为数据存储内容。 例如,“restconf”容器并不打算作为顶级数据节点来实现(在“/restconf/data”的URI下)。

请注意,“ietf-restconf”的模块没有任何协议可访问的对象,因此不显示YANG树形图。

<CODE BEGINS>

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

<CODE ENDS>