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