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