1 module ietf-yang-types {
3 namespace "urn:ietf:params:xml:ns:yang:ietf-yang-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>
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>";
20 "This module contains a collection of generally useful derived
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.";
35 "This revision adds the following new data types:
41 "RFC 6991: Common YANG Data Types";
48 "RFC 6021: Common YANG Data Types";
51 /*** collection of counter and gauge types ***/
56 "The counter32 type represents a non-negative integer
57 that monotonically increases until it reaches a
58 maximum value of 2^32-1 (4294967295 decimal), when it
59 wraps around and starts increasing again from zero.
60 Counters have no defined 'initial' value, and thus, a
61 single value of a counter has (in general) no information
62 content. Discontinuities in the monotonically increasing
63 value normally occur at re-initialization of the
64 management system, and at other times as specified in the
65 description of a schema node using this type. If such
66 other times can occur, for example, the creation of
67 a schema node of type counter32 at times other than
68 re-initialization, then a corresponding schema node
69 should be defined, with an appropriate type, to indicate
70 the last discontinuity.
71 The counter32 type should not be used for configuration
72 schema nodes. A default statement SHOULD NOT be used in
73 combination with the type counter32.
74 In the value set and its semantics, this type is equivalent
75 to the Counter32 type of the SMIv2.";
77 "RFC 2578: Structure of Management Information Version 2
81 typedef zero-based-counter32 {
85 "The zero-based-counter32 type represents a counter32
86 that has the defined 'initial' value zero.
87 A schema node of this type will be set to zero (0) on creation
88 and will thereafter increase monotonically until it reaches
89 a maximum value of 2^32-1 (4294967295 decimal), when it
90 wraps around and starts increasing again from zero.
91 Provided that an application discovers a new schema node
92 of this type within the minimum time to wrap, it can use the
93 'initial' value as a delta. It is important for a management
94 station to be aware of this minimum time and the actual time
95 between polls, and to discard data if the actual time is too
96 long or there is no defined minimum time.
97 In the value set and its semantics, this type is equivalent
98 to the ZeroBasedCounter32 textual convention of the SMIv2.";
100 "RFC 4502: Remote Network Monitoring Management Information
107 "The counter64 type represents a non-negative integer
108 that monotonically increases until it reaches a
109 maximum value of 2^64-1 (18446744073709551615 decimal),
110 when it wraps around and starts increasing again from zero.
111 Counters have no defined 'initial' value, and thus, a
112 single value of a counter has (in general) no information
113 content. Discontinuities in the monotonically increasing
114 value normally occur at re-initialization of the
115 management system, and at other times as specified in the
116 description of a schema node using this type. If such
117 other times can occur, for example, the creation of
118 a schema node of type counter64 at times other than
119 re-initialization, then a corresponding schema node
120 should be defined, with an appropriate type, to indicate
121 the last discontinuity.
122 The counter64 type should not be used for configuration
123 schema nodes. A default statement SHOULD NOT be used in
124 combination with the type counter64.
125 In the value set and its semantics, this type is equivalent
126 to the Counter64 type of the SMIv2.";
128 "RFC 2578: Structure of Management Information Version 2
132 typedef zero-based-counter64 {
136 "The zero-based-counter64 type represents a counter64 that
137 has the defined 'initial' value zero.
138 A schema node of this type will be set to zero (0) on creation
139 and will thereafter increase monotonically until it reaches
140 a maximum value of 2^64-1 (18446744073709551615 decimal),
141 when it wraps around and starts increasing again from zero.
142 Provided that an application discovers a new schema node
143 of this type within the minimum time to wrap, it can use the
144 'initial' value as a delta. It is important for a management
145 station to be aware of this minimum time and the actual time
146 between polls, and to discard data if the actual time is too
147 long or there is no defined minimum time.
148 In the value set and its semantics, this type is equivalent
149 to the ZeroBasedCounter64 textual convention of the SMIv2.";
151 "RFC 2856: Textual Conventions for Additional High Capacity
158 "The gauge32 type represents a non-negative integer, which
159 may increase or decrease, but shall never exceed a maximum
160 value, nor fall below a minimum value. The maximum value
161 cannot be greater than 2^32-1 (4294967295 decimal), and
162 the minimum value cannot be smaller than 0. The value of
163 a gauge32 has its maximum value whenever the information
164 being modeled is greater than or equal to its maximum
165 value, and has its minimum value whenever the information
166 being modeled is smaller than or equal to its minimum value.
167 If the information being modeled subsequently decreases
168 below (increases above) the maximum (minimum) value, the
169 gauge32 also decreases (increases).
170 In the value set and its semantics, this type is equivalent
171 to the Gauge32 type of the SMIv2.";
173 "RFC 2578: Structure of Management Information Version 2
180 "The gauge64 type represents a non-negative integer, which
181 may increase or decrease, but shall never exceed a maximum
182 value, nor fall below a minimum value. The maximum value
183 cannot be greater than 2^64-1 (18446744073709551615), and
184 the minimum value cannot be smaller than 0. The value of
185 a gauge64 has its maximum value whenever the information
186 being modeled is greater than or equal to its maximum
187 value, and has its minimum value whenever the information
188 being modeled is smaller than or equal to its minimum value.
189 If the information being modeled subsequently decreases
190 below (increases above) the maximum (minimum) value, the
191 gauge64 also decreases (increases).
192 In the value set and its semantics, this type is equivalent
193 to the CounterBasedGauge64 SMIv2 textual convention defined
196 "RFC 2856: Textual Conventions for Additional High Capacity
200 /*** collection of identifier-related types ***/
202 typedef object-identifier {
204 pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
205 + '(\.(0|([1-9]\d*)))*';
208 "The object-identifier type represents administratively
209 assigned names in a registration-hierarchical-name tree.
210 Values of this type are denoted as a sequence of numerical
211 non-negative sub-identifier values. Each sub-identifier
212 value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
213 are separated by single dots and without any intermediate
215 The ASN.1 standard restricts the value space of the first
216 sub-identifier to 0, 1, or 2. Furthermore, the value space
217 of the second sub-identifier is restricted to the range
218 0 to 39 if the first sub-identifier is 0 or 1. Finally,
219 the ASN.1 standard requires that an object identifier
220 has always at least two sub-identifiers. The pattern
221 captures these restrictions.
222 Although the number of sub-identifiers is not limited,
223 module designers should realize that there may be
224 implementations that stick with the SMIv2 limit of 128
226 This type is a superset of the SMIv2 OBJECT IDENTIFIER type
227 since it is not restricted to 128 sub-identifiers. Hence,
228 this type SHOULD NOT be used to represent the SMIv2 OBJECT
229 IDENTIFIER type; the object-identifier-128 type SHOULD be
232 "ISO9834-1: Information technology -- Open Systems
233 Interconnection -- Procedures for the operation of OSI
234 Registration Authorities: General procedures and top
235 arcs of the ASN.1 Object Identifier tree";
238 typedef object-identifier-128 {
239 type object-identifier {
240 pattern '\d*(\.\d*){1,127}';
243 "This type represents object-identifiers restricted to 128
245 In the value set and its semantics, this type is equivalent
246 to the OBJECT IDENTIFIER type of the SMIv2.";
248 "RFC 2578: Structure of Management Information Version 2
252 typedef yang-identifier {
255 pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
256 pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
259 "A YANG identifier string as defined by the 'identifier'
260 rule in Section 12 of RFC 6020. An identifier must
261 start with an alphabetic character or an underscore
262 followed by an arbitrary sequence of alphabetic or
263 numeric characters, underscores, hyphens, or dots.
264 A YANG identifier MUST NOT start with any possible
265 combination of the lowercase or uppercase character
268 "RFC 6020: YANG - A Data Modeling Language for the Network
269 Configuration Protocol (NETCONF)";
272 /*** collection of types related to date and time***/
274 typedef date-and-time {
276 pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
277 + '(Z|[\+\-]\d{2}:\d{2})';
280 "The date-and-time type is a profile of the ISO 8601
281 standard for representation of dates and times using the
282 Gregorian calendar. The profile is defined by the
283 date-time production in Section 5.6 of RFC 3339.
284 The date-and-time type is compatible with the dateTime XML
285 schema type with the following notable exceptions:
286 (a) The date-and-time type does not allow negative years.
287 (b) The date-and-time time-offset -00:00 indicates an unknown
288 time zone (see RFC 3339) while -00:00 and +00:00 and Z
289 all represent the same time zone in dateTime.
290 (c) The canonical format (see below) of data-and-time values
291 differs from the canonical format used by the dateTime XML
292 schema type, which requires all times to be in UTC using
294 This type is not equivalent to the DateAndTime textual
295 convention of the SMIv2 since RFC 3339 uses a different
296 separator between full-date and full-time and provides
297 higher resolution of time-secfrac.
298 The canonical format for date-and-time values with a known time
299 zone uses a numeric time zone offset that is calculated using
300 the device's configured known offset to UTC time. A change of
301 the device's offset to UTC time will cause date-and-time values
302 to change accordingly. Such changes might happen periodically
303 in case a server follows automatically daylight saving time
304 (DST) time zone offset changes. The canonical format for
305 date-and-time values with an unknown time zone (usually
306 referring to the notion of local time) uses the time-offset
309 "RFC 3339: Date and Time on the Internet: Timestamps
310 RFC 2579: Textual Conventions for SMIv2
311 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
317 "The timeticks type represents a non-negative integer that
318 represents the time, modulo 2^32 (4294967296 decimal), in
319 hundredths of a second between two epochs. When a schema
320 node is defined that uses this type, the description of
321 the schema node identifies both of the reference epochs.
322 In the value set and its semantics, this type is equivalent
323 to the TimeTicks type of the SMIv2.";
325 "RFC 2578: Structure of Management Information Version 2
332 "The timestamp type represents the value of an associated
333 timeticks schema node at which a specific occurrence
334 happened. The specific occurrence must be defined in the
335 description of any schema node defined using this type. When
336 the specific occurrence occurred prior to the last time the
337 associated timeticks attribute was zero, then the timestamp
338 value is zero. Note that this requires all timestamp values
339 to be reset to zero when the value of the associated timeticks
340 attribute reaches 497+ days and wraps around to zero.
341 The associated timeticks schema node must be specified
342 in the description of any schema node using this type.
343 In the value set and its semantics, this type is equivalent
344 to the TimeStamp textual convention of the SMIv2.";
346 "RFC 2579: Textual Conventions for SMIv2";
349 /*** collection of generic address types ***/
351 typedef phys-address {
353 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
357 "Represents media- or physical-level addresses represented
358 as a sequence octets, each octet represented by two hexadecimal
359 numbers. Octets are separated by colons. The canonical
360 representation uses lowercase characters.
361 In the value set and its semantics, this type is equivalent
362 to the PhysAddress textual convention of the SMIv2.";
364 "RFC 2579: Textual Conventions for SMIv2";
367 typedef mac-address {
369 pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
372 "The mac-address type represents an IEEE 802 MAC address.
373 The canonical representation uses lowercase characters.
374 In the value set and its semantics, this type is equivalent
375 to the MacAddress textual convention of the SMIv2.";
377 "IEEE 802: IEEE Standard for Local and Metropolitan Area
378 Networks: Overview and Architecture
379 RFC 2579: Textual Conventions for SMIv2";
382 /*** collection of XML-specific types ***/
387 "This type represents an XPATH 1.0 expression.
388 When a schema node is defined that uses this type, the
389 description of the schema node MUST specify the XPath
390 context in which the XPath expression is evaluated.";
392 "XPATH: XML Path Language (XPath) Version 1.0";
395 /*** collection of string types ***/
399 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
402 "A hexadecimal string with octets represented as hex digits
403 separated by colons. The canonical representation uses
404 lowercase characters.";
409 pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
410 + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
413 "A Universally Unique IDentifier in the string representation
414 defined in RFC 4122. The canonical representation uses
415 lowercase characters.
416 The following is an example of a UUID in string representation:
417 f81d4fae-7dec-11d0-a765-00a0c91e6bf6
420 "RFC 4122: A Universally Unique IDentifier (UUID) URN
424 typedef dotted-quad {
427 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
428 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
431 "An unsigned 32-bit number expressed in the dotted-quad
432 notation, i.e., four octets written as decimal numbers
433 and separated with the '.' (full stop) character.";