blob: 2bce2cf53aa08bebccea3e38ba3ec62f5db803ac [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
Peter K. Lee4d936892016-09-13 11:59:21 -07006 import ietf-yang-types { prefix yang; }
7 import ietf-inet-types { prefix inet; }
8 import xos-types { prefix xtype; }
9
Peter K. Lee2bade4d2016-07-14 16:19:56 -070010 organization
11 "Open Networking Lab (XOS) / Corenova Technologies";
12
13 contact
14 "Larry Peterson <llp@onlab.us>
15 Peter K. Lee <peter@corenova.com>";
16
Peter K. Leef4d38d32016-07-23 02:47:38 -070017 description
18 "This module contains a collection of core models for XOS.
19
20 Copyright (c) 2016 ON.LAB and the persons identified as authors of
21 the code. All rights reserved.
22
23 Redistribution and use in source and binary forms, with or without
24 modification, is permitted pursuant to, and subject to the license
25 terms of the Apache License, Version 2.0 which accompanies this
26 distribution, and is available at
27 (http://www.apache.org/licenses/LICENSE-2.0).";
28
29 revision 2016-07-14 {
30 description "Initial revision.";
31 }
32
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
Peter K. Lee0db45ac2016-09-13 00:30:37 -070042 grouping attribute-pair {
Peter K. Leecb2eb922016-09-01 18:02:31 -070043 leaf name { type string { length 0..128; } }
44 leaf value { type string; }
45 // don't need pointer back to service
46 }
Peter K. Lee2da78632016-09-06 21:02:47 -070047
Peter K. Lee0db45ac2016-09-13 00:30:37 -070048 grouping sync-record {
Peter K. Lee2da78632016-09-06 21:02:47 -070049 description "Synchronizer-specific properties for model records";
50
51 leaf created { type yang:date-and-time; }
52 leaf updated { type yang:date-and-time; }
53 leaf enacted { type yang:date-and-time; }
54 leaf policed { type yang:date-and-time; }
55
56 leaf writable { type boolean; default true; }
57 leaf locked { type boolean; default false; }
58 leaf deleted { type boolean; default false; }
59
60 leaf dirty {
61 config false;
62 type boolean;
63 default false;
64 }
65
66 container sync {
67 anydata register {
68 description "scratchpad used by the Observer";
69 }
70 leaf progress {
71 type enumeration {
72 enum provisioning {
73 value 0;
74 description "Provisioning in progress";
75 }
76 }
77 }
78 leaf disabled { type boolean; default false; }
79 leaf enforced { type boolean; default true; }
80
81 list policy {
82 // TODO: how are policy defined/enforced?
83 }
84 }
85
86 action diff {
87 when "../dirty == true";
88 description "retrieve diff of model state if dirty";
89 }
90 action save {
91 description "trigger save into data store via synchronizer";
92 }
93 }
Peter K. Leecb2eb922016-09-01 18:02:31 -070094
Peter K. Lee0db45ac2016-09-13 00:30:37 -070095 grouping base-common {
Peter K. Lee2bade4d2016-07-14 16:19:56 -070096 leaf id {
Peter K. Lee4d936892016-09-13 11:59:21 -070097 type xtype:unique-identifier;
Peter K. Lee2bade4d2016-07-14 16:19:56 -070098 mandatory true;
99 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700100 leaf name {
101 type string {
102 length 0..255;
103 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700104 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700105 list attribute {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700106 uses attribute-pair;
Peter K. Lee2da78632016-09-06 21:02:47 -0700107 key name;
108 status deprecated;
109 reference "XOS: service-specific-attribute";
110 description "backwards-compatible attribute association";
111 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700112 leaf service-specific-id {
Peter K. Lee4d936892016-09-13 11:59:21 -0700113 type xtype:unique-identifier;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700114 mandatory true;
Peter K. Lee2da78632016-09-06 21:02:47 -0700115 status deprecated;
116 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700117 container record {
118 if-feature synchronizer;
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700119 uses sync-record;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700120 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700121 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700122 grouping tenant-root {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700123 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700124 refine 'name' {
125 description "Specify name of the TenantRoot";
126 }
127 }
128 description
129 "A Tenant Root is one of the things that can sit at the root of a chain
130 of tenancy. This object represents a node.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700131
Peter K. Leeaf777da2016-08-17 04:33:00 -0700132 list subscribed-tenant {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700133 config false;
134 // not exactly clear how this is populated
135 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700136 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700137 grouping subscriber {
138 uses tenant-root {
139 refine kind { default subscriber; }
140 }
141 // seems we should have interesting attributes specific to subscriber?
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700142 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700143 grouping provider {
144 uses tenant-root {
145 refine kind { default provider; }
146 }
147 // seems we should have interesting attributes specific to provider?
148 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700149 grouping service {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700150 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700151 refine 'name' {
152 description "Name of the Service";
153 }
154 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700155 leaf kind {
156 type identityref {
157 base kind;
158 }
159 default generic;
160 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700161 leaf description {
162 type string {
163 length 0..254;
164 }
165 description "Description of the Service";
166 }
167 leaf version {
168 type string { length 0..30; }
169 description "Version of Service Definition";
170 }
171
172 leaf enabled { type boolean; default true; }
173 leaf published { type boolean; default true; }
174
Peter K. Lee2da78632016-09-06 21:02:47 -0700175 container links {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700176 leaf view { type inet:uri; }
177 leaf icon { type inet:uri; }
178 }
179
180 list keypair {
181 description "collection of public/private key pair(s)";
Peter K. Lee2da78632016-09-06 21:02:47 -0700182 // should be a specific typedef for storing this content
Peter K. Leecb2eb922016-09-01 18:02:31 -0700183 leaf public { type string { length 0..1024; } }
184 leaf private { type string { length 0..1024; } }
185 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700186 list provider {
187 description
188 "Each entry represents a provider of the service. Each unique service
189 should augment this block with service specific attributes.";
190 key id;
191 uses xos:provider;
192 }
193 list subscriber {
194 description
195 "Each entry represents a subscriber of the service. Each unique service
196 should augment this block with service specific attributes.";
197 key id;
198 uses xos:subscriber;
199 notification subscriber-added;
200 notification subscriber-deleted;
201 }
Peter K. Leec3960502016-09-13 11:47:02 -0700202 list slice {
203 uses xos:slice;
204 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700205
206 // TOOD: need to better understand relationship between Service and Slice
207 action scale {
208 description "Adjust scale for slice(s)";
209 }
210
211 // TODO: need to better understand relationship between Service and VTN
212 }
213
214 grouping tenancy {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700215 uses base-common;
Peter K. Leecb2eb922016-09-01 18:02:31 -0700216
217 choice provider {
218 description "only one type of provider node is valid.";
219 case service { leaf provider-service { type instance-identifier; } }
220 }
221
222 choice subscriber {
223 description "only one type of subscriber node is valid.";
224 case service { leaf subscriber-service { type instance-identifier; } }
225 case tenant { leaf subscriber-tenant { type instance-identifier; } }
226 case user { leaf subscriber-user { type instance-identifier; } }
227 case root { leaf subscriber-root { type instance-identifier; } }
228 case network { leaf subscriber-network { type instance-identifier; } }
229 }
230
231 leaf connect-method {
232 //when "../kind == 'static-tenant'";
233
234 type enumeration {
235 enum public { description "Public"; }
236 enum private { description "Private"; }
237 enum private-unidirectional { description "Private Uni-directional"; }
238 enum na { description "Not Applicable"; }
239 }
240 default na;
241 }
242
243 // TODO: should be able to deal with TenantWithContainer here
244
245 }
sb980529d242b12016-09-13 20:47:26 +0200246
247 grouping slice {
248 description
249 "A slice is a logically centralized container for network and compute resources"
250
251 uses base-common;
252
253 leaf enabled {
254 type boolean;
255 default true;
256 }
257
258 leaf omf-friendly {
259 type boolean;
260 default false;
261 status deprecated;
262 }
263
264 leaf slice-url {
265 description "A URL describing the purpose of this slice";
Peter K. Lee4d936892016-09-13 11:59:21 -0700266 type xtype:url-field;
sb980529d242b12016-09-13 20:47:26 +0200267 // blank true;
268 }
269
270 leaf max-instances {
271 description "The maximum number of VMs that this slice is allowed to allocate";
272 type uint32;
273 }
274
275 leaf service {
276 description "The service that runs in this slice";
Peter K. Lee4d936892016-09-13 11:59:21 -0700277 type xtype:service;
sb980529d242b12016-09-13 20:47:26 +0200278 }
279
280 leaf network {
281 description "The network that the slice uses to connect to other slices and to the Internet.";
282 type string;
283 }
284
285 leaf exposed-ports {
286 description "The ports to be exposed for other slices to connect to";
287 type string;
288 }
289
290 leaf service-class {
Peter K. Lee4d936892016-09-13 11:59:21 -0700291 type xtype:service-class;
292 status deprecated;
sb980529d242b12016-09-13 20:47:26 +0200293 }
294
295 leaf creator {
Peter K. Lee4d936892016-09-13 11:59:21 -0700296 type xtype:user;
sb980529d242b12016-09-13 20:47:26 +0200297 }
298
299 leaf default-flavor {
Peter K. Lee4d936892016-09-13 11:59:21 -0700300 type xtype:flavor;
sb980529d242b12016-09-13 20:47:26 +0200301 }
302
303 leaf default-image {
Peter K. Lee4d936892016-09-13 11:59:21 -0700304 type xtype:image;
sb980529d242b12016-09-13 20:47:26 +0200305 }
306
307 leaf default-node {
Peter K. Lee4d936892016-09-13 11:59:21 -0700308 type xtype:node;
sb980529d242b12016-09-13 20:47:26 +0200309 }
310
311 leaf mount-data-sets {
Peter K. Lee4d936892016-09-13 11:59:21 -0700312 type string {
313 length 0..256;
314 }
315 default "GenBank";
sb980529d242b12016-09-13 20:47:26 +0200316 }
317
318 leaf default_isolation {
Peter K. Lee4d936892016-09-13 11:59:21 -0700319 type string {
320 length 0..30;
321 }
322 default "vm";
sb980529d242b12016-09-13 20:47:26 +0200323 }
324
325 leaf-list tags {
Peter K. Lee4d936892016-09-13 11:59:21 -0700326 // below leafref is not valid since there is no /tag
327 type leafref {
328 path "/tag[id = current()/../id]/id";
329 }
sb980529d242b12016-09-13 20:47:26 +0200330 }
331 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700332
Peter K. Leef4d38d32016-07-23 02:47:38 -0700333 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700334
335 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700336 description
337 "The primary configuration interaction endpoint";
338
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700339 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700340 description
341 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700342 }
343 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700344 description
345 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700346 }
347 }
348
349}