4 * Copyright 2016 RIFT.IO Inc
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
23 * @file rw-yang-types.yang
24 * @author Tom Seidenberg
26 * @brief RiftWare yang type overrides
28 * These typedefs exist to allow RiftWare to specify special extensions
34 namespace "http://riftio.com/ns/riftware-1.0/rw-yang-types";
37 import ietf-inet-types {
39 revision-date 2013-07-15;
42 import ietf-yang-types {
43 prefix "ietf-yang-types";
44 revision-date 2013-07-15;
48 "This module contains redefinitions of the ietf-yang-types and
49 ietf-inet-types modules, which allows customized extensions to be
50 defined for these types when used in RiftWare applications.";
56 "RIFT yang types that redefine the IETF types.";
70 typedef ipv6-flow-label {
71 type inet:ipv6-flow-label;
75 type inet:port-number;
86 typedef ipv4-address {
87 type inet:ipv4-address;
90 typedef ipv6-address {
91 type inet:ipv6-address;
94 typedef ip-address-no-zone {
95 type inet:ip-address-no-zone;
98 typedef ipv4-address-no-zone {
99 type inet:ipv4-address-no-zone;
102 typedef ipv6-address-no-zone {
103 type inet:ipv6-address-no-zone;
110 typedef ip-prefix-non-canonical {
112 type rwt:ipv4-prefix-non-canonical;
113 type rwt:ipv6-prefix-non-canonical;
116 "The ip-prefix type represents an IP prefix and is IP
117 version neutral. The format of the textual representations
118 implies the IP version.";
121 typedef ipv4-prefix {
122 type inet:ipv4-prefix;
125 typedef ipv4-prefix-non-canonical {
128 '(([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])\.){3}'
129 + '([0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5])'
130 + '/(([0-9])|([1-2][0-9])|(3[0-2]))';
133 "The ipv4-prefix type represents an IPv4 address prefix.
134 The prefix length is given by the number following the
135 slash character and must be less than or equal to 32.
137 A prefix length value of n corresponds to an IP address
138 mask that has n contiguous 1-bits from the most
139 significant bit (MSB) and all other bits set to 0.";
142 typedef ipv6-prefix {
143 type inet:ipv6-prefix;
146 typedef ipv6-prefix-non-canonical {
148 pattern '((:|[0-9a-fA-F]{0,4}):)([0-9a-fA-F]{0,4}:){0,5}'
149 + '((([0-9a-fA-F]{0,4}:)?(:|[0-9a-fA-F]{0,4}))|'
150 + '(((25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])\.){3}'
151 + '(25[0-5]|2[0-4][0-9]|[01]?[0-9]?[0-9])))'
152 + '(/(([0-9])|([0-9]{2})|(1[0-1][0-9])|(12[0-8])))';
153 pattern '(([^:]+:){6}(([^:]+:[^:]+)|(.*\..*)))|'
154 + '((([^:]+:)*[^:]+)?::(([^:]+:)*[^:]+)?)'
158 "The ipv6-prefix type represents an IPv6 address prefix.
159 The prefix length is given by the number following the
160 slash character and must be less than or equal to 128.
162 A prefix length value of n corresponds to an IP address
163 mask that has n contiguous 1-bits from the most
164 significant bit (MSB) and all other bits set to 0.
166 The IPv6 address should have all bits that do not belong
167 to the prefix set to zero.";
171 typedef domain-name {
172 type inet:domain-name;
184 /* ietf-yang-types */
187 type ietf-yang-types:counter32;
190 typedef zero-based-counter32 {
191 type ietf-yang-types:zero-based-counter32;
195 type ietf-yang-types:counter64;
198 typedef zero-based-counter64 {
199 type ietf-yang-types:zero-based-counter64;
203 type ietf-yang-types:gauge32;
207 type ietf-yang-types:gauge64;
210 typedef object-identifier {
211 type ietf-yang-types:object-identifier;
214 typedef object-identifier-128 {
215 type ietf-yang-types:object-identifier-128;
218 typedef yang-identifier {
219 type ietf-yang-types:yang-identifier;
222 typedef date-and-time {
223 type ietf-yang-types:date-and-time;
227 type ietf-yang-types:timeticks;
231 type ietf-yang-types:timestamp;
234 typedef phys-address {
235 type ietf-yang-types:phys-address;
238 typedef mac-address {
239 type ietf-yang-types:mac-address;
243 type ietf-yang-types:xpath1.0;
247 type ietf-yang-types:hex-string;
251 type ietf-yang-types:uuid;
254 typedef dotted-quad {
255 type ietf-yang-types:dotted-quad;
260 pattern '[0-9]{1,20}:[0-9]{1,20}';
264 typedef base64-binary {
266 pattern '[0-9a-zA-Z+/]{4,}[=]{0,2}';
271 pattern '[0-9A-Fa-f]{2}([0-9A-Fa-f]{2})*';
276 typedef rw-ip-protocol{
278 enum icmp { value 1; }
279 enum tcp { value 6; }
280 enum udp { value 17; }
281 enum gre { value 47; }