vca-config-access container for vnf/vdu configuration
[osm/IM.git] / models / yang / vnfd-base.yang
1
2 /*
3  *
4  *   Copyright 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 vnfd-base
22 {
23   namespace "urn:etsi:osm:yang:vnfd-base";
24   prefix "vnfd-base";
25
26   import mano-types {
27     prefix "manotypes";
28   }
29
30   import ietf-inet-types {
31     prefix "inet";
32   }
33
34   revision 2017-02-28 {
35     description
36       "Initial revision. This YANG file defines
37        the common types for Virtual Network Function
38        (VNF) descriptor";
39     reference
40       "Derived from earlier versions of base YANG files";
41   }
42
43   grouping common-connection-point {
44     leaf name {
45       description "Name of the connection point";
46       type string;
47     }
48
49     leaf id {
50       description "Identifier for the internal connection points";
51       type string;
52     }
53
54     leaf short-name {
55       description "Short name to appear as label in the UI";
56       type string;
57     }
58
59     leaf type {
60       description "Type of the connection point.";
61       type manotypes:connection-point-type;
62     }
63
64     leaf port-security-enabled {
65       description "Enables the port security for the port.";
66       type boolean;
67       default true;
68     }
69   }
70
71   typedef interface-type {
72     type enumeration {
73       enum INTERNAL;
74       enum EXTERNAL;
75     }
76   }
77
78   typedef vnf-operational-status {
79     type enumeration {
80       enum init;
81       enum running;
82       enum upgrading;
83       enum terminate;
84       enum terminated;
85       enum failed;
86     }
87   }
88
89   grouping virtual-interface {
90     container virtual-interface {
91       description
92           "Container for the virtual interface properties";
93
94       leaf type {
95         description
96             "Specifies the type of virtual interface
97              between VM and host.
98              PARAVIRT        : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.).
99              VIRTIO          : Deprecated! Use the traditional VIRTIO interface.
100              PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
101              SR-IOV          : Use SR-IOV interface.
102              E1000           : Emulate E1000 interface.
103              RTL8139         : Emulate RTL8139 interface.
104              PCNET           : Emulate PCNET interface.
105              OM-MGMT         : Deprecated! Use PARAVIRT instead and set the VNF management interface at vnfd:mgmt-interface:cp";
106
107         type enumeration {
108           enum PARAVIRT;
109           enum OM-MGMT;
110           enum PCI-PASSTHROUGH;
111           enum SR-IOV;
112           enum VIRTIO;
113           enum E1000;
114           enum RTL8139;
115           enum PCNET;
116         }
117         default "PARAVIRT";
118       }
119
120       leaf vpci {
121         description
122             "Specifies the virtual PCI address. Expressed in
123              the following format dddd:dd:dd.d. For example
124              0000:00:12.0. This information can be used to
125              pass as metadata during the VM creation.";
126         type string;
127       }
128
129       leaf bandwidth {
130         description
131             "Aggregate bandwidth of the NIC.";
132         type uint64;
133       }
134     }
135   }
136
137   grouping vnfd-descriptor {
138       leaf id {
139         description "Identifier for the VNFD.";
140         type string {
141           length "1..63";
142         }
143       }
144
145       leaf name {
146         description "VNFD name.";
147         mandatory true;
148         type string;
149       }
150
151       leaf short-name {
152         description "Short name to appear as label in the UI";
153         type string;
154       }
155
156       leaf vendor {
157         description "Vendor of the VNFD.";
158         type string;
159       }
160
161       leaf logo {
162         description
163             "Vendor logo for the Virtual Network Function";
164         type string;
165       }
166
167       leaf description {
168         description "Description of the VNFD.";
169         type string;
170       }
171
172       leaf version {
173         description "Version of the VNFD";
174         type string;
175       }
176
177       container vnf-configuration {
178         uses manotypes:vca-configuration;
179         uses manotypes:vca-config-access;
180       }
181
182       leaf operational-status {
183          description
184            "The operational status of the VNF
185              init                : The VNF has just started.
186              running             : The VNF is active in VM
187              upgrading           : The VNF is being upgraded (EXPERIMENTAL)
188              terminate           : The VNF is being terminated
189              terminated          : The VNF is in the terminated state.
190              failed              : The VNF  instantiation failed.
191            ";
192          type vnf-operational-status;
193       }
194
195       container mgmt-interface {
196         description
197             "Interface over which the VNF is managed.";
198
199         choice endpoint-type {
200           description
201               "Indicates the type of management endpoint.";
202
203           case ip {
204             description
205                 "Specifies the static IP address for managing the VNF.";
206             leaf ip-address {
207               type inet:ip-address;
208             }
209           }
210
211           case vdu-id {
212             description
213                 "Use the default management interface on this VDU.";
214             leaf vdu-id {
215               type leafref {
216                 path "../../vdu/id";
217               }
218             }
219           }
220
221           case cp {
222             description
223                 "Use the ip address associated with this connection point. This cp is then considered as management.";
224             leaf cp {
225               type leafref {
226                 path "../../connection-point/name";
227               }
228             }
229           }
230         }
231
232         leaf port {
233           description
234               "Port for the management interface.";
235           type inet:port-number;
236         }
237
238         container dashboard-params {
239           description "Parameters for the VNF dashboard";
240
241           leaf path {
242             description "The HTTP path for the dashboard";
243             type string;
244           }
245
246           leaf https {
247             description "Pick HTTPS instead of HTTP , Default is false";
248             type boolean;
249           }
250
251           leaf port {
252             description "The HTTP port for the dashboard";
253             type inet:port-number;
254           }
255         }
256       }
257
258       list internal-vld {
259         key "id";
260         description
261           "List of Internal Virtual Link Descriptors (VLD).
262           The internal VLD describes the basic topology of
263           the connectivity such as E-LAN, E-Line, E-Tree.
264           between internal VNF components of the system.";
265
266         leaf id {
267           description "Identifier for the VLD";
268           type string;
269         }
270
271         leaf name {
272           description "Name of the internal VLD";
273           type string;
274         }
275
276         leaf short-name {
277           description "Short name to appear as label in the UI";
278           type string;
279         }
280
281         leaf description {
282           type string;
283         }
284
285         leaf type {
286           type manotypes:virtual-link-type;
287         }
288
289         leaf root-bandwidth {
290           description
291               "For ELAN this is the aggregate bandwidth.";
292           type uint64;
293         }
294
295         leaf leaf-bandwidth {
296           description
297               "For ELAN this is the bandwidth of branches.";
298           type uint64;
299         }
300
301         list internal-connection-point {
302           key "id-ref";
303           description "List of internal connection points in this VLD";
304           leaf id-ref {
305             description "Reference to the internal connection point id";
306             type leafref {
307               path "../../../vdu/internal-connection-point/id";
308             }
309           }
310
311           leaf ip-address {
312             description "IP address of the internal connection point";
313             type inet:ip-address;
314           }
315         }
316
317         uses manotypes:provider-network;
318         choice init-params {
319           description "Extra parameters for VLD instantiation";
320
321           case vim-network-ref {
322             leaf vim-network-name {
323               description
324                   "Name of network in VIM account. This is used to indicate
325                     pre-provisioned network name in cloud account.";
326               type string;
327             }
328           }
329
330           case vim-network-profile {
331             leaf ip-profile-ref {
332               description "Named reference to IP-profile object";
333               type string;
334             }
335           }
336
337         }
338       }
339
340       uses manotypes:ip-profile-list;
341
342       list connection-point {
343         key "name";
344         description
345           "List for external connection points. Each VNF has one
346           or more external connection points that connect the VNF
347           to other VNFs or to external networks. Each VNF exposes
348           connection points to the orchestrator, which can construct
349           network services by connecting the connection points
350           between different VNFs. The NFVO will use VLDs and VNFFGs
351           at the network service level to construct network services.";
352
353         uses common-connection-point;
354
355         leaf internal-vld-ref {
356           description
357             "Reference to an internal VLD of the VNF. This field is
358             optional. It allows exposing an internal VLD through a
359             connection point. When building a NS, this VNF CP might be
360             connected to a NS VLD, then both VLDs (the i-VLD of the VNF and the
361             VLD of the NS) will become the same network and the IP profile will
362             be the one configured at NS level.";
363           type leafref {
364             path "../../internal-vld/id";
365           }
366         }
367       }
368
369       list vdu {
370         description "List of Virtual Deployment Units";
371         key "id";
372
373         leaf id {
374           description "Unique id for the VDU";
375           type string;
376         }
377
378         leaf name {
379           description "Unique name for the VDU";
380           type string;
381         }
382
383         leaf description {
384             description "Description of the VDU.";
385             type string;
386         }
387
388         leaf pdu-type {
389           description
390             "Type of PDU. If this field exists, the deployment unit must be
391             understood as a PDU, not as a VDU. This field is used to identify
392             the category of PDU instances to be used at instantiation time. For
393             the instantiation to be successful, there must be available
394             PDU instances of this type in the selected datacenter.";
395           type string;
396         }
397
398         leaf count {
399           description "Number of instances of VDU";
400           type uint64;
401         }
402
403         leaf mgmt-vpci {
404           description
405               "Specifies the virtual PCI address. Expressed in
406              the following format dddd:dd:dd.d. For example
407              0000:00:12.0. This information can be used to
408              pass as metadata during the VM creation.";
409           type string;
410         }
411
412         uses manotypes:vm-flavor;
413         uses manotypes:guest-epa;
414         uses manotypes:vswitch-epa;
415         uses manotypes:hypervisor-epa;
416         uses manotypes:host-epa;
417
418         list alarm {
419           key "alarm-id";
420
421           leaf alarm-id {
422             description
423                   "This field is reserved for the identifier assigned by the VIM provider";
424
425             type string;
426           }
427
428
429           leaf vnf-monitoring-param-ref {
430               description
431                  "Reference to the VNF level monitoring parameter
432                   that is aggregated";
433               type leafref {
434                 path "../../monitoring-param/id";
435               }
436           }
437
438           uses manotypes:alarm-properties;
439         }
440
441         uses manotypes:image-properties;
442
443         list alternative-images {
444           key "vim-type";
445           description
446             "List of alternative images per VIM type.
447             Different images can be used for specific types of VIMs instead
448             of the default image. This allows deployments in sites where the
449             image identifier in the VIM is given by the VIM provider and
450             cannot be modified.
451             If an alternative image is specified for a VIM type, it will prevail
452             over the default image";
453
454           leaf vim-type {
455             description "VIM type: openvim, openstack, vmware, aws, etc.";
456             type string;
457           }
458
459           uses manotypes:image-properties;
460         }
461
462         container vdu-configuration {
463           uses manotypes:vca-configuration;
464           uses manotypes:vca-config-access;
465         }
466
467         list monitoring-param {
468           description
469             "List of VDU-related monitoring parameters at NFVI level";
470           key id;
471           leaf id {
472             description "The unique id of the monitoring param at VDU level";
473             type string;
474           }
475
476           leaf nfvi-metric {
477             description "The associated NFVI metric to be monitored";
478             type manotypes:nfvi-metric-type;
479           }
480
481           leaf interface-name-ref {
482             description
483               "Reference to a VDU interface name. Applicable only when the nfvi-metric
484               refers to an interface and not to the VM";
485             type leafref {
486               path "../../interface/name";
487             }
488           }
489         }
490
491         choice cloud-init-input {
492           description
493             "Indicates how the contents of cloud-init script are provided.
494              There are 2 choices - inline or in a file";
495
496           case inline {
497             leaf cloud-init {
498               description
499                 "Contents of cloud-init script, provided inline, in cloud-config format";
500               type string;
501             }
502           }
503
504           case filename {
505             leaf cloud-init-file {
506               description
507                 "Name of file with contents of cloud-init script in cloud-config format";
508                 type string;
509             }
510           }
511         }
512
513         uses manotypes:supplemental-boot-data;
514
515         list internal-connection-point {
516           key "id";
517           description
518             "List for internal connection points. Each VNFC
519             has zero or more internal connection points.
520             Internal connection points are used for connecting
521             the VNF with components internal to the VNF. If a VNF
522             has only one VNFC, it may not have any internal
523             connection points.";
524
525           uses common-connection-point;
526
527           leaf internal-vld-ref {
528             type leafref {
529               path "../../../internal-vld/id";
530             }
531           }
532         }
533
534         list interface {
535           description
536               "List of Interfaces (external and internal) for the VNF";
537           key name;
538
539           leaf name {
540             description
541                 "Name of the interface. Note that this
542                 name has only local significance to the VDU.";
543             type string;
544           }
545
546           leaf position {
547             description
548                 "Explicit Position of the interface within the list";
549             type uint32;
550           }
551
552           leaf mgmt-interface {
553             description
554                 "Flag to indicate that this is the mgmt interface
555                 to be used for VDU configuration";
556             type boolean;
557             default false;
558           }
559
560           leaf type {
561             description
562                 "Type of the Interface";
563             type interface-type;
564
565             default "EXTERNAL";
566           }
567
568           leaf mac-address {
569             description
570                 "MAC address of the interface.
571                 Some VNFs require a specific MAC address to be configured
572                 in the interface. While this is not recommended at all in
573                 NFV environments, this parameter exists to allow those
574                 scenarios.
575                 This parameter will be likely deprecated in the future.";
576             type string;
577           }
578
579           choice connection-point-type {
580             case internal {
581               leaf internal-connection-point-ref {
582                 description
583                     "Leaf Ref to the particular internal connection point";
584                 type leafref {
585                    path "../../internal-connection-point/id";
586                  }
587               }
588             }
589             case external {
590               leaf external-connection-point-ref {
591                 description
592                     "Leaf Ref to the particular external connection point";
593                 type leafref {
594                    path "../../../connection-point/name";
595                  }
596               }
597             }
598           }
599
600           uses virtual-interface;
601         }
602
603
604         list volumes {
605           key "name";
606
607           leaf name {
608             description "Name of the disk-volumes, e.g. vda, vdb etc";
609             type string;
610           }
611
612           uses manotypes:volume-info;
613         }
614       }
615
616       list vdu-dependency {
617         description
618             "List of VDU dependencies.";
619
620         key vdu-source-ref;
621         leaf vdu-source-ref {
622           type leafref {
623             path "../../vdu/id";
624           }
625         }
626
627         leaf vdu-depends-on-ref {
628           description
629             "Reference to the VDU on which
630             the source VDU depends.";
631           type leafref {
632             path "../../vdu/id";
633           }
634         }
635       }
636
637       leaf service-function-chain {
638         description "Type of node in Service Function Chaining Architecture";
639
640         type enumeration {
641           enum UNAWARE;
642           enum CLASSIFIER;
643           enum SF;
644           enum SFF;
645         }
646         default "UNAWARE";
647       }
648
649       leaf service-function-type {
650         description
651           "Type of Service Function.
652            NOTE: This needs to map with Service Function Type in ODL to
653            support VNFFG. Service Function Type is mandatory param in ODL
654            SFC. This is temporarily set to string for ease of use";
655         type string;
656       }
657
658       uses manotypes:http-endpoints;
659
660       list scaling-group-descriptor {
661         description
662             "scaling group descriptor within the VNF.
663              The scaling group defines a group of VDUs,
664              and the ratio of VDUs in the VNF
665              that is used as target for scaling action";
666
667         key "name";
668
669         leaf name {
670           description "Name of this scaling group.";
671           type string;
672         }
673
674         list scaling-policy {
675
676           key "name";
677
678           leaf name {
679             description
680                 "Name of the scaling policy";
681             type string;
682           }
683
684           leaf scaling-type {
685             description
686                 "Type of scaling";
687             type manotypes:scaling-policy-type;
688           }
689
690           leaf enabled {
691             description
692               "Specifies if the scaling policy can be applied";
693             type boolean;
694             default true;
695           }
696
697           leaf scale-in-operation-type {
698             description
699                 "Operation to be applied to check between scaling criterias to
700                  check if the scale in threshold condition has been met.
701                  Defaults to AND";
702             type manotypes:scaling-criteria-operation;
703             default AND;
704           }
705
706           leaf scale-out-operation-type {
707             description
708                 "Operation to be applied to check between scaling criterias to
709                  check if the scale out threshold condition has been met.
710                  Defauls to OR";
711             type manotypes:scaling-criteria-operation;
712             default OR;
713           }
714
715           leaf threshold-time {
716             description
717               "The duration for which the criteria must hold true";
718             type uint32;
719             mandatory true;
720           }
721
722           leaf cooldown-time {
723             description
724               "The duration after a scaling-in/scaling-out action has been
725               triggered, for which there will be no further optional";
726             type uint32;
727             mandatory true;
728           }
729
730           list scaling-criteria {
731             description
732                 "list of conditions to be met for generating scaling
733                    requests";
734             key "name";
735
736             leaf name {
737               type string;
738             }
739
740             leaf scale-in-threshold {
741               description
742                   "Value below which scale-in requests are generated";
743               type decimal64{
744                 fraction-digits 10;
745              }
746             }
747
748             leaf scale-in-relational-operation {
749               description
750                 "The relational operator used to compare the monitoring param
751                 against the scale-in-threshold.";
752               type manotypes:relational-operation-type;
753               default LE;
754             }
755
756             leaf scale-out-threshold {
757               description
758                   "Value above which scale-out requests are generated";
759               type decimal64{
760                 fraction-digits 10;
761              }
762             }
763
764             leaf scale-out-relational-operation {
765               description
766                 "The relational operator used to compare the monitoring param
767                 against the scale-out-threshold.";
768               type manotypes:relational-operation-type;
769               default GE;
770             }
771
772             leaf vnf-monitoring-param-ref {
773               description
774                  "Reference to the VNF level monitoring parameter
775                   that is aggregated";
776               type leafref {
777                 path "../../../../monitoring-param/id";
778               }
779             }
780           }
781         }
782
783         list vdu {
784           description "List of VDUs in this scaling group";
785           key "vdu-id-ref";
786
787           leaf vdu-id-ref {
788             description "Reference to the VDU id";
789             type leafref {
790               path "../../../vdu/id";
791             }
792           }
793
794           leaf count {
795             description
796               "count of this VDU id within this scaling group.
797                The count allows to define the number of instances
798                when a scaling action targets this scaling group";
799             type uint32;
800             default 1;
801           }
802         }
803
804         leaf min-instance-count {
805           description
806             "Minimum instances of the scaling group which are allowed.
807             These instances are created by default when the network service
808             is instantiated.";
809           type uint32;
810           default 0;
811         }
812
813         leaf max-instance-count {
814           description
815             "Maximum instances of this scaling group that are allowed
816              in a single network service. The network service scaling
817              will fail, when the number of service group instances
818              exceed the max-instance-count specified.";
819           type uint32;
820           default 10;
821         }
822
823         list scaling-config-action {
824           description "List of scaling config actions";
825           key "trigger";
826
827           leaf trigger {
828             description "scaling trigger";
829             type manotypes:scaling-trigger;
830           }
831
832           leaf vnf-config-primitive-name-ref {
833             description "Reference to the VNF config primitive";
834             type leafref {
835               path "../../../vnf-configuration/config-primitive/name";
836             }
837           }
838         }
839       }
840
841       list monitoring-param {
842         description
843           "List of monitoring parameters at the network service level";
844         key id;
845         leaf id {
846           type string;
847         }
848
849         leaf name {
850           type string;
851         }
852
853         uses manotypes:monitoring-param-aggregation;
854
855         choice monitoring-type {
856           description
857             "Defines the type of monitoring param to be used:
858               * vdu-monitorin-param:     VDU-related metric (from NFVI)
859               * vnf-metric:              VNF-related metric (from VCA)
860               * vdu-metric:              VDU-related metric (from VCA)
861             ";
862
863           case vdu-monitoring-param {
864             description "VDU-related metric from the infrastructure";
865             container vdu-monitoring-param {
866               leaf vdu-ref {
867                 type leafref {
868                   path "../../../vdu/id";
869                 }
870               }
871               leaf vdu-monitoring-param-ref {
872                 type leafref {
873                   path "../../../vdu[id = current()/../vdu-ref]/monitoring-param/id";
874                 }
875               }
876             }
877           }
878
879           case vnf-metric {
880             description "VNF-related metric (from VCA)";
881             container vnf-metric {
882               leaf vnf-metric-name-ref {
883                 type leafref {
884                   path "../../../vnf-configuration/metrics/name";
885                 }
886               }
887             }
888           }
889
890           case vdu-metric {
891             description "VDU-related metric (from VCA)";
892             container vdu-metric {
893               leaf vdu-ref {
894                 type leafref {
895                   path "../../../vdu/id";
896                 }
897               }
898               leaf vdu-metric-name-ref {
899                 type leafref {
900                   path "../../../vdu[id = current()/../vdu-ref]/vdu-configuration/metrics/name";
901                 }
902               }
903             }
904           }
905
906         }
907
908         leaf http-endpoint-ref {
909           type leafref {
910             path "../../http-endpoint/path";
911           }
912         }
913
914         leaf json-query-method {
915           type manotypes:json-query-method;
916           default "NAMEKEY";
917         }
918
919         container json-query-params {
920           leaf json-path {
921             description
922               "The jsonpath to use to extract value from JSON structure";
923             type string;
924           }
925           leaf object-path {
926             description
927               "The objectpath to use to extract value from JSON structure";
928             type string;
929           }
930         }
931
932         uses manotypes:monitoring-param-ui-data;
933         uses manotypes:monitoring-param-value;
934
935       }
936
937       list placement-groups {
938         description "List of placement groups at VNF level";
939
940         key "name";
941         uses manotypes:placement-group-info;
942
943         list member-vdus {
944
945           description
946               "List of VDUs that are part of this placement group";
947           key "member-vdu-ref";
948
949           leaf member-vdu-ref {
950             type leafref {
951               path "../../../vdu/id";
952             }
953           }
954         }
955       }
956   }
957 }
958
959 // vim: sw=2