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.
29 Redistribution and use in source and binary forms, with or without
30 modification, is permitted pursuant to, and subject to the license
31 terms contained in, the Simplified BSD License set forth in Section
32 4.c of the IETF Trust's Legal Provisions Relating to IETF Documents
33 (http://trustee.ietf.org/license-info).
35 This version of this YANG module is part of RFC 6021; see
36 the RFC itself for full legal notices.";
42 "RFC 6021: Common YANG Data Types";
45 /*** collection of protocol field related types ***/
52 "An unknown or unspecified version of the Internet protocol.";
57 "The IPv4 protocol as defined in RFC 791.";
62 "The IPv6 protocol as defined in RFC 2460.";
66 "This value represents the version of the IP protocol.
68 In the value set and its semantics, this type is equivalent
69 to the InetVersion textual convention of the SMIv2.";
71 "RFC 791: Internet Protocol
72 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification
73 RFC 4001: Textual Conventions for Internet Network Addresses";
81 "The dscp type represents a Differentiated Services Code-Point
82 that may be used for marking packets in a traffic stream.
84 In the value set and its semantics, this type is equivalent
85 to the Dscp textual convention of the SMIv2.";
87 "RFC 3289: Management Information Base for the Differentiated
89 RFC 2474: Definition of the Differentiated Services Field
90 (DS Field) in the IPv4 and IPv6 Headers
91 RFC 2780: IANA Allocation Guidelines For Values In
92 the Internet Protocol and Related Headers";
95 typedef ipv6-flow-label {
100 "The flow-label type represents flow identifier or Flow Label
101 in an IPv6 packet header that may be used to discriminate
104 In the value set and its semantics, this type is equivalent
105 to the IPv6FlowLabel textual convention of the SMIv2.";
107 "RFC 3595: Textual Conventions for IPv6 Flow Label
108 RFC 2460: Internet Protocol, Version 6 (IPv6) Specification";
111 typedef port-number {
116 "The port-number type represents a 16-bit port number of an
117 Internet transport layer protocol such as UDP, TCP, DCCP, or
118 SCTP. Port numbers are assigned by IANA. A current list of
119 all assignments is available from <http://www.iana.org/>.
121 Note that the port number value zero is reserved by IANA. In
122 situations where the value zero does not make sense, it can
123 be excluded by subtyping the port-number type.
125 In the value set and its semantics, this type is equivalent
126 to the InetPortNumber textual convention of the SMIv2.";
128 "RFC 768: User Datagram Protocol
129 RFC 793: Transmission Control Protocol
130 RFC 4960: Stream Control Transmission Protocol
131 RFC 4340: Datagram Congestion Control Protocol (DCCP)
132 RFC 4001: Textual Conventions for Internet Network Addresses";
135 /*** collection of autonomous system related types ***/
140 "The as-number type represents autonomous system numbers
141 which identify an Autonomous System (AS). An AS is a set
142 of routers under a single technical administration, using
143 an interior gateway protocol and common metrics to route
144 packets within the AS, and using an exterior gateway
145 protocol to route packets to other ASs'. IANA maintains
146 the AS number space and has delegated large parts to the
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.
155 In the value set and its semantics, this type is equivalent
156 to the InetAutonomousSystemNumber textual convention of
159 "RFC 1930: Guidelines for creation, selection, and registration
160 of an Autonomous System (AS)
161 RFC 4271: A Border Gateway Protocol 4 (BGP-4)
162 RFC 4893: BGP Support for Four-octet AS Number Space
163 RFC 4001: Textual Conventions for Internet Network Addresses";
166 /*** collection of IP address and hostname related types ***/
170 type inet:ipv4-address;
171 type inet:ipv6-address;
174 "The ip-address type represents an IP address and is IP
175 version neutral. The format of the textual representations
176 implies the IP version.";
179 typedef ipv4-address {
182 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
183 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
184 + '(%[\p{N}\p{L}]+)?';
187 "The ipv4-address type represents an IPv4 address in
188 dotted-quad notation. The IPv4 address may include a zone
189 index, separated by a % sign.
191 The zone index is used to disambiguate identical address
192 values. For link-local addresses, the zone index will
193 typically be the interface index number or the name of an
194 interface. If the zone index is not present, the default
195 zone of the device will be used.
197 The canonical format for the zone index is the numerical
201 typedef ipv6-address {
203 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
204 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
205 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
206 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
207 + '(%[\p{N}\p{L}]+)?';
208 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
209 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
213 "The ipv6-address type represents an IPv6 address in full,
214 mixed, shortened, and shortened-mixed notation. The IPv6
215 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.
223 The canonical format of IPv6 addresses uses the compressed
224 format described in RFC 4291, Section 2.2, item 2 with the
225 following additional rules: the :: substitution must be
226 applied to the longest sequence of all-zero 16-bit chunks
227 in an IPv6 address. If there is a tie, the first sequence
228 of all-zero 16-bit chunks is replaced by ::. Single
229 all-zero 16-bit chunks are not compressed. The canonical
230 format uses lowercase characters and leading zeros are
231 not allowed. The canonical format for the zone index is
232 the numerical format as described in RFC 4007, Section
235 "RFC 4291: IP Version 6 Addressing Architecture
236 RFC 4007: IPv6 Scoped Address Architecture
237 RFC 5952: A Recommendation for IPv6 Address Text Representation";
242 type inet:ipv4-prefix;
243 type inet:ipv6-prefix;
246 "The ip-prefix type represents an IP prefix and is IP
247 version neutral. The format of the textual representations
248 implies the IP version.";
251 typedef ipv4-prefix {
254 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
255 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
256 + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
259 "The ipv4-prefix type represents an IPv4 address prefix.
260 The prefix length is given by the number following the
261 slash character and must be less than or equal to 32.
263 A prefix length value of n corresponds to an IP address
264 mask that has n contiguous 1-bits from the most
265 significant bit (MSB) and all other bits set to 0.
267 The canonical format of an IPv4 prefix has all bits of
268 the IPv4 address set to zero that are not part of the
272 typedef ipv6-prefix {
274 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
275 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
276 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
277 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
278 + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
279 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
280 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
284 "The ipv6-prefix type represents an IPv6 address prefix.
285 The prefix length is given by the number following the
286 slash character and must be less than or equal 128.
288 A prefix length value of n corresponds to an IP address
289 mask that has n contiguous 1-bits from the most
290 significant bit (MSB) and all other bits set to 0.
292 The IPv6 address should have all bits that do not belong
293 to the prefix set to zero.
295 The canonical format of an IPv6 prefix has all bits of
296 the IPv6 address set to zero that are not part of the
297 IPv6 prefix. Furthermore, IPv6 address is represented
298 in the compressed format described in RFC 4291, Section
299 2.2, item 2 with the following additional rules: the ::
300 substitution must be applied to the longest sequence of
301 all-zero 16-bit chunks in an IPv6 address. If there is
302 a tie, the first sequence of all-zero 16-bit chunks is
303 replaced by ::. Single all-zero 16-bit chunks are not
304 compressed. The canonical format uses lowercase
305 characters and leading zeros are not allowed.";
307 "RFC 4291: IP Version 6 Addressing Architecture";
310 /*** collection of domain name and URI types ***/
312 typedef domain-name {
314 pattern '((([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.)*'
315 + '([a-zA-Z0-9_]([a-zA-Z0-9\-_]){0,61})?[a-zA-Z0-9]\.?)'
320 "The domain-name type represents a DNS domain name. The
321 name SHOULD be fully qualified whenever possible.
323 Internet domain names are only loosely specified. Section
324 3.5 of RFC 1034 recommends a syntax (modified in Section
325 2.1 of RFC 1123). The pattern above is intended to allow
326 for current practice in domain name use, and some possible
327 future expansion. It is designed to hold various types of
328 domain names, including names used for A or AAAA records
329 (host names) and other records, such as SRV records. Note
330 that Internet host names have a stricter syntax (described
331 in RFC 952) than the DNS recommendations in RFCs 1034 and
332 1123, and that systems that want to store host names in
333 schema nodes using the domain-name type are recommended to
334 adhere to this stricter standard to ensure interoperability.
336 The encoding of DNS names in the DNS protocol is limited
337 to 255 characters. Since the encoding consists of labels
338 prefixed by a length bytes and there is a trailing NULL
339 byte, only 253 characters can appear in the textual dotted
342 The description clause of schema nodes using the domain-name
343 type MUST describe when and how these names are resolved to
344 IP addresses. Note that the resolution of a domain-name value
345 may require to query multiple DNS records (e.g., A for IPv4
346 and AAAA for IPv6). The order of the resolution process and
347 which DNS record takes precedence can either be defined
348 explicitely or it may depend on the configuration of the
351 Domain-name values use the US-ASCII encoding. Their canonical
352 format uses lowercase US-ASCII characters. Internationalized
353 domain names MUST be encoded in punycode as described in RFC
356 "RFC 952: DoD Internet Host Table Specification
357 RFC 1034: Domain Names - Concepts and Facilities
358 RFC 1123: Requirements for Internet Hosts -- Application
360 RFC 2782: A DNS RR for specifying the location of services
362 RFC 3492: Punycode: A Bootstring encoding of Unicode for
363 Internationalized Domain Names in Applications
365 RFC 5891: Internationalizing Domain Names in Applications
371 type inet:ip-address;
372 type inet:domain-name;
375 "The host type represents either an IP address or a DNS
382 "The uri type represents a Uniform Resource Identifier
383 (URI) as defined by STD 66.
385 Objects using the uri type MUST be in US-ASCII encoding,
386 and MUST be normalized as described by RFC 3986 Sections
387 6.2.1, 6.2.2.1, and 6.2.2.2. All unnecessary
388 percent-encoding is removed, and all case-insensitive
389 characters are set to lowercase except for hexadecimal
390 digits, which are normalized to uppercase as described in
393 The purpose of this normalization is to help provide
394 unique URIs. Note that this normalization is not
395 sufficient to provide uniqueness. Two URIs that are
396 textually distinct after this normalization may still be
399 Objects using the uri type may restrict the schemes that
400 they permit. For example, 'data:' and 'urn:' schemes
401 might not be appropriate.
403 A zero-length URI is not a valid URI. This can be used to
404 express 'URI absent' where required.
406 In the value set and its semantics, this type is equivalent
407 to the Uri SMIv2 textual convention defined in RFC 5017.";
409 "RFC 3986: Uniform Resource Identifier (URI): Generic Syntax
410 RFC 3305: Report from the Joint W3C/IETF URI Planning Interest
411 Group: Uniform Resource Identifiers (URIs), URLs,
412 and Uniform Resource Names (URNs): Clarifications
414 RFC 5017: MIB Textual Conventions for Uniform Resource