blob: 371a091d14f590771c02452629f159fb8c9a76bc [file] [log] [blame]
Marc De Leenheerf20c7fb2017-05-05 10:24:41 -07001module ietf-yang-types {
2
3 namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";
4 prefix "yang";
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
13 WG Chair: David Kessens
14 <mailto:david.kessens@nsn.com>
15
16 WG Chair: Juergen Schoenwaelder
17 <mailto:j.schoenwaelder@jacobs-university.de>
18
19 Editor: Juergen Schoenwaelder
20 <mailto:j.schoenwaelder@jacobs-university.de>";
21
22 description
23 "This module contains a collection of generally useful derived
24 YANG data types.
25
26 Copyright (c) 2013 IETF Trust and the persons identified as
27 authors of the code. All rights reserved.
28
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).
35
36 This version of this YANG module is part of RFC 6991; see
37 the RFC itself for full legal notices.";
38
39 revision 2013-07-15 {
40 description
41 "This revision adds the following new data types:
42 - yang-identifier
43 - hex-string
44 - uuid
45 - dotted-quad";
46 reference
47 "RFC 6991: Common YANG Data Types";
48 }
49
50 revision 2010-09-24 {
51 description
52 "Initial revision.";
53 reference
54 "RFC 6021: Common YANG Data Types";
55 }
56
57 /*** collection of counter and gauge types ***/
58
59 typedef counter32 {
60 type uint32;
61 description
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.
66
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.
78
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.
82
83 In the value set and its semantics, this type is equivalent
84 to the Counter32 type of the SMIv2.";
85 reference
86 "RFC 2578: Structure of Management Information Version 2
87 (SMIv2)";
88 }
89
90 typedef zero-based-counter32 {
91 type yang:counter32;
92 default "0";
93 description
94 "The zero-based-counter32 type represents a counter32
95 that has the defined 'initial' value zero.
96
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.
101
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.
108
109 In the value set and its semantics, this type is equivalent
110 to the ZeroBasedCounter32 textual convention of the SMIv2.";
111 reference
112 "RFC 4502: Remote Network Monitoring Management Information
113 Base Version 2";
114 }
115
116 typedef counter64 {
117 type uint64;
118 description
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.
123
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.
135
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.
139
140 In the value set and its semantics, this type is equivalent
141 to the Counter64 type of the SMIv2.";
142 reference
143 "RFC 2578: Structure of Management Information Version 2
144 (SMIv2)";
145 }
146
147 typedef zero-based-counter64 {
148 type yang:counter64;
149 default "0";
150 description
151 "The zero-based-counter64 type represents a counter64 that
152 has the defined 'initial' value zero.
153
154
155
156
157 A schema node of this type will be set to zero (0) on creation
158 and will thereafter increase monotonically until it reaches
159 a maximum value of 2^64-1 (18446744073709551615 decimal),
160 when it wraps around and starts increasing again from zero.
161
162 Provided that an application discovers a new schema node
163 of this type within the minimum time to wrap, it can use the
164 'initial' value as a delta. It is important for a management
165 station to be aware of this minimum time and the actual time
166 between polls, and to discard data if the actual time is too
167 long or there is no defined minimum time.
168
169 In the value set and its semantics, this type is equivalent
170 to the ZeroBasedCounter64 textual convention of the SMIv2.";
171 reference
172 "RFC 2856: Textual Conventions for Additional High Capacity
173 Data Types";
174 }
175
176 typedef gauge32 {
177 type uint32;
178 description
179 "The gauge32 type represents a non-negative integer, which
180 may increase or decrease, but shall never exceed a maximum
181 value, nor fall below a minimum value. The maximum value
182 cannot be greater than 2^32-1 (4294967295 decimal), and
183 the minimum value cannot be smaller than 0. The value of
184 a gauge32 has its maximum value whenever the information
185 being modeled is greater than or equal to its maximum
186 value, and has its minimum value whenever the information
187 being modeled is smaller than or equal to its minimum value.
188 If the information being modeled subsequently decreases
189 below (increases above) the maximum (minimum) value, the
190 gauge32 also decreases (increases).
191
192 In the value set and its semantics, this type is equivalent
193 to the Gauge32 type of the SMIv2.";
194 reference
195 "RFC 2578: Structure of Management Information Version 2
196 (SMIv2)";
197 }
198
199 typedef gauge64 {
200 type uint64;
201 description
202 "The gauge64 type represents a non-negative integer, which
203 may increase or decrease, but shall never exceed a maximum
204 value, nor fall below a minimum value. The maximum value
205 cannot be greater than 2^64-1 (18446744073709551615), and
206 the minimum value cannot be smaller than 0. The value of
207 a gauge64 has its maximum value whenever the information
208 being modeled is greater than or equal to its maximum
209 value, and has its minimum value whenever the information
210 being modeled is smaller than or equal to its minimum value.
211 If the information being modeled subsequently decreases
212 below (increases above) the maximum (minimum) value, the
213 gauge64 also decreases (increases).
214
215 In the value set and its semantics, this type is equivalent
216 to the CounterBasedGauge64 SMIv2 textual convention defined
217 in RFC 2856";
218 reference
219 "RFC 2856: Textual Conventions for Additional High Capacity
220 Data Types";
221 }
222
223 /*** collection of identifier-related types ***/
224
225 typedef object-identifier {
226 type string {
227 pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'
228 + '(\.(0|([1-9]\d*)))*';
229 }
230 description
231 "The object-identifier type represents administratively
232 assigned names in a registration-hierarchical-name tree.
233
234 Values of this type are denoted as a sequence of numerical
235 non-negative sub-identifier values. Each sub-identifier
236 value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers
237 are separated by single dots and without any intermediate
238 whitespace.
239
240 The ASN.1 standard restricts the value space of the first
241 sub-identifier to 0, 1, or 2. Furthermore, the value space
242 of the second sub-identifier is restricted to the range
243 0 to 39 if the first sub-identifier is 0 or 1. Finally,
244 the ASN.1 standard requires that an object identifier
245 has always at least two sub-identifiers. The pattern
246 captures these restrictions.
247
248 Although the number of sub-identifiers is not limited,
249 module designers should realize that there may be
250 implementations that stick with the SMIv2 limit of 128
251 sub-identifiers.
252
253 This type is a superset of the SMIv2 OBJECT IDENTIFIER type
254 since it is not restricted to 128 sub-identifiers. Hence,
255 this type SHOULD NOT be used to represent the SMIv2 OBJECT
256 IDENTIFIER type; the object-identifier-128 type SHOULD be
257 used instead.";
258 reference
259 "ISO9834-1: Information technology -- Open Systems
260 Interconnection -- Procedures for the operation of OSI
261 Registration Authorities: General procedures and top
262 arcs of the ASN.1 Object Identifier tree";
263 }
264
265 typedef object-identifier-128 {
266 type object-identifier {
267 pattern '\d*(\.\d*){1,127}';
268 }
269 description
270 "This type represents object-identifiers restricted to 128
271 sub-identifiers.
272
273 In the value set and its semantics, this type is equivalent
274 to the OBJECT IDENTIFIER type of the SMIv2.";
275 reference
276 "RFC 2578: Structure of Management Information Version 2
277 (SMIv2)";
278 }
279
280 typedef yang-identifier {
281 type string {
282 length "1..max";
283 pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';
284 pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';
285 }
286 description
287 "A YANG identifier string as defined by the 'identifier'
288 rule in Section 12 of RFC 6020. An identifier must
289 start with an alphabetic character or an underscore
290 followed by an arbitrary sequence of alphabetic or
291 numeric characters, underscores, hyphens, or dots.
292
293 A YANG identifier MUST NOT start with any possible
294 combination of the lowercase or uppercase character
295 sequence 'xml'.";
296 reference
297 "RFC 6020: YANG - A Data Modeling Language for the Network
298 Configuration Protocol (NETCONF)";
299 }
300
301 /*** collection of types related to date and time***/
302
303 typedef date-and-time {
304 type string {
305 pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'
306 + '(Z|[\+\-]\d{2}:\d{2})';
307 }
308 description
309 "The date-and-time type is a profile of the ISO 8601
310 standard for representation of dates and times using the
311 Gregorian calendar. The profile is defined by the
312 date-time production in Section 5.6 of RFC 3339.
313
314 The date-and-time type is compatible with the dateTime XML
315 schema type with the following notable exceptions:
316
317 (a) The date-and-time type does not allow negative years.
318
319 (b) The date-and-time time-offset -00:00 indicates an unknown
320 time zone (see RFC 3339) while -00:00 and +00:00 and Z
321 all represent the same time zone in dateTime.
322
323 (c) The canonical format (see below) of data-and-time values
324 differs from the canonical format used by the dateTime XML
325 schema type, which requires all times to be in UTC using
326 the time-offset 'Z'.
327
328 This type is not equivalent to the DateAndTime textual
329 convention of the SMIv2 since RFC 3339 uses a different
330 separator between full-date and full-time and provides
331 higher resolution of time-secfrac.
332
333 The canonical format for date-and-time values with a known time
334 zone uses a numeric time zone offset that is calculated using
335 the device's configured known offset to UTC time. A change of
336 the device's offset to UTC time will cause date-and-time values
337 to change accordingly. Such changes might happen periodically
338 in case a server follows automatically daylight saving time
339 (DST) time zone offset changes. The canonical format for
340 date-and-time values with an unknown time zone (usually
341 referring to the notion of local time) uses the time-offset
342 -00:00.";
343 reference
344 "RFC 3339: Date and Time on the Internet: Timestamps
345 RFC 2579: Textual Conventions for SMIv2
346 XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";
347 }
348
349 typedef timeticks {
350 type uint32;
351 description
352 "The timeticks type represents a non-negative integer that
353 represents the time, modulo 2^32 (4294967296 decimal), in
354 hundredths of a second between two epochs. When a schema
355 node is defined that uses this type, the description of
356 the schema node identifies both of the reference epochs.
357
358 In the value set and its semantics, this type is equivalent
359 to the TimeTicks type of the SMIv2.";
360 reference
361 "RFC 2578: Structure of Management Information Version 2
362 (SMIv2)";
363 }
364
365 typedef timestamp {
366 type yang:timeticks;
367 description
368 "The timestamp type represents the value of an associated
369 timeticks schema node at which a specific occurrence
370 happened. The specific occurrence must be defined in the
371 description of any schema node defined using this type. When
372 the specific occurrence occurred prior to the last time the
373 associated timeticks attribute was zero, then the timestamp
374 value is zero. Note that this requires all timestamp values
375 to be reset to zero when the value of the associated timeticks
376 attribute reaches 497+ days and wraps around to zero.
377
378 The associated timeticks schema node must be specified
379 in the description of any schema node using this type.
380
381 In the value set and its semantics, this type is equivalent
382 to the TimeStamp textual convention of the SMIv2.";
383 reference
384 "RFC 2579: Textual Conventions for SMIv2";
385 }
386
387 /*** collection of generic address types ***/
388
389 typedef phys-address {
390 type string {
391 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
392 }
393
394
395
396
397 description
398 "Represents media- or physical-level addresses represented
399 as a sequence octets, each octet represented by two hexadecimal
400 numbers. Octets are separated by colons. The canonical
401 representation uses lowercase characters.
402
403 In the value set and its semantics, this type is equivalent
404 to the PhysAddress textual convention of the SMIv2.";
405 reference
406 "RFC 2579: Textual Conventions for SMIv2";
407 }
408
409 typedef mac-address {
410 type string {
411 pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';
412 }
413 description
414 "The mac-address type represents an IEEE 802 MAC address.
415 The canonical representation uses lowercase characters.
416
417 In the value set and its semantics, this type is equivalent
418 to the MacAddress textual convention of the SMIv2.";
419 reference
420 "IEEE 802: IEEE Standard for Local and Metropolitan Area
421 Networks: Overview and Architecture
422 RFC 2579: Textual Conventions for SMIv2";
423 }
424
425 /*** collection of XML-specific types ***/
426
427 typedef xpath1.0 {
428 type string;
429 description
430 "This type represents an XPATH 1.0 expression.
431
432 When a schema node is defined that uses this type, the
433 description of the schema node MUST specify the XPath
434 context in which the XPath expression is evaluated.";
435 reference
436 "XPATH: XML Path Language (XPath) Version 1.0";
437 }
438
439 /*** collection of string types ***/
440
441 typedef hex-string {
442 type string {
443 pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';
444 }
445 description
446 "A hexadecimal string with octets represented as hex digits
447 separated by colons. The canonical representation uses
448 lowercase characters.";
449 }
450
451 typedef uuid {
452 type string {
453 pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'
454 + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';
455 }
456 description
457 "A Universally Unique IDentifier in the string representation
458 defined in RFC 4122. The canonical representation uses
459 lowercase characters.
460
461 The following is an example of a UUID in string representation:
462 f81d4fae-7dec-11d0-a765-00a0c91e6bf6
463 ";
464 reference
465 "RFC 4122: A Universally Unique IDentifier (UUID) URN
466 Namespace";
467 }
468
469 typedef dotted-quad {
470 type string {
471 pattern
472 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
473 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';
474 }
475 description
476 "An unsigned 32-bit number expressed in the dotted-quad
477 notation, i.e., four octets written as decimal numbers
478 and separated with the '.' (full stop) character.";
479 }
480}