Merge from OSM SO master
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-resource-mgr.yang
1
2 /*
3  * 
4  *   Copyright 2016-2017 RIFT.IO Inc
5  *
6  *   Licensed under the Apache License, Version 2.0 (the "License");
7  *   you may not use this file except in compliance with the License.
8  *   You may obtain a copy of the License at
9  *
10  *       http://www.apache.org/licenses/LICENSE-2.0
11  *
12  *   Unless required by applicable law or agreed to in writing, software
13  *   distributed under the License is distributed on an "AS IS" BASIS,
14  *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  *   See the License for the specific language governing permissions and
16  *   limitations under the License.
17  *
18  */
19
20
21
22 module rw-resource-mgr
23 {
24   namespace "http://riftio.com/ns/riftware-1.0/rw-resource-mgr";
25   prefix "rw-resource-mgr";
26
27   import rw-pb-ext {
28     prefix "rwpb";
29   }
30
31   import rw-cli-ext {
32     prefix "rwcli";
33   }
34
35   import rw-yang-types {
36     prefix "rwt";
37   }
38
39   import rw-cloud {
40     prefix "rwcloud";
41   }
42
43   import rwcal {
44     prefix "rwcal";
45   }
46
47   import ietf-yang-types {
48     prefix "yang";
49   }
50
51   import mano-types {
52     prefix "manotypes";
53   }
54
55   import rw-project {
56     prefix "rw-project";
57   }
58
59   import rw-project-mano {
60     prefix "rw-project-mano";
61   }
62
63   revision 2017-02-08 {
64     description
65       "Update model to support projects.";
66   }
67
68   revision 2015-10-16 {
69     description
70       "Initial revision.";
71   }
72
73   grouping resource-pool-info {
74     leaf name {
75       description "Name of the resource pool";
76       rwpb:field-inline "true";
77       rwpb:field-string-max 64;
78       type string;
79       //mandatory true;
80     }
81
82     leaf resource-type {
83       description "Type of resource";
84       type enumeration {
85         enum compute;
86         enum network;
87       }
88     }
89
90     leaf pool-type {
91       description "Type of pool";
92       type enumeration {
93         enum static;
94         enum dynamic;
95       }
96       default "static";
97     }
98
99     leaf max-size {
100       description "Maximum size to which a dynamic resource pool can grow";
101       type uint32;
102     }
103
104   }
105
106   augment "/rw-project:project" {
107     container resource-mgr-config {
108       description "Data model for configuration of resource-mgr";
109       rwpb:msg-new ResourceManagerConfig;
110       config true;
111
112       container management-domain {
113         leaf name {
114           description "The management domain name this launchpad is associated with.";
115           rwpb:field-inline "true";
116           rwpb:field-string-max 64;
117           type string;
118           //mandatory true;
119         }
120       }
121
122       container resource-pools {
123         description "Resource Pool configuration";
124         rwpb:msg-new ResourcePools;
125         list cloud-account {
126           key "name";
127           leaf name {
128             description
129               "Resource pool for the configured cloud account";
130             type leafref {
131               path "../../../../rwcloud:cloud/rwcloud:account/rwcloud:name";
132             }
133           }
134         }
135       }
136     }
137   }
138
139   grouping resource-state {
140     leaf resource-state {
141       type enumeration {
142         enum inactive;
143         enum active;
144         enum pending;
145         enum failed;
146       }
147     }
148     leaf resource-errors {
149       description "Error message details in case of failed resource state";
150       type string;
151     }
152   }
153
154   augment "/rw-project:project" {
155     container resource-mgmt {
156       description "Resource management ";
157       config false;
158
159       container vdu-event {
160         description "Events for VDU Management";
161         rwpb:msg-new VDUEvent;
162
163         list vdu-event-data {
164           rwpb:msg-new VDUEventData;
165           key "event-id";
166
167           leaf event-id {
168             description "Identifier associated with the VDU transaction";
169             type yang:uuid;
170           }
171
172           leaf cloud-account {
173             description "The cloud account to use for this resource request";
174             type leafref {
175               path "../../../../rwcloud:cloud/rwcloud:account/rwcloud:name";
176             }
177           }
178
179           container request-info {
180             description "Information about required resource";
181
182             uses rwcal:vdu-create-params;
183           }
184
185           container resource-info {
186             description "Information about allocated resource";
187             leaf pool-name {
188               type string;
189             }
190             uses resource-state;
191             uses rwcal:vdu-info-params;
192           }
193         }
194       }
195
196       container vlink-event {
197         description "Events for Virtual Link management";
198         rwpb:msg-new VirtualLinkEvent;
199
200         list vlink-event-data {
201           rwpb:msg-new VirtualLinkEventData;
202
203           key "event-id";
204
205           leaf event-id {
206             description "Identifier associated with the Virtual Link transaction";
207             type yang:uuid;
208           }
209
210           leaf cloud-account {
211             description "The cloud account to use for this resource request";
212             type leafref {
213               path "../../../../rwcloud:cloud/rwcloud:account/rwcloud:name";
214             }
215           }
216
217           container request-info {
218             description "Information about required resource";
219
220             uses rwcal:virtual-link-create-params;
221           }
222
223           container resource-info {
224             leaf pool-name {
225               type string;
226             }
227             uses resource-state;
228             uses rwcal:virtual-link-info-params;
229           }
230         }
231       }
232     }
233   }
234
235
236   augment "/rw-project:project" {
237     container resource-pool-records {
238       description "Resource Pool Records";
239       rwpb:msg-new ResourcePoolRecords;
240       config false;
241
242       list cloud-account {
243         key "name";
244         leaf name {
245           description
246             "The configured cloud account's pool records.";
247           type leafref {
248             path "../../../rwcloud:cloud/rwcloud:account/rwcloud:name";
249           }
250         }
251
252         list records {
253           rwpb:msg-new ResourceRecordInfo;
254           key "name";
255           uses resource-pool-info;
256
257           leaf pool-status {
258             type enumeration {
259               enum unknown;
260               enum locked;
261               enum unlocked;
262             }
263           }
264
265           leaf total-resources {
266             type uint32;
267           }
268
269           leaf free-resources {
270             type uint32;
271           }
272
273           leaf allocated-resources {
274             type uint32;
275           }
276         }
277       }
278     }
279   }
280
281
282   augment "/rw-project:project" {
283     container resource-mgr-data {
284       description "Resource Manager operational data";
285       config false;
286
287       container pool-record {
288         description "Resource Pool record";
289
290         list cloud {
291           key "name";
292           max-elements 16;
293           rwpb:msg-new "ResmgrCloudPoolRecords";
294           leaf name {
295             description
296               "The configured cloud account's pool records.";
297             type leafref {
298               path "../../../../rwcloud:cloud/rwcloud:account/rwcloud:name";
299             }
300           }
301
302           list records {
303             key "name";
304             uses resource-pool-info;
305
306             list free-vdu-list {
307               key vdu-id;
308               uses rwcal:vdu-info-params;
309             }
310
311             list in-use-vdu-list {
312               key vdu-id;
313               uses rwcal:vdu-info-params;
314             }
315
316             list free-vlink-list {
317               key virtual-link-id;
318               uses rwcal:virtual-link-info-params;
319             }
320
321             list in-use-vlink-list {
322               key virtual-link-id;
323               uses rwcal:virtual-link-info-params;
324             }
325           }
326         }
327       }
328     }
329   }
330 }