Merge "Added -H option to BUILD.sh launchpad instruction"
[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       leaf-list cpu-feature {
721         description
722             "List of CPU features.";
723         type cpu-feature-type;
724       }
725
726       
727       leaf om-cpu-model-string {
728         description "Openmano CPU model string";
729         type string;
730       }
731
732       leaf-list om-cpu-feature {
733         description "Openmano CPU features";
734         type string;
735       }
736     }
737   }
738
739   grouping guest-epa {
740     description "EPA attributes for the guest";
741     container guest-epa {
742       leaf trusted-execution {
743         description "This VM should be allocated from trusted pool";
744         type boolean;
745       }
746
747       leaf mempage-size {
748         description
749             "Memory page allocation size. If a VM requires
750              hugepages, it should choose LARGE or SIZE_2MB
751              or SIZE_1GB. If the VM prefers hugepages it
752              should chose PREFER_LARGE.
753              LARGE        : Require hugepages (either 2MB or 1GB)
754              SMALL        : Doesn't require hugepages
755              SIZE_2MB     : Requires 2MB hugepages
756              SIZE_1GB     : Requires 1GB hugepages
757              PREFER_LARGE : Application perfers hugepages";
758         type enumeration {
759           enum LARGE;
760           enum SMALL;
761           enum SIZE_2MB;
762           enum SIZE_1GB;
763           enum PREFER_LARGE;
764         }
765       }
766
767       leaf cpu-pinning-policy {
768         description
769             "CPU pinning policy describes association
770              between virtual CPUs in guest and the
771              physical CPUs in the host.
772              DEDICATED : Virtual CPUs are pinned to
773                          physical CPUs
774              SHARED    : Multiple VMs may share the
775                          same physical CPUs.
776              ANY       : Any policy is acceptable for the VM";
777         type enumeration {
778           enum DEDICATED;
779           enum SHARED;
780           enum ANY;
781         }
782         default "ANY";
783       }
784
785       leaf cpu-thread-pinning-policy {
786           description
787             "CPU thread pinning policy describes how to
788              place the guest CPUs when the host supports
789              hyper threads:
790              AVOID   : Avoids placing a guest on a host
791                        with threads.
792              SEPARATE: Places vCPUs on separate cores,
793                        and avoids placing two vCPUs on
794                        two threads of same core.
795              ISOLATE : Places each vCPU on a different core,
796                        and places no vCPUs from a different
797                        guest on the same core.
798              PREFER  : Attempts to place vCPUs on threads
799                        of the same core.";
800         type enumeration {
801           enum AVOID;
802           enum SEPARATE;
803           enum ISOLATE;
804           enum PREFER;
805         }
806       }
807
808       list pcie-device {
809         description
810             "List of pcie passthrough devices.";
811         key device-id;
812         leaf device-id {
813           description
814               "Device identifier.";
815           type string;
816         }
817         leaf count {
818           description
819               "Number of devices to attach to the VM.";
820           type uint64;
821         }
822       }
823
824       choice numa-policy {
825         case numa-unware {
826           leaf numa-unware {
827             type empty;
828           }
829         }
830
831         case numa-aware {
832           container numa-node-policy {
833             description
834                 "This policy defines numa topology of the
835                  guest. Specifically identifies if the guest
836                  should be run on a host with one numa
837                  node or multiple numa nodes. As an example
838                  a guest may want 8 vcpus and 4 GB of
839                  memory. But may want the vcpus and memory
840                  distributed across multiple numa nodes.
841                  The NUMA node 1 may run with 6 vcpus and
842                  3GB, and NUMA node 2 may run with 2 vcpus
843                  and 1GB.";
844
845             leaf node-cnt {
846               description
847                   "The number of numa nodes to expose to the VM.";
848               type uint16;
849             }
850
851             leaf mem-policy {
852               description
853                   "This policy specifies how the memory should
854                    be allocated in a multi-node scenario.
855                    STRICT    : The memory must be allocated
856                                strictly from the memory attached
857                                to the NUMA node.
858                    PREFERRED : The memory should be allocated
859                                perferentially from the memory
860                                attached to the NUMA node";
861               type enumeration {
862                 enum STRICT;
863                 enum PREFERRED;
864               }
865             }
866
867            list node {
868               key id;
869               leaf id {
870                 description
871                     "NUMA node identification. Typically
872                      it's 0 or 1";
873                 type uint64;
874               }
875
876               leaf-list vcpu {
877                 description
878                     "List of vcpus to allocate on
879                      this numa node.";
880                 type uint64;
881               }
882
883               leaf memory-mb {
884                 description
885                     "Memory size expressed in MB
886                      for this NUMA node.";
887                 type uint64;
888               }
889
890               choice om-numa-type {
891                 description
892                     "Openmano Numa type selection";
893
894                 case cores {
895                   leaf num-cores {
896                     type uint8;
897                   }
898                 }
899
900                 case paired-threads {
901                   container paired-threads {
902                     leaf num-paired-threads {
903                       type uint8;
904                     }
905
906                     list paired-thread-ids {
907                       description
908                           "List of thread pairs to use in case of paired-thread numa";
909                       max-elements 16;
910                       key thread-a;
911
912                       leaf thread-a {
913                           type uint8;
914                       }
915
916                       leaf thread-b {
917                           type uint8;
918                       }
919                     }
920                   }
921                 }
922                 case threads {
923                   leaf num-threads {
924                     type uint8;
925                   }
926                 }
927               }
928             }
929
930           }
931         }
932       }
933     }
934   }
935
936   grouping provider-network {
937     container provider-network {
938       description "Container for the provider network.";
939       leaf physical-network {
940         description
941             "Name of the phsyical network on which the provider
942              network is built.";
943         type string;
944       }
945
946       leaf overlay-type {
947         description
948             "Type of the overlay network.";
949         type enumeration {
950           enum LOCAL;
951           enum FLAT;
952           enum VLAN;
953           enum VXLAN;
954           enum GRE;
955         }
956       }
957       leaf segmentation_id {
958         description
959             "Segmentation ID";
960             type uint32;
961       }
962     }
963   }
964
965   grouping ns-service-primitive {
966     list service-primitive {
967       description
968           "Network service level service primitives.";
969
970       key "name";
971
972       leaf name {
973         description
974             "Name of the service primitive.";
975         type string;
976       }
977
978       list parameter {
979         description
980             "List of parameters for the service primitive.";
981
982         key "name";
983         uses manotypes:primitive-parameter;
984       }
985
986       list parameter-group {
987         description
988             "Grouping of parameters which are logically grouped in UI";
989         key "name";
990
991         leaf name {
992           description
993               "Name of the parameter group";
994           type string;
995         }
996
997         list parameter {
998           description
999               "List of parameters for the service primitive.";
1000           key "name";
1001           uses manotypes:primitive-parameter;
1002         }
1003
1004         leaf mandatory {
1005           description "Is this parameter group mandatory";
1006           type boolean;
1007           default true;
1008         }
1009       }
1010
1011       list vnf-primitive-group {
1012         description
1013             "List of service primitives grouped by VNF.";
1014
1015         key "member-vnf-index-ref";
1016         leaf member-vnf-index-ref {
1017           description
1018               "Reference to member-vnf within constituent-vnfds";
1019           type uint64;
1020         }
1021
1022         leaf vnfd-id-ref {
1023           description
1024               "A reference to a vnfd. This is a 
1025                leafref to path:
1026                    ../../../../nsd:constituent-vnfd
1027                    + [nsd:id = current()/../nsd:id-ref]
1028                    + /nsd:vnfd-id-ref
1029                NOTE: An issue with confd is preventing the
1030                use of xpath. Seems to be an issue with leafref
1031                to leafref, whose target is in a different module.
1032                Once that is resovled this will switched to use
1033                leafref";
1034
1035           type string;
1036         }
1037
1038         leaf vnfd-name {
1039           description
1040               "Name of the VNFD";
1041           type string;
1042         }
1043
1044         list primitive {
1045           key "index";
1046
1047           leaf index {
1048             description "Index of this primitive";
1049             type uint32;
1050           }
1051
1052           leaf name {
1053             description "Name of the primitive in the VNF primitive ";
1054             type string;
1055           }
1056         }
1057       }
1058
1059       leaf user-defined-script {
1060         description
1061             "A user defined script.";
1062         type string;
1063       }
1064     }
1065   }
1066
1067   grouping monitoring-param {
1068     list http-endpoint {
1069       description
1070           "List of http endpoints to be used by monitoring params";
1071       key path;
1072
1073       leaf path {
1074         description "The HTTP path on the management server";
1075         type string;
1076       }
1077
1078       leaf https {
1079         description "Pick HTTPS instead of HTTP , Default is false";
1080         type boolean;
1081         default "false";
1082       }
1083
1084       leaf port {
1085         description "The HTTP port to connect to";
1086         type inet:port-number;
1087       }
1088
1089       leaf username {
1090         description "The HTTP basic auth username";
1091         type string;
1092       }
1093
1094       leaf password {
1095         description "The HTTP basic auth password";
1096         type string;
1097       }
1098
1099       leaf polling_interval_secs {
1100         description "The HTTP polling interval in seconds";
1101         type uint8;
1102         default 2;
1103       }
1104
1105       leaf method {
1106         description
1107           "This is the method to be performed at the uri.
1108            GET by default for action";
1109
1110         type manotypes:http-method;
1111         default "GET";
1112       }
1113
1114       list headers {
1115         description "Custom HTTP headers to put on HTTP request";
1116         key key;
1117         leaf key{
1118           description "HTTP header key";
1119           type string;
1120         }
1121
1122         leaf value{
1123           description "HTTP header value";
1124           type string;
1125         }
1126       }
1127     }
1128
1129     list monitoring-param {
1130       description
1131           "List of monitoring parameters at the NS level";
1132       key id;
1133       leaf id {
1134         type string;
1135       }
1136
1137       leaf name {
1138         type string;
1139       }
1140
1141       leaf http-endpoint-ref {
1142         type leafref {
1143           path "../../http-endpoint/path";
1144         }
1145       }
1146
1147       leaf json-query-method {
1148         type json-query-method;
1149         default "NAMEKEY";
1150       }
1151
1152       container json-query-params {
1153         leaf json-path {
1154           description
1155             "The jsonpath to use to extract value from JSON structure";
1156           type string;
1157         }
1158         leaf object-path {
1159           description
1160             "The objectpath to use to extract value from JSON structure";
1161           type string;
1162         }
1163       }
1164
1165       uses monitoring-param-ui-data;
1166       uses monitoring-param-value;
1167
1168     }
1169   }
1170
1171   grouping monitoring-param-aggregation {
1172     typedef aggregation-type {
1173       description "aggregation-type";
1174       type enumeration {
1175         enum AVERAGE;
1176         enum MINIMUM;
1177         enum MAXIMUM;
1178         enum COUNT;
1179         enum SUM;
1180       }
1181     }
1182
1183     leaf aggregation-type {
1184       type aggregation-type;
1185     }
1186   }
1187
1188   grouping monitoring-param-ui-data {
1189       leaf description {
1190         type string;
1191       }
1192
1193       leaf group-tag {
1194         description "A simple tag to group monitoring parameters";
1195         type string;
1196       }
1197
1198
1199       leaf widget-type {
1200         type manotypes:widget-type;
1201       }
1202
1203       leaf units {
1204         type string;
1205       }
1206   }
1207
1208   grouping monitoring-param-value {
1209       leaf value-type {
1210         type param-value-type;
1211         default "INT";
1212       }
1213
1214       container numeric-constraints {
1215         leaf min-value {
1216           description
1217               "Minimum value for the parameter";
1218           type uint64;
1219         }
1220         leaf max-value {
1221           description
1222               "Maxium value for the parameter";
1223           type uint64;
1224         }
1225       }
1226
1227       container text-constraints {
1228         leaf min-length {
1229           description
1230               "Minimum string length for the parameter";
1231           type uint8;
1232         }
1233         leaf max-length {
1234           description
1235               "Maximum string length for the parameter";
1236           type uint8;
1237         }
1238       }
1239
1240       leaf value-integer {
1241         description
1242             "Current value for an integer parameter";
1243         type int64;
1244       }
1245
1246       leaf value-decimal {
1247         description
1248             "Current value for a decimal parameter";
1249         type decimal64 {
1250           fraction-digits 4;
1251         }
1252       }
1253
1254       leaf value-string {
1255         description
1256             "Current value for a string parameter";
1257         type string;
1258       }
1259   }
1260
1261   grouping control-param {
1262     list control-param {
1263       description
1264           "List of control parameters to manage and
1265            update the running configuration of the VNF";
1266       key id;
1267
1268       leaf id {
1269         type string;
1270       }
1271
1272       leaf name {
1273         type string;
1274       }
1275
1276       leaf description {
1277         type string;
1278       }
1279
1280       leaf group-tag {
1281         description "A simple tag to group control parameters";
1282         type string;
1283       }
1284
1285       leaf min-value {
1286         description
1287             "Minimum value for the parameter";
1288         type uint64;
1289       }
1290
1291       leaf max-value {
1292         description
1293             "Maxium value for the parameter";
1294         type uint64;
1295       }
1296
1297       leaf current-value {
1298         description
1299             "Current value for the parameter";
1300         type uint64;
1301       }
1302
1303       leaf step-value {
1304         description
1305             "Step value for the parameter";
1306         type uint64;
1307       }
1308
1309       leaf units {
1310         type string;
1311       }
1312
1313       leaf widget-type {
1314         type manotypes:widget-type;
1315       }
1316
1317       leaf url {
1318         description
1319           "This is the URL where to perform the operation";
1320
1321         type inet:uri;
1322       }
1323
1324       leaf method {
1325         description
1326           "This is the method to be performed at the uri.
1327            POST by default for action";
1328
1329         type manotypes:http-method;
1330         default "POST";
1331       }
1332
1333       leaf payload {
1334         description
1335           "This is the operation payload or payload template as stringified
1336            JSON. This field provides the data  to be sent for this operation
1337            call";
1338
1339         type string;
1340       }
1341     }
1342   }
1343
1344   grouping action-param {
1345     list action-param {
1346       description
1347           "List of action parameters to
1348            control VNF";
1349       key id;
1350       leaf id {
1351         type string;
1352       }
1353
1354       leaf name {
1355         type string;
1356       }
1357
1358       leaf description {
1359         type string;
1360       }
1361
1362       leaf group-tag {
1363         description "A simple tag to group monitoring parameter";
1364         type string;
1365       }
1366
1367       leaf url {
1368         description
1369           "This is the URL where to perform the operation";
1370         type inet:uri;
1371       }
1372
1373       leaf method {
1374         description
1375           "This is the method to be performed at the uri.
1376            POST by default for action";
1377
1378         type manotypes:http-method;
1379         default "POST";
1380       }
1381
1382       leaf payload {
1383         description
1384           "This is the operation payload or payload template to be sent in
1385            the data for this operation call";
1386
1387         type string;
1388       }
1389     }
1390   }
1391
1392   grouping input-parameter {
1393     description "";
1394
1395     list input-parameter {
1396       description
1397           "List of input parameters";
1398
1399       key xpath;
1400
1401
1402       leaf xpath {
1403         description
1404           "A an xpath that specfies which element in a descriptor is to be
1405           modified.";
1406         type string;
1407       }
1408
1409       leaf value {
1410         description
1411           "The value that the element specified by the xpath should take when a
1412           record is created.";
1413         type string;
1414       }
1415     }
1416   }
1417
1418   grouping input-parameter-xpath {
1419     list input-parameter-xpath {
1420       description
1421           "List of xpaths to parameters inside the NSD
1422            the can be customized during the instantiation.";
1423
1424       key "xpath";
1425       leaf xpath {
1426         description
1427             "An xpath that specifies the element in a descriptor.";
1428         type string;
1429       }
1430
1431       leaf label {
1432         description "A descriptive string";
1433         type string;
1434       }
1435
1436       leaf default-value {
1437         description " A default value for this input parameter";
1438         type string;
1439       }
1440     }
1441   }
1442
1443   grouping nfvi-metrics {
1444     container vcpu {
1445       leaf label {
1446         description
1447           "Label to show in UI";
1448         type string;
1449         default "VCPU";
1450       }
1451
1452       leaf total {
1453         description
1454           "The total number of VCPUs available.";
1455         type uint64;
1456       }
1457
1458       leaf utilization {
1459         description
1460           "The VCPU utilization (percentage).";
1461         type decimal64 {
1462           fraction-digits 2;
1463           range "0 .. 100";
1464         }
1465       }
1466     }
1467
1468     container memory {
1469       leaf label {
1470         description
1471           "Label to show in UI";
1472         type string;
1473         default "MEMORY";
1474       }
1475
1476       leaf used {
1477         description
1478           "The amount of memory (bytes) currently in use.";
1479         type uint64;
1480       }
1481
1482       leaf total {
1483         description
1484           "The amount of memory (bytes) available.";
1485         type uint64;
1486       }
1487
1488       leaf utilization {
1489         description
1490           "The memory utilization (percentage).";
1491         type decimal64 {
1492           fraction-digits 2;
1493           range "0 .. 100";
1494         }
1495       }
1496     }
1497
1498     container storage {
1499       leaf label {
1500         description
1501           "Label to show in UI";
1502         type string;
1503         default "STORAGE";
1504       }
1505
1506       leaf used {
1507         description
1508           "The amount of storage (bytes) currently in use.";
1509         type uint64;
1510       }
1511
1512       leaf total {
1513         description
1514           "The amount of storage (bytes) available.";
1515         type uint64;
1516       }
1517
1518       leaf utilization {
1519         description
1520           "The storage utilization (percentage).";
1521         type decimal64 {
1522           fraction-digits 2;
1523           range "0 .. 100";
1524         }
1525       }
1526     }
1527
1528     container external-ports {
1529       leaf label {
1530         description
1531           "Label to show in UI";
1532         type string;
1533         default "EXTERNAL PORTS";
1534       }
1535
1536       leaf total {
1537         description
1538           "The total number of external ports.";
1539         type uint64;
1540       }
1541     }
1542
1543     container internal-ports {
1544       leaf label {
1545         description
1546           "Label to show in UI";
1547         type string;
1548         default "INTERNAL PORTS";
1549       }
1550
1551       leaf total {
1552         description
1553           "The total number of internal ports.";
1554         type uint64;
1555       }
1556     }
1557
1558     container network {
1559       leaf label {
1560         description
1561           "Label to show in UI";
1562         type string;
1563         default "NETWORK TRAFFIC";
1564       }
1565
1566       container incoming {
1567         leaf label {
1568           description
1569             "Label to show in UI";
1570           type string;
1571           default "INCOMING NETWORK TRAFFIC";
1572         }
1573
1574         leaf bytes {
1575           description
1576             "The cumulative number of incoming bytes.";
1577           type uint64;
1578         }
1579
1580         leaf packets {
1581           description
1582             "The cumulative number of incoming packets.";
1583           type uint64;
1584         }
1585
1586         leaf byte-rate {
1587           description
1588             "The current incoming byte-rate (bytes per second).";
1589           type decimal64 {
1590             fraction-digits 2;
1591           }
1592         }
1593
1594         leaf packet-rate {
1595           description
1596             "The current incoming packet (packets per second).";
1597           type decimal64 {
1598             fraction-digits 2;
1599           }
1600         }
1601       }
1602
1603       container outgoing {
1604         leaf label {
1605           description
1606             "Label to show in UI";
1607           type string;
1608           default "OUTGOING NETWORK TRAFFIC";
1609         }
1610
1611         leaf bytes {
1612           description
1613             "The cumulative number of outgoing bytes.";
1614           type uint64;
1615         }
1616
1617         leaf packets {
1618           description
1619             "The cumulative number of outgoing packets.";
1620           type uint64;
1621         }
1622
1623         leaf byte-rate {
1624           description
1625             "The current outgoing byte-rate (bytes per second).";
1626           type decimal64 {
1627             fraction-digits 2;
1628           }
1629         }
1630
1631         leaf packet-rate {
1632           description
1633             "The current outgoing packet (packets per second).";
1634           type decimal64 {
1635             fraction-digits 2;
1636           }
1637         }
1638       }
1639     }
1640   }
1641
1642   typedef alarm-severity-type {
1643     description "An indication of the importance or ugency of the alarm";
1644     type enumeration {
1645       enum LOW;
1646       enum MODERATE;
1647       enum CRITICAL;
1648     }
1649   }
1650
1651   typedef alarm-metric-type {
1652     description "The type of metrics to register the alarm for";
1653     type enumeration {
1654       enum CPU_UTILIZATION;
1655       enum MEMORY_UTILIZATION;
1656       enum STORAGE_UTILIZATION;
1657     }
1658   }
1659
1660   typedef alarm-statistic-type {
1661     description
1662         "The type of statistic to used to measure a metric to determine
1663         threshold crossing for an alarm.";
1664     type enumeration {
1665       enum AVERAGE;
1666       enum MINIMUM;
1667       enum MAXIMUM;
1668       enum COUNT;
1669       enum SUM;
1670     }
1671   }
1672
1673   typedef alarm-operation-type {
1674     description
1675         "The relational operator used to define whether an alarm should be
1676         triggered when, say, the metric statistic goes above or below a
1677         specified value.";
1678     type enumeration {
1679       enum GE; // greater than or equal
1680       enum LE; // less than or equal
1681       enum GT; // greater than
1682       enum LT; // less than
1683       enum EQ; // equal
1684     }
1685   }
1686
1687   grouping alarm {
1688     leaf alarm-id {
1689       description
1690           "This field is reserved for the identifier assigned by the cloud
1691           provider";
1692
1693       type string;
1694     }
1695
1696     leaf name {
1697       description "A human readable string to identify the alarm";
1698       type string;
1699     }
1700
1701     leaf description {
1702       description "A string containing a description of this alarm";
1703       type string;
1704     }
1705
1706     leaf vdur-id {
1707       description
1708           "The identifier of the VDUR that the alarm is associated with";
1709       type string;
1710     }
1711
1712     container actions {
1713       list ok {
1714         key "url";
1715         leaf url {
1716           type string;
1717         }
1718       }
1719
1720       list insufficient-data {
1721         key "url";
1722         leaf url {
1723           type string;
1724         }
1725       }
1726
1727       list alarm {
1728         key "url";
1729         leaf url {
1730           type string;
1731         }
1732       }
1733     }
1734
1735     leaf repeat {
1736       description
1737           "This flag indicates whether the alarm should be repeatedly emitted
1738           while the associated threshold has been crossed.";
1739
1740       type boolean;
1741       default true;
1742     }
1743
1744     leaf enabled {
1745       description
1746           "This flag indicates whether the alarm has been enabled or
1747           disabled.";
1748
1749       type boolean;
1750       default true;
1751     }
1752
1753     leaf severity {
1754       description "A measure of the important or urgency of the alarm";
1755       type alarm-severity-type;
1756     }
1757
1758     leaf metric {
1759       description "The metric to be tracked by this alarm.";
1760       type alarm-metric-type;
1761     }
1762
1763     leaf statistic {
1764       description "The type of metric statistic that is tracked by this alarm";
1765       type alarm-statistic-type;
1766     }
1767
1768     leaf operation {
1769       description
1770           "The relational operator that defines whether the alarm should be
1771           triggered when the metric statistic is, say, above or below the
1772           specified threshold value.";
1773       type alarm-operation-type;
1774     }
1775
1776     leaf value {
1777       description
1778           "This value defines the threshold that, if crossed, will trigger
1779           the alarm.";
1780       type decimal64 {
1781         fraction-digits 4;
1782       }
1783     }
1784
1785     leaf period {
1786       description
1787           "The period defines the length of time (seconds) that the metric
1788           data are collected over in oreder to evaluate the chosen
1789           statistic.";
1790       type uint32;
1791     }
1792
1793     leaf evaluations {
1794       description
1795           "This is the number of samples of the metric statistic used to
1796           evaluate threshold crossing. Each sample or evaluation is equal to
1797           the metric statistic obtained for a given period. This can be used
1798           to mitigate spikes in the metric that may skew the statistic of
1799           interest.";
1800       type uint32;
1801     }
1802   }
1803
1804   typedef cloud-account-type {
1805     description "cloud account type";
1806     type enumeration {
1807       enum aws;
1808       enum cloudsim;
1809       enum cloudsim_proxy;
1810       enum mock;
1811       enum openmano;
1812       enum openstack;
1813       enum vsphere;
1814       enum openvim;
1815     }
1816   }
1817   
1818   grouping host-aggregate {
1819     list host-aggregate {
1820       description "Name of the Host Aggregate";
1821       key "metadata-key";
1822       
1823       leaf metadata-key {
1824         type string;
1825       }
1826       leaf metadata-value {
1827         type string;
1828       }
1829     }
1830   }
1831   
1832   grouping placement-group-input {
1833     leaf cloud-type {
1834       type manotypes:cloud-account-type;
1835     }
1836     choice cloud-provider {
1837       case openstack {           
1838         container availability-zone {
1839           description "Name of the Availability Zone";
1840           leaf name {
1841             type string;
1842           }
1843         }
1844         container server-group {
1845           description "Name of the Affinity/Anti-Affinity Server Group";
1846           leaf name {
1847             type string;
1848           }
1849         }
1850         uses host-aggregate;
1851       }
1852       case aws {
1853         leaf aws-construct {
1854           type empty;
1855         }
1856       }
1857       case openmano {
1858         leaf openmano-construct {
1859           type empty;
1860         }        
1861       }
1862       case vsphere {
1863         leaf vsphere-construct {
1864           type empty;
1865         }
1866       }
1867       case mock {
1868         leaf mock-construct {
1869           type empty;
1870         }
1871       }
1872       case cloudsim {
1873         leaf cloudsim-construct {
1874           type empty;
1875         }
1876       }
1877     }
1878   }
1879   
1880   grouping placement-group-info {
1881     description "";
1882
1883     leaf name {
1884       description
1885           "Place group construct to define the compute resource placement strategy
1886            in cloud environment";
1887       type string;
1888     }
1889
1890     leaf requirement {
1891       description "This is free text space used to describe the intent/rationale
1892                    behind this placement group. This is for human consumption only";
1893       type string;
1894     }
1895     
1896     leaf strategy {
1897       description
1898           "Strategy associated with this placement group
1899              Following values are possible
1900                - COLOCATION: Colocation strategy imply intent to share the physical
1901                              infrastructure (hypervisor/network) among all members
1902                              of this group.
1903                - ISOLATION: Isolation strategy imply intent to not share the physical
1904                             infrastructure (hypervisor/network) among the members
1905                             of this group.
1906              ";
1907       type enumeration {
1908         enum COLOCATION;
1909         enum ISOLATION;
1910       }
1911       default "COLOCATION";
1912     }
1913   }
1914
1915   grouping ip-profile-info {
1916     description "Grouping for IP-Profile";
1917     container ip-profile-params {
1918       
1919       leaf ip-version {
1920         type inet:ip-version;
1921         default ipv4;
1922       }
1923
1924       leaf subnet-address {
1925         description "Subnet IP prefix associated with IP Profile";
1926         type inet:ip-prefix;
1927       }
1928
1929       leaf gateway-address {
1930         description "IP Address of the default gateway associated with IP Profile";
1931         type inet:ip-address;
1932       }
1933
1934       leaf security-group {
1935         description "Name of the security group";
1936         type string;
1937       }
1938
1939       list dns-server {
1940         key "address";
1941         leaf address {
1942                                         description "List of DNS Servers associated with IP Profile";
1943                                         type inet:ip-address;
1944         }
1945       }
1946
1947       container dhcp-params {  
1948         leaf enabled {
1949           description "This flag indicates if DHCP is enabled or not";
1950           type boolean;
1951           default true;
1952         }
1953
1954         leaf start-address {
1955           description "Start IP address of the IP-Address range associated with DHCP domain";
1956           type inet:ip-address;
1957         }
1958
1959         leaf count {
1960           description "Size of the DHCP pool associated with DHCP domain";
1961           type uint32;
1962         }
1963       }
1964
1965       leaf subnet-prefix-pool {
1966         description "VIM Specific reference to pre-created subnet prefix";
1967         type string;
1968       }
1969     }
1970   }
1971
1972   grouping ip-profile-list {
1973     list ip-profiles {
1974       description
1975           "List of IP Profiles.
1976              IP Profile describes the IP characteristics for the Virtual-Link";
1977     
1978       key "name";
1979
1980       leaf name {
1981         description "Name of the IP-Profile";
1982         type string;
1983       }
1984       
1985       leaf description {
1986         description "Description for IP profile";
1987         type string;
1988       }
1989       
1990       uses ip-profile-info;
1991     }
1992   }
1993   
1994 }