blob: 1137c28528b9ec3714183f37c10b32ab845bcbbc [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 }
139
140 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 }
155
156 grouping subscriber {
157 uses tenant-root {
158 refine kind { default subscriber; }
159 }
160 // seems we should have interesting attributes specific to subscriber?
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700161 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700162
163 grouping provider {
164 uses tenant-root {
165 refine kind { default provider; }
166 }
167 // seems we should have interesting attributes specific to provider?
168 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700169
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. Leecb2eb922016-09-01 18:02:31 -0700223
224 // TOOD: need to better understand relationship between Service and Slice
225 action scale {
226 description "Adjust scale for slice(s)";
227 }
228
229 // TODO: need to better understand relationship between Service and VTN
230 }
231
232 grouping tenancy {
Peter K. Lee0db45ac2016-09-13 00:30:37 -0700233 uses base-common;
Peter K. Leecb2eb922016-09-01 18:02:31 -0700234
235 choice provider {
236 description "only one type of provider node is valid.";
237 case service { leaf provider-service { type instance-identifier; } }
238 }
239
240 choice subscriber {
241 description "only one type of subscriber node is valid.";
242 case service { leaf subscriber-service { type instance-identifier; } }
243 case tenant { leaf subscriber-tenant { type instance-identifier; } }
244 case user { leaf subscriber-user { type instance-identifier; } }
245 case root { leaf subscriber-root { type instance-identifier; } }
246 case network { leaf subscriber-network { type instance-identifier; } }
247 }
248
249 leaf connect-method {
250 //when "../kind == 'static-tenant'";
251
252 type enumeration {
253 enum public { description "Public"; }
254 enum private { description "Private"; }
255 enum private-unidirectional { description "Private Uni-directional"; }
256 enum na { description "Not Applicable"; }
257 }
258 default na;
259 }
260
261 // TODO: should be able to deal with TenantWithContainer here
262
263 }
264
Peter K. Leef4d38d32016-07-23 02:47:38 -0700265 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700266
267 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700268 description
269 "The primary configuration interaction endpoint";
270
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700271 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700272 description
273 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700274 }
275 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700276 description
277 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700278 }
279 }
280
281}