blob: b7d24629f97b1faaf2bf973ca34c39b644bcd674 [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; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070031
Peter K. Leef4d38d32016-07-23 02:47:38 -070032 feature synchronizer {
33 description
34 "Enables configuration synchronization to the distributed store.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -070035 }
36
37 identity kind;
Peter K. Lee0db45ac2016-09-13 00:30:37 -070038 identity generic { base kind; }
39 identity service { base kind; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070040
41 typedef unique-identifier {
42 description "defines valid formats for external reference id";
43 type union {
Peter K. Lee4302f472016-07-28 03:51:39 -070044 type uint32 { range 1..max; }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070045 type yang:uuid;
46 type inet:uri;
Peter K. Lee2bade4d2016-07-14 16:19:56 -070047 }
48 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -070049 typedef bandwidth {
50 type uint32 {
51 range 1000000..max; // should be at least 1 Mbps?
52 }
53 units 'bps';
54 }
55 typedef vlan {
56 type uint16 { range 0..4095; }
57 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -070058
Peter K. Lee0db45ac2016-09-13 00:30:37 -070059 grouping attribute-pair {
Peter K. Leecb2eb922016-09-01 18:02:31 -070060 leaf name { type string { length 0..128; } }
61 leaf value { type string; }
62 // don't need pointer back to service
63 }
Peter K. Lee2da78632016-09-06 21:02:47 -070064
Peter K. Lee0db45ac2016-09-13 00:30:37 -070065 grouping sync-record {
Peter K. Lee2da78632016-09-06 21:02:47 -070066 description "Synchronizer-specific properties for model records";
67
68 leaf created { type yang:date-and-time; }
69 leaf updated { type yang:date-and-time; }
70 leaf enacted { type yang:date-and-time; }
71 leaf policed { type yang:date-and-time; }
72
73 leaf writable { type boolean; default true; }
74 leaf locked { type boolean; default false; }
75 leaf deleted { type boolean; default false; }
76
77 leaf dirty {
78 config false;
79 type boolean;
80 default false;
81 }
82
83 container sync {
84 anydata register {
85 description "scratchpad used by the Observer";
86 }
87 leaf progress {
88 type enumeration {
89 enum provisioning {
90 value 0;
91 description "Provisioning in progress";
92 }
93 }
94 }
95 leaf disabled { type boolean; default false; }
96 leaf enforced { type boolean; default true; }
97
98 list policy {
99 // TODO: how are policy defined/enforced?
100 }
101 }
102
103 action diff {
104 when "../dirty == true";
105 description "retrieve diff of model state if dirty";
106 }
107 action save {
108 description "trigger save into data store via synchronizer";
109 }
110 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700111
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700112 grouping base-common {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700113 leaf id {
114 type unique-identifier;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700115 mandatory true;
116 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700117 leaf name {
118 type string {
119 length 0..255;
120 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700121 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700122 list attribute {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700123 uses attribute-pair;
Peter K. Lee2da78632016-09-06 21:02:47 -0700124 key name;
125 status deprecated;
126 reference "XOS: service-specific-attribute";
127 description "backwards-compatible attribute association";
128 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700129 leaf service-specific-id {
130 type unique-identifier;
131 mandatory true;
Peter K. Lee2da78632016-09-06 21:02:47 -0700132 status deprecated;
133 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700134 container record {
135 if-feature synchronizer;
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700136 uses sync-record;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700137 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700138 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700139 grouping tenant-root {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700140 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700141 refine 'name' {
142 description "Specify name of the TenantRoot";
143 }
144 }
145 description
146 "A Tenant Root is one of the things that can sit at the root of a chain
147 of tenancy. This object represents a node.";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700148
Peter K. Leeaf777da2016-08-17 04:33:00 -0700149 list subscribed-tenant {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700150 config false;
151 // not exactly clear how this is populated
152 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700153 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700154 grouping subscriber {
155 uses tenant-root {
156 refine kind { default subscriber; }
157 }
158 // seems we should have interesting attributes specific to subscriber?
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700159 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700160 grouping provider {
161 uses tenant-root {
162 refine kind { default provider; }
163 }
164 // seems we should have interesting attributes specific to provider?
165 }
Peter K. Leec3960502016-09-13 11:47:02 -0700166 grouping slice {
167 // TBD
168 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700169 grouping service {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700170 uses base-common {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700171 refine 'name' {
172 description "Name of the Service";
173 }
174 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700175 leaf kind {
176 type identityref {
177 base kind;
178 }
179 default generic;
180 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700181 leaf description {
182 type string {
183 length 0..254;
184 }
185 description "Description of the Service";
186 }
187 leaf version {
188 type string { length 0..30; }
189 description "Version of Service Definition";
190 }
191
192 leaf enabled { type boolean; default true; }
193 leaf published { type boolean; default true; }
194
Peter K. Lee2da78632016-09-06 21:02:47 -0700195 container links {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700196 leaf view { type inet:uri; }
197 leaf icon { type inet:uri; }
198 }
199
200 list keypair {
201 description "collection of public/private key pair(s)";
Peter K. Lee2da78632016-09-06 21:02:47 -0700202 // should be a specific typedef for storing this content
Peter K. Leecb2eb922016-09-01 18:02:31 -0700203 leaf public { type string { length 0..1024; } }
204 leaf private { type string { length 0..1024; } }
205 }
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700206 list provider {
207 description
208 "Each entry represents a provider of the service. Each unique service
209 should augment this block with service specific attributes.";
210 key id;
211 uses xos:provider;
212 }
213 list subscriber {
214 description
215 "Each entry represents a subscriber of the service. Each unique service
216 should augment this block with service specific attributes.";
217 key id;
218 uses xos:subscriber;
219 notification subscriber-added;
220 notification subscriber-deleted;
221 }
Peter K. Leec3960502016-09-13 11:47:02 -0700222 list slice {
223 uses xos:slice;
224 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700225
226 // TOOD: need to better understand relationship between Service and Slice
227 action scale {
228 description "Adjust scale for slice(s)";
229 }
230
231 // TODO: need to better understand relationship between Service and VTN
232 }
233
234 grouping tenancy {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700235 uses base-common;
Peter K. Leecb2eb922016-09-01 18:02:31 -0700236
237 choice provider {
238 description "only one type of provider node is valid.";
239 case service { leaf provider-service { type instance-identifier; } }
240 }
241
242 choice subscriber {
243 description "only one type of subscriber node is valid.";
244 case service { leaf subscriber-service { type instance-identifier; } }
245 case tenant { leaf subscriber-tenant { type instance-identifier; } }
246 case user { leaf subscriber-user { type instance-identifier; } }
247 case root { leaf subscriber-root { type instance-identifier; } }
248 case network { leaf subscriber-network { type instance-identifier; } }
249 }
250
251 leaf connect-method {
252 //when "../kind == 'static-tenant'";
253
254 type enumeration {
255 enum public { description "Public"; }
256 enum private { description "Private"; }
257 enum private-unidirectional { description "Private Uni-directional"; }
258 enum na { description "Not Applicable"; }
259 }
260 default na;
261 }
262
263 // TODO: should be able to deal with TenantWithContainer here
264
265 }
266
Peter K. Leef4d38d32016-07-23 02:47:38 -0700267 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700268
269 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700270 description
271 "The primary configuration interaction endpoint";
272
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700273 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700274 description
275 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700276 }
277 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700278 description
279 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700280 }
281 }
282
283}