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