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