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