Bug 261 Fix NSR member vnf index type for NS service primitive
[osm/SO.git] / models / plugins / yang / mano-types.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 mano-types
22 {
23   namespace "urn:ietf:params:xml:ns:yang:nfvo:mano-types";
24   prefix "manotypes";
25
26   import ietf-inet-types {
27     prefix "inet";
28   }
29
30   import rw-pb-ext {
31     prefix "rwpb";
32   }
33
34   revision 2015-04-23 {
35     description
36       "Initial revision. This YANG file defines
37        the reusable base types for VNF Management
38        and Orchestration (MANO).";
39     reference
40       "Derived from earlier versions of base YANG files";
41   }
42
43   typedef package-type {
44       description "Type of descriptor being on-boarded";
45       type enumeration {
46         enum NSD;
47         enum VNFD;
48       }
49     }
50
51   typedef parameter-data-type {
52     type enumeration {
53       enum STRING;
54       enum INTEGER;
55       enum BOOLEAN;
56     }
57   }
58
59   grouping primitive-parameter-value {
60     list parameter {
61       description
62           "List of parameters to the configuration primitive.";
63       key "name";
64       leaf name {
65         description
66             "Name of the parameter.";
67         type string;
68       }
69
70       leaf value {
71         description
72             "Value associated with the name.";
73         type string;
74       }
75     }
76   }
77
78   grouping primitive-parameter {
79     leaf name {
80       description
81           "Name of the parameter.";
82       type string;
83     }
84
85     leaf data-type {
86       description
87           "Data type associated with the name.";
88       type manotypes:parameter-data-type;
89     }
90
91     leaf mandatory {
92       description "Is this field mandatory";
93       type boolean;
94       default false;
95     }
96
97     leaf default-value {
98       description "The default value for this field";
99       type string;
100     }
101
102     leaf parameter-pool {
103       description "NSD parameter pool name to use for this parameter";
104       type string;
105     }
106
107     leaf read-only {
108       description
109         "The value should be dimmed by the UI.
110         Only applies to parameters with default values.";
111       type boolean;
112     }
113
114     leaf hidden {
115       description
116         "The value should be hidden by the UI.
117         Only applies to parameters with default values.";
118       type boolean;
119     }
120   }
121   
122   grouping ui-primitive-group {
123     list parameter-group {
124       description
125             "Grouping of parameters which are logically grouped in UI";
126       key "name";
127  
128       leaf name {
129         description
130             "Name of the parameter group";
131         type string;
132       }
133  
134       list parameter {
135         description
136             "List of parameters for the service primitive.";
137         key "name";
138         uses manotypes:primitive-parameter;
139       }
140  
141       leaf mandatory {
142         description "Is this parameter group mandatory";
143         type boolean;
144         default true;
145       }
146     }
147   }
148
149   grouping image-properties {
150     leaf image {
151       description
152             "Image name for the software image.
153              If the image name is found within the VNF package it will
154              be uploaded to all VIM accounts during onboarding process.
155              Otherwise, the image must be added to the VIM account with
156              the same name as entered here.
157             ";
158       type string;
159     }
160
161     leaf image-checksum {
162       description
163             "Image md5sum for the software image.
164             The md5sum, if provided, along with the image name uniquely
165             identifies an image uploaded to the CAL.
166             ";
167       type string;
168     } 
169   }
170   grouping initial-config {
171     leaf seq {
172       description
173           "Sequence number for the configuration primitive.";
174       type uint64;
175     }
176
177     leaf name {
178       description
179           "Name of the configuration primitive.";
180       type string;
181       mandatory "true";
182     }
183
184     leaf user-defined-script {
185       description
186           "A user defined script.";
187       type string;
188     }
189
190     list parameter {
191       key "name";
192       leaf name {
193         type string;
194       }
195
196       leaf value {
197         description "Value of the configuration primitive.";
198         type string;
199       }
200     }
201   }
202
203   grouping vnf-configuration {
204     container vnf-configuration {
205       rwpb:msg-new VnfConfiguration;
206       description
207           "Information about the VNF configuration. Note: 
208            If the NS contains multiple instances of the
209            same VNF, each instance could have a different
210            configuration.";
211
212       choice config-method {
213         description
214             "Defines the configuration method for the VNF.";
215         case script {
216           description
217               "Use custom script for configuring the VNF.
218                This script is executed in the context of
219                Orchestrator (The same system and environment
220                as the Launchpad).";
221           container script {
222             leaf script-type {
223               description
224                   "Script type - currently supported : python";
225               type enumeration {
226                 enum python;
227               }
228             }
229           }
230         }
231
232         case juju {
233           description
234             "Configure the VNF through Juju.";
235           container juju {
236             leaf charm {
237               description "Juju charm to use with the VNF.";
238               type string;
239             }
240           }
241         }
242       }
243
244       container config-attributes {
245         description
246             "Miscellaneous input parameters to be considered
247              while processing the NSD to apply configuration";
248
249         leaf config-priority {
250           description
251               "Configuration priority - order of configuration
252                to be applied to each VNF in this NS. A low
253                number takes precedence over a high number";
254           type uint64;
255         }
256
257         leaf config-delay {
258           description 
259               "Wait (seconds) before applying the configuration to VNF";
260           type uint64;
261         }
262       }
263
264       list service-primitive {
265         rwpb:msg-new ServicePrimitive;
266         description
267           "List of service primitives supported by the
268           configuration agent for this VNF.";
269         key "name";
270
271         leaf name {
272           description
273             "Name of the service primitive.";
274           type string;
275         }
276
277         list parameter {
278           description
279             "List of parameters to the service primitive.";
280           key "name";
281           uses primitive-parameter;
282         }
283       }
284
285       list initial-config-primitive {
286         rwpb:msg-new InitialConfigPrimitive;
287         description
288           "Initial set of configuration primitives.";
289         key "seq";
290         uses initial-config;
291       }
292     }
293   } // END - grouping vnf-configuration
294
295   typedef virtual-link-type {
296     description
297         "Type of virtual link
298          ELAN: A multipoint service connecting a set of VNFs
299          // ELINE: For a simple point to point connection
300          //        between a VNF and the existing network.
301          // ETREE: A multipoint service connecting one or
302          //        more roots and a set of leaves, but
303          //        preventing inter-leaf communication.";
304     type enumeration {
305       enum ELAN;
306       // enum ETREE;
307       // enum ELINE;
308     }
309   }
310
311   grouping named-value {
312     leaf name {
313       type string;
314     }
315
316     leaf value {
317       type string;
318     }
319   }
320
321   typedef http-method {
322     description
323       "Type of HTTP operation";
324
325     type enumeration {
326       enum POST;
327       enum PUT;
328       enum GET;
329       enum DELETE;
330       enum OPTIONS;
331       enum PATCH;
332     }
333   }
334
335   typedef api-type {
336     description
337       "Type of API to fetch monitoring parameters";
338
339     type enumeration {
340       enum HTTP;
341       enum NETCONF;
342       enum SOAP;
343     }
344   }
345
346   typedef json-query-method {
347     description
348       "The method to extract a value from a JSON response
349
350        NAMEKEY - Use the name as the key for a non-nested value.
351        JSONPATH - Use jsonpath-rw implementation to extract a value.
352        OBJECTPATH - Use objectpath implementation to extract a value.";
353       type enumeration {
354         enum NAMEKEY;
355         enum JSONPATH;
356         enum OBJECTPATH;
357       }
358   }
359
360   typedef param-value-type {
361     description
362       "The type of the parameter value";
363     type enumeration {
364        enum INT;
365        enum DECIMAL;
366        enum STRING;
367     }
368   }
369
370   typedef connection-point-type {
371     description
372         "Type of connection point
373         VPORT: Virtual Port
374         // VNIC_ADDR: Virtual NIC Address
375         // PNIC_ADDR: Physical NIC Address
376         // PPORT: Physical Port.";
377
378     type enumeration {
379       enum VPORT;
380     }
381   }
382
383   typedef widget-type {
384     description
385         "Type of the widget, typically used by the UI.";
386     type enumeration {
387       enum HISTOGRAM;
388       enum BAR;
389       enum GAUGE;
390       enum SLIDER;
391       enum COUNTER;
392       enum TEXTBOX;
393     }
394   }
395
396   typedef cpu-feature-type {
397     description
398         "Enumeration for CPU features.
399
400          AES: CPU supports advanced instruction set for
401          AES (Advanced Encryption Standard).
402
403          CAT: Cache Allocation Technology (CAT) allows
404          an Operating System, Hypervisor, or similar
405          system management agent to specify the amount
406          of L3 cache (currently the last-level cache
407          in most server and client platforms) space an
408          application can fill (as a hint to hardware
409          functionality, certain features such as power
410          management may override CAT settings).
411
412          CMT: Cache Monitoring Technology (CMT) allows
413          an Operating System, Hypervisor, or similar
414          system management agent to determine the
415          usage of cache based on applications running
416          on the platform. The implementation is
417          directed at L3 cache monitoring (currently
418          the last-level cache in most server and
419          client platforms).
420
421          DDIO: Intel Data Direct I/O (DDIO) enables
422          Ethernet server NICs and controllers talk
423          directly to the processor cache without a
424          detour via system memory. This enumeration
425          specifies if the VM requires a DDIO
426          capable host.";
427
428     type enumeration {
429       enum PREFER_AES;
430       enum REQUIRE_AES;
431       enum PREFER_CAT;
432       enum REQUIRE_CAT;
433       enum PREFER_CMT;
434       enum REQUIRE_CMT;
435       enum PREFER_DDIO;
436       enum REQUIRE_DDIO;
437       enum REQUIRE_VME;
438       enum PREFER_VME;
439       enum REQUIRE_DE;
440       enum PREFER_DE;
441       enum REQUIRE_PSE;
442       enum PREFER_PSE;
443       enum REQUIRE_TSC;
444       enum PREFER_TSC;
445       enum REQUIRE_MSR;
446       enum PREFER_MSR;
447       enum REQUIRE_PAE;
448       enum PREFER_PAE;
449       enum REQUIRE_MCE;
450       enum PREFER_MCE;
451       enum REQUIRE_CX8;
452       enum PREFER_CX8;
453       enum REQUIRE_APIC;
454       enum PREFER_APIC;
455       enum REQUIRE_SEP;
456       enum PREFER_SEP;
457       enum REQUIRE_MTRR;
458       enum PREFER_MTRR;
459       enum REQUIRE_PGE;
460       enum PREFER_PGE;
461       enum REQUIRE_MCA;
462       enum PREFER_MCA;
463       enum REQUIRE_CMOV;
464       enum PREFER_CMOV;
465       enum REQUIRE_PAT;
466       enum PREFER_PAT;
467       enum REQUIRE_PSE36;
468       enum PREFER_PSE36;
469       enum REQUIRE_CLFLUSH;
470       enum PREFER_CLFLUSH;
471       enum REQUIRE_DTS;
472       enum PREFER_DTS;
473       enum REQUIRE_ACPI;
474       enum PREFER_ACPI;
475       enum REQUIRE_MMX;
476       enum PREFER_MMX;
477       enum REQUIRE_FXSR;
478       enum PREFER_FXSR;
479       enum REQUIRE_SSE;
480       enum PREFER_SSE;
481       enum REQUIRE_SSE2;
482       enum PREFER_SSE2;
483       enum REQUIRE_SS;
484       enum PREFER_SS;
485       enum REQUIRE_HT;
486       enum PREFER_HT;
487       enum REQUIRE_TM;
488       enum PREFER_TM;
489       enum REQUIRE_IA64;
490       enum PREFER_IA64;
491       enum REQUIRE_PBE;
492       enum PREFER_PBE;
493       enum REQUIRE_RDTSCP;
494       enum PREFER_RDTSCP;
495       enum REQUIRE_PNI;
496       enum PREFER_PNI;
497       enum REQUIRE_PCLMULQDQ;
498       enum PREFER_PCLMULQDQ;
499       enum REQUIRE_DTES64;
500       enum PREFER_DTES64;
501       enum REQUIRE_MONITOR;
502       enum PREFER_MONITOR;
503       enum REQUIRE_DS_CPL;
504       enum PREFER_DS_CPL;
505       enum REQUIRE_VMX;
506       enum PREFER_VMX;
507       enum REQUIRE_SMX;
508       enum PREFER_SMX;
509       enum REQUIRE_EST;
510       enum PREFER_EST;
511       enum REQUIRE_TM2;
512       enum PREFER_TM2;
513       enum REQUIRE_SSSE3;
514       enum PREFER_SSSE3;
515       enum REQUIRE_CID;
516       enum PREFER_CID;
517       enum REQUIRE_FMA;
518       enum PREFER_FMA;
519       enum REQUIRE_CX16;
520       enum PREFER_CX16;
521       enum REQUIRE_XTPR;
522       enum PREFER_XTPR;
523       enum REQUIRE_PDCM;
524       enum PREFER_PDCM;
525       enum REQUIRE_PCID;
526       enum PREFER_PCID;
527       enum REQUIRE_DCA;
528       enum PREFER_DCA;
529       enum REQUIRE_SSE4_1;
530       enum PREFER_SSE4_1;
531       enum REQUIRE_SSE4_2;
532       enum PREFER_SSE4_2;
533       enum REQUIRE_X2APIC;
534       enum PREFER_X2APIC;
535       enum REQUIRE_MOVBE;
536       enum PREFER_MOVBE;
537       enum REQUIRE_POPCNT;
538       enum PREFER_POPCNT;
539       enum REQUIRE_TSC_DEADLINE_TIMER;
540       enum PREFER_TSC_DEADLINE_TIMER;
541       enum REQUIRE_XSAVE;
542       enum PREFER_XSAVE;
543       enum REQUIRE_AVX;
544       enum PREFER_AVX;
545       enum REQUIRE_F16C;
546       enum PREFER_F16C;
547       enum REQUIRE_RDRAND;
548       enum PREFER_RDRAND;
549       enum REQUIRE_FSGSBASE;
550       enum PREFER_FSGSBASE;
551       enum REQUIRE_BMI1;
552       enum PREFER_BMI1;
553       enum REQUIRE_HLE;
554       enum PREFER_HLE;
555       enum REQUIRE_AVX2;
556       enum PREFER_AVX2;
557       enum REQUIRE_SMEP;
558       enum PREFER_SMEP;
559       enum REQUIRE_BMI2;
560       enum PREFER_BMI2;
561       enum REQUIRE_ERMS;
562       enum PREFER_ERMS;
563       enum REQUIRE_INVPCID;
564       enum PREFER_INVPCID;
565       enum REQUIRE_RTM;
566       enum PREFER_RTM;
567       enum REQUIRE_MPX;
568       enum PREFER_MPX;
569       enum REQUIRE_RDSEED;
570       enum PREFER_RDSEED;
571       enum REQUIRE_ADX;
572       enum PREFER_ADX;
573       enum REQUIRE_SMAP;
574       enum PREFER_SMAP;
575     }
576   }
577
578   grouping vm-flavor {
579     container vm-flavor {
580       leaf vcpu-count {
581         description
582             "Number of VCPUs for the VM.";
583         type uint16;
584       }
585
586       leaf memory-mb {
587         description
588             "Amount of memory in MB.";
589         type uint64;
590       }
591
592       leaf storage-gb {
593         description
594             "Amount of disk space in GB.";
595         type uint64;
596       }
597     }
598   } //grouping vm-flavor
599
600   grouping vswitch-epa {
601     container vswitch-epa {
602       leaf ovs-acceleration {
603         description
604             "Specifies Open vSwitch acceleration mode.
605              MANDATORY: OVS acceleration is required
606              PREFERRED: OVS acceleration is preferred";
607         type enumeration {
608           enum MANDATORY;
609           enum PREFERRED;
610           enum DISABLED;
611         }
612       }
613
614       leaf ovs-offload {
615         description
616             "Specifies Open vSwitch hardware offload mode.
617              MANDATORY: OVS offload is required
618              PREFERRED: OVS offload is preferred";
619         type enumeration {
620           enum MANDATORY;
621           enum PREFERRED;
622           enum DISABLED;
623         }
624       }
625     }
626   }
627
628   grouping hypervisor-epa {
629     container hypervisor-epa {
630       leaf type {
631         description
632             "Specifies the type of hypervisor.
633              KVM: KVM
634              XEN: XEN";
635         type enumeration {
636           enum PREFER_KVM;
637           enum REQUIRE_KVM;
638         }
639       }
640       leaf version {
641         type string;
642       }
643     }
644   }
645
646   grouping host-epa {
647     container host-epa {
648       description "Specifies the host level EPA attributes.";
649       leaf cpu-model {
650         description
651             "Host CPU model. Examples include: SandyBridge,
652              IvyBridge";
653         type enumeration {
654           enum PREFER_WESTMERE;
655           enum REQUIRE_WESTMERE;
656           enum PREFER_SANDYBRIDGE;
657           enum REQUIRE_SANDYBRIDGE;
658           enum PREFER_IVYBRIDGE;
659           enum REQUIRE_IVYBRIDGE;
660           enum PREFER_HASWELL;
661           enum REQUIRE_HASWELL;
662           enum PREFER_BROADWELL;
663           enum REQUIRE_BROADWELL;
664           enum PREFER_NEHALEM;
665           enum REQUIRE_NEHALEM;
666           enum PREFER_PENRYN;
667           enum REQUIRE_PENRYN;
668           enum PREFER_CONROE;
669           enum REQUIRE_CONROE;
670           enum PREFER_CORE2DUO;
671           enum REQUIRE_CORE2DUO;
672         }
673       }
674
675       leaf cpu-arch {
676         description "Host CPU architecture.";
677         type enumeration {
678           enum PREFER_X86;
679           enum REQUIRE_X86;
680           enum PREFER_X86_64;
681           enum REQUIRE_X86_64;
682           enum PREFER_I686;
683           enum REQUIRE_I686;
684           enum PREFER_IA64;
685           enum REQUIRE_IA64;
686           enum PREFER_ARMV7;
687           enum REQUIRE_ARMV7;
688           enum PREFER_ARMV8;
689           enum REQUIRE_ARMV8;
690         }
691       }
692
693       leaf cpu-vendor {
694         description "Host CPU Vendor.";
695         type enumeration {
696           enum PREFER_INTEL;
697           enum REQUIRE_INTEL;
698           enum PREFER_AMD;
699           enum REQUIRE_AMD;
700         }
701       }
702
703       leaf cpu-socket-count {
704         description "Number of sockets on the host.";
705         type uint64;
706       }
707
708       leaf cpu-core-count {
709         description "Number of cores on the host.";
710         type uint64;
711       }
712
713       leaf cpu-core-thread-count {
714         description "Number of threads per cores on the host.";
715         type uint64;
716       }
717       
718       list cpu-feature {
719         key "feature";
720         description "List of CPU features.";
721         leaf feature {
722           description "CPU feature.";
723           type cpu-feature-type;
724         }
725       }
726
727       
728       leaf om-cpu-model-string {
729         description "OpenMANO CPU model string";
730         type string;
731       }
732
733       list om-cpu-feature {
734         key "feature";
735         description "List of OpenMANO CPU features";
736         leaf feature {
737           description "CPU feature";
738           type string;
739         }
740       }
741     }
742   }
743
744   grouping guest-epa {
745     description "EPA attributes for the guest";
746     container guest-epa {
747       leaf trusted-execution {
748         description "This VM should be allocated from trusted pool";
749         type boolean;
750       }
751
752       leaf mempage-size {
753         description
754             "Memory page allocation size. If a VM requires
755              hugepages, it should choose LARGE or SIZE_2MB
756              or SIZE_1GB. If the VM prefers hugepages it
757              should choose PREFER_LARGE.
758              LARGE        : Require hugepages (either 2MB or 1GB)
759              SMALL        : Doesn't require hugepages
760              SIZE_2MB     : Requires 2MB hugepages
761              SIZE_1GB     : Requires 1GB hugepages
762              PREFER_LARGE : Application prefers hugepages";
763         type enumeration {
764           enum LARGE;
765           enum SMALL;
766           enum SIZE_2MB;
767           enum SIZE_1GB;
768           enum PREFER_LARGE;
769         }
770       }
771
772       leaf cpu-pinning-policy {
773         description
774             "CPU pinning policy describes association
775              between virtual CPUs in guest and the
776              physical CPUs in the host.
777              DEDICATED : Virtual CPUs are pinned to
778                          physical CPUs
779              SHARED    : Multiple VMs may share the
780                          same physical CPUs.
781              ANY       : Any policy is acceptable for the VM";
782         type enumeration {
783           enum DEDICATED;
784           enum SHARED;
785           enum ANY;
786         }
787         default "ANY";
788       }
789
790       leaf cpu-thread-pinning-policy {
791           description
792             "CPU thread pinning policy describes how to
793              place the guest CPUs when the host supports
794              hyper threads:
795              AVOID   : Avoids placing a guest on a host
796                        with threads.
797              SEPARATE: Places vCPUs on separate cores,
798                        and avoids placing two vCPUs on
799                        two threads of same core.
800              ISOLATE : Places each vCPU on a different core,
801                        and places no vCPUs from a different
802                        guest on the same core.
803              PREFER  : Attempts to place vCPUs on threads
804                        of the same core.";
805         type enumeration {
806           enum AVOID;
807           enum SEPARATE;
808           enum ISOLATE;
809           enum PREFER;
810         }
811       }
812
813       list pcie-device {
814         description
815             "List of pcie passthrough devices.";
816         key device-id;
817         leaf device-id {
818           description
819               "Device identifier.";
820           type string;
821         }
822         leaf count {
823           description
824               "Number of devices to attach to the VM.";
825           type uint64;
826         }
827       }
828
829       choice numa-policy {
830         case numa-unaware {
831           leaf numa-unaware {
832             type empty;
833           }
834         }
835
836         case numa-aware {
837           container numa-node-policy {
838             description
839                 "This policy defines NUMA topology of the
840                  guest. Specifically identifies if the guest
841                  should be run on a host with one NUMA
842                  node or multiple NUMA nodes. As an example
843                  a guest might need 8 VCPUs and 4 GB of
844                  memory. However, it might need the VCPUs
845                  and memory distributed across multiple
846                  NUMA nodes. In this scenario, NUMA node
847                  1 could run with 6 VCPUs and 3GB, and
848                  NUMA node 2 could run with 2 VCPUs and
849                  1GB.";
850
851             leaf node-cnt {
852               description
853                   "The number of NUMA nodes to expose to the VM.";
854               type uint16;
855             }
856
857             leaf mem-policy {
858               description
859                   "This policy specifies how the memory should
860                    be allocated in a multi-node scenario.
861                    STRICT    : The memory must be allocated
862                                strictly from the memory attached
863                                to the NUMA node.
864                    PREFERRED : The memory should be allocated
865                                preferentially from the memory
866                                attached to the NUMA node";
867               type enumeration {
868                 enum STRICT;
869                 enum PREFERRED;
870               }
871             }
872
873            list node {
874               key id;
875               leaf id {
876                 description
877                     "NUMA node identification. Typically
878                      it's 0 or 1";
879                 type uint64;
880               }
881
882               list vcpu {
883                 key "id";
884                 description
885                     "List of VCPUs to allocate on
886                      this NUMA node.";
887                 leaf id {
888                   type uint64;
889                   description "List of VCPUs ids to allocate on
890                                this NUMA node";
891                 }
892               }
893
894               leaf memory-mb {
895                 description
896                     "Memory size expressed in MB
897                      for this NUMA node.";
898                 type uint64;
899               }
900
901               choice om-numa-type {
902                 description
903                     "OpenMANO Numa type selection";
904
905                 case cores {
906                   leaf num-cores {
907                     type uint8;
908                   }
909                 }
910
911                 case paired-threads {
912                   container paired-threads {
913                     leaf num-paired-threads {
914                       type uint8;
915                     }
916
917                     list paired-thread-ids {
918                       description
919                           "List of thread pairs to use in case of paired-thread NUMA";
920                       max-elements 16;
921                       key thread-a;
922
923                       leaf thread-a {
924                           type uint8;
925                       }
926
927                       leaf thread-b {
928                           type uint8;
929                       }
930                     }
931                   }
932                 }
933                 case threads {
934                   leaf num-threads {
935                     type uint8;
936                   }
937                 }
938               }
939             }
940
941           }
942         }
943       }
944     }
945   }
946
947   grouping provider-network {
948     container provider-network {
949       description "Container for the provider network.";
950       leaf physical-network {
951         description
952             "Name of the physical network on which the provider
953              network is built.";
954         type string;
955       }
956
957       leaf overlay-type {
958         description
959             "Type of the overlay network.
960              LOCAL - Provider network implemented in a single compute node
961              FLAT - Provider network shared by all tenants 
962              VLAN - Provider network implemented using 802.1Q tagging
963              VXLAN - Provider networks implemented using RFC 7348
964              GRE - Provider networks implemented using GRE tunnels";
965         type enumeration {
966           enum LOCAL;
967           enum FLAT;
968           enum VLAN;
969           enum VXLAN;
970           enum GRE;
971         }
972       }
973       leaf segmentation_id {
974         description
975             "ID of segregated virtual networks";
976             type uint32;
977       }
978     }
979   }
980
981   grouping monitoring-param {
982     list http-endpoint {
983       description
984           "List of http endpoints to be used by monitoring params";
985       key path;
986
987       leaf path {
988         description "The HTTP path on the management server";
989         type string;
990       }
991
992       leaf https {
993         description "Pick HTTPS instead of HTTP , Default is false";
994         type boolean;
995         default "false";
996       }
997
998       leaf port {
999         description "The HTTP port to connect to";
1000         type inet:port-number;
1001       }
1002
1003       leaf username {
1004         description "The HTTP basic auth username";
1005         type string;
1006       }
1007
1008       leaf password {
1009         description "The HTTP basic auth password";
1010         type string;
1011       }
1012
1013       leaf polling-interval-secs {
1014         description "The HTTP polling interval in seconds";
1015         type uint8;
1016         default 2;
1017       }
1018
1019       leaf method {
1020         description
1021           "Method that the URI should perform.
1022            Deafult action is GET.";
1023
1024         type manotypes:http-method;
1025         default "GET";
1026       }
1027
1028       list headers {
1029         description "Custom HTTP headers to put on HTTP request";
1030         key key;
1031         leaf key{
1032           description "HTTP header key";
1033           type string;
1034         }
1035
1036         leaf value{
1037           description "HTTP header value";
1038           type string;
1039         }
1040       }
1041     }
1042
1043     list monitoring-param {
1044       description
1045           "List of monitoring parameters at the network service level";
1046       key id;
1047       leaf id {
1048         type string;
1049       }
1050
1051       leaf name {
1052         type string;
1053       }
1054
1055       leaf http-endpoint-ref {
1056         type leafref {
1057           path "../../http-endpoint/path";
1058         }
1059       }
1060
1061       leaf json-query-method {
1062         type json-query-method;
1063         default "NAMEKEY";
1064       }
1065
1066       container json-query-params {
1067         leaf json-path {
1068           description
1069             "The jsonpath to use to extract value from JSON structure";
1070           type string;
1071         }
1072         leaf object-path {
1073           description
1074             "The objectpath to use to extract value from JSON structure";
1075           type string;
1076         }
1077       }
1078
1079       uses monitoring-param-ui-data;
1080       uses monitoring-param-value;
1081
1082     }
1083   }
1084
1085   grouping monitoring-param-aggregation {
1086     typedef aggregation-type {
1087       description "aggregation-type";
1088       type enumeration {
1089         enum AVERAGE;
1090         enum MINIMUM;
1091         enum MAXIMUM;
1092         enum COUNT;
1093         enum SUM;
1094       }
1095     }
1096
1097     leaf aggregation-type {
1098       type aggregation-type;
1099     }
1100   }
1101
1102   grouping monitoring-param-ui-data {
1103       leaf description {
1104         type string;
1105       }
1106
1107       leaf group-tag {
1108         description "A tag to group monitoring parameters";
1109         type string;
1110       }
1111
1112
1113       leaf widget-type {
1114         description "Defines the UI Display variant of measured counters.";
1115         type manotypes:widget-type;
1116       }
1117
1118       leaf units {
1119         description "Measured Counter Units (e.g., Packets, Kbps, Mbps, etc.)";
1120         type string;
1121       }
1122   }
1123
1124   grouping monitoring-param-value {
1125       leaf value-type {
1126         type param-value-type;
1127         default "INT";
1128       }
1129
1130       container numeric-constraints {
1131         leaf min-value {
1132           description
1133               "Minimum value for the parameter";
1134           type uint64;
1135         }
1136         leaf max-value {
1137           description
1138               "Maximum value for the parameter";
1139           type uint64;
1140         }
1141       }
1142
1143       container text-constraints {
1144         leaf min-length {
1145           description
1146               "Minimum string length for the parameter";
1147           type uint8;
1148         }
1149         leaf max-length {
1150           description
1151               "Maximum string length for the parameter";
1152           type uint8;
1153         }
1154       }
1155
1156       leaf value-integer {
1157         description
1158             "Current value for an integer parameter";
1159         type int64;
1160       }
1161
1162       leaf value-decimal {
1163         description
1164             "Current value for a decimal parameter";
1165         type decimal64 {
1166           fraction-digits 4;
1167         }
1168       }
1169
1170       leaf value-string {
1171         description
1172             "Current value for a string parameter";
1173         type string;
1174       }
1175   }
1176
1177   grouping control-param {
1178     list control-param {
1179       description
1180           "List of control parameters to manage and
1181            update the running configuration of the VNF";
1182       key id;
1183
1184       leaf id {
1185         description "Identifier for control parameter";
1186         type string;
1187       }
1188
1189       leaf name {
1190         description "Name of a control parameter";
1191         type string;
1192       }
1193
1194       leaf description {
1195         description "A description of the control parameter";
1196         type string;
1197       }
1198
1199       leaf group-tag {
1200         description "A tag to group control parameters";
1201         type string;
1202       }
1203
1204       leaf min-value {
1205         description
1206             "Minimum value for the parameter";
1207         type uint64;
1208       }
1209
1210       leaf max-value {
1211         description
1212             "Maximum value for the parameter";
1213         type uint64;
1214       }
1215
1216       leaf current-value {
1217         description
1218             "Current value for the parameter";
1219         type uint64;
1220       }
1221
1222       leaf step-value {
1223         description
1224             "Step value for the parameter";
1225         type uint64;
1226       }
1227
1228       leaf units {
1229         type string;
1230       }
1231
1232       leaf widget-type {
1233         type manotypes:widget-type;
1234       }
1235
1236       leaf url {
1237         description
1238           "This is the URL where the operation should be performed.";
1239
1240         type inet:uri;
1241       }
1242
1243       leaf method {
1244         description
1245           "Method that the URI should perform.
1246            Default Action is POST";
1247
1248         type manotypes:http-method;
1249         default "POST";
1250       }
1251
1252       leaf payload {
1253         description
1254           "This is the operation payload or payload template as stringified
1255            JSON. This field provides the data  to be sent for this operation
1256            call";
1257
1258         type string;
1259       }
1260     }
1261   }
1262
1263   grouping action-param {
1264     list action-param {
1265       description
1266           "List of action parameters to
1267            control VNF";
1268       key id;
1269       leaf id {
1270         type string;
1271       }
1272
1273       leaf name {
1274         type string;
1275       }
1276
1277       leaf description {
1278         type string;
1279       }
1280
1281       leaf group-tag {
1282         description "A tag to group monitoring parameter";
1283         type string;
1284       }
1285
1286       leaf url {
1287         description
1288           "This is the URL where to perform the operation";
1289         type inet:uri;
1290       }
1291
1292       leaf method {
1293         description
1294           "This is the method to be performed at the uri.
1295            POST by default for action";
1296
1297         type manotypes:http-method;
1298         default "POST";
1299       }
1300
1301       leaf payload {
1302         description
1303           "This is the operation payload or payload template to be sent in
1304            the data for this operation call";
1305
1306         type string;
1307       }
1308     }
1309   }
1310
1311   grouping input-parameter {
1312     description "List of input parameters that can be specified when instantiating a network service.";
1313
1314     list input-parameter {
1315       description
1316           "List of input parameters";
1317
1318       key xpath;
1319
1320
1321       leaf xpath {
1322         description
1323           "An xpath that specfies which element in a descriptor is to be
1324           modified.";
1325         type string;
1326       }
1327
1328       leaf value {
1329         description
1330           "The value that the element specified by the xpath should take when a
1331           record is created.";
1332         type string;
1333       }
1334     }
1335   }
1336
1337   grouping input-parameter-xpath {
1338     list input-parameter-xpath {
1339       description
1340           "List of xpaths to parameters inside the NSD
1341            the can be customized during the instantiation.";
1342
1343       key "xpath";
1344       leaf xpath {
1345         description
1346             "An xpath that specifies the element in a descriptor.";
1347         type string;
1348       }
1349
1350       leaf label {
1351         description "A descriptive string";
1352         type string;
1353       }
1354
1355       leaf default-value {
1356         description "/nsd:nsd-catalog/nsd:nsd/nsd:vendor";
1357         type string;
1358       }
1359     }
1360   }
1361
1362   grouping nfvi-metrics {
1363     container vcpu {
1364       leaf label {
1365         description
1366           "Label to show in UI";
1367         type string;
1368         default "VCPU";
1369       }
1370
1371       leaf total {
1372         description
1373           "The total number of VCPUs available.";
1374         type uint64;
1375       }
1376
1377       leaf utilization {
1378         description
1379           "The VCPU utilization (percentage).";
1380         type decimal64 {
1381           fraction-digits 2;
1382           range "0 .. 100";
1383         }
1384       }
1385     }
1386
1387     container memory {
1388       leaf label {
1389         description
1390           "Label to show in UI";
1391         type string;
1392         default "MEMORY";
1393       }
1394
1395       leaf used {
1396         description
1397           "The amount of memory (bytes) currently in use.";
1398         type uint64;
1399       }
1400
1401       leaf total {
1402         description
1403           "The amount of memory (bytes) available.";
1404         type uint64;
1405       }
1406
1407       leaf utilization {
1408         description
1409           "The memory utilization (percentage).";
1410         type decimal64 {
1411           fraction-digits 2;
1412           range "0 .. 100";
1413         }
1414       }
1415     }
1416
1417     container storage {
1418       leaf label {
1419         description
1420           "Label to show in UI";
1421         type string;
1422         default "STORAGE";
1423       }
1424
1425       leaf used {
1426         description
1427           "The amount of storage (bytes) currently in use.";
1428         type uint64;
1429       }
1430
1431       leaf total {
1432         description
1433           "The amount of storage (bytes) available.";
1434         type uint64;
1435       }
1436
1437       leaf utilization {
1438         description
1439           "The storage utilization (percentage).";
1440         type decimal64 {
1441           fraction-digits 2;
1442           range "0 .. 100";
1443         }
1444       }
1445     }
1446
1447     container external-ports {
1448       leaf label {
1449         description
1450           "Label to show in UI";
1451         type string;
1452         default "EXTERNAL PORTS";
1453       }
1454
1455       leaf total {
1456         description
1457           "The total number of external ports.";
1458         type uint64;
1459       }
1460     }
1461
1462     container internal-ports {
1463       leaf label {
1464         description
1465           "Label to show in UI";
1466         type string;
1467         default "INTERNAL PORTS";
1468       }
1469
1470       leaf total {
1471         description
1472           "The total number of internal ports.";
1473         type uint64;
1474       }
1475     }
1476
1477     container network {
1478       leaf label {
1479         description
1480           "Label to show in UI";
1481         type string;
1482         default "NETWORK TRAFFIC";
1483       }
1484
1485       container incoming {
1486         leaf label {
1487           description
1488             "Label to show in UI";
1489           type string;
1490           default "INCOMING NETWORK TRAFFIC";
1491         }
1492
1493         leaf bytes {
1494           description
1495             "The cumulative number of incoming bytes.";
1496           type uint64;
1497         }
1498
1499         leaf packets {
1500           description
1501             "The cumulative number of incoming packets.";
1502           type uint64;
1503         }
1504
1505         leaf byte-rate {
1506           description
1507             "The current incoming byte-rate (bytes per second).";
1508           type decimal64 {
1509             fraction-digits 2;
1510           }
1511         }
1512
1513         leaf packet-rate {
1514           description
1515             "The current incoming packet (packets per second).";
1516           type decimal64 {
1517             fraction-digits 2;
1518           }
1519         }
1520       }
1521
1522       container outgoing {
1523         leaf label {
1524           description
1525             "Label to show in UI";
1526           type string;
1527           default "OUTGOING NETWORK TRAFFIC";
1528         }
1529
1530         leaf bytes {
1531           description
1532             "The cumulative number of outgoing bytes.";
1533           type uint64;
1534         }
1535
1536         leaf packets {
1537           description
1538             "The cumulative number of outgoing packets.";
1539           type uint64;
1540         }
1541
1542         leaf byte-rate {
1543           description
1544             "The current outgoing byte-rate (bytes per second).";
1545           type decimal64 {
1546             fraction-digits 2;
1547           }
1548         }
1549
1550         leaf packet-rate {
1551           description
1552             "The current outgoing packet (packets per second).";
1553           type decimal64 {
1554             fraction-digits 2;
1555           }
1556         }
1557       }
1558     }
1559   }
1560
1561   typedef alarm-severity-type {
1562     description "An indication of the importance or urgency of the alarm";
1563     type enumeration {
1564       enum LOW;
1565       enum MODERATE;
1566       enum CRITICAL;
1567     }
1568   }
1569
1570   typedef alarm-metric-type {
1571     description "The type of metrics to register the alarm for";
1572     type enumeration {
1573       enum CPU_UTILIZATION;
1574       enum MEMORY_UTILIZATION;
1575       enum STORAGE_UTILIZATION;
1576     }
1577   }
1578
1579   typedef alarm-statistic-type {
1580     description
1581         "Statistic type to use to determine threshold crossing
1582          for an alarm.";
1583     type enumeration {
1584       enum AVERAGE;
1585       enum MINIMUM;
1586       enum MAXIMUM;
1587       enum COUNT;
1588       enum SUM;
1589     }
1590   }
1591
1592   typedef alarm-operation-type {
1593     description
1594         "The relational operator used to define whether an alarm
1595         should be triggered in certain scenarios, such as if the
1596         metric statistic goes above or below a specified value.";
1597     type enumeration {
1598       enum GE; // greater than or equal
1599       enum LE; // less than or equal
1600       enum GT; // greater than
1601       enum LT; // less than
1602       enum EQ; // equal
1603     }
1604   }
1605
1606   grouping alarm {
1607     leaf alarm-id {
1608       description
1609           "This field is reserved for the identifier assigned by the VIM provider";
1610
1611       type string;
1612     }
1613
1614     leaf name {
1615       description "A human readable string to identify the alarm";
1616       type string;
1617     }
1618
1619     leaf description {
1620       description "A description of this alarm";
1621       type string;
1622     }
1623
1624     leaf vdur-id {
1625       description
1626           "The identifier of the VDUR that the alarm is associated with";
1627       type string;
1628     }
1629
1630     container actions {
1631       list ok {
1632         key "url";
1633         leaf url {
1634           type string;
1635         }
1636       }
1637
1638       list insufficient-data {
1639         key "url";
1640         leaf url {
1641           type string;
1642         }
1643       }
1644
1645       list alarm {
1646         key "url";
1647         leaf url {
1648           type string;
1649         }
1650       }
1651     }
1652
1653     leaf repeat {
1654       description
1655           "This flag indicates whether the alarm should be repeatedly emitted
1656           while the associated threshold has been crossed.";
1657
1658       type boolean;
1659       default true;
1660     }
1661
1662     leaf enabled {
1663       description
1664           "This flag indicates whether the alarm has been enabled or
1665           disabled.";
1666
1667       type boolean;
1668       default true;
1669     }
1670
1671     leaf severity {
1672       description "A measure of the importance or urgency of the alarm";
1673       type alarm-severity-type;
1674     }
1675
1676     leaf metric {
1677       description "The metric to be tracked by this alarm.";
1678       type alarm-metric-type;
1679     }
1680
1681     leaf statistic {
1682       description "The type of metric statistic that is tracked by this alarm";
1683       type alarm-statistic-type;
1684     }
1685
1686     leaf operation {
1687       description
1688           "The relational operator used to define whether an alarm should be
1689            triggered in certain scenarios, such as if the metric statistic 
1690            goes above or below a specified value.";
1691       type alarm-operation-type;
1692     }
1693
1694     leaf value {
1695       description
1696           "This value defines the threshold that, if crossed, will trigger
1697           the alarm.";
1698       type decimal64 {
1699         fraction-digits 4;
1700       }
1701     }
1702
1703     leaf period {
1704       description
1705           "The period defines the length of time (seconds) that the metric
1706           data are collected over in oreder to evaluate the chosen
1707           statistic.";
1708       type uint32;
1709     }
1710
1711     leaf evaluations {
1712       description
1713           "Defines the length of time (seconds) in which metric data are
1714            collected in order to evaluate the chosen statistic.";
1715       type uint32;
1716     }
1717   }
1718
1719   typedef cloud-account-type {
1720     description "VIM account type";
1721     type enumeration {
1722       enum aws;
1723       enum cloudsim;
1724       enum cloudsim_proxy;
1725       enum mock;
1726       enum openmano;
1727       enum openstack;
1728       enum vsphere;
1729       enum openvim;
1730     }
1731   }
1732   
1733   grouping host-aggregate {
1734     list host-aggregate {
1735       description "Name of the Host Aggregate";
1736       key "metadata-key";
1737       
1738       leaf metadata-key {
1739         description
1740             "Name of the additional information attached to the host-aggregate";
1741         type string;
1742       }
1743       leaf metadata-value {
1744         description
1745             "Value of the corresponding metadata-key";
1746         type string;
1747       }
1748     }
1749   }
1750   
1751   grouping placement-group-input {
1752     leaf cloud-type {
1753       type manotypes:cloud-account-type;
1754     }
1755     choice cloud-provider {
1756       case openstack {           
1757         container availability-zone {
1758           description "Name of the Availability Zone";
1759           leaf name {
1760             type string;
1761           }
1762         }
1763         container server-group {
1764           description "Name of the Affinity/Anti-Affinity Server Group";
1765           leaf name {
1766             type string;
1767           }
1768         }
1769         uses host-aggregate;
1770       }
1771       case aws {
1772         leaf aws-construct {
1773           type empty;
1774         }
1775       }
1776       case openmano {
1777         leaf openmano-construct {
1778           type empty;
1779         }        
1780       }
1781       case vsphere {
1782         leaf vsphere-construct {
1783           type empty;
1784         }
1785       }
1786       case mock {
1787         leaf mock-construct {
1788           type empty;
1789         }
1790       }
1791       case cloudsim {
1792         leaf cloudsim-construct {
1793           type empty;
1794         }
1795       }
1796     }
1797   }
1798   
1799   grouping placement-group-info {
1800     description "";
1801
1802     leaf name {
1803       description
1804           "Place group construct to define the compute resource placement strategy
1805            in cloud environment";
1806       type string;
1807     }
1808
1809     leaf requirement {
1810       description "This is free text space used to describe the intent/rationale
1811                    behind this placement group. This is for human consumption only";
1812       type string;
1813     }
1814     
1815     leaf strategy {
1816       description
1817           "Strategy associated with this placement group
1818              Following values are possible
1819                - COLOCATION: Colocation strategy imply intent to share the physical
1820                              infrastructure (hypervisor/network) among all members
1821                              of this group.
1822                - ISOLATION: Isolation strategy imply intent to not share the physical
1823                             infrastructure (hypervisor/network) among the members
1824                             of this group.
1825              ";
1826       type enumeration {
1827         enum COLOCATION;
1828         enum ISOLATION;
1829       }
1830       default "COLOCATION";
1831     }
1832   }
1833
1834   grouping ip-profile-info {
1835     description "Grouping for IP-Profile";
1836     container ip-profile-params {
1837       
1838       leaf ip-version {
1839         type inet:ip-version;
1840         default ipv4;
1841       }
1842
1843       leaf subnet-address {
1844         description "Subnet IP prefix associated with IP Profile";
1845         type inet:ip-prefix;
1846       }
1847
1848       leaf gateway-address {
1849         description "IP Address of the default gateway associated with IP Profile";
1850         type inet:ip-address;
1851       }
1852
1853       leaf security-group {
1854         description "Name of the security group";
1855         type string;
1856       }
1857
1858       list dns-server {
1859         key "address";
1860         leaf address {
1861                                         description "List of DNS Servers associated with IP Profile";
1862                                         type inet:ip-address;
1863         }
1864       }
1865
1866       container dhcp-params {  
1867         leaf enabled {
1868           description "This flag indicates if DHCP is enabled or not";
1869           type boolean;
1870           default true;
1871         }
1872
1873         leaf start-address {
1874           description "Start IP address of the IP-Address range associated with DHCP domain";
1875           type inet:ip-address;
1876         }
1877
1878         leaf count {
1879           description "Size of the DHCP pool associated with DHCP domain";
1880           type uint32;
1881         }
1882       }
1883
1884       leaf subnet-prefix-pool {
1885         description "VIM Specific reference to pre-created subnet prefix";
1886         type string;
1887       }
1888     }
1889   }
1890
1891   grouping ip-profile-list {
1892     list ip-profiles {
1893       description
1894           "List of IP Profiles.
1895              IP Profile describes the IP characteristics for the Virtual-Link";
1896     
1897       key "name";
1898
1899       leaf name {
1900         description "Name of the IP-Profile";
1901         type string;
1902       }
1903       
1904       leaf description {
1905         description "Description for IP profile";
1906         type string;
1907       }
1908       
1909       uses ip-profile-info;
1910     }
1911   }
1912
1913   grouping config-file {
1914     description "Grouping for files needed to be mounted into an additional drive";
1915     list config-file {
1916       description
1917           "List of configuration files to be written on an additional drive";
1918       key "source";
1919       leaf source {
1920         description "Name of the configuration file";
1921         type string;
1922       }
1923       leaf dest {
1924         description "Full path of the destination in the guest";
1925         type string;
1926       }
1927     }
1928   }
1929
1930   grouping supplemental-boot-data {
1931     description "Grouping for custom vim data";
1932     container supplemental-boot-data {
1933       uses manotypes:config-file;
1934       leaf boot-data-drive {
1935         description "Some VIMs implement additional drives to host config-files or meta-data";
1936         type boolean;
1937         default false;
1938       } 
1939     }
1940   }
1941
1942   grouping volume-info {
1943     description "Grouping for Volume-info";
1944
1945     leaf description {
1946       description "Description for Volume";
1947       type string;
1948     }
1949
1950     leaf size {
1951       description "Size of disk in GB";
1952       type uint64;
1953     }
1954
1955     choice volume-source {
1956       description
1957             "Defines the source of the volume. Possible options are
1958              1. Ephemeral -- Empty disk
1959              2. Image     -- Refer to image to be used for volume
1960              3. Volume    -- Reference of pre-existing volume to be used
1961             ";
1962
1963       case ephemeral {
1964         leaf ephemeral {
1965           type empty;
1966         }
1967       }
1968
1969       case image {
1970         uses image-properties;
1971       }
1972
1973     }
1974
1975     leaf device-bus {
1976       description "Type of disk-bus on which this disk is exposed to guest";
1977       type enumeration {
1978         enum ide;
1979         enum usb;
1980         enum virtio;
1981         enum scsi;
1982       }
1983     }
1984
1985     leaf device-type {
1986       description "The type of device as exposed to guest";
1987       type enumeration {
1988           enum disk;
1989           enum cdrom;
1990           enum floppy;
1991           enum lun;
1992       }
1993     }
1994
1995   }
1996 }