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