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