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