+++ /dev/null
-module ietf-yang-types {\r
-\r
-namespace "urn:ietf:params:xml:ns:yang:ietf-yang-types";\r
-prefix "yang";\r
-\r
-organization\r
- "IETF NETMOD (NETCONF Data Modeling Language) Working Group";\r
-\r
-contact\r
- "WG Web: <http://tools.ietf.org/wg/netmod/>\r
- WG List: <mailto:netmod@ietf.org>\r
- WG Chair: David Kessens\r
- <mailto:david.kessens@nsn.com>\r
- WG Chair: Juergen Schoenwaelder\r
- <mailto:j.schoenwaelder@jacobs-university.de>\r
- Editor: Juergen Schoenwaelder\r
- <mailto:j.schoenwaelder@jacobs-university.de>";\r
-\r
-description\r
- "This module contains a collection of generally useful derived\r
- YANG data types.\r
- Copyright (c) 2013 IETF Trust and the persons identified as\r
- authors of the code. All rights reserved.\r
- Redistribution and use in source and binary forms, with or\r
- without modification, is permitted pursuant to, and subject\r
- to the license terms contained in, the Simplified BSD License\r
- set forth in Section 4.c of the IETF Trust's Legal Provisions\r
- Relating to IETF Documents\r
- (http://trustee.ietf.org/license-info).\r
- This version of this YANG module is part of RFC 6991; see\r
- the RFC itself for full legal notices.";\r
-\r
-revision 2013-07-15 {\r
- description\r
- "This revision adds the following new data types:\r
- - yang-identifier\r
- - hex-string\r
- - uuid\r
- - dotted-quad";\r
- reference\r
- "RFC 6991: Common YANG Data Types";\r
-}\r
-\r
-revision 2010-09-24 {\r
- description\r
- "Initial revision.";\r
- reference\r
- "RFC 6021: Common YANG Data Types";\r
-}\r
-\r
-/*** collection of counter and gauge types ***/\r
-\r
-typedef counter32 {\r
- type uint32;\r
- description\r
- "The counter32 type represents a non-negative integer\r
- that monotonically increases until it reaches a\r
- maximum value of 2^32-1 (4294967295 decimal), when it\r
- wraps around and starts increasing again from zero.\r
- Counters have no defined 'initial' value, and thus, a\r
- single value of a counter has (in general) no information\r
- content. Discontinuities in the monotonically increasing\r
- value normally occur at re-initialization of the\r
- management system, and at other times as specified in the\r
- description of a schema node using this type. If such\r
- other times can occur, for example, the creation of\r
- a schema node of type counter32 at times other than\r
- re-initialization, then a corresponding schema node\r
- should be defined, with an appropriate type, to indicate\r
- the last discontinuity.\r
- The counter32 type should not be used for configuration\r
- schema nodes. A default statement SHOULD NOT be used in\r
- combination with the type counter32.\r
- In the value set and its semantics, this type is equivalent\r
- to the Counter32 type of the SMIv2.";\r
- reference\r
- "RFC 2578: Structure of Management Information Version 2\r
- (SMIv2)";\r
-}\r
-\r
-typedef zero-based-counter32 {\r
- type yang:counter32;\r
- default "0";\r
- description\r
- "The zero-based-counter32 type represents a counter32\r
- that has the defined 'initial' value zero.\r
- A schema node of this type will be set to zero (0) on creation\r
- and will thereafter increase monotonically until it reaches\r
- a maximum value of 2^32-1 (4294967295 decimal), when it\r
- wraps around and starts increasing again from zero.\r
- Provided that an application discovers a new schema node\r
- of this type within the minimum time to wrap, it can use the\r
- 'initial' value as a delta. It is important for a management\r
- station to be aware of this minimum time and the actual time\r
- between polls, and to discard data if the actual time is too\r
- long or there is no defined minimum time.\r
- In the value set and its semantics, this type is equivalent\r
- to the ZeroBasedCounter32 textual convention of the SMIv2.";\r
- reference\r
- "RFC 4502: Remote Network Monitoring Management Information\r
- Base Version 2";\r
-}\r
-\r
-typedef counter64 {\r
- type uint64;\r
- description\r
- "The counter64 type represents a non-negative integer\r
- that monotonically increases until it reaches a\r
- maximum value of 2^64-1 (18446744073709551615 decimal),\r
- when it wraps around and starts increasing again from zero.\r
- Counters have no defined 'initial' value, and thus, a\r
- single value of a counter has (in general) no information\r
- content. Discontinuities in the monotonically increasing\r
- value normally occur at re-initialization of the\r
- management system, and at other times as specified in the\r
- description of a schema node using this type. If such\r
- other times can occur, for example, the creation of\r
- a schema node of type counter64 at times other than\r
- re-initialization, then a corresponding schema node\r
- should be defined, with an appropriate type, to indicate\r
- the last discontinuity.\r
- The counter64 type should not be used for configuration\r
- schema nodes. A default statement SHOULD NOT be used in\r
- combination with the type counter64.\r
- In the value set and its semantics, this type is equivalent\r
- to the Counter64 type of the SMIv2.";\r
- reference\r
- "RFC 2578: Structure of Management Information Version 2\r
- (SMIv2)";\r
-}\r
-\r
-typedef zero-based-counter64 {\r
- type yang:counter64;\r
- default "0";\r
- description\r
- "The zero-based-counter64 type represents a counter64 that\r
- has the defined 'initial' value zero.\r
- A schema node of this type will be set to zero (0) on creation\r
- and will thereafter increase monotonically until it reaches\r
- a maximum value of 2^64-1 (18446744073709551615 decimal),\r
- when it wraps around and starts increasing again from zero.\r
- Provided that an application discovers a new schema node\r
- of this type within the minimum time to wrap, it can use the\r
- 'initial' value as a delta. It is important for a management\r
- station to be aware of this minimum time and the actual time\r
- between polls, and to discard data if the actual time is too\r
- long or there is no defined minimum time.\r
- In the value set and its semantics, this type is equivalent\r
- to the ZeroBasedCounter64 textual convention of the SMIv2.";\r
- reference\r
- "RFC 2856: Textual Conventions for Additional High Capacity\r
- Data Types";\r
-}\r
-\r
-typedef gauge32 {\r
- type uint32;\r
- description\r
- "The gauge32 type represents a non-negative integer, which\r
- may increase or decrease, but shall never exceed a maximum\r
- value, nor fall below a minimum value. The maximum value\r
- cannot be greater than 2^32-1 (4294967295 decimal), and\r
- the minimum value cannot be smaller than 0. The value of\r
- a gauge32 has its maximum value whenever the information\r
- being modeled is greater than or equal to its maximum\r
- value, and has its minimum value whenever the information\r
- being modeled is smaller than or equal to its minimum value.\r
- If the information being modeled subsequently decreases\r
- below (increases above) the maximum (minimum) value, the\r
- gauge32 also decreases (increases).\r
- In the value set and its semantics, this type is equivalent\r
- to the Gauge32 type of the SMIv2.";\r
- reference\r
- "RFC 2578: Structure of Management Information Version 2\r
- (SMIv2)";\r
-}\r
-\r
-typedef gauge64 {\r
- type uint64;\r
- description\r
- "The gauge64 type represents a non-negative integer, which\r
- may increase or decrease, but shall never exceed a maximum\r
- value, nor fall below a minimum value. The maximum value\r
- cannot be greater than 2^64-1 (18446744073709551615), and\r
- the minimum value cannot be smaller than 0. The value of\r
- a gauge64 has its maximum value whenever the information\r
- being modeled is greater than or equal to its maximum\r
- value, and has its minimum value whenever the information\r
- being modeled is smaller than or equal to its minimum value.\r
- If the information being modeled subsequently decreases\r
- below (increases above) the maximum (minimum) value, the\r
- gauge64 also decreases (increases).\r
- In the value set and its semantics, this type is equivalent\r
- to the CounterBasedGauge64 SMIv2 textual convention defined\r
- in RFC 2856";\r
- reference\r
- "RFC 2856: Textual Conventions for Additional High Capacity\r
- Data Types";\r
-}\r
-\r
-/*** collection of identifier-related types ***/\r
-\r
-typedef object-identifier {\r
- type string {\r
- pattern '(([0-1](\.[1-3]?[0-9]))|(2\.(0|([1-9]\d*))))'\r
- + '(\.(0|([1-9]\d*)))*';\r
- }\r
- description\r
- "The object-identifier type represents administratively\r
- assigned names in a registration-hierarchical-name tree.\r
- Values of this type are denoted as a sequence of numerical\r
- non-negative sub-identifier values. Each sub-identifier\r
- value MUST NOT exceed 2^32-1 (4294967295). Sub-identifiers\r
- are separated by single dots and without any intermediate\r
- whitespace.\r
- The ASN.1 standard restricts the value space of the first\r
- sub-identifier to 0, 1, or 2. Furthermore, the value space\r
- of the second sub-identifier is restricted to the range\r
- 0 to 39 if the first sub-identifier is 0 or 1. Finally,\r
- the ASN.1 standard requires that an object identifier\r
- has always at least two sub-identifiers. The pattern\r
- captures these restrictions.\r
- Although the number of sub-identifiers is not limited,\r
- module designers should realize that there may be\r
- implementations that stick with the SMIv2 limit of 128\r
- sub-identifiers.\r
- This type is a superset of the SMIv2 OBJECT IDENTIFIER type\r
- since it is not restricted to 128 sub-identifiers. Hence,\r
- this type SHOULD NOT be used to represent the SMIv2 OBJECT\r
- IDENTIFIER type; the object-identifier-128 type SHOULD be\r
- used instead.";\r
- reference\r
- "ISO9834-1: Information technology -- Open Systems\r
- Interconnection -- Procedures for the operation of OSI\r
- Registration Authorities: General procedures and top\r
- arcs of the ASN.1 Object Identifier tree";\r
-}\r
-\r
-typedef object-identifier-128 {\r
- type object-identifier {\r
- pattern '\d*(\.\d*){1,127}';\r
- }\r
- description\r
- "This type represents object-identifiers restricted to 128\r
- sub-identifiers.\r
- In the value set and its semantics, this type is equivalent\r
- to the OBJECT IDENTIFIER type of the SMIv2.";\r
- reference\r
- "RFC 2578: Structure of Management Information Version 2\r
- (SMIv2)";\r
-}\r
-\r
-typedef yang-identifier {\r
- type string {\r
- length "1..max";\r
- pattern '[a-zA-Z_][a-zA-Z0-9\-_.]*';\r
- pattern '.|..|[^xX].*|.[^mM].*|..[^lL].*';\r
- }\r
- description\r
- "A YANG identifier string as defined by the 'identifier'\r
- rule in Section 12 of RFC 6020. An identifier must\r
- start with an alphabetic character or an underscore\r
- followed by an arbitrary sequence of alphabetic or\r
- numeric characters, underscores, hyphens, or dots.\r
- A YANG identifier MUST NOT start with any possible\r
- combination of the lowercase or uppercase character\r
- sequence 'xml'.";\r
- reference\r
- "RFC 6020: YANG - A Data Modeling Language for the Network\r
- Configuration Protocol (NETCONF)";\r
-}\r
-\r
-/*** collection of types related to date and time***/\r
-\r
-typedef date-and-time {\r
- type string {\r
- pattern '\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(\.\d+)?'\r
- + '(Z|[\+\-]\d{2}:\d{2})';\r
- }\r
- description\r
- "The date-and-time type is a profile of the ISO 8601\r
- standard for representation of dates and times using the\r
- Gregorian calendar. The profile is defined by the\r
- date-time production in Section 5.6 of RFC 3339.\r
- The date-and-time type is compatible with the dateTime XML\r
- schema type with the following notable exceptions:\r
- (a) The date-and-time type does not allow negative years.\r
- (b) The date-and-time time-offset -00:00 indicates an unknown\r
- time zone (see RFC 3339) while -00:00 and +00:00 and Z\r
- all represent the same time zone in dateTime.\r
- (c) The canonical format (see below) of data-and-time values\r
- differs from the canonical format used by the dateTime XML\r
- schema type, which requires all times to be in UTC using\r
- the time-offset 'Z'.\r
- This type is not equivalent to the DateAndTime textual\r
- convention of the SMIv2 since RFC 3339 uses a different\r
- separator between full-date and full-time and provides\r
- higher resolution of time-secfrac.\r
- The canonical format for date-and-time values with a known time\r
- zone uses a numeric time zone offset that is calculated using\r
- the device's configured known offset to UTC time. A change of\r
- the device's offset to UTC time will cause date-and-time values\r
- to change accordingly. Such changes might happen periodically\r
- in case a server follows automatically daylight saving time\r
- (DST) time zone offset changes. The canonical format for\r
- date-and-time values with an unknown time zone (usually\r
- referring to the notion of local time) uses the time-offset\r
- -00:00.";\r
- reference\r
- "RFC 3339: Date and Time on the Internet: Timestamps\r
- RFC 2579: Textual Conventions for SMIv2\r
- XSD-TYPES: XML Schema Part 2: Datatypes Second Edition";\r
-}\r
-\r
-typedef timeticks {\r
- type uint32;\r
- description\r
- "The timeticks type represents a non-negative integer that\r
- represents the time, modulo 2^32 (4294967296 decimal), in\r
- hundredths of a second between two epochs. When a schema\r
- node is defined that uses this type, the description of\r
- the schema node identifies both of the reference epochs.\r
- In the value set and its semantics, this type is equivalent\r
- to the TimeTicks type of the SMIv2.";\r
- reference\r
- "RFC 2578: Structure of Management Information Version 2\r
- (SMIv2)";\r
-}\r
-\r
-typedef timestamp {\r
- type yang:timeticks;\r
- description\r
- "The timestamp type represents the value of an associated\r
- timeticks schema node at which a specific occurrence\r
- happened. The specific occurrence must be defined in the\r
- description of any schema node defined using this type. When\r
- the specific occurrence occurred prior to the last time the\r
- associated timeticks attribute was zero, then the timestamp\r
- value is zero. Note that this requires all timestamp values\r
- to be reset to zero when the value of the associated timeticks\r
- attribute reaches 497+ days and wraps around to zero.\r
- The associated timeticks schema node must be specified\r
- in the description of any schema node using this type.\r
- In the value set and its semantics, this type is equivalent\r
- to the TimeStamp textual convention of the SMIv2.";\r
- reference\r
- "RFC 2579: Textual Conventions for SMIv2";\r
-}\r
-\r
-/*** collection of generic address types ***/\r
-\r
-typedef phys-address {\r
- type string {\r
- pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';\r
- }\r
-\r
- description\r
- "Represents media- or physical-level addresses represented\r
- as a sequence octets, each octet represented by two hexadecimal\r
- numbers. Octets are separated by colons. The canonical\r
- representation uses lowercase characters.\r
- In the value set and its semantics, this type is equivalent\r
- to the PhysAddress textual convention of the SMIv2.";\r
- reference\r
- "RFC 2579: Textual Conventions for SMIv2";\r
-}\r
-\r
-typedef mac-address {\r
- type string {\r
- pattern '[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}';\r
- }\r
- description\r
- "The mac-address type represents an IEEE 802 MAC address.\r
- The canonical representation uses lowercase characters.\r
- In the value set and its semantics, this type is equivalent\r
- to the MacAddress textual convention of the SMIv2.";\r
- reference\r
- "IEEE 802: IEEE Standard for Local and Metropolitan Area\r
- Networks: Overview and Architecture\r
- RFC 2579: Textual Conventions for SMIv2";\r
-}\r
-\r
-/*** collection of XML-specific types ***/\r
-\r
-typedef xpath1.0 {\r
- type string;\r
- description\r
- "This type represents an XPATH 1.0 expression.\r
- When a schema node is defined that uses this type, the\r
- description of the schema node MUST specify the XPath\r
- context in which the XPath expression is evaluated.";\r
- reference\r
- "XPATH: XML Path Language (XPath) Version 1.0";\r
-}\r
-\r
-/*** collection of string types ***/\r
-\r
-typedef hex-string {\r
- type string {\r
- pattern '([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?';\r
- }\r
- description\r
- "A hexadecimal string with octets represented as hex digits\r
- separated by colons. The canonical representation uses\r
- lowercase characters.";\r
-}\r
-\r
-typedef uuid {\r
- type string {\r
- pattern '[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-'\r
- + '[0-9a-fA-F]{4}-[0-9a-fA-F]{12}';\r
- }\r
- description\r
- "A Universally Unique IDentifier in the string representation\r
- defined in RFC 4122. The canonical representation uses\r
- lowercase characters.\r
- The following is an example of a UUID in string representation:\r
- f81d4fae-7dec-11d0-a765-00a0c91e6bf6\r
- ";\r
- reference\r
- "RFC 4122: A Universally Unique IDentifier (UUID) URN\r
- Namespace";\r
-}\r
-\r
-typedef dotted-quad {\r
- type string {\r
- pattern\r
- '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'\r
- + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])';\r
- }\r
- description\r
- "An unsigned 32-bit number expressed in the dotted-quad\r
- notation, i.e., four octets written as decimal numbers\r
- and separated with the '.' (full stop) character.";\r
-}\r
-}\r