blob: 749fac42616b905198181f597527dd0c2d3db8d1 [file] [log] [blame]
Thomas Vachuska6655bee2017-08-24 16:12:59 -07001module 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.1.2";
36
37 revision 2017-07-30 {
38 description
39 "Fixed unprintable character";
40 reference "0.1.2";
41 }
42
43 revision 2017-04-03 {
44 description
45 "Update copyright notice.";
46 reference "0.1.1";
47 }
48
49 revision 2017-01-26 {
50 description
51 "Initial module for inet types";
52 reference "0.1.0";
53 }
54
55 typedef dotted-quad {
56 type string {
57 pattern '^(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|' +
58 '25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4]' +
59 '[0-9]|25[0-5])$';
60 }
61 description
62 "An unsigned 32-bit integer expressed as a dotted quad. The
63 format is four octets written as decimal numbers separated
64 with a period character.";
65 }
66
67 typedef hex-string {
68 type string {
69 pattern '^[0-9a-fA-F]*$';
70 }
71 description
72 "A string consisting of a hexadecimal characters.";
73 }
74
75 typedef counter32 {
76 type uint32;
77 description
78
79 "A 32-bit counter. A counter value is a monotonically increasing
80 value which is used to express a count of a number of
81 occurrences of a particular event or entity. When the counter
82 reaches its maximum value, in this case 2^32-1, it wraps to 0.
83
84 Discontinuities in the counter are generally triggered only when
85 the counter is reset to zero.";
86 }
87
88 typedef counter64 {
89 type uint64;
90 description
91
92 "A 64-bit counter. A counter value is a monotonically increasing
93 value which is used to express a count of a number of
94 occurrences of a particular event or entity. When a counter64
95 reaches its maximum value, 2^64-1, it loops to zero.
96 Discontinuities in a counter are generally triggered only when
97 the counter is reset to zero, through operator or system
98 intervention.";
99 }
100
101 typedef date-and-time {
102 type string {
103 pattern
104 '^[0-9]{4}\-[0-9]{2}\-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}' +
105 '(\.[0-9]+)?Z[+-][0-9]{2}:[0-9]{2}$';
106 }
107 description
108 "A date and time, expressed in the format described in RFC3339.
109 That is to say:
110
111 YYYY-MM-DDTHH:MM:SSZ+-hh:mm
112
113 where YYYY is the year, MM is the month expressed as a two-digit
114 month (zero padding if required), DD is the day of the month,
115 expressed as a two digit value. T is the literal character 'T',
116 HH is the hour of the day expressed as a two digit number, using
117 the 24-hour clock, MM is the minute of the hour expressed as a
118 two digit number. Z is the literal character 'Z', followed by a
119 timezone offset expressed in hours (hh) and minutes (mm), both
120 expressed as two digit numbers. The time offset is specified as
121 a positive or negative offset to UTC using the '+' or '-'
122 character preceding the offset.
123
124 Optionally, fractional seconds can be expressed after the minute
125 of the hour as a decimal number of unspecified precision
126 reflecting fractions of a second.";
127 reference
128 "RFC3339 - Date and Time on the Internet: Timestamps";
129 }
130
131 typedef gauge64 {
132 type uint64;
133 description
134 "A gauge value may increase or decrease - and reflects a value
135 at a particular point in time. If the value of the variable
136 being modeled using the gauge exceeds its maximum - 2^64-1 in
137 this case - the gauge is set to its maximum value.";
138 }
139
140 typedef phys-address {
141 type string {
142 pattern '^([0-9a-fA-F]{2}(:[0-9a-fA-F]{2})*)?$';
143 }
144 description
145 "A physical layer address, expressed as a series of pairs of
146 hexadecimal digits.";
147 }
148
149 typedef mac-address {
150 type string {
151 pattern '^[0-9a-fA-F]{2}(:[0-9a-fA-F]{2}){5}$';
152 }
153 description
154 "An IEEE 802 MAC address";
155 }
156}