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