附录B. NETCONF消息层的XML Schema

本部分是规范性的。

<CODE BEGINS> file “netconf.xsd”

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
  3. xmlns="urn:ietf:params:xml:ns:netconf:base:1.0"
  4. targetNamespace="urn:ietf:params:xml:ns:netconf:base:1.0"
  5. elementFormDefault="qualified"
  6. attributeFormDefault="unqualified"
  7. xml:lang="en"
  8. version="1.1">
  9. <xs:annotation>
  10. <xs:documentation>
  11. This schema defines the syntax for the NETCONF Messages layer
  12. messages 'hello', 'rpc', and 'rpc-reply'.
  13. </xs:documentation>
  14. </xs:annotation>
  15. <!--
  16. import standard XML definitions
  17. -->
  18. <xs:import namespace="http://www.w3.org/XML/1998/namespace"
  19. schemaLocation="http://www.w3.org/2001/xml.xsd">
  20. <xs:annotation>
  21. <xs:documentation>
  22. This import accesses the xml: attribute groups for the
  23. xml:lang as declared on the error-message element.
  24. </xs:documentation>
  25. </xs:annotation>
  26. </xs:import>
  27. <!--
  28. message-id attribute
  29. -->
  30. <xs:simpleType name="messageIdType">
  31. <xs:restriction base="xs:string">
  32. <xs:maxLength value="4095"/>
  33. </xs:restriction>
  34. </xs:simpleType>
  35. <!--
  36. Types used for session-id
  37. -->
  38. <xs:simpleType name="SessionId">
  39. <xs:restriction base="xs:unsignedInt">
  40. <xs:minInclusive value="1"/>
  41. </xs:restriction>
  42. </xs:simpleType>
  43. <xs:simpleType name="SessionIdOrZero">
  44. <xs:restriction base="xs:unsignedInt"/>
  45. </xs:simpleType>
  46. <!--
  47. <rpc> element
  48. -->
  49. <xs:complexType name="rpcType">
  50. <xs:sequence>
  51. <xs:element ref="rpcOperation"/>
  52. </xs:sequence>
  53. <xs:attribute name="message-id" type="messageIdType" use="required"/>
  54. <!--
  55. Arbitrary attributes can be supplied with <rpc> element.
  56. -->
  57. <xs:anyAttribute processContents="lax"/>
  58. </xs:complexType>
  59. <xs:element name="rpc" type="rpcType"/>
  60. <!--
  61. data types and elements used to construct rpc-errors
  62. -->
  63. <xs:simpleType name="ErrorType">
  64. <xs:restriction base="xs:string">
  65. <xs:enumeration value="transport"/>
  66. <xs:enumeration value="rpc"/>
  67. <xs:enumeration value="protocol"/>
  68. <xs:enumeration value="application"/>
  69. </xs:restriction>
  70. </xs:simpleType>
  71. <xs:simpleType name="ErrorTag">
  72. <xs:restriction base="xs:string">
  73. <xs:enumeration value="in-use"/>
  74. <xs:enumeration value="invalid-value"/>
  75. <xs:enumeration value="too-big"/>
  76. <xs:enumeration value="missing-attribute"/>
  77. <xs:enumeration value="bad-attribute"/>
  78. <xs:enumeration value="unknown-attribute"/>
  79. <xs:enumeration value="missing-element"/>
  80. <xs:enumeration value="bad-element"/>
  81. <xs:enumeration value="unknown-element"/>
  82. <xs:enumeration value="unknown-namespace"/>
  83. <xs:enumeration value="access-denied"/>
  84. <xs:enumeration value="lock-denied"/>
  85. <xs:enumeration value="resource-denied"/>
  86. <xs:enumeration value="rollback-failed"/>
  87. <xs:enumeration value="data-exists"/>
  88. <xs:enumeration value="data-missing"/>
  89. <xs:enumeration value="operation-not-supported"/>
  90. <xs:enumeration value="operation-failed"/>
  91. <xs:enumeration value="partial-operation"/>
  92. <xs:enumeration value="malformed-message"/>
  93. </xs:restriction>
  94. </xs:simpleType>
  95. <xs:simpleType name="ErrorSeverity">
  96. <xs:restriction base="xs:string">
  97. <xs:enumeration value="error"/>
  98. <xs:enumeration value="warning"/>
  99. </xs:restriction>
  100. </xs:simpleType>
  101. <xs:complexType name="errorInfoType">
  102. <xs:sequence>
  103. <xs:choice>
  104. <xs:element name="session-id" type="SessionIdOrZero"/>
  105. <xs:sequence minOccurs="0" maxOccurs="unbounded">
  106. <xs:sequence>
  107. <xs:element name="bad-attribute" type="xs:QName" minOccurs="0" maxOccurs="1"/>
  108. <xs:element name="bad-element" type="xs:QName" minOccurs="0" maxOccurs="1"/>
  109. <xs:element name="ok-element" type="xs:QName" minOccurs="0" maxOccurs="1"/>
  110. <xs:element name="err-element" type="xs:QName" minOccurs="0" maxOccurs="1"/>
  111. <xs:element name="noop-element" type="xs:QName" minOccurs="0" maxOccurs="1"/>
  112. <xs:element name="bad-namespace" type="xs:string" minOccurs="0" maxOccurs="1"/>
  113. </xs:sequence>
  114. </xs:sequence>
  115. </xs:choice>
  116. <!-- elements from any other namespace are also allowed
  117. to follow the NETCONF elements -->
  118. <xs:any namespace="##other" processContents="lax"
  119. minOccurs="0" maxOccurs="unbounded"/>
  120. </xs:sequence>
  121. </xs:complexType>
  122. <xs:complexType name="rpcErrorType">
  123. <xs:sequence>
  124. <xs:element name="error-type" type="ErrorType"/>
  125. <xs:element name="error-tag" type="ErrorTag"/>
  126. <xs:element name="error-severity" type="ErrorSeverity"/>
  127. <xs:element name="error-app-tag" type="xs:string"
  128. minOccurs="0"/>
  129. <xs:element name="error-path" type="xs:string" minOccurs="0"/>
  130. <xs:element name="error-message" minOccurs="0">
  131. <xs:complexType>
  132. <xs:simpleContent>
  133. <xs:extension base="xs:string">
  134. <xs:attribute ref="xml:lang" use="optional"/>
  135. </xs:extension>
  136. </xs:simpleContent>
  137. </xs:complexType>
  138. </xs:element>
  139. <xs:element name="error-info" type="errorInfoType"
  140. minOccurs="0"/>
  141. </xs:sequence>
  142. </xs:complexType>
  143. <!--
  144. operation attribute used in <edit-config>
  145. -->
  146. <xs:simpleType name="editOperationType">
  147. <xs:restriction base="xs:string">
  148. <xs:enumeration value="merge"/>
  149. <xs:enumeration value="replace"/>
  150. <xs:enumeration value="create"/>
  151. <xs:enumeration value="delete"/>
  152. <xs:enumeration value="remove"/>
  153. </xs:restriction>
  154. </xs:simpleType>
  155. <xs:attribute name="operation" type="editOperationType"/>
  156. <!--
  157. <rpc-reply> element
  158. -->
  159. <xs:complexType name="rpcReplyType">
  160. <xs:choice>
  161. <xs:element name="ok"/>
  162. <xs:sequence>
  163. <xs:element ref="rpc-error" minOccurs="0" maxOccurs="unbounded"/>
  164. <xs:element ref="rpcResponse" minOccurs="0" maxOccurs="unbounded"/>
  165. </xs:sequence>
  166. </xs:choice>
  167. <xs:attribute name="message-id" type="messageIdType"
  168. use="optional"/>
  169. <!--
  170. Any attributes supplied with <rpc> element must be returned
  171. on <rpc-reply>.
  172. -->
  173. <xs:anyAttribute processContents="lax"/>
  174. </xs:complexType>
  175. <xs:element name="rpc-reply" type="rpcReplyType"/>
  176. <!--
  177. <rpc-error> element
  178. -->
  179. <xs:element name="rpc-error" type="rpcErrorType"/>
  180. <!--
  181. rpcOperationType: used as a base type for all
  182. NETCONF operations
  183. -->
  184. <xs:complexType name="rpcOperationType"/>
  185. <xs:element name="rpcOperation" type="rpcOperationType" abstract="true"/>
  186. <!--
  187. rpcResponseType: used as a base type for all
  188. NETCONF responses
  189. -->
  190. <xs:complexType name="rpcResponseType"/>
  191. <xs:element name="rpcResponse" type="rpcResponseType" abstract="true"/>
  192. <!--
  193. <hello> element
  194. -->
  195. <xs:element name="hello">
  196. <xs:complexType>
  197. <xs:sequence>
  198. <xs:element name="capabilities">
  199. <xs:complexType>
  200. <xs:sequence>
  201. <xs:element name="capability" type="xs:anyURI" maxOccurs="unbounded"/>
  202. </xs:sequence>
  203. </xs:complexType>
  204. </xs:element>
  205. <xs:element name="session-id" type="SessionId"
  206. minOccurs="0"/>
  207. </xs:sequence>
  208. </xs:complexType>
  209. </xs:element>
  210. </xs:schema>

<CODE ENDS>