blob: b3b2c1633d437488d1c6fc588acb588d68c88424 [file] [log] [blame]
hiroki096259b2018-12-07 09:33:24 -08001module openconfig-yang-types {
2
3 yang-version "1";
4 namespace "http://openconfig.net/yang/types/yang";
5 prefix "oc-yang";
6
7 import openconfig-extensions { prefix "oc-ext"; }
8
9 organization
10 "OpenConfig working group";
11
12 contact
13 "OpenConfig working group
14 www.openconfig.net";
15
16 description
17 "This module contains a set of extension types to the
18 YANG builtin types that are used across multiple
19 OpenConfig models.
20
21 Portions of this code were derived from IETF RFC 6021.
22 Please reproduce this note if possible.
23
24 IETF code is subject to the following copyright and license:
25 Copyright (c) IETF Trust and the persons identified as authors of
26 the code.
27 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
32 Section 4.c of the IETF Trust's Legal Provisions Relating
33 to IETF Documents (http://trustee.ietf.org/license-info).";
34
35 oc-ext:openconfig-version "0.2.0";
36
37 revision 2018-04-24 {
38 description
39 "Add date typedef";
40 reference "0.2.0";
41 }
42
43 revision 2017-07-30 {
44 description
45 "Fixed unprintable character";
46 reference "0.1.2";
47 }
48
49 revision 2017-04-03 {
50 description
51 "Update copyright notice.";
52 reference "0.1.1";
53 }
54
55 revision 2017-01-26 {
56 description
57 "Initial module for inet types";
58 reference "0.1.0";
59 }
60
61 typedef dotted-quad {
62 type string {
63 pattern '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
64 '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4]' +
65 '[0-9]|25[0-5])$';
66 }
67 description
68 "An unsigned 32-bit integer expressed as a dotted quad. The
69 format is four octets written as decimal numbers separated
70 with a period character.";
71 }
72
73 typedef hex-string {
74 type string {
75 pattern '^[0-9a-fA-F]*$';
76 }
77 description
78 "A string consisting of a hexadecimal characters.";
79 }
80
81 typedef counter32 {
82 type uint32;
83 description
84
85 "A 32-bit counter. A counter value is a monotonically increasing
86 value which is used to express a count of a number of
87 occurrences of a particular event or entity. When the counter
88 reaches its maximum value, in this case 2^32-1, it wraps to 0.
89
90 Discontinuities in the counter are generally triggered only when
91 the counter is reset to zero.";
92 }
93
94 typedef counter64 {
95 type uint64;
96 description
97
98 "A 64-bit counter. A counter value is a monotonically increasing
99 value which is used to express a count of a number of
100 occurrences of a particular event or entity. When a counter64
101 reaches its maximum value, 2^64-1, it loops to zero.
102 Discontinuities in a counter are generally triggered only when
103 the counter is reset to zero, through operator or system
104 intervention.";
105 }
106
107 typedef date-and-time {
108 type string {
109 pattern
110 '^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}' +
111 '(\.[0-9]+)?Z[+-][0-9]{2}:[0-9]{2}$';
112 }
113 description
114 "A date and time, expressed in the format described in RFC3339.
115 That is to say:
116
117 YYYY-MM-DDTHH:MM:SSZ+-hh:mm
118
119 where YYYY is the year, MM is the month expressed as a two-digit
120 month (zero padding if required), DD is the day of the month,
121 expressed as a two digit value. T is the literal character 'T',
122 HH is the hour of the day expressed as a two digit number, using
123 the 24-hour clock, MM is the minute of the hour expressed as a
124 two digit number. Z is the literal character 'Z', followed by a
125 timezone offset expressed in hours (hh) and minutes (mm), both
126 expressed as two digit numbers. The time offset is specified as
127 a positive or negative offset to UTC using the '+' or '-'
128 character preceding the offset.
129
130 Optionally, fractional seconds can be expressed after the minute
131 of the hour as a decimal number of unspecified precision
132 reflecting fractions of a second.";
133 reference
134 "RFC3339 - Date and Time on the Internet: Timestamps";
135 }
136
137 typedef date {
138 type string {
139 pattern '^[0-9]{4}\-[0-9]{2}\-[0-9]{2}$';
140 }
141 description
142 "A full UTC date, expressed in the format described in RFC3339.
143 That is to say:
144
145 YYYY-MM-DD
146
147 where YYYY is the year, MM is the month expressed as a two-digit
148 month (zero padding if required), DD is the day of the month,
149 expressed as a two digit value.";
150
151 reference
152 "RFC3339 - Date and Time on the Internet: full-date";
153 }
154
155 typedef gauge64 {
156 type uint64;
157 description
158 "A gauge value may increase or decrease - and reflects a value
159 at a particular point in time. If the value of the variable
160 being modeled using the gauge exceeds its maximum - 2^64-1 in
161 this case - the gauge is set to its maximum value.";
162 }
163
164 typedef phys-address {
165 type string {
166 pattern '^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?$';
167 }
168 description
169 "A physical layer address, expressed as a series of pairs of
170 hexadecimal digits.";
171 }
172
173 typedef mac-address {
174 type string {
175 pattern '^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$';
176 }
177 description
178 "An IEEE 802 MAC address";
179 }
180}