1 module ietf-inet-types {
3 namespace "urn:ietf:params:xml:ns:yang:ietf-inet-types";
7 "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
10 "WG Web: <http://tools.ietf.org/wg/netmod/>
11 WG List: <mailto:netmod@ietf.org>
13 WG Chair: David Partain
14 <mailto:david.partain@ericsson.com>
16 WG Chair: David Kessens
17 <mailto:david.kessens@nsn.com>
19 Editor: Juergen Schoenwaelder
20 <mailto:j.schoenwaelder@jacobs-university.de>";
23 "This module contains a collection of generally useful derived
24 YANG data types for Internet addresses and related things.
26 Copyright (c) 2010 IETF Trust and the persons identified as
27 authors of the code. All rights reserved.
31 Redistribution and use in source and binary forms, with or without
32 modification, is permitted pursuant to, and subject to the license
33 terms contained in, the Simplified BSD License set forth in Section
34 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
35 (http://trustee.ietf.org/license-info).
37 This version of this YANG module is part of RFC 6021; see
38 the RFC itself for full legal notices.";
44 "RFC 6021: Common YANG Data Types";
47 /*** collection of protocol field related types ***/
54 "An unknown or unspecified version of the Internet protocol.";
59 "The IPv4 protocol as defined in RFC 791.";
64 "The IPv6 protocol as defined in RFC 2460.";
68 "This value represents the version of the IP protocol.
70 In the value set and its semantics, this type is equivalent
71 to the InetVersion textual convention of the SMIv2.";
73 "RFC 791: Internet Protocol
74 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
75 RFC 4001: Textual Conventions for Internet Network Addresses";
83 "The dscp type represents a Differentiated Services Code-Point
84 that may be used for marking packets in a traffic stream.
86 In the value set and its semantics, this type is equivalent
87 to the Dscp textual convention of the SMIv2.";
89 "RFC 3289: Management Information Base for the Differentiated
91 RFC 2474: Definition of the Differentiated Services Field
92 (DS Field) in the IPv4 and IPv6 Headers
93 RFC 2780: IANA Allocation Guidelines For Values In
94 the Internet Protocol and Related Headers";
97 typedef ipv6-flow-label {
102 "The flow-label type represents flow identifier or Flow Label
103 in an IPv6 packet header that may be used to discriminate
106 In the value set and its semantics, this type is equivalent
107 to the IPv6FlowLabel textual convention of the SMIv2.";
109 "RFC 3595: Textual Conventions for IPv6 Flow Label
110 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
113 typedef port-number {
118 "The port-number type represents a 16-bit port number of an
119 Internet transport layer protocol such as UDP, TCP, DCCP, or
120 SCTP. Port numbers are assigned by IANA. A current list of
121 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.
127 In the value set and its semantics, this type is equivalent
128 to the InetPortNumber textual convention of the SMIv2.";
130 "RFC 768: User Datagram Protocol
131 RFC 793: Transmission Control Protocol
132 RFC 4960: Stream Control Transmission Protocol
133 RFC 4340: Datagram Congestion Control Protocol (DCCP)
134 RFC 4001: Textual Conventions for Internet Network Addresses";
137 /*** collection of autonomous system related types ***/
142 "The as-number type represents autonomous system numbers
143 which identify an Autonomous System (AS). An AS is a set
144 of routers under a single technical administration, using
145 an interior gateway protocol and common metrics to route
146 packets within the AS, and using an exterior gateway
147 protocol to route packets to other ASs'. IANA maintains
148 the AS number space and has delegated large parts to the
151 Autonomous system numbers were originally limited to 16
152 bits. BGP extensions have enlarged the autonomous system
153 number space to 32 bits. This type therefore uses an uint32
154 base type without a range restriction in order to support
155 a larger autonomous system number space.
157 In the value set and its semantics, this type is equivalent
158 to the InetAutonomousSystemNumber textual convention of
161 "RFC 1930: Guidelines for creation, selection, and registration
162 of an Autonomous System (AS)
163 RFC 4271: A Border Gateway Protocol 4 (BGP-4)
164 RFC 4893: BGP Support for Four-octet AS Number Space
165 RFC 4001: Textual Conventions for Internet Network Addresses";
168 /*** collection of IP address and hostname related types ***/
172 type inet:ipv4-address;
173 type inet:ipv6-address;
176 "The ip-address type represents an IP address and is IP
177 version neutral. The format of the textual representations
178 implies the IP version.";
181 typedef ipv4-address {
184 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
185 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
186 + '(%[\p{N}\p{L}]+)?';
189 "The ipv4-address type represents an IPv4 address in
190 dotted-quad notation. The IPv4 address may include a zone
191 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.
199 The canonical format for the zone index is the numerical
203 typedef ipv6-address {
205 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
206 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
207 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
208 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
209 + '(%[\p{N}\p{L}]+)?';
210 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
211 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
215 "The ipv6-address type represents an IPv6 address in full,
216 mixed, shortened, and shortened-mixed notation. The IPv6
217 address may include a zone index, separated by a % sign.
223 The zone index is used to disambiguate identical address
224 values. For link-local addresses, the zone index will
225 typically be the interface index number or the name of an
226 interface. If the zone index is not present, the default
227 zone of the device will be used.
229 The canonical format of IPv6 addresses uses the compressed
230 format described in RFC 4291, Section 2.2, item 2 with the
231 following additional rules: the :: substitution must be
232 applied to the longest sequence of all-zero 16-bit chunks
233 in an IPv6 address. If there is a tie, the first sequence
234 of all-zero 16-bit chunks is replaced by ::. Single
235 all-zero 16-bit chunks are not compressed. The canonical
236 format uses lowercase characters and leading zeros are
237 not allowed. The canonical format for the zone index is
238 the numerical format as described in RFC 4007, Section
241 "RFC 4291: IP Version 6 Addressing Architecture
242 RFC 4007: IPv6 Scoped Address Architecture
243 RFC 5952: A Recommendation for IPv6 Address Text Representation";
248 type inet:ipv4-prefix;
249 type inet:ipv6-prefix;
252 "The ip-prefix type represents an IP prefix and is IP
253 version neutral. The format of the textual representations
254 implies the IP version.";
257 typedef ipv4-prefix {
260 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
261 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
262 + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
265 "The ipv4-prefix type represents an IPv4 address prefix.
266 The prefix length is given by the number following the
267 slash character and must be less than or equal to 32.
271 A prefix length value of n corresponds to an IP address
272 mask that has n contiguous 1-bits from the most
273 significant bit (MSB) and all other bits set to 0.
275 The canonical format of an IPv4 prefix has all bits of
276 the IPv4 address set to zero that are not part of the
280 typedef ipv6-prefix {
282 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
283 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
284 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
285 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
286 + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
287 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
288 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
292 "The ipv6-prefix type represents an IPv6 address prefix.
293 The prefix length is given by the number following the
294 slash character and must be less than or equal 128.
296 A prefix length value of n corresponds to an IP address
297 mask that has n contiguous 1-bits from the most
298 significant bit (MSB) and all other bits set to 0.
300 The IPv6 address should have all bits that do not belong
301 to the prefix set to zero.
303 The canonical format of an IPv6 prefix has all bits of
304 the IPv6 address set to zero that are not part of the
305 IPv6 prefix. Furthermore, IPv6 address is represented
306 in the compressed format described in RFC 4291, Section
307 2.2, item 2 with the following additional rules: the ::
308 substitution must be applied to the longest sequence of
309 all-zero 16-bit chunks in an IPv6 address. If there is
310 a tie, the first sequence of all-zero 16-bit chunks is
311 replaced by ::. Single all-zero 16-bit chunks are not
312 compressed. The canonical format uses lowercase
313 characters and leading zeros are not allowed.";
315 "RFC 4291: IP Version 6 Addressing Architecture";
319 /*** collection of domain name and URI types ***/
321 typedef domain-name {
323 pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
324 + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
329 "The domain-name type represents a DNS domain name. The
330 name SHOULD be fully qualified whenever possible.
332 Internet domain names are only loosely specified. Section
333 3.5 of RFC 1034 recommends a syntax (modified in Section
334 2.1 of RFC 1123). The pattern above is intended to allow
335 for current practice in domain name use, and some possible
336 future expansion. It is designed to hold various types of
337 domain names, including names used for A or AAAA records
338 (host names) and other records, such as SRV records. Note
339 that Internet host names have a stricter syntax (described
340 in RFC 952) than the DNS recommendations in RFCs 1034 and
341 1123, and that systems that want to store host names in
342 schema nodes using the domain-name type are recommended to
343 adhere to this stricter standard to ensure interoperability.
345 The encoding of DNS names in the DNS protocol is limited
346 to 255 characters. Since the encoding consists of labels
347 prefixed by a length bytes and there is a trailing NULL
348 byte, only 253 characters can appear in the textual dotted
351 The description clause of schema nodes using the domain-name
352 type MUST describe when and how these names are resolved to
353 IP addresses. Note that the resolution of a domain-name value
354 may require to query multiple DNS records (e.g., A for IPv4
355 and AAAA for IPv6). The order of the resolution process and
356 which DNS record takes precedence can either be defined
357 explicitely or it may depend on the configuration of the
360 Domain-name values use the US-ASCII encoding. Their canonical
361 format uses lowercase US-ASCII characters. Internationalized
362 domain names MUST be encoded in punycode as described in RFC
365 "RFC 952: DoD Internet Host Table Specification
366 RFC 1034: Domain Names - Concepts and Facilities
367 RFC 1123: Requirements for Internet Hosts -- Application
369 RFC 2782: A DNS RR for specifying the location of services
371 RFC 3492: Punycode: A Bootstring encoding of Unicode for
372 Internationalized Domain Names in Applications
374 RFC 5891: Internationalizing Domain Names in Applications
380 type inet:ip-address;
381 type inet:domain-name;
384 "The host type represents either an IP address or a DNS
391 "The uri type represents a Uniform Resource Identifier
392 (URI) as defined by STD 66.
394 Objects using the uri type MUST be in US-ASCII encoding,
395 and MUST be normalized as described by RFC 3986 Sections
396 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
397 percent-encoding is removed, and all case-insensitive
398 characters are set to lowercase except for hexadecimal
399 digits, which are normalized to uppercase as described in
402 The purpose of this normalization is to help provide
403 unique URIs. Note that this normalization is not
404 sufficient to provide uniqueness. Two URIs that are
405 textually distinct after this normalization may still be
408 Objects using the uri type may restrict the schemes that
409 they permit. For example, 'data:' and 'urn:' schemes
410 might not be appropriate.
412 A zero-length URI is not a valid URI. This can be used to
413 express 'URI absent' where required.
415 In the value set and its semantics, this type is equivalent
416 to the Uri SMIv2 textual convention defined in RFC 5017.";
418 "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
419 RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
420 Group: Uniform Resource Identifiers (URIs), URLs,
421 and Uniform Resource Names (URNs): Clarifications
423 RFC 5017: MIB Textual Conventions for Uniform Resource