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