Bug 313: move makefiles from SO
[osm/IM.git] / models / yang / 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 vnfr
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:vnfr";
24   prefix "vnfr";
25
26   import mano-types {
27     prefix "manotypes";
28   }
29
30   import rw-pb-ext {
31     prefix "rwpb";
32   }
33
34   import vnfd {
35     prefix "vnfd";
36   }
37
38   import nsd {
39     prefix "nsd";
40   }
41
42   import vlr {
43     prefix "vlr";
44   }
45
46   import ietf-yang-types {
47     prefix "yang";
48   }
49
50   import ietf-inet-types {
51     prefix "inet";
52   }
53
54   revision 2015-09-10 {
55     description
56       "Initial revision. This YANG file defines
57        the Virtual Network Function Record (VNFR)";
58     reference
59       "Derived from earlier versions of base YANG files";
60   }
61
62   grouping placement-group-info {
63     list placement-groups-info {
64       description
65           "
66           Placement groups to which this VDU belongs and its
67           cloud construct
68           ";
69       key "name";
70       uses manotypes:placement-group-info;
71       uses manotypes:placement-group-input;
72     }  
73   }
74   
75   
76   grouping virtual-interface {
77     container virtual-interface {
78       description
79           "Container for the virtual interface properties";
80
81       leaf type {
82         description
83             "Specifies the type of virtual interface
84              between VM and host.
85              VIRTIO          : Use the traditional VIRTIO interface.
86              PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
87              SR-IOV          : Use SR-IOV interface.";
88         type enumeration {
89           enum VIRTIO;
90           enum PCI-PASSTHROUGH;
91           enum SR-IOV;
92         }
93       }
94
95       leaf bandwidth {
96         description
97             "Aggregate bandwidth of the NIC.";
98         type uint64;
99       }
100
101       leaf ovs-offload {
102         description
103             "Defines if the NIC supports OVS offload.
104              MANDATORY : OVS offload support in the NIC is mandatory.
105              PREFERRED : OVS offload support in the NIC is preferred.";
106         type enumeration {
107           enum MANDATORY;
108           enum PREFERRED;
109         }
110       }
111
112       leaf vendor-id {
113         description
114             "Specifies the vendor specific id for
115              the device. This is used when a NIC from
116              specific HW vendor is required.";
117         type string;
118       }
119
120       leaf datapath-library {
121         description
122             "Specifies the name and version of the datapath
123              library the NIC is expected to support.";
124         type string;
125       }
126
127       leaf provider-network-name {
128         description
129             "Name of the provider network to which this
130              NIC is attached.";
131         type string;
132       }
133     }
134   }
135
136   container vnfr-catalog {
137     config false;
138     list vnfr {
139       description
140           "Virtual Network Function Record (VNFR).";
141       key "id";
142       unique "name";
143
144       leaf id {
145         description "Identifier for the VNFR.";
146         type yang:uuid;
147       }
148
149       leaf nsr-id-ref {
150         description
151             "NS instance identifier.
152              This is a leafref /nsr:ns-instance-config/nsr:nsr/nsr:id";
153         type yang:uuid;
154       }
155
156       leaf member-vnf-index-ref {
157         description "Reference to member VNF index in Network service.";
158         type leafref {
159           path "/nsd:nsd-catalog/nsd:nsd/nsd:constituent-vnfd/nsd:member-vnf-index";
160         }
161       }
162
163       leaf dashboard-url {
164         description "Dashboard URL";
165         type inet:uri;
166       }
167
168       leaf name {
169         description "VNFR name.";
170         type string;
171       }
172
173       leaf short-name {
174         description "VNFR short name.";
175         type string;
176       }
177
178       leaf vendor {
179         description "Vendor of the VNFR.";
180         type string;
181       }
182
183       leaf description {
184         description "Description of the VNFR.";
185         type string;
186       }
187
188       leaf version {
189         description "Version of the VNFR";
190         type string;
191       }
192
193       leaf create-time {
194         description
195           "Creation timestamp of this Virtual Network 
196           Function.  The timestamp is expressed as 
197           seconds since unix epoch - 1970-01-01T00:00:00Z";
198
199         type uint32;
200       }
201
202       leaf uptime {
203         description
204           "Active period of this Virtual Network Function.
205           Uptime is expressed in seconds";
206
207         type uint32;
208       }
209
210       container vnfd {
211         description "VNF descriptor used to instantiate this VNF";
212         uses vnfd:vnfd-descriptor;
213       }
214
215       // Use parameters provided here to configure this VNF
216       uses manotypes:vnf-configuration;
217
218       // Mainly used by Mon-params & dashboard url
219       container mgmt-interface {
220         leaf ip-address {
221           type inet:ip-address;
222         }
223         leaf port {
224           type inet:port-number;
225         }
226       }
227
228       list internal-vlr {
229         key "vlr-ref";
230
231         leaf vlr-ref {
232           description "Reference to a VLR record in the VLR catalog";
233           type leafref {
234             path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
235           }
236         }
237
238         leaf-list internal-connection-point-ref {
239           type leafref {
240             path "../../vdur/internal-connection-point/id";
241           }
242         }
243       }
244
245       list connection-point {
246         key "name";
247         description
248             "List for external connection points. Each VNF has one
249              or more external connection points. As the name
250              implies that external connection points are used for
251              connecting the VNF to other VNFs or to external networks.
252              Each VNF exposes these connection points to the
253              orchestrator. The orchestrator can construct network
254              services by connecting the connection points between
255              different VNFs. The NFVO will use VLDs and VNFFGs at
256              the network service level to construct network services.";
257
258         uses vnfd:common-connection-point;
259
260         leaf vlr-ref {
261           description
262               "Reference to the VLR associated with this connection point";
263           type  leafref {
264             path "/vlr:vlr-catalog/vlr:vlr/vlr:id";
265           }
266         }
267
268         leaf ip-address {
269           description
270               "IP address assigned to the external connection point";
271           type inet:ip-address;
272         }
273         leaf mac-address {
274           description
275               "MAC address assigned to the external connection point";
276           // type inet:mac-address;
277           type string;
278         }
279         leaf connection-point-id {
280           rwpb:field-inline "true";
281           rwpb:field-string-max 64;
282           type string;
283         }
284       }
285
286       list vdur {
287         description "List of Virtual Deployment Units";
288         key "id";
289         unique "name";
290
291         leaf id {
292           description "Unique id for the VDU";
293           type yang:uuid;
294         }
295
296         leaf name {
297           description "name of the instantiated VDUR";
298           type string;
299         }
300
301         leaf unique-short-name {
302           description "Short Unique name of the VDU
303                 This will be of the format NSR name-ShortnedString-VDUname
304                 NSR name and VDU name shall be constrained to 10 characters";
305           rwpb:field-inline "true";
306           rwpb:field-string-max 64;
307           type string;
308         }
309
310         leaf vdu-id-ref {
311           type leafref {
312             path "../../vnfd/vdu/id";
313           }
314         }
315
316         leaf vim-id {
317           description "Allocated VM resource id";
318           type string;
319         }
320
321         leaf flavor-id {
322           description "VIM assigned flavor id";
323           type string;
324         }
325
326         leaf image-id {
327           description "VIM assigned image id";
328           type string;
329         }
330
331         leaf management-ip {
332           description "Management IP address";
333           type inet:ip-address;
334         }
335
336         leaf vm-management-ip {
337           description "VM Private Management IP address";
338           type inet:ip-address;
339         }
340
341         leaf console-url {
342           description "Console URL for this VDU, if available";
343           type inet:uri;
344         }
345
346         uses manotypes:vm-flavor;
347         uses manotypes:guest-epa;
348         uses manotypes:vswitch-epa;
349         uses manotypes:hypervisor-epa;
350         uses manotypes:host-epa;
351
352         uses manotypes:supplemental-boot-data;
353
354         list volumes {
355           key "name";
356
357           leaf name {
358             description "Name of the disk-volumes, e.g. vda, vdb etc";
359             type string;
360           }
361
362           leaf volume-id {
363             description "VIM assigned volume id";
364             type string;
365           }
366
367           uses manotypes:volume-info;
368         }
369
370         list alarms {
371           description
372               "A list of the alarms that have been created for this VDU";
373
374           key "alarm-id";
375           uses manotypes:alarm;
376         }
377
378         list internal-connection-point {
379           key "id";
380           description
381               "List for internal connection points. Each VNFC
382                has zero or more internal connection points.
383                Internal connection points are used for connecting
384                the VNF components internal to the VNF. If a VNF
385                has only one VNFC, it may not have any internal
386                connection points.";
387
388           uses vnfd:common-connection-point;
389
390           leaf ip-address {
391             description
392                 "IP address assigned to the internal connection point";
393             type inet:ip-address;
394           }
395           leaf mac-address {
396             description
397                 "MAC address assigned to the internal connection point";
398             // type inet:mac-address;
399             type string;
400           }
401         }
402
403         list internal-interface {
404           description
405               "List of internal interfaces for the VNF";
406           key name;
407
408           leaf name {
409             description
410                 "Name of internal interface. Note that this
411                  name has only local significance to the VDU.";
412             type string;
413           }
414
415           leaf vdur-internal-connection-point-ref {
416             type leafref {
417               path "../../internal-connection-point/id";
418             }
419           }
420           uses virtual-interface;
421         }
422
423         list external-interface {
424           description
425               "List of external interfaces for the VNF.
426                The external interfaces enable sending
427                traffic to and from VNF.";
428           key name;
429
430           leaf name {
431             description
432                 "Name of the external interface. Note that
433                  this name has only local significance.";
434             type string;
435           }
436
437           leaf vnfd-connection-point-ref {
438             description
439               "Name of the external connection point.";
440             type leafref {
441               path "../../../connection-point/name";
442             }
443           }
444           uses virtual-interface;
445         }
446         leaf operational-status {
447           description
448             "The operational status of the VDU 
449               init                : The VDU has just started.
450               vm-init-phase       : The VDUs in the VNF is being created in VIM.
451               vm-alloc-pending    : The  VM alloc is pending in VIM
452               running             : The VDU is active in VM
453               terminate           : The VDU is being terminated
454               vm-terminate-phase  : The VDU in the VNF is being terminated in VIM.
455               terminated          : The VDU is in the terminated state.
456               failed              : The VDU  instantiation failed.
457             ";
458
459           type enumeration {
460             rwpb:enum-type "VduOperationalStatus";
461             enum init;
462             enum vm-init-phase;
463             enum vm-alloc-pending;
464             enum running;
465             enum terminate;
466             enum vl-terminate-phase;
467             enum terminated;
468             enum failed;
469           }
470         }
471         uses placement-group-info;
472       }
473
474       uses manotypes:monitoring-param;
475
476       leaf operational-status {
477         description
478           "The operational status of the VNFR instance
479             init                : The VNF has just started.
480             vl-init-phase       : The internal VLs in the VNF are being instantiated.
481             vm-init-phase       : The VMs for VDUs in the VNF are being instantiated.
482             running             : The VNF is in running state.
483             terminate           : The VNF is being terminated.
484             vm-terminate-phase  : The VMs in the VNF are being terminated.
485             vl-terminate-phase  : The internal VLs in the VNF are being terminated.
486             terminated          : The VNF is in the terminated state.
487             failed              : The VNF instantiation failed
488           ";
489
490         type enumeration {
491           rwpb:enum-type "VnfrOperationalStatus";
492           enum init;
493           enum vl-init-phase;
494           enum vm-init-phase;
495           enum running;
496           enum terminate;
497           enum vm-terminate-phase;
498           enum vl-terminate-phase;
499           enum terminated;
500           enum failed;
501         }
502       }
503       leaf config-status {
504         description
505           "The configuration status of the NS instance
506             configuring: At least one of the VNFs in this instance is in configuring state
507             configured:  All the VNFs in this NS instance are configured or config-not-needed state
508           ";
509
510         type enumeration {
511           enum configuring {
512             value 1;
513           }
514           enum configured {
515             value 2;
516           }
517           enum failed {
518             value 3;
519           }
520           enum config-not-needed {
521             value 4;
522           }
523         }
524       }
525       uses placement-group-info;
526     }
527   }
528
529   rpc create-alarm {
530     description "Create an alert for a running VDU";
531     input {
532       leaf cloud-account {
533         mandatory true;
534         type string;
535       }
536
537       leaf vdur-id {
538         mandatory true;
539         type string;
540       }
541
542       container alarm {
543         uses manotypes:alarm;
544       }
545     }
546
547     output {
548       leaf alarm-id {
549         type string;
550       }
551     }
552   }
553
554   rpc destroy-alarm {
555     description "Destroy an alert that is associated with a running VDU";
556     input {
557       leaf cloud-account {
558         mandatory true;
559         type string;
560       }
561
562       leaf alarm-id {
563         mandatory true;
564         type string;
565       }
566     }
567   }
568 }
569