Update openjdk version to 19 and yang2swagger version to 2.1.0
[osm/IM.git] / models / augments / epa.yang
1 /*
2   Copyright 2020 Whitestack LLC
3
4   Licensed under the Apache License, Version 2.0 (the "License");
5   you may not use this file except in compliance with the License.
6   You may obtain a copy of the License at
7
8     http://www.apache.org/licenses/LICENSE-2.0
9
10   Unless required by applicable law or agreed to in writing, software
11   distributed under the License is distributed on an "AS IS" BASIS,
12   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
13   implied.
14   See the License for the specific language governing permissions and
15   limitations under the License.
16 */
17
18 module epa {
19     yang-version 1.1;
20     namespace "urn:etsi:osm:yang:augments:epa";
21     prefix "epa";
22
23     import etsi-nfv-vnfd {
24         prefix vnfd;
25     }
26
27     grouping allocation-properties {
28         leaf limit {
29             description
30               "Defines the maximum allocation. The value 0 indicates that usage is not limited.
31                This parameter ensures that the instance never uses more than the defined amount of resource.";
32             type uint64;
33         }
34
35         leaf reserve {
36             description
37               "Defines the guaranteed minimum reservation.
38                If needed, the machine will definitely get allocated the reserved amount of resources.";
39             type uint64;
40         }
41
42         leaf shares {
43             description
44               "Number of shares allocated.
45                Specifies the proportional weighted share for the domain.
46                If this element is omitted, the service defaults to the OS provided defaults";
47             type uint64;
48         }
49     }
50
51     grouping extended-mem-quota {
52         container mem-quota {
53             description
54               "Memory quota describes the memory resource allocation policy.
55                Limit and Reserve values are defined in MB";
56             uses allocation-properties;
57         }
58     }
59
60     grouping extended-vif-quota {
61         container vif-quota {
62             description
63               "Virtual interfaces quota describes the virtual interface bandwidth resource allocation policy.
64                Limit and Reserve values are defined in Mbps";
65             uses allocation-properties;
66         }
67     }
68
69     grouping extended-disk-io-quota {
70         container disk-io-quota {
71             description
72               "Disk IO quota describes the disk IO operations resource allocation policy.
73                Limit and Reserve values are defined in IOPS";
74             uses allocation-properties;
75         }
76     }
77
78     grouping extended-cpu-quota {
79         container cpu-quota {
80             description
81               "CPU quota describes the CPU resource allocation policy.
82                Limit and Reserve values are defined in MHz";
83             uses allocation-properties;
84         }
85     }
86
87     grouping extended-cpu-policy {
88         leaf thread-policy {
89             description
90               "CPU thread pinning policy describes how to
91                place the guest CPUs when the host supports
92                hyper threads:
93                REQUIRE : Each vCPU is allocated on thread siblings
94                          of the same core.
95                ISOLATE : Places each vCPU on a different core,
96                          and places no vCPUs from a different
97                          guest on the same core.
98                PREFER  : Attempts to place vCPUs on threads
99                          of the same core.";
100             type enumeration {
101                 enum REQUIRE;
102                 enum ISOLATE;
103                 enum PREFER;
104             }
105         }
106     }
107
108     grouping extended-mempage-size {
109         leaf mempage-size {
110             description
111               "Memory page allocation size. If a VM requires
112                hugepages, it should choose LARGE or SIZE_2MB
113                or SIZE_1GB. If the VM prefers hugepages it
114                should choose PREFER_LARGE.
115                LARGE        : Require hugepages (either 2MB or 1GB)
116                SMALL        : Doesn't require hugepages
117                SIZE_2MB     : Requires 2MB hugepages
118                SIZE_1GB     : Requires 1GB hugepages
119                PREFER_LARGE : Application prefers hugepages";
120             type enumeration {
121                 enum LARGE;
122                 enum SMALL;
123                 enum SIZE_2MB;
124                 enum SIZE_1GB;
125                 enum PREFER_LARGE;
126             }
127         }
128     }
129     grouping extended-numa {
130         container numa-node-policy {
131             description
132               "This policy defines NUMA topology of the
133                guest. Specifically identifies if the guest
134                should be run on a host with one NUMA
135                node or multiple NUMA nodes. As an example
136                a guest might need 8 VCPUs and 4 GB of
137                memory. However, it might need the VCPUs
138                and memory distributed across multiple
139                NUMA nodes. In this scenario, NUMA node
140                1 could run with 6 VCPUs and 3GB, and
141                NUMA node 2 could run with 2 VCPUs and
142                1GB.";
143
144             leaf node-cnt {
145                 description
146                   "The number of NUMA nodes to expose to the VM.";
147                 type uint16;
148             }
149
150             leaf mem-policy {
151                 description
152                   "This policy specifies how the memory should
153                    be allocated in a multi-node scenario.
154                    STRICT    : The memory must be allocated
155                                strictly from the memory attached
156                                to the NUMA node.
157                    PREFERRED : The memory should be allocated
158                                preferentially from the memory
159                                attached to the NUMA node";
160                 type enumeration {
161                     enum STRICT;
162                     enum PREFERRED;
163                 }
164             }
165
166             list node {
167                 key id;
168                 leaf id {
169                     description
170                       "NUMA node identification. Typically
171                        it's 0 or 1";
172                     type uint64;
173                 }
174
175                 list vcpu {
176                     key "id";
177                     description
178                       "List of VCPUs to allocate on
179                        this NUMA node.";
180                     leaf id {
181                         type uint64;
182                         description
183                           "List of VCPUs ids to allocate on
184                            this NUMA node";
185                     }
186                 }
187
188                 leaf memory-mb {
189                     description
190                       "Memory size expressed in MB
191                        for this NUMA node.";
192                     type uint64;
193                 }
194
195                 choice om-numa-type {
196                     description
197                       "OpenMANO Numa type selection";
198
199                     case cores {
200                         leaf num-cores {
201                             type uint8;
202                         }
203                     }
204
205                     case paired-threads {
206                         container paired-threads {
207                             leaf num-paired-threads {
208                                 type uint8;
209                             }
210
211                             list paired-thread-ids {
212                                 description
213                                   "List of thread pairs to use in case of paired-thread NUMA";
214                                 max-elements 16;
215                                 key thread-a;
216
217                                 leaf thread-a {
218                                     type uint8;
219                                 }
220
221                                 leaf thread-b {
222                                     type uint8;
223                                 }
224                             }
225                         }
226                     }
227                     case threads {
228                         leaf num-threads {
229                             type uint8;
230                         }
231                     }
232                 }
233             }
234         }
235     }
236
237     augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-memory" {
238         uses extended-numa;
239         uses extended-mempage-size;
240         uses extended-mem-quota;
241     }
242
243     augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-cpu/vnfd:pinning" {
244         uses extended-cpu-policy;
245     }
246
247     augment "/vnfd:vnfd/vnfd:virtual-compute-desc/vnfd:virtual-cpu" {
248         uses extended-cpu-quota;
249     }
250
251     augment "/vnfd:vnfd/vnfd:virtual-storage-desc" {
252         uses extended-disk-io-quota;
253     }
254
255     augment "/vnfd:vnfd/vnfd:vdu/vnfd:int-cpd/vnfd:virtual-network-interface-requirement" {
256         uses extended-vif-quota;
257     }
258 }