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