update from RIFT as of 696b75d2fe9fb046261b08c616f1bcf6c0b54a9b second try
[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-cli-ext {
28     prefix "rwcli";
29   }
30
31   import rw-yang-types {
32     prefix "rwt";
33   }
34
35   import rw-cloud {
36     prefix "rw-cloud";
37   }
38
39   import rwcal {
40     prefix "rwcal";
41   }
42
43   import ietf-yang-types {
44     prefix "yang";
45   }
46
47   import mano-types {
48     prefix "manotypes";
49   }
50
51   import rw-project {
52     prefix "rw-project";
53   }
54
55   import rw-project-mano {
56     prefix "rw-project-mano";
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       type string;
73       //mandatory true;
74     }
75
76     leaf resource-type {
77       description "Type of resource";
78       type enumeration {
79         enum compute;
80         enum network;
81       }
82     }
83
84     leaf pool-type {
85       description "Type of pool";
86       type enumeration {
87         enum static;
88         enum dynamic;
89       }
90       default "static";
91     }
92
93     leaf max-size {
94       description "Maximum size to which a dynamic resource pool can grow";
95       type uint32;
96     }
97
98   }
99
100   augment "/rw-project:project" {
101     container resource-mgr-config {
102       description "Data model for configuration of resource-mgr";
103       config true;
104
105       container management-domain {
106         leaf name {
107           description "The management domain name this launchpad is associated with.";
108           type string;
109           //mandatory true;
110         }
111       }
112
113       container resource-pools {
114         description "Resource Pool configuration";
115         list cloud-account {
116           key "name";
117           leaf name {
118             description
119               "Resource pool for the configured cloud account";
120             type leafref {
121               path "../../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
122             }
123           }
124         }
125       }
126     }
127   }
128
129   grouping resource-state {
130     leaf resource-state {
131       type enumeration {
132         enum inactive;
133         enum active;
134         enum pending;
135         enum failed;
136       }
137     }
138     leaf resource-errors {
139       description "Error message details in case of failed resource state";
140       type string;
141     }
142   }
143
144   augment "/rw-project:project" {
145     container resource-mgmt {
146       description "Resource management ";
147       config false;
148
149       container vdu-event {
150         description "Events for VDU Management";
151         
152         list vdu-event-data {
153           key "event-id";
154
155           leaf event-id {
156             description "Identifier associated with the VDU transaction";
157             type yang:uuid;
158           }
159
160           leaf cloud-account {
161             description "The cloud account to use for this resource request";
162             type leafref {
163               path "../../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
164             }
165           }
166
167           container request-info {
168             description "Information about required resource";
169
170             uses rwcal:vdu-create-params;
171           }
172
173           container resource-info {
174             description "Information about allocated resource";
175             leaf pool-name {
176               type string;
177             }
178             uses resource-state;
179             uses rwcal:vdu-info-params;
180           }
181         }
182       }
183
184       container vlink-event {
185         description "Events for Virtual Link management";
186         
187         list vlink-event-data {
188           
189           key "event-id";
190
191           leaf event-id {
192             description "Identifier associated with the Virtual Link transaction";
193             type yang:uuid;
194           }
195
196           leaf cloud-account {
197             description "The cloud account to use for this resource request";
198             type leafref {
199               path "../../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
200             }
201           }
202
203           container request-info {
204             description "Information about required resource";
205
206             uses rwcal:virtual-link-create-params;
207           }
208
209           container resource-info {
210             leaf pool-name {
211               type string;
212             }
213             uses resource-state;
214             uses rwcal:virtual-link-info-params;
215           }
216         }
217       }
218     }
219   }
220
221
222   augment "/rw-project:project" {
223     container resource-pool-records {
224       description "Resource Pool Records";
225       config false;
226
227       list cloud-account {
228         key "name";
229         leaf name {
230           description
231             "The configured cloud account's pool records.";
232           type leafref {
233             path "../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
234           }
235         }
236
237         list records {
238           key "name";
239           uses resource-pool-info;
240
241           leaf pool-status {
242             type enumeration {
243               enum unknown;
244               enum locked;
245               enum unlocked;
246             }
247           }
248
249           leaf total-resources {
250             type uint32;
251           }
252
253           leaf free-resources {
254             type uint32;
255           }
256
257           leaf allocated-resources {
258             type uint32;
259           }
260         }
261       }
262     }
263   }
264
265
266   augment "/rw-project:project" {
267     container resource-mgr-data {
268       description "Resource Manager operational data";
269       config false;
270
271       container pool-record {
272         description "Resource Pool record";
273
274         list cloud {
275           key "name";
276           max-elements 16;
277           leaf name {
278             description
279               "The configured cloud account's pool records.";
280             type leafref {
281               path "../../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
282             }
283           }
284
285           list records {
286             key "name";
287             uses resource-pool-info;
288
289             list free-vdu-list {
290               key vdu-id;
291               uses rwcal:vdu-info-params;
292             }
293
294             list in-use-vdu-list {
295               key vdu-id;
296               uses rwcal:vdu-info-params;
297             }
298
299             list free-vlink-list {
300               key virtual-link-id;
301               uses rwcal:virtual-link-info-params;
302             }
303
304             list in-use-vlink-list {
305               key virtual-link-id;
306               uses rwcal:virtual-link-info-params;
307             }
308           }
309         }
310       }
311     }
312   }
313
314         augment "/rw-project:project/resource-mgmt/vdu-event/vdu-event-data/request-info/vm-flavor" {
315                 uses manotypes:vm-flavor-name;
316         }
317
318 }