Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / composer / src / schemas / yang / rwvcs-types.yang.src
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 module rwvcs-types
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/rwvcs-types";
24   prefix "rwvcstypes";
25
26   import rw-pb-ext {
27     prefix "rwpb";
28   }
29
30   import rw-yang-types {
31     prefix "rwt";
32   }
33
34   import ietf-inet-types {
35     prefix "inet";
36     revision-date 2013-07-15;
37   }
38
39   revision 2014-03-12 {
40     description
41       "Initial implementation of RW.Manifest.";
42     reference
43       "RW.VX Software Component Document";
44   }
45
46   typedef component_type {
47     type enumeration {
48       enum RWCOLLECTION;
49       enum RWVM;
50       enum RWPROC;
51       enum PROC;
52       enum RWTASKLET;
53     }
54   }
55
56   typedef recovery-type {
57     type enumeration {
58       enum NONE;
59       enum RESTART;
60       enum FAILCRITICAL;
61       enum IGNORE;
62       enum CUSTOM;
63     }
64   }
65
66   grouping rwvcs-variable-list {
67     leaf-list python-variable {
68       description
69           "List of Python variable assignments";
70       type string;
71     }
72   }
73
74   grouping valgrind {
75     container valgrind {
76       leaf enable {
77         description
78             "Run the component under valgrind";
79         type boolean;
80       }
81
82       leaf-list opts {
83         description
84             "Command line options to pass to valgrind";
85         type string;
86       }
87     }
88   }
89
90   grouping action-list {
91     list action {
92       description
93           "This section contains a sequence
94            of RW.VCS actions";
95       key "name";
96       //rwpb:msg-new VcsAction;
97
98       leaf name {
99         description
100             "Name of the action within the sequence";
101         type string;
102       }
103
104       grouping rwvcs-python-loop {
105         leaf python-loop-expression {
106           description "Python expression";
107           type string;
108         }
109
110         leaf python-loop-iterate {
111           description "Python iteration";
112           type string;
113         }
114       }
115       uses rwvcs-python-loop;
116
117       choice action {
118         case annex {
119           container annex {
120             leaf component-name {
121               description
122                   "Name of the component type
123                    in the inventory";
124               type leafref {
125                 path "../../../../../../../component/component-name";
126               }
127             }
128             leaf instance-id {
129               description
130                   "ID of the component instance
131                    in the inventory";
132               type string;
133             }
134           }
135         }
136
137         case start {
138           container start {
139             //rwpb:msg-new ActionStart;
140
141             uses rwvcs-variable-list;
142             leaf component-name {
143               description
144                   "Name of the component type in
145                    the inventory";
146               type leafref {
147                 path "../../../../../../../component/component-name";
148               }
149             }
150             leaf instance-id {
151               description
152                   "ID of the component instance
153                    in the inventory";
154               type string;
155             }
156             leaf config-ready {
157               description
158                   "Config readiness check enable";
159               type boolean;
160               default true;
161             }
162             leaf recovery-action {
163               description
164                   "Define recovery action if this component fail";
165               type recovery-type;
166             }
167           }
168         }
169
170         case sleep {
171           container sleep {
172             leaf wait-time-usec {
173               description
174                   "Time to wait while sleeping";
175               type uint32;
176             }
177           }
178         }
179       } // choice action
180     } // list action
181   } // grouping action-list
182
183   grouping rwvcs-event-list {
184     container event-list {
185       description "";
186       //rwpb:msg-new VcsEventList;
187
188       list event {
189         description
190             "This section contains a list
191              of RW.VCS events";
192         key "name";
193         //rwpb:msg-new VcsEvent;
194
195         leaf name {
196           description
197               "Name of the event";
198           type string;
199         }
200
201         uses action-list;
202       } // list event
203     } // container event-list
204   } // grouping rwvcs-event-list
205
206   grouping rwvcs-rwcollection {
207     container rwcollection {
208       description
209           "This section defines a RW.VCS
210            rwollection component";
211       //rwpb:msg-new VcsRwCollection;
212
213       leaf collection-type {
214         description "Collection type";
215         type string;
216       }
217
218       uses rwvcs-event-list;
219     }
220   }
221
222   grouping rwvcs-rwvm {
223     container rwvm {
224       description
225           "This section defines a RW.VCS
226            rwvm component";
227       //rwpb:msg-new VcsRwVm;
228
229       leaf pool-name {
230         description
231             "Name of the pool from which to
232              allocate the VM";
233         type string;
234       }
235
236       leaf leader {
237         description
238             "True if this VM is designated as a leader for
239              the parent collection.";
240         type boolean;
241       }
242
243       uses rwvcs-event-list;
244       uses valgrind;
245     }
246   }
247
248   grouping rwvcs-rwproc {
249     container rwproc {
250       description
251           "This section defines a RW.VCS
252            rwproc component";
253       //rwpb:msg-new VcsRwproc;
254
255       leaf run-as {
256         description
257             "Host OS user that should run this
258              process, requires sudo -E access
259              and non-collapsed processes";
260         type string;
261       }
262
263       list tasklet {
264         description
265             "List of tasklets to be run within
266              this process";
267         key "name";
268         //rwpb:msg-new RwprocTasklet;
269
270         leaf name {
271           description
272               "Local description of the tasklet";
273           type string;
274         }
275
276         leaf component-name {
277           description
278               "Component name of the tasklet";
279           mandatory true;
280           type string;
281         }
282
283         leaf instance-id {
284           description
285               "If specified, the desired instance-id of
286                tasklet component instance";
287           type uint32;
288         }
289
290         leaf config-ready {
291           description
292               "Config readiness check enable";
293           type boolean;
294           default true;
295         }
296
297         leaf recovery-action {
298           description
299               "Define recovery action if this component fail";
300           type recovery-type;
301         }
302
303         uses rwvcs-variable-list;
304       }
305       uses valgrind;
306     }
307   }
308
309   grouping native-proc {
310     container native-proc {
311       //rwpb:msg-new NativeProc;
312
313       leaf run-as {
314         description
315             "Host OS user that should run this
316              process, requires sudo -E access";
317         type string;
318       }
319
320       leaf environment {
321         description
322             "Runtime environment for native process";
323         type string;
324       }
325
326       leaf exe-path {
327         description
328             "Path to native process executable";
329         type string;
330       }
331
332       leaf args {
333         description
334             "Arguments to pass to native process";
335         type string;
336       }
337
338       leaf network-namespace {
339         description
340             "Namespace to start process in";
341         type string;
342       }
343
344       leaf stdout {
345         description
346             "Redirect stdout to the file at the
347              specified path";
348         type string;
349       }
350
351       leaf stderr {
352         description
353             "Redirect stderr to the file at the
354              specified path. Optionally, 'stdout'
355              may be used to redirect to the same
356              file as stdout";
357         type string;
358       }
359
360       leaf interactive {
361         description "Native process is interactive and needs
362           terminal control";
363         type empty;
364       }
365       uses valgrind;
366     }
367   }
368
369   grouping rwvcs-rwtasklet {
370     container rwtasklet {
371       description
372           "This section defines a RW.VCS
373            rwtasklet component";
374       //rwpb:msg-new VcsRwTasklet;
375
376       leaf plugin-directory {
377         description "";
378         type string;
379       }
380
381       leaf plugin-name {
382         description "";
383         type string;
384       }
385
386       leaf plugin-version {
387         description "";
388         type string;
389       }
390     }
391   }
392
393   grouping rwvcs-component-list {
394     list component {
395       description
396           "This section defines the RIFT.ware
397            virtual components";
398       key "component-name";
399       //rwpb:application-request-point;
400
401       leaf component-name {
402         description "";
403         type string;
404       }
405
406       leaf component-type {
407         description "";
408         type component_type;
409         mandatory true;
410       }
411
412       choice component {
413         case rwvcs-rwcollection {
414           uses rwvcs-rwcollection;
415         }
416         case rwvcs-rwvm {
417           uses rwvcs-rwvm;
418         }
419         case rwvcs-rwproc {
420           uses rwvcs-rwproc;
421         }
422         case native-proc {
423           uses native-proc;
424         }
425         case rwvcs-rwtasklet {
426           uses rwvcs-rwtasklet;
427         }
428       }
429     } // list component
430   } // grouping rwvcs-component-list
431 }
432
433 // vim: sw=2
434