blob: 6adc80ef9cf7d7816b50d8fd4a862920036e3271 [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 }
140
141 grouping tenant-root {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700142 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700143 refine 'name' {
144 description "Specify name of the TenantRoot";
145 }
146 }
147 description
148 "A Tenant Root is one of the things that can sit at the root of a chain
149 of tenancy. This object represents a node.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700150
Peter K. Leeaf777da2016-08-17 04:33:00 -0700151 list subscribed-tenant {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700152 config false;
153 // not exactly clear how this is populated
154 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700155 }
156
157 grouping subscriber {
158 uses tenant-root {
159 refine kind { default subscriber; }
160 }
161 // seems we should have interesting attributes specific to subscriber?
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700162 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700163
164 grouping provider {
165 uses tenant-root {
166 refine kind { default provider; }
167 }
168 // seems we should have interesting attributes specific to provider?
169 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700170
Peter K. Leecb2eb922016-09-01 18:02:31 -0700171 grouping service {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700172 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700173 refine 'name' {
174 description "Name of the Service";
175 }
176 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700177 leaf kind {
178 type identityref {
179 base kind;
180 }
181 default generic;
182 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700183 leaf description {
184 type string {
185 length 0..254;
186 }
187 description "Description of the Service";
188 }
189 leaf version {
190 type string { length 0..30; }
191 description "Version of Service Definition";
192 }
193
194 leaf enabled { type boolean; default true; }
195 leaf published { type boolean; default true; }
196
Peter K. Lee2da78632016-09-06 21:02:47 -0700197 container links {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700198 leaf view { type inet:uri; }
199 leaf icon { type inet:uri; }
200 }
201
202 list keypair {
203 description "collection of public/private key pair(s)";
Peter K. Lee2da78632016-09-06 21:02:47 -0700204 // should be a specific typedef for storing this content
Peter K. Leecb2eb922016-09-01 18:02:31 -0700205 leaf public { type string { length 0..1024; } }
206 leaf private { type string { length 0..1024; } }
207 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700208 list provider {
209 description
210 "Each entry represents a provider of the service. Each unique service
211 should augment this block with service specific attributes.";
212 key id;
213 uses xos:provider;
214 }
215 list subscriber {
216 description
217 "Each entry represents a subscriber of the service. Each unique service
218 should augment this block with service specific attributes.";
219 key id;
220 uses xos:subscriber;
221 notification subscriber-added;
222 notification subscriber-deleted;
223 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700224
225 // TOOD: need to better understand relationship between Service and Slice
226 action scale {
227 description "Adjust scale for slice(s)";
228 }
229
230 // TODO: need to better understand relationship between Service and VTN
231 }
232
233 grouping tenancy {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700234 uses base-common;
Peter K. Leecb2eb922016-09-01 18:02:31 -0700235
236 choice provider {
237 description "only one type of provider node is valid.";
238 case service { leaf provider-service { type instance-identifier; } }
239 }
240
241 choice subscriber {
242 description "only one type of subscriber node is valid.";
243 case service { leaf subscriber-service { type instance-identifier; } }
244 case tenant { leaf subscriber-tenant { type instance-identifier; } }
245 case user { leaf subscriber-user { type instance-identifier; } }
246 case root { leaf subscriber-root { type instance-identifier; } }
247 case network { leaf subscriber-network { type instance-identifier; } }
248 }
249
250 leaf connect-method {
251 //when "../kind == 'static-tenant'";
252
253 type enumeration {
254 enum public { description "Public"; }
255 enum private { description "Private"; }
256 enum private-unidirectional { description "Private Uni-directional"; }
257 enum na { description "Not Applicable"; }
258 }
259 default na;
260 }
261
262 // TODO: should be able to deal with TenantWithContainer here
263
264 }
sb980529d242b12016-09-13 20:47:26 +0200265
266 grouping slice {
267 description
268 "A slice is a logically centralized container for network and compute resources"
269
270 uses base-common;
271
272 leaf enabled {
273 type boolean;
274 default true;
275 }
276
277 leaf omf-friendly {
278 type boolean;
279 default false;
280 status deprecated;
281 }
282
283 leaf slice-url {
284 description "A URL describing the purpose of this slice";
285 type xos.refs.url-field;
286 // blank true;
287 }
288
289 leaf max-instances {
290 description "The maximum number of VMs that this slice is allowed to allocate";
291 type uint32;
292 }
293
294 leaf service {
295 description "The service that runs in this slice";
296 type xos.refs.service;
297 }
298
299 leaf network {
300 description "The network that the slice uses to connect to other slices and to the Internet.";
301 type string;
302 }
303
304 leaf exposed-ports {
305 description "The ports to be exposed for other slices to connect to";
306 type string;
307 }
308
309 leaf service-class {
310 type xos.refs.service-class;
311 status deprecated;
312 }
313
314 leaf creator {
315 type xos.refs.user;
316 }
317
318 leaf default-flavor {
319 type xos.refs.flavor;
320 }
321
322 leaf default-image {
323 type xos.refs.image;
324 }
325
326 leaf default-node {
327 type xos.refs.node;
328 }
329
330 leaf mount-data-sets {
331 type string;
332 default "GenBank";
333 length 0..256;
334 }
335
336 leaf default_isolation {
337 type string;
338 default "vm";
339 length 0..30;
340 }
341
342 leaf-list tags {
343 type leafref {
344 path "/tag[id = current()/../id]/id";
345 }
346 }
347 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700348
Peter K. Leef4d38d32016-07-23 02:47:38 -0700349 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700350
351 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700352 description
353 "The primary configuration interaction endpoint";
354
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700355 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700356 description
357 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700358 }
359 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700360 description
361 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700362 }
363 }
364
365}