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>
13 WG Chair: David Kessens
14 <mailto:david.kessens@nsn.com>
16 WG Chair: Juergen Schoenwaelder
17 <mailto:j.schoenwaelder@jacobs-university.de>
19 Editor: Juergen Schoenwaelder
20 <mailto:j.schoenwaelder@jacobs-university.de>";
23 "This module contains a collection of generally useful derived
26 Copyright (c) 2013 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
30 without modification, is permitted pursuant to, and subject
31 to the license terms contained in, the Simplified BSD License
32 set forth in Section 4.c of the IETF Trust's Legal Provisions
33 Relating to IETF Documents
34 (http://trustee.ietf.org/license-info).
36 This version of this YANG module is part of RFC XXXX; see
37 the RFC itself for full legal notices.";
41 "This revision adds the following new data types:
47 "RFC XXXX: Common YANG Data Types";
54 "RFC 6021: Common YANG Data Types";
57 /*** collection of counter and gauge types ***/
62 "The counter32 type represents a non-negative integer
63 that monotonically increases until it reaches a
64 maximum value of 2^32-1 (4294967295 decimal), when it
65 wraps around and starts increasing again from zero.
67 Counters have no defined 'initial' value, and thus, a
68 single value of a counter has (in general) no information
69 content. Discontinuities in the monotonically increasing
70 value normally occur at re-initialization of the
71 management system, and at other times as specified in the
72 description of a schema node using this type. If such
73 other times can occur, for example, the creation of
74 a schema node of type counter32 at times other than
75 re-initialization, then a corresponding schema node
76 should be defined, with an appropriate type, to indicate
77 the last discontinuity.
79 The counter32 type should not be used for configuration
80 schema nodes. A default statement SHOULD NOT be used in
81 combination with the type counter32.
83 In the value set and its semantics, this type is equivalent
84 to the Counter32 type of the SMIv2.";
86 "RFC 2578: Structure of Management Information Version 2
90 typedef zero-based-counter32 {
94 "The zero-based-counter32 type represents a counter32
95 that has the defined 'initial' value zero.
97 A schema node of this type will be set to zero (0) on creation
98 and will thereafter increase monotonically until it reaches
99 a maximum value of 2^32-1 (4294967295 decimal), when it
100 wraps around and starts increasing again from zero.
102 Provided that an application discovers a new schema node
103 of this type within the minimum time to wrap, it can use the
104 'initial' value as a delta. It is important for a management
105 station to be aware of this minimum time and the actual time
106 between polls, and to discard data if the actual time is too
107 long or there is no defined minimum time.
109 In the value set and its semantics, this type is equivalent
110 to the ZeroBasedCounter32 textual convention of the SMIv2.";
112 "RFC 4502: Remote Network Monitoring Management Information
119 "The counter64 type represents a non-negative integer
120 that monotonically increases until it reaches a
121 maximum value of 2^64-1 (18446744073709551615 decimal),
122 when it wraps around and starts increasing again from zero.
124 Counters have no defined 'initial' value, and thus, a
125 single value of a counter has (in general) no information
126 content. Discontinuities in the monotonically increasing
127 value normally occur at re-initialization of the
128 management system, and at other times as specified in the
129 description of a schema node using this type. If such
130 other times can occur, for example, the creation of
131 a schema node of type counter64 at times other than
132 re-initialization, then a corresponding schema node
133 should be defined, with an appropriate type, to indicate
134 the last discontinuity.
136 The counter64 type should not be used for configuration
137 schema nodes. A default statement SHOULD NOT be used in
138 combination with the type counter64.
140 In the value set and its semantics, this type is equivalent
141 to the Counter64 type of the SMIv2.";
143 "RFC 2578: Structure of Management Information Version 2
147 typedef zero-based-counter64 {
151 "The zero-based-counter64 type represents a counter64 that
152 has the defined 'initial' value zero.
154 A schema node of this type will be set to zero (0) on creation
155 and will thereafter increase monotonically until it reaches
156 a maximum value of 2^64-1 (18446744073709551615 decimal),
157 when it wraps around and starts increasing again from zero.
159 Provided that an application discovers a new schema node
160 of this type within the minimum time to wrap, it can use the
161 'initial' value as a delta. It is important for a management
162 station to be aware of this minimum time and the actual time
163 between polls, and to discard data if the actual time is too
164 long or there is no defined minimum time.
166 In the value set and its semantics, this type is equivalent
167 to the ZeroBasedCounter64 textual convention of the SMIv2.";
169 "RFC 2856: Textual Conventions for Additional High Capacity
176 "The gauge32 type represents a non-negative integer, which
177 may increase or decrease, but shall never exceed a maximum
178 value, nor fall below a minimum value. The maximum value
179 cannot be greater than 2^32-1 (4294967295 decimal), and
180 the minimum value cannot be smaller than 0. The value of
181 a gauge32 has its maximum value whenever the information
182 being modeled is greater than or equal to its maximum
183 value, and has its minimum value whenever the information
184 being modeled is smaller than or equal to its minimum value.
185 If the information being modeled subsequently decreases
186 below (increases above) the maximum (minimum) value, the
187 gauge32 also decreases (increases).
189 In the value set and its semantics, this type is equivalent
190 to the Gauge32 type of the SMIv2.";
192 "RFC 2578: Structure of Management Information Version 2
199 "The gauge64 type represents a non-negative integer, which
200 may increase or decrease, but shall never exceed a maximum
201 value, nor fall below a minimum value. The maximum value
202 cannot be greater than 2^64-1 (18446744073709551615), and
203 the minimum value cannot be smaller than 0. The value of
204 a gauge64 has its maximum value whenever the information
205 being modeled is greater than or equal to its maximum
206 value, and has its minimum value whenever the information
207 being modeled is smaller than or equal to its minimum value.
208 If the information being modeled subsequently decreases
209 below (increases above) the maximum (minimum) value, the
210 gauge64 also decreases (increases).
212 In the value set and its semantics, this type is equivalent
213 to the CounterBasedGauge64 SMIv2 textual convention defined
216 "RFC 2856: Textual Conventions for Additional High Capacity
220 /*** collection of identifier related types ***/
222 typedef object-identifier {
224 pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
225 + '(\.(0|([1-9]\d*)))*';
228 "The object-identifier type represents administratively
229 assigned names in a registration-hierarchical-name tree.
231 Values of this type are denoted as a sequence of numerical
232 non-negative sub-identifier values. Each sub-identifier
233 value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
234 are separated by single dots and without any intermediate
237 The ASN.1 standard restricts the value space of the first
238 sub-identifier to 0, 1, or 2. Furthermore, the value space
239 of the second sub-identifier is restricted to the range
240 0 to 39 if the first sub-identifier is 0 or 1. Finally,
241 the ASN.1 standard requires that an object identifier
242 has always at least two sub-identifier. The pattern
243 captures these restrictions.
245 Although the number of sub-identifiers is not limited,
246 module designers should realize that there may be
247 implementations that stick with the SMIv2 limit of 128
250 This type is a superset of the SMIv2 OBJECT IDENTIFIER type
251 since it is not restricted to 128 sub-identifiers. Hence,
252 this type SHOULD NOT be used to represent the SMIv2 OBJECT
253 IDENTIFIER type, the object-identifier-128 type SHOULD be
256 "ISO9834-1: Information technology -- Open Systems
257 Interconnection -- Procedures for the operation of OSI
258 Registration Authorities: General procedures and top
259 arcs of the ASN.1 Object Identifier tree";
262 typedef object-identifier-128 {
263 type object-identifier {
264 pattern '\d*(\.\d*){1,127}';
267 "This type represents object-identifiers restricted to 128
270 In the value set and its semantics, this type is equivalent
271 to the OBJECT IDENTIFIER type of the SMIv2.";
273 "RFC 2578: Structure of Management Information Version 2
277 typedef yang-identifier {
280 pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
281 pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
284 "A YANG identifier string as defined in RFC 6020, page 163.
285 An identifier must start with an alphabetic character or
286 an underscore followed by an arbitrary sequence of
287 alphabetic or numeric characters, underscores, hyphens
290 A YANG identifier MUST NOT start with any possible
291 combination of the lower-case or upper-case character
294 "RFC 6020: YANG - A Data Modeling Language for the Network
295 Configuration Protocol (NETCONF)";
298 /*** collection of date and time related types ***/
300 typedef date-and-time {
302 pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
303 + '(Z|[\+\-]\d{2}:\d{2})';
306 "The date-and-time type is a profile of the ISO 8601
307 standard for representation of dates and times using the
308 Gregorian calendar. The profile is defined by the
309 date-time production in Section 5.6 of RFC 3339.
311 The date-and-time type is compatible with the dateTime XML
312 schema type with the following notable exceptions:
314 (a) The date-and-time type does not allow negative years.
316 (b) The date-and-time time-offset -00:00 indicates an unknown
317 time zone (see RFC 3339) while -00:00 and +00:00 and Z all
318 represent the same time zone in dateTime.
320 (c) The canonical format (see below) of data-and-time values
321 differs from the canonical format used by the dateTime XML
322 schema type, which requires all times to be in UTC using
325 This type is not equivalent to the DateAndTime textual
326 convention of the SMIv2 since RFC 3339 uses a different
327 separator between full-date and full-time and provides
328 higher resolution of time-secfrac.
329 The canonical format for date-and-time values with a known time
330 zone uses a numeric time zone offset that is calculated using
331 the device's configured known offset to UTC time. A change of
332 the device's offset to UTC time will cause date-and-time values
333 to change accordingly. Such changes might happen periodically
334 in case a server follows automatically daylight saving time
335 (DST) time zone offset changes. The canonical format for
336 date-and-time values with an unknown time zone (usually
337 referring to the notion of local time) uses the time-offset
340 "RFC 3339: Date and Time on the Internet: Timestamps
341 RFC 2579: Textual Conventions for SMIv2
342 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
348 "The timeticks type represents a non-negative integer that
349 represents the time, modulo 2^32 (4294967296 decimal), in
350 hundredths of a second between two epochs. When a schema
351 node is defined that uses this type, the description of
352 the schema node identifies both of the reference epochs.
354 In the value set and its semantics, this type is equivalent
355 to the TimeTicks type of the SMIv2.";
357 "RFC 2578: Structure of Management Information Version 2
364 "The timestamp type represents the value of an associated
365 timeticks schema node at which a specific occurrence
366 happened. The specific occurrence must be defined in the
367 description of any schema node defined using this type. When
368 the specific occurrence occurred prior to the last time the
369 associated timeticks attribute was zero, then the timestamp
370 value is zero. Note that this requires all timestamp values
371 to be reset to zero when the value of the associated timeticks
372 attribute reaches 497+ days and wraps around to zero.
374 The associated timeticks schema node must be specified
375 in the description of any schema node using this type.
376 In the value set and its semantics, this type is equivalent
377 to the TimeStamp textual convention of the SMIv2.";
379 "RFC 2579: Textual Conventions for SMIv2";
382 /*** collection of generic address types ***/
384 typedef phys-address {
386 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
389 "Represents media- or physical-level addresses represented
390 as a sequence octets, each octet represented by two hexadecimal
391 numbers. Octets are separated by colons. The canonical
392 representation uses lowercase characters.
394 In the value set and its semantics, this type is equivalent
395 to the PhysAddress textual convention of the SMIv2.";
397 "RFC 2579: Textual Conventions for SMIv2";
400 typedef mac-address {
402 pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
405 "The mac-address type represents an IEEE 802 MAC address.
406 The canonical representation uses lowercase characters.
408 In the value set and its semantics, this type is equivalent
409 to the MacAddress textual convention of the SMIv2.";
411 "IEEE 802: IEEE Standard for Local and Metropolitan Area
412 Networks: Overview and Architecture
413 RFC 2579: Textual Conventions for SMIv2";
416 /*** collection of XML specific types ***/
421 "This type represents an XPATH 1.0 expression.
423 When a schema node is defined that uses this type, the
424 description of the schema node MUST specify the XPath
425 context in which the XPath expression is evaluated.";
427 "XPATH: XML Path Language (XPath) Version 1.0";
430 /*** collection of string types ***/
434 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
437 "A hexadecimal string with octets represented as hex digits
438 separated by colons. The canonical representation uses
439 lowercase characters.";
444 pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
445 + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
448 "A Universally Unique IDentifier in the string representation
449 defined in RFC 4122. The canonical representation uses
450 lowercase characters.
452 The following is an example of a UUID in string representation:
453 f81d4fae-7dec-11d0-a765-00a0c91e6bf6
456 "RFC 4122: A Universally Unique IDentifier (UUID) URN
460 typedef dotted-quad {
463 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
464 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
467 "An unsigned 32-bit number expressed in the dotted-quad
468 notation, i.e., four octets written as decimal numbers
469 and separated with the '.' (full stop) character.";