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