Overview and User Guide for TR-069Adapter
[oam/tr069-adapter.git] / netconf-server / test-schemas / ietf-inet-types@2013-07-15.yang
1 module ietf-inet-types {\r
2 \r
3   namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";\r
4   prefix "inet";\r
5 \r
6   organization\r
7    "IETF NETMOD (NETCONF Data Modeling Language) Working Group";\r
8 \r
9   contact\r
10    "WG Web:   <http://tools.ietf.org/wg/netmod/>\r
11     WG List:  <mailto:netmod@ietf.org>\r
12 \r
13     WG Chair: David Kessens\r
14               <mailto:david.kessens@nsn.com>\r
15 \r
16     WG Chair: Juergen Schoenwaelder\r
17               <mailto:j.schoenwaelder@jacobs-university.de>\r
18 \r
19     Editor:   Juergen Schoenwaelder\r
20               <mailto:j.schoenwaelder@jacobs-university.de>";\r
21 \r
22   description\r
23    "This module contains a collection of generally useful derived\r
24     YANG data types for Internet addresses and related things.\r
25 \r
26     Copyright (c) 2013 IETF Trust and the persons identified as\r
27     authors of the code.  All rights reserved.\r
28 \r
29     Redistribution and use in source and binary forms, with or\r
30     without modification, is permitted pursuant to, and subject\r
31     to the license terms contained in, the Simplified BSD License\r
32     set forth in Section 4.c of the IETF Trust's Legal Provisions\r
33     Relating to IETF Documents\r
34     (http://trustee.ietf.org/license-info).\r
35 \r
36     This version of this YANG module is part of RFC 6991; see\r
37     the RFC itself for full legal notices.";\r
38 \r
39   revision 2013-07-15 {\r
40     description\r
41      "This revision adds the following new data types:\r
42       - ip-address-no-zone\r
43       - ipv4-address-no-zone\r
44       - ipv6-address-no-zone";\r
45     reference\r
46      "RFC 6991: Common YANG Data Types";\r
47   }\r
48 \r
49   revision 2010-09-24 {\r
50     description\r
51      "Initial revision.";\r
52     reference\r
53      "RFC 6021: Common YANG Data Types";\r
54   }\r
55 \r
56   /*** collection of types related to protocol fields ***/\r
57 \r
58   typedef ip-version {\r
59     type enumeration {\r
60       enum unknown {\r
61         value "0";\r
62         description\r
63          "An unknown or unspecified version of the Internet\r
64           protocol.";\r
65       }\r
66       enum ipv4 {\r
67         value "1";\r
68         description\r
69          "The IPv4 protocol as defined in RFC 791.";\r
70       }\r
71       enum ipv6 {\r
72         value "2";\r
73         description\r
74          "The IPv6 protocol as defined in RFC 2460.";\r
75       }\r
76     }\r
77     description\r
78      "This value represents the version of the IP protocol.\r
79 \r
80       In the value set and its semantics, this type is equivalent\r
81       to the InetVersion textual convention of the SMIv2.";\r
82     reference\r
83      "RFC  791: Internet Protocol\r
84       RFC 2460: Internet Protocol, Version 6 (IPv6) Specification\r
85       RFC 4001: Textual Conventions for Internet Network Addresses";\r
86   }\r
87 \r
88   typedef dscp {\r
89     type uint8 {\r
90       range "0..63";\r
91     }\r
92     description\r
93      "The dscp type represents a Differentiated Services Code Point\r
94       that may be used for marking packets in a traffic stream.\r
95       In the value set and its semantics, this type is equivalent\r
96       to the Dscp textual convention of the SMIv2.";\r
97     reference\r
98      "RFC 3289: Management Information Base for the Differentiated\r
99                 Services Architecture\r
100       RFC 2474: Definition of the Differentiated Services Field\r
101                 (DS Field) in the IPv4 and IPv6 Headers\r
102       RFC 2780: IANA Allocation Guidelines For Values In\r
103                 the Internet Protocol and Related Headers";\r
104   }\r
105 \r
106   typedef ipv6-flow-label {\r
107     type uint32 {\r
108       range "0..1048575";\r
109     }\r
110     description\r
111      "The ipv6-flow-label type represents the flow identifier or Flow\r
112       Label in an IPv6 packet header that may be used to\r
113       discriminate traffic flows.\r
114 \r
115       In the value set and its semantics, this type is equivalent\r
116       to the IPv6FlowLabel textual convention of the SMIv2.";\r
117     reference\r
118      "RFC 3595: Textual Conventions for IPv6 Flow Label\r
119       RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";\r
120   }\r
121 \r
122   typedef port-number {\r
123     type uint16 {\r
124       range "0..65535";\r
125     }\r
126     description\r
127      "The port-number type represents a 16-bit port number of an\r
128       Internet transport-layer protocol such as UDP, TCP, DCCP, or\r
129       SCTP.  Port numbers are assigned by IANA.  A current list of\r
130       all assignments is available from <http://www.iana.org/>.\r
131 \r
132       Note that the port number value zero is reserved by IANA.  In\r
133       situations where the value zero does not make sense, it can\r
134       be excluded by subtyping the port-number type.\r
135       In the value set and its semantics, this type is equivalent\r
136       to the InetPortNumber textual convention of the SMIv2.";\r
137     reference\r
138      "RFC  768: User Datagram Protocol\r
139       RFC  793: Transmission Control Protocol\r
140       RFC 4960: Stream Control Transmission Protocol\r
141       RFC 4340: Datagram Congestion Control Protocol (DCCP)\r
142       RFC 4001: Textual Conventions for Internet Network Addresses";\r
143   }\r
144 \r
145   /*** collection of types related to autonomous systems ***/\r
146 \r
147   typedef as-number {\r
148     type uint32;\r
149     description\r
150      "The as-number type represents autonomous system numbers\r
151       which identify an Autonomous System (AS).  An AS is a set\r
152       of routers under a single technical administration, using\r
153       an interior gateway protocol and common metrics to route\r
154       packets within the AS, and using an exterior gateway\r
155       protocol to route packets to other ASes.  IANA maintains\r
156       the AS number space and has delegated large parts to the\r
157       regional registries.\r
158 \r
159       Autonomous system numbers were originally limited to 16\r
160       bits.  BGP extensions have enlarged the autonomous system\r
161       number space to 32 bits.  This type therefore uses an uint32\r
162       base type without a range restriction in order to support\r
163       a larger autonomous system number space.\r
164 \r
165       In the value set and its semantics, this type is equivalent\r
166       to the InetAutonomousSystemNumber textual convention of\r
167       the SMIv2.";\r
168     reference\r
169      "RFC 1930: Guidelines for creation, selection, and registration\r
170                 of an Autonomous System (AS)\r
171       RFC 4271: A Border Gateway Protocol 4 (BGP-4)\r
172       RFC 4001: Textual Conventions for Internet Network Addresses\r
173       RFC 6793: BGP Support for Four-Octet Autonomous System (AS)\r
174                 Number Space";\r
175   }\r
176 \r
177   /*** collection of types related to IP addresses and hostnames ***/\r
178 \r
179   typedef ip-address {\r
180     type union {\r
181       type inet:ipv4-address;\r
182       type inet:ipv6-address;\r
183     }\r
184     description\r
185      "The ip-address type represents an IP address and is IP\r
186       version neutral.  The format of the textual representation\r
187       implies the IP version.  This type supports scoped addresses\r
188       by allowing zone identifiers in the address format.";\r
189     reference\r
190      "RFC 4007: IPv6 Scoped Address Architecture";\r
191   }\r
192 \r
193   typedef ipv4-address {\r
194     type string {\r
195       pattern\r
196         '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'\r
197       +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'\r
198       + '(%[\p{N}\p{L}]+)?';\r
199     }\r
200     description\r
201       "The ipv4-address type represents an IPv4 address in\r
202        dotted-quad notation.  The IPv4 address may include a zone\r
203        index, separated by a % sign.\r
204 \r
205        The zone index is used to disambiguate identical address\r
206        values.  For link-local addresses, the zone index will\r
207        typically be the interface index number or the name of an\r
208        interface.  If the zone index is not present, the default\r
209        zone of the device will be used.\r
210 \r
211        The canonical format for the zone index is the numerical\r
212        format";\r
213   }\r
214 \r
215   typedef ipv6-address {\r
216     type string {\r
217       pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'\r
218             + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'\r
219             + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'\r
220             + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'\r
221             + '(%[\p{N}\p{L}]+)?';\r
222       pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'\r
223             + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'\r
224             + '(%.+)?';\r
225     }\r
226     description\r
227      "The ipv6-address type represents an IPv6 address in full,\r
228       mixed, shortened, and shortened-mixed notation.  The IPv6\r
229       address may include a zone index, separated by a % sign.\r
230 \r
231       The zone index is used to disambiguate identical address\r
232       values.  For link-local addresses, the zone index will\r
233       typically be the interface index number or the name of an\r
234       interface.  If the zone index is not present, the default\r
235       zone of the device will be used.\r
236 \r
237       The canonical format of IPv6 addresses uses the textual\r
238       representation defined in Section 4 of RFC 5952.  The\r
239       canonical format for the zone index is the numerical\r
240       format as described in Section 11.2 of RFC 4007.";\r
241     reference\r
242      "RFC 4291: IP Version 6 Addressing Architecture\r
243       RFC 4007: IPv6 Scoped Address Architecture\r
244       RFC 5952: A Recommendation for IPv6 Address Text\r
245                 Representation";\r
246   }\r
247 \r
248   typedef ip-address-no-zone {\r
249     type union {\r
250       type inet:ipv4-address-no-zone;\r
251       type inet:ipv6-address-no-zone;\r
252     }\r
253     description\r
254      "The ip-address-no-zone type represents an IP address and is\r
255       IP version neutral.  The format of the textual representation\r
256       implies the IP version.  This type does not support scoped\r
257       addresses since it does not allow zone identifiers in the\r
258       address format.";\r
259     reference\r
260      "RFC 4007: IPv6 Scoped Address Architecture";\r
261   }\r
262 \r
263   typedef ipv4-address-no-zone {\r
264     type inet:ipv4-address {\r
265       pattern '[0-9\.]*';\r
266     }\r
267     description\r
268       "An IPv4 address without a zone index.  This type, derived from\r
269        ipv4-address, may be used in situations where the zone is\r
270        known from the context and hence no zone index is needed.";\r
271   }\r
272 \r
273   typedef ipv6-address-no-zone {\r
274     type inet:ipv6-address {\r
275       pattern '[0-9a-fA-F:\.]*';\r
276     }\r
277     description\r
278       "An IPv6 address without a zone index.  This type, derived from\r
279        ipv6-address, may be used in situations where the zone is\r
280        known from the context and hence no zone index is needed.";\r
281     reference\r
282      "RFC 4291: IP Version 6 Addressing Architecture\r
283       RFC 4007: IPv6 Scoped Address Architecture\r
284       RFC 5952: A Recommendation for IPv6 Address Text\r
285                 Representation";\r
286   }\r
287 \r
288   typedef ip-prefix {\r
289     type union {\r
290       type inet:ipv4-prefix;\r
291       type inet:ipv6-prefix;\r
292     }\r
293     description\r
294      "The ip-prefix type represents an IP prefix and is IP\r
295       version neutral.  The format of the textual representations\r
296       implies the IP version.";\r
297   }\r
298 \r
299   typedef ipv4-prefix {\r
300     type string {\r
301       pattern\r
302          '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'\r
303        +  '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'\r
304        + '/(([0-9])|([1-2][0-9])|(3[0-2]))';\r
305     }\r
306     description\r
307      "The ipv4-prefix type represents an IPv4 address prefix.\r
308       The prefix length is given by the number following the\r
309       slash character and must be less than or equal to 32.\r
310 \r
311       A prefix length value of n corresponds to an IP address\r
312       mask that has n contiguous 1-bits from the most\r
313       significant bit (MSB) and all other bits set to 0.\r
314 \r
315       The canonical format of an IPv4 prefix has all bits of\r
316       the IPv4 address set to zero that are not part of the\r
317       IPv4 prefix.";\r
318   }\r
319 \r
320   typedef ipv6-prefix {\r
321     type string {\r
322       pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'\r
323             + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'\r
324             + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'\r
325             + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'\r
326             + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';\r
327       pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'\r
328             + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'\r
329             + '(/.+)';\r
330     }\r
331 \r
332     description\r
333      "The ipv6-prefix type represents an IPv6 address prefix.\r
334       The prefix length is given by the number following the\r
335       slash character and must be less than or equal to 128.\r
336 \r
337       A prefix length value of n corresponds to an IP address\r
338       mask that has n contiguous 1-bits from the most\r
339       significant bit (MSB) and all other bits set to 0.\r
340 \r
341       The IPv6 address should have all bits that do not belong\r
342       to the prefix set to zero.\r
343 \r
344       The canonical format of an IPv6 prefix has all bits of\r
345       the IPv6 address set to zero that are not part of the\r
346       IPv6 prefix.  Furthermore, the IPv6 address is represented\r
347       as defined in Section 4 of RFC 5952.";\r
348     reference\r
349      "RFC 5952: A Recommendation for IPv6 Address Text\r
350                 Representation";\r
351   }\r
352 \r
353   /*** collection of domain name and URI types ***/\r
354 \r
355   typedef domain-name {\r
356     type string {\r
357       pattern\r
358         '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'\r
359       + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'\r
360       + '|\.';\r
361       length "1..253";\r
362     }\r
363     description\r
364      "The domain-name type represents a DNS domain name.  The\r
365       name SHOULD be fully qualified whenever possible.\r
366 \r
367       Internet domain names are only loosely specified.  Section\r
368       3.5 of RFC 1034 recommends a syntax (modified in Section\r
369       2.1 of RFC 1123).  The pattern above is intended to allow\r
370       for current practice in domain name use, and some possible\r
371       future expansion.  It is designed to hold various types of\r
372       domain names, including names used for A or AAAA records\r
373       (host names) and other records, such as SRV records.  Note\r
374       that Internet host names have a stricter syntax (described\r
375       in RFC 952) than the DNS recommendations in RFCs 1034 and\r
376       1123, and that systems that want to store host names in\r
377       schema nodes using the domain-name type are recommended to\r
378       adhere to this stricter standard to ensure interoperability.\r
379 \r
380       The encoding of DNS names in the DNS protocol is limited\r
381       to 255 characters.  Since the encoding consists of labels\r
382       prefixed by a length bytes and there is a trailing NULL\r
383       byte, only 253 characters can appear in the textual dotted\r
384       notation.\r
385 \r
386       The description clause of schema nodes using the domain-name\r
387       type MUST describe when and how these names are resolved to\r
388       IP addresses.  Note that the resolution of a domain-name value\r
389       may require to query multiple DNS records (e.g., A for IPv4\r
390       and AAAA for IPv6).  The order of the resolution process and\r
391       which DNS record takes precedence can either be defined\r
392       explicitly or may depend on the configuration of the\r
393       resolver.\r
394 \r
395       Domain-name values use the US-ASCII encoding.  Their canonical\r
396       format uses lowercase US-ASCII characters.  Internationalized\r
397       domain names MUST be A-labels as per RFC 5890.";\r
398     reference\r
399      "RFC  952: DoD Internet Host Table Specification\r
400       RFC 1034: Domain Names - Concepts and Facilities\r
401       RFC 1123: Requirements for Internet Hosts -- Application\r
402                 and Support\r
403       RFC 2782: A DNS RR for specifying the location of services\r
404                 (DNS SRV)\r
405       RFC 5890: Internationalized Domain Names in Applications\r
406                 (IDNA): Definitions and Document Framework";\r
407   }\r
408 \r
409   typedef host {\r
410     type union {\r
411       type inet:ip-address;\r
412       type inet:domain-name;\r
413     }\r
414     description\r
415      "The host type represents either an IP address or a DNS\r
416       domain name.";\r
417   }\r
418 \r
419   typedef uri {\r
420     type string;\r
421     description\r
422      "The uri type represents a Uniform Resource Identifier\r
423       (URI) as defined by STD 66.\r
424 \r
425       Objects using the uri type MUST be in US-ASCII encoding,\r
426       and MUST be normalized as described by RFC 3986 Sections\r
427       6.2.1, 6.2.2.1, and 6.2.2.2.  All unnecessary\r
428       percent-encoding is removed, and all case-insensitive\r
429       characters are set to lowercase except for hexadecimal\r
430       digits, which are normalized to uppercase as described in\r
431       Section 6.2.2.1.\r
432 \r
433       The purpose of this normalization is to help provide\r
434       unique URIs.  Note that this normalization is not\r
435       sufficient to provide uniqueness.  Two URIs that are\r
436       textually distinct after this normalization may still be\r
437       equivalent.\r
438 \r
439       Objects using the uri type may restrict the schemes that\r
440       they permit.  For example, 'data:' and 'urn:' schemes\r
441       might not be appropriate.\r
442 \r
443       A zero-length URI is not a valid URI.  This can be used to\r
444       express 'URI absent' where required.\r
445 \r
446       In the value set and its semantics, this type is equivalent\r
447       to the Uri SMIv2 textual convention defined in RFC 5017.";\r
448     reference\r
449      "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax\r
450       RFC 3305: Report from the Joint W3C/IETF URI Planning Interest\r
451                 Group: Uniform Resource Identifiers (URIs), URLs,\r
452                 and Uniform Resource Names (URNs): Clarifications\r
453                 and Recommendations\r
454       RFC 5017: MIB Textual Conventions for Uniform Resource\r
455                 Identifiers (URIs)";\r
456   }\r
457 \r
458 }\r