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