blob: 44a702c1b62d80a7e6601c1103f93b87e1d090a6 [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;
38 identity generic { base kind; }
39 identity subscriber { base kind; }
40
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 }
49
Peter K. Lee2da78632016-09-06 21:02:47 -070050 grouping xos-attribute {
Peter K. Leecb2eb922016-09-01 18:02:31 -070051 leaf name { type string { length 0..128; } }
52 leaf value { type string; }
53 // don't need pointer back to service
54 }
Peter K. Lee2da78632016-09-06 21:02:47 -070055
56 grouping xos-sync-record {
57 description "Synchronizer-specific properties for model records";
58
59 leaf created { type yang:date-and-time; }
60 leaf updated { type yang:date-and-time; }
61 leaf enacted { type yang:date-and-time; }
62 leaf policed { type yang:date-and-time; }
63
64 leaf writable { type boolean; default true; }
65 leaf locked { type boolean; default false; }
66 leaf deleted { type boolean; default false; }
67
68 leaf dirty {
69 config false;
70 type boolean;
71 default false;
72 }
73
74 container sync {
75 anydata register {
76 description "scratchpad used by the Observer";
77 }
78 leaf progress {
79 type enumeration {
80 enum provisioning {
81 value 0;
82 description "Provisioning in progress";
83 }
84 }
85 }
86 leaf disabled { type boolean; default false; }
87 leaf enforced { type boolean; default true; }
88
89 list policy {
90 // TODO: how are policy defined/enforced?
91 }
92 }
93
94 action diff {
95 when "../dirty == true";
96 description "retrieve diff of model state if dirty";
97 }
98 action save {
99 description "trigger save into data store via synchronizer";
100 }
101 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700102
103 grouping xos-base {
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700104 leaf id {
105 type unique-identifier;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700106 mandatory true;
107 }
108 leaf kind {
109 type identityref {
110 base kind;
111 }
112 default generic;
113 }
114 leaf name {
115 type string {
116 length 0..255;
117 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700118 }
Peter K. Lee2da78632016-09-06 21:02:47 -0700119
120 list attribute {
121 uses xos-attribute;
122 key name;
123 status deprecated;
124 reference "XOS: service-specific-attribute";
125 description "backwards-compatible attribute association";
126 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700127 leaf service-specific-id {
128 type unique-identifier;
129 mandatory true;
Peter K. Lee2da78632016-09-06 21:02:47 -0700130 status deprecated;
131 }
132
133 container record {
134 if-feature synchronizer;
135 uses xos-sync-record;
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700136 }
Peter K. Leecb2eb922016-09-01 18:02:31 -0700137 }
138
139 grouping tenant-root {
140 uses xos-base {
141 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 }
154
155 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
162 grouping provider {
163 uses tenant-root {
164 refine kind { default provider; }
165 }
166 // seems we should have interesting attributes specific to provider?
167 }
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700168
Peter K. Leecb2eb922016-09-01 18:02:31 -0700169 grouping service {
170 uses xos-base {
171 refine 'name' {
172 description "Name of the Service";
173 }
174 }
175 leaf description {
176 type string {
177 length 0..254;
178 }
179 description "Description of the Service";
180 }
181 leaf version {
182 type string { length 0..30; }
183 description "Version of Service Definition";
184 }
185
186 leaf enabled { type boolean; default true; }
187 leaf published { type boolean; default true; }
188
Peter K. Lee2da78632016-09-06 21:02:47 -0700189 container links {
Peter K. Leecb2eb922016-09-01 18:02:31 -0700190 leaf view { type inet:uri; }
191 leaf icon { type inet:uri; }
192 }
193
194 list keypair {
195 description "collection of public/private key pair(s)";
Peter K. Lee2da78632016-09-06 21:02:47 -0700196 // should be a specific typedef for storing this content
Peter K. Leecb2eb922016-09-01 18:02:31 -0700197 leaf public { type string { length 0..1024; } }
198 leaf private { type string { length 0..1024; } }
199 }
200
201 // TOOD: need to better understand relationship between Service and Slice
202 action scale {
203 description "Adjust scale for slice(s)";
204 }
205
206 // TODO: need to better understand relationship between Service and VTN
207 }
208
209 grouping tenancy {
210 uses xos-base;
211
212 choice provider {
213 description "only one type of provider node is valid.";
214 case service { leaf provider-service { type instance-identifier; } }
215 }
216
217 choice subscriber {
218 description "only one type of subscriber node is valid.";
219 case service { leaf subscriber-service { type instance-identifier; } }
220 case tenant { leaf subscriber-tenant { type instance-identifier; } }
221 case user { leaf subscriber-user { type instance-identifier; } }
222 case root { leaf subscriber-root { type instance-identifier; } }
223 case network { leaf subscriber-network { type instance-identifier; } }
224 }
225
226 leaf connect-method {
227 //when "../kind == 'static-tenant'";
228
229 type enumeration {
230 enum public { description "Public"; }
231 enum private { description "Private"; }
232 enum private-unidirectional { description "Private Uni-directional"; }
233 enum na { description "Not Applicable"; }
234 }
235 default na;
236 }
237
238 // TODO: should be able to deal with TenantWithContainer here
239
240 }
241
Peter K. Leef4d38d32016-07-23 02:47:38 -0700242 /*** main configuration tree for XOS ***/
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700243
244 container api {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700245 description
246 "The primary configuration interaction endpoint";
247
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700248 container service {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700249 description
250 "placeholder endpoint for services to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700251 }
252 container tenant {
Peter K. Leef4d38d32016-07-23 02:47:38 -0700253 description
254 "placeholder endpoint for tenants to augment";
Peter K. Lee2bade4d2016-07-14 16:19:56 -0700255 }
256 }
257
258}