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