6337cad99f79bdd8965078060fb30e2d2099fcc4
[osm/SO.git] / models / plugins / yang / rw-vnfr.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 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 "rw-cloud";
42   }
43
44   import rwvcs-types {
45     prefix "rwvcstypes";
46   }
47
48   import ietf-yang-types {
49     prefix "yang";
50   }
51
52   import ietf-inet-types {
53     prefix "inet";
54   }
55
56   import rw-project {
57     prefix "rw-project";
58   }
59
60   revision 2017-02-08 {
61     description
62       "Update model to support projects.";
63   }
64
65   revision 2015-09-10 {
66     description
67       "Initial revision. This YANG file augments
68        the base MANO VNFD";
69     reference
70       "Derived from earlier versions of base YANG files";
71   }
72
73   grouping vnfr-operational-events {
74     list operational-events {
75       key "id";
76       description
77         "Recent operational events for VNFR
78         Though the model does not impose any restrictions on the numbe of events, 
79         the max operational events will be limited to the most recent 10"; 
80
81       leaf id {
82         description "The id of the instance";
83         type uint64;
84       }
85
86       leaf timestamp {
87         description
88           "The timestamp of this event expressed as seconds since
89           unix epoch - 1970-01-01T00:00:00Z";
90         type uint32;
91       }
92       leaf event {
93         description "The event";
94         type enumeration {
95           rwpb:enum-type "VnfrOperationalEvent";
96           enum instantiate-rcvd;
97           enum vl-inited;
98           enum vnf-inited;
99           enum running;
100           enum terminate-rcvd;
101           enum vnf-terminated;
102           enum vl-terminated;
103           enum terminated;
104         }
105       }
106       leaf description {
107         description
108           "The description of this event";
109         type string;
110       }
111     }
112   }
113
114   grouping vdur-operational-events {
115     list operational-events {
116       key "id";
117       description
118         "Recent operational events for VDUR
119         Though the model does not impose any restrictions on the numbe of events, 
120         the max operational events will be limited to the most recent 10"; 
121
122       leaf id {
123         description "The id of the instance";
124         type uint64;
125       }
126
127       leaf timestamp {
128         description
129           "The timestamp of this event expressed as seconds since
130           unix epoch - 1970-01-01T00:00:00Z";
131         type uint32;
132       }
133       leaf event {
134         description "The event";
135         type enumeration {
136           rwpb:enum-type "VdurOperationalEvent";
137           enum instantiate-rcvd;
138           enum vm-allocation-requested;
139           enum running;
140           enum terminate-rcvd;
141           enum vm-terminate-requested;
142           enum terminated;
143         }
144       }
145       leaf description {
146         description
147           "The description of this event";
148         type string;
149       }
150     }
151   }
152
153   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr {
154     uses manotypes:action-param;
155     uses manotypes:control-param;
156
157     leaf cloud-account {
158       description
159         "The cloud account to use when requesting resources for
160          this vnf";
161       type leafref {
162         path "../../../rw-cloud:cloud/rw-cloud:account/rw-cloud:name";
163       }
164     }
165
166     leaf om-datacenter {
167       description
168           "Openmano datacenter name to use when instantiating
169           the network service.  This is only used when openmano
170           is selected as the cloud account.  This should be superceded
171           by multiple cloud accounts when that becomes available.";
172       type string;
173     }
174
175     container nfvi-metrics {
176       container vm {
177         leaf label {
178           description
179             "Label to show in UI";
180           type string;
181           default "VM";
182         }
183
184         leaf active-vm {
185           description
186             "The number of active VMs.";
187           type uint64;
188         }
189
190         leaf inactive-vm {
191           description
192             "The number of inactive VMs.";
193           type uint64;
194         }
195       }
196       
197       uses manotypes:nfvi-metrics;
198     }
199
200     list component {
201       description
202           "This section defines the RIFT.ware
203            virtual components";
204       key "component-name";
205       rwpb:msg-new VcsComponentOp;
206       rwpb:application-request-point;
207
208       leaf component-name {
209         description "";
210         type string;
211       }
212
213       leaf component-type {
214         description "";
215         type rwvcstypes:component_type;
216         mandatory true;
217       }
218
219       choice component {
220         case rwvcs-rwcollection {
221           uses rwvcstypes:rwvcs-rwcollection;
222         }
223         case rwvcs-rwvm {
224           uses rwvcstypes:rwvcs-rwvm;
225         }
226         case rwvcs-rwproc {
227           uses rwvcstypes:rwvcs-rwproc;
228         }
229         case native-proc {
230           uses rwvcstypes:native-proc;
231         }
232         case rwvcs-rwtasklet {
233           uses rwvcstypes:rwvcs-rwtasklet;
234         }
235       }
236     } // list component
237
238     uses vnfr-operational-events;
239
240     leaf operational-status-details {
241       description
242         "The error message in case of a failed VNFR operational status";
243       type string;
244     }
245   }
246
247   augment /rw-project:project/vnfr:vnfr-catalog/vnfr:vnfr/vnfr:vdur {
248     leaf vm-pool {
249       description
250         "The pool from which this vm was allocated from";
251       type string;
252     }
253
254     container nfvi-metrics {
255       uses manotypes:nfvi-metrics;
256     }
257
258     leaf vcs-component-ref {
259       description
260           "This defines the software components using the
261            RIFT.ware Virtual Component System (VCS). This
262            also allows specifying a state machine during
263            the VM startup.
264            NOTE: This is an significant addition to MANO,
265            since MANO doesn't clearly specify a method to
266            identify various software components in a VM.
267            Also using a state machine is not something that
268            is well described in MANO.";
269       type leafref {
270         path "../../rw-vnfr:component/rw-vnfr:component-name";
271       }
272     }
273
274     uses vdur-operational-events;
275
276     leaf operational-status-details {
277       description
278         "The error message in case of a failed VDU operational status";
279       type string;
280     }
281   }
282
283   grouping vnfd-ref-count {
284     list vnfd-ref-count {
285       key "vnfd-id-ref";
286       description "This table maintains the number of VNFRs used by each VNFD";
287
288       leaf vnfd-id-ref {
289         description "Reference to VNFD";
290         type leafref {
291           path "../../../vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id";
292         }
293       }
294       leaf instance-ref-count {
295         description
296           "Reference count for the number of VNFRs refering this VNFD.
297            Every VNF Record instantiated using this descriptor takes
298            a reference on the VNFD and releases the reference when the
299            virtual network service is terminated. This desciptor cannot
300            be deleted when this counter is non zero";
301         type uint64;
302       }
303     }
304   }
305
306   augment /rw-project:project/vnfr:vnfr-catalog {
307     uses vnfd-ref-count;
308   }
309
310   augment /rw-project:project {
311     container vnfr-console {
312       config false;
313       list vnfr {
314         key "id";
315         leaf id {
316           description "Identifier for the VNFR.";
317           type yang:uuid;
318         }
319         list vdur {
320           description "List of Virtual Deployment Units";
321           key "id";
322           leaf id {
323             description "Unique id for the VDU";
324             type yang:uuid;
325           }
326           leaf console-url {
327             description "Console URL for this VDU, if available";
328             type inet:uri;
329           }
330         }
331       }
332     }
333   }
334
335 }
336
337 // vim: sw=2