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