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