blob: 1c8de53f8e040a5b90920949186c7397e33fc84e [file] [log] [blame]
Peter K. Lee2bade4d2016-07-14 16:19:56 -07001module xos-core {
Peter K. Lee55395802016-07-15 18:25:40 -07002 namespace "urn:onlab:xos:core";
Peter K. Lee2bade4d2016-07-14 16:19:56 -07003 prefix xos;
4 yang-version 1.1;
5
6 organization
7 "Open Networking Lab (XOS) / Corenova Technologies";
8
9 contact
10 "Larry Peterson <llp@onlab.us>
11 Peter K. Lee <peter@corenova.com>";
12
Peter K. Leef4d38d32016-07-23 02:47:38 -070013 description
14 "This module contains a collection of core models for XOS.
15
16 Copyright (c) 2016 ON.LAB and the persons identified as authors of
17 the code. All rights reserved.
18
19 Redistribution and use in source and binary forms, with or without
20 modification, is permitted pursuant to, and subject to the license
21 terms of the Apache License, Version 2.0 which accompanies this
22 distribution, and is available at
23 (http://www.apache.org/licenses/LICENSE-2.0).";
24
25 revision 2016-07-14 {
26 description "Initial revision.";
27 }
28
Peter K. Lee2bade4d2016-07-14 16:19:56 -070029 import ietf-yang-types { prefix yang; }
Peter K. Lee55395802016-07-15 18:25:40 -070030 import ietf-inet-types { prefix inet; }
sb980529d242b12016-09-13 20:47:26 +020031 import xos-types { prefix xos; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070032
Peter K. Leef4d38d32016-07-23 02:47:38 -070033 feature synchronizer {
34 description
35 "Enables configuration synchronization to the distributed store.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -070036 }
37
38 identity kind;
Peter K. Lee0db45ac2016-09-13 00:30:37 -070039 identity generic { base kind; }
40 identity service { base kind; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070041
42 typedef unique-identifier {
43 description "defines valid formats for external reference id";
44 type union {
Peter K. Lee4302f472016-07-28 03:51:39 -070045 type uint32 { range 1..max; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070046 type yang:uuid;
47 type inet:uri;
Peter K. Lee2bade4d2016-07-14 16:19:56 -070048 }
49 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -070050 typedef bandwidth {
51 type uint32 {
52 range 1000000..max; // should be at least 1 Mbps?
53 }
54 units 'bps';
55 }
56 typedef vlan {
57 type uint16 { range 0..4095; }
58 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070059
Peter K. Lee0db45ac2016-09-13 00:30:37 -070060 grouping attribute-pair {
Peter K. Leecb2eb922016-09-01 18:02:31 -070061 leaf name { type string { length 0..128; } }
62 leaf value { type string; }
63 // don't need pointer back to service
64 }
Peter K. Lee2da78632016-09-06 21:02:47 -070065
Peter K. Lee0db45ac2016-09-13 00:30:37 -070066 grouping sync-record {
Peter K. Lee2da78632016-09-06 21:02:47 -070067 description "Synchronizer-specific properties for model records";
68
69 leaf created { type yang:date-and-time; }
70 leaf updated { type yang:date-and-time; }
71 leaf enacted { type yang:date-and-time; }
72 leaf policed { type yang:date-and-time; }
73
74 leaf writable { type boolean; default true; }
75 leaf locked { type boolean; default false; }
76 leaf deleted { type boolean; default false; }
77
78 leaf dirty {
79 config false;
80 type boolean;
81 default false;
82 }
83
84 container sync {
85 anydata register {
86 description "scratchpad used by the Observer";
87 }
88 leaf progress {
89 type enumeration {
90 enum provisioning {
91 value 0;
92 description "Provisioning in progress";
93 }
94 }
95 }
96 leaf disabled { type boolean; default false; }
97 leaf enforced { type boolean; default true; }
98
99 list policy {
100 // TODO: how are policy defined/enforced?
101 }
102 }
103
104 action diff {
105 when "../dirty == true";
106 description "retrieve diff of model state if dirty";
107 }
108 action save {
109 description "trigger save into data store via synchronizer";
110 }
111 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700112
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700113 grouping base-common {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700114 leaf id {
115 type unique-identifier;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700116 mandatory true;
117 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700118 leaf name {
119 type string {
120 length 0..255;
121 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700122 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700123 list attribute {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700124 uses attribute-pair;
Peter K. Lee2da78632016-09-06 21:02:47 -0700125 key name;
126 status deprecated;
127 reference "XOS: service-specific-attribute";
128 description "backwards-compatible attribute association";
129 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700130 leaf service-specific-id {
131 type unique-identifier;
132 mandatory true;
Peter K. Lee2da78632016-09-06 21:02:47 -0700133 status deprecated;
134 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700135 container record {
136 if-feature synchronizer;
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700137 uses sync-record;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700138 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700139 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700140 grouping tenant-root {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700141 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700142 refine 'name' {
143 description "Specify name of the TenantRoot";
144 }
145 }
146 description
147 "A Tenant Root is one of the things that can sit at the root of a chain
148 of tenancy. This object represents a node.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700149
Peter K. Leeaf777da2016-08-17 04:33:00 -0700150 list subscribed-tenant {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700151 config false;
152 // not exactly clear how this is populated
153 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700154 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700155 grouping subscriber {
156 uses tenant-root {
157 refine kind { default subscriber; }
158 }
159 // seems we should have interesting attributes specific to subscriber?
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700160 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700161 grouping provider {
162 uses tenant-root {
163 refine kind { default provider; }
164 }
165 // seems we should have interesting attributes specific to provider?
166 }
Peter K. Leec3960502016-09-13 11:47:02 -0700167 grouping slice {
168 // TBD
169 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700170 grouping service {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700171 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700172 refine 'name' {
173 description "Name of the Service";
174 }
175 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700176 leaf kind {
177 type identityref {
178 base kind;
179 }
180 default generic;
181 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700182 leaf description {
183 type string {
184 length 0..254;
185 }
186 description "Description of the Service";
187 }
188 leaf version {
189 type string { length 0..30; }
190 description "Version of Service Definition";
191 }
192
193 leaf enabled { type boolean; default true; }
194 leaf published { type boolean; default true; }
195
Peter K. Lee2da78632016-09-06 21:02:47 -0700196 container links {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700197 leaf view { type inet:uri; }
198 leaf icon { type inet:uri; }
199 }
200
201 list keypair {
202 description "collection of public/private key pair(s)";
Peter K. Lee2da78632016-09-06 21:02:47 -0700203 // should be a specific typedef for storing this content
Peter K. Leecb2eb922016-09-01 18:02:31 -0700204 leaf public { type string { length 0..1024; } }
205 leaf private { type string { length 0..1024; } }
206 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700207 list provider {
208 description
209 "Each entry represents a provider of the service. Each unique service
210 should augment this block with service specific attributes.";
211 key id;
212 uses xos:provider;
213 }
214 list subscriber {
215 description
216 "Each entry represents a subscriber of the service. Each unique service
217 should augment this block with service specific attributes.";
218 key id;
219 uses xos:subscriber;
220 notification subscriber-added;
221 notification subscriber-deleted;
222 }
Peter K. Leec3960502016-09-13 11:47:02 -0700223 list slice {
224 uses xos:slice;
225 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700226
227 // TOOD: need to better understand relationship between Service and Slice
228 action scale {
229 description "Adjust scale for slice(s)";
230 }
231
232 // TODO: need to better understand relationship between Service and VTN
233 }
234
235 grouping tenancy {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700236 uses base-common;
Peter K. Leecb2eb922016-09-01 18:02:31 -0700237
238 choice provider {
239 description "only one type of provider node is valid.";
240 case service { leaf provider-service { type instance-identifier; } }
241 }
242
243 choice subscriber {
244 description "only one type of subscriber node is valid.";
245 case service { leaf subscriber-service { type instance-identifier; } }
246 case tenant { leaf subscriber-tenant { type instance-identifier; } }
247 case user { leaf subscriber-user { type instance-identifier; } }
248 case root { leaf subscriber-root { type instance-identifier; } }
249 case network { leaf subscriber-network { type instance-identifier; } }
250 }
251
252 leaf connect-method {
253 //when "../kind == 'static-tenant'";
254
255 type enumeration {
256 enum public { description "Public"; }
257 enum private { description "Private"; }
258 enum private-unidirectional { description "Private Uni-directional"; }
259 enum na { description "Not Applicable"; }
260 }
261 default na;
262 }
263
264 // TODO: should be able to deal with TenantWithContainer here
265
266 }
sb980529d242b12016-09-13 20:47:26 +0200267
268 grouping slice {
269 description
270 "A slice is a logically centralized container for network and compute resources"
271
272 uses base-common;
273
274 leaf enabled {
275 type boolean;
276 default true;
277 }
278
279 leaf omf-friendly {
280 type boolean;
281 default false;
282 status deprecated;
283 }
284
285 leaf slice-url {
286 description "A URL describing the purpose of this slice";
287 type xos.refs.url-field;
288 // blank true;
289 }
290
291 leaf max-instances {
292 description "The maximum number of VMs that this slice is allowed to allocate";
293 type uint32;
294 }
295
296 leaf service {
297 description "The service that runs in this slice";
298 type xos.refs.service;
299 }
300
301 leaf network {
302 description "The network that the slice uses to connect to other slices and to the Internet.";
303 type string;
304 }
305
306 leaf exposed-ports {
307 description "The ports to be exposed for other slices to connect to";
308 type string;
309 }
310
311 leaf service-class {
312 type xos.refs.service-class;
313 status deprecated;
314 }
315
316 leaf creator {
317 type xos.refs.user;
318 }
319
320 leaf default-flavor {
321 type xos.refs.flavor;
322 }
323
324 leaf default-image {
325 type xos.refs.image;
326 }
327
328 leaf default-node {
329 type xos.refs.node;
330 }
331
332 leaf mount-data-sets {
333 type string;
334 default "GenBank";
335 length 0..256;
336 }
337
338 leaf default_isolation {
339 type string;
340 default "vm";
341 length 0..30;
342 }
343
344 leaf-list tags {
345 type leafref {
346 path "/tag[id = current()/../id]/id";
347 }
348 }
349 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700350
Peter K. Leef4d38d32016-07-23 02:47:38 -0700351 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700352
353 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700354 description
355 "The primary configuration interaction endpoint";
356
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700357 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700358 description
359 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700360 }
361 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700362 description
363 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700364 }
365 }
366
367}