Merge "Build on jenkins nodes with label docker"
[osm/SO.git] / rwlaunchpad / plugins / yang / rw-resource-mgr.yang
1
2 /*
3  * 
4  *   Copyright 2016 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   revision 2015-10-16 {
56     description
57       "Initial revision.";
58   }
59
60   grouping resource-pool-info {
61     leaf name {
62       description "Name of the resource pool";
63       rwpb:field-inline "true";
64       rwpb:field-string-max 64;
65       type string;
66       //mandatory true;
67     }
68
69     leaf resource-type {
70       description "Type of resource";
71       type enumeration {
72         enum compute;
73         enum network;
74       }
75     }
76
77     leaf pool-type {
78       description "Type of pool";
79       type enumeration {
80         enum static;
81         enum dynamic;
82       }
83       default "static";
84     }
85
86     leaf max-size {
87       description "Maximum size to which a dynamic resource pool can grow";
88       type uint32;
89     }
90
91   }
92
93   container resource-mgr-config {
94     description "Data model for configuration of resource-mgr";
95     rwpb:msg-new ResourceManagerConfig;
96     config true;
97
98     container management-domain {
99       leaf name {
100         description "The management domain name this launchpad is associated with.";
101         rwpb:field-inline "true";
102         rwpb:field-string-max 64;
103         type string;
104         //mandatory true;
105       }
106     }
107
108     container resource-pools {
109       description "Resource Pool configuration";
110       rwpb:msg-new ResourcePools;
111       list cloud-account {
112         key "name";
113         leaf name {
114           description
115             "Resource pool for the configured cloud account";
116           type leafref {
117             path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
118           }
119         }
120       }
121     }
122   }
123
124   grouping resource-state {
125     leaf resource-state {
126       type enumeration {
127         enum inactive;
128         enum active;
129         enum pending;
130         enum failed;
131       }
132     }
133     leaf resource-errors {
134       description "Error message details in case of failed resource state";
135       type string;
136     }
137   }
138
139   container resource-mgmt {
140     description "Resource management ";
141     config false;
142
143     container vdu-event {
144       description "Events for VDU Management";
145       rwpb:msg-new VDUEvent;
146
147       list vdu-event-data {
148         rwpb:msg-new VDUEventData;
149         key "event-id";
150
151         leaf event-id {
152           description "Identifier associated with the VDU transaction";
153           type yang:uuid;
154         }
155
156         leaf cloud-account {
157           description "The cloud account to use for this resource request";
158           type leafref {
159             path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
160           }
161         }
162
163         container request-info {
164           description "Information about required resource";
165
166           uses rwcal:vdu-create-params;
167         }
168
169         container resource-info {
170           description "Information about allocated resource";
171           leaf pool-name {
172             type string;
173           }
174           uses resource-state;
175           uses rwcal:vdu-info-params;
176         }
177       }
178     }
179
180     container vlink-event {
181       description "Events for Virtual Link management";
182       rwpb:msg-new VirtualLinkEvent;
183
184       list vlink-event-data {
185         rwpb:msg-new VirtualLinkEventData;
186
187         key "event-id";
188
189         leaf event-id {
190           description "Identifier associated with the Virtual Link transaction";
191           type yang:uuid;
192         }
193
194         leaf cloud-account {
195           description "The cloud account to use for this resource request";
196           type leafref {
197             path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
198           }
199         }
200
201         container request-info {
202           description "Information about required resource";
203
204           uses rwcal:virtual-link-create-params;
205         }
206
207         container resource-info {
208           leaf pool-name {
209             type string;
210           }
211           uses resource-state;
212           uses rwcal:virtual-link-info-params;
213         }
214       }
215     }
216   }
217
218
219   container resource-pool-records {
220     description "Resource Pool Records";
221     rwpb:msg-new ResourcePoolRecords;
222     config false;
223
224     list cloud-account {
225       key "name";
226       leaf name {
227         description
228           "The configured cloud account's pool records.";
229         type leafref {
230           path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
231         }
232       }
233
234       list records {
235         rwpb:msg-new ResourceRecordInfo;
236         key "name";
237         uses resource-pool-info;
238
239         leaf pool-status {
240           type enumeration {
241             enum unknown;
242             enum locked;
243             enum unlocked;
244           }
245         }
246
247         leaf total-resources {
248           type uint32;
249         }
250
251         leaf free-resources {
252           type uint32;
253         }
254
255         leaf allocated-resources {
256           type uint32;
257         }
258       }
259     }
260   }
261
262
263   container resource-mgr-data{
264     description "Resource Manager operational data";
265     config false;
266
267     container pool-record {
268       description "Resource Pool record";
269
270       list cloud {
271         key "name";
272         max-elements 16;
273         rwpb:msg-new "ResmgrCloudPoolRecords";
274         leaf name {
275           description
276             "The configured cloud account's pool records.";
277           type leafref {
278             path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
279           }
280         }
281
282         list records {
283           key "name";
284           uses resource-pool-info;
285
286           list free-vdu-list {
287             key vdu-id;
288             uses rwcal:vdu-info-params;
289           }
290
291           list in-use-vdu-list {
292             key vdu-id;
293             uses rwcal:vdu-info-params;
294           }
295
296           list free-vlink-list {
297             key virtual-link-id;
298             uses rwcal:virtual-link-info-params;
299           }
300
301           list in-use-vlink-list {
302               key virtual-link-id;
303             uses rwcal:virtual-link-info-params;
304           }
305         }
306       }
307     }
308   }
309 }