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