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