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