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