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