Rift.IO OSM R1 Initial Submission
[osm/UI.git] / skyquake / plugins / composer / src / schemas / yang / rw-vnfr.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 rw-vnfr
22 {
23   namespace "http://riftio.com/ns/riftware-1.0/rw-vnfr";
24   prefix "rw-vnfr";
25
26   import mano-types {
27     prefix "manotypes";
28   }
29
30   import rw-pb-ext { prefix "rwpb"; }
31
32   import vnfr {
33     prefix "vnfr";
34   }
35
36   import vnfd {
37     prefix "vnfd";
38   }
39
40   import rw-cloud {
41     prefix "rwcloud";
42   }
43
44   import rwvcs-types {
45     prefix "rwvcstypes";
46   }
47
48   import ietf-yang-types {
49     prefix "yang";
50   }
51
52   revision 2015-09-10 {
53     description
54       "Initial revision. This YANG file augments
55        the base MANO VNFD";
56     reference
57       "Derived from earlier versions of base YANG files";
58   }
59
60   grouping vnfr-operational-events {
61     list operational-events {
62       key "id";
63       description
64         "Recent operational events for VNFR
65         Though the model does not impose any restrictions on the numbe of events,
66         the max operational events will be limited to the most recent 10";
67
68       leaf id {
69         description "The id of the instance";
70         type uint64;
71       }
72
73       leaf timestamp {
74         description
75           "The timestamp of this event expressed as seconds since
76           unix epoch - 1970-01-01T00:00:00Z";
77         type uint32;
78       }
79       leaf event {
80         description "The event";
81         type enumeration {
82           //rwpb:enum-type "VnfrOperationalEvent";
83           enum instantiate-rcvd;
84           enum vl-inited;
85           enum vnf-inited;
86           enum running;
87           enum terminate-rcvd;
88           enum vnf-terminated;
89           enum vl-terminated;
90           enum terminated;
91         }
92       }
93       leaf description {
94         description
95           "The description of this event";
96         type string;
97       }
98     }
99   }
100
101   grouping vdur-operational-events {
102     list operational-events {
103       key "id";
104       description
105         "Recent operational events for VDUR
106         Though the model does not impose any restrictions on the numbe of events,
107         the max operational events will be limited to the most recent 10";
108
109       leaf id {
110         description "The id of the instance";
111         type uint64;
112       }
113
114       leaf timestamp {
115         description
116           "The timestamp of this event expressed as seconds since
117           unix epoch - 1970-01-01T00:00:00Z";
118         type uint32;
119       }
120       leaf event {
121         description "The event";
122         type enumeration {
123           //rwpb:enum-type "VdurOperationalEvent";
124           enum instantiate-rcvd;
125           enum vm-allocation-requested;
126           enum running;
127           enum terminate-rcvd;
128           enum vm-terminate-requested;
129           enum terminated;
130         }
131       }
132       leaf description {
133         description
134           "The description of this event";
135         type string;
136       }
137     }
138   }
139
140   augment /vnfr:vnfr-catalog/vnfr:vnfr {
141     uses manotypes:action-param;
142     uses manotypes:control-param;
143
144     leaf cloud-account {
145       description
146         "The cloud account to use when requesting resources for
147          this vnf";
148       type leafref {
149         path "/rwcloud:cloud/rwcloud:account/rwcloud:name";
150       }
151     }
152
153     container nfvi-metrics {
154       container vm {
155         leaf label {
156           description
157             "Label to show in UI";
158           type string;
159           default "VM";
160         }
161
162         leaf active-vm {
163           description
164             "The number of active VMs.";
165           type uint64;
166         }
167
168         leaf inactive-vm {
169           description
170             "The number of inactive VMs.";
171           type uint64;
172         }
173       }
174
175       uses manotypes:nfvi-metrics;
176     }
177
178     list component {
179       description
180           "This section defines the RIFT.ware
181            virtual components";
182       key "component-name";
183       //rwpb:msg-new VcsComponentOp;
184       //rwpb:application-request-point;
185
186       leaf component-name {
187         description "";
188         type string;
189       }
190
191       leaf component-type {
192         description "";
193         type rwvcstypes:component_type;
194         mandatory true;
195       }
196
197       choice component {
198         case rwvcs-rwcollection {
199           uses rwvcstypes:rwvcs-rwcollection;
200         }
201         case rwvcs-rwvm {
202           uses rwvcstypes:rwvcs-rwvm;
203         }
204         case rwvcs-rwproc {
205           uses rwvcstypes:rwvcs-rwproc;
206         }
207         case native-proc {
208           uses rwvcstypes:native-proc;
209         }
210         case rwvcs-rwtasklet {
211           uses rwvcstypes:rwvcs-rwtasklet;
212         }
213       }
214     } // list component
215     uses vnfr-operational-events;
216   }
217
218   augment /vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur {
219     leaf vm-pool {
220       description
221         "The pool from which this vm was allocated from";
222       type string;
223     }
224
225     container nfvi-metrics {
226       uses manotypes:nfvi-metrics;
227     }
228
229     leaf vcs-component-ref {
230       description
231           "This defines the software components using the
232            RIFT.ware Virtual Component System (VCS). This
233            also allows specifying a state machine during
234            the VM startup.
235            NOTE: This is an significant addition to MANO,
236            since MANO doesn't clearly specify a method to
237            identify various software components in a VM.
238            Also using a state machine is not something that
239            is well described in MANO.";
240       type leafref {
241         path "/vnfr:vnfr-catalog/vnfr:vnfr/rw-vnfr:component/rw-vnfr:component-name";
242       }
243     }
244     uses vdur-operational-events;
245   }
246   grouping vnfd-ref-count {
247     list vnfd-ref-count {
248       key "vnfd-id-ref";
249       description "This table maintains the number of VNFRs used by each VNFD";
250
251       leaf vnfd-id-ref {
252         description "Reference to VNFD";
253         type leafref {
254           path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
255         }
256       }
257       leaf instance-ref-count {
258         description
259           "Reference count for the number of VNFRs refering this VNFD.
260            Every VNF Record instantiated using this descriptor takes
261            a reference on the VNFD and releases the reference when the
262            virtual network service is terminated. This desciptor cannot
263            be deleted when this counter is non zero";
264         type uint64;
265       }
266     }
267   }
268   augment /vnfr:vnfr-catalog {
269     uses vnfd-ref-count;
270   }
271 }
272
273 // vim: sw=2