Feature 10509: Add support for scaling KDUs
[osm/IM.git] / models / augments / scaling.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 scaling {
19     yang-version 1.1;
20     namespace "urn:etsi:osm:yang:augments:scaling";
21     prefix "scaling";
22
23     import etsi-nfv-vnfd {
24         prefix vnfd;
25     }
26
27     import common-augments {
28         prefix common;
29     }
30
31     import day1-2 {
32         prefix day1-2;
33     }
34
35     import kdu {
36         prefix kdu;
37     }
38
39     grouping extended-scaling {
40         list scaling-policy {
41
42             key "name";
43
44             leaf name {
45                 description
46                   "Name of the scaling policy";
47                 type string;
48             }
49
50             leaf scaling-type {
51                 description
52                   "Type of scaling";
53                 type common:scaling-policy-type;
54             }
55
56             leaf enabled {
57                 description
58                   "Specifies if the scaling policy can be applied";
59                 type boolean;
60                 default true;
61             }
62
63             leaf scale-in-operation-type {
64                 description
65                   "Operation to be applied to check between scaling criterias to
66                    check if the scale in threshold condition has been met.
67                    Defaults to AND";
68                 type common:scaling-criteria-operation;
69                 default AND;
70             }
71
72             leaf scale-out-operation-type {
73                 description
74                   "Operation to be applied to check between scaling criterias to
75                    check if the scale out threshold condition has been met.
76                    Defauls to OR";
77                 type common:scaling-criteria-operation;
78                 default OR;
79             }
80
81             leaf threshold-time {
82                 description
83                   "The duration for which the criteria must hold true";
84                 type uint32;
85                 mandatory true;
86             }
87
88             leaf cooldown-time {
89                 description
90                   "The duration after a scaling-in/scaling-out action has been
91                    triggered, for which there will be no further optional";
92                 type uint32;
93                 mandatory true;
94             }
95
96             list scaling-criteria {
97                 description
98                   "list of conditions to be met for generating scaling
99                      requests";
100                 key "name";
101
102                 leaf name {
103                     type string;
104                 }
105
106                 leaf scale-in-threshold {
107                     description
108                       "Value below which scale-in requests are generated";
109                     type decimal64{
110                         fraction-digits 10;
111                     }
112                 }
113
114                 leaf scale-in-relational-operation {
115                     description
116                       "The relational operator used to compare the monitoring param
117                        against the scale-in-threshold.";
118                     type common:relational-operation-type;
119                     default LE;
120                 }
121
122                 leaf scale-out-threshold {
123                     description
124                       "Value above which scale-out requests are generated";
125                     type decimal64{
126                         fraction-digits 10;
127                     }
128                 }
129
130                 leaf scale-out-relational-operation {
131                     description
132                       "The relational operator used to compare the monitoring param
133                        against the scale-out-threshold.";
134                     type common:relational-operation-type;
135                     default GE;
136                 }
137
138                 leaf vnf-monitoring-param-ref {
139                     description
140                       "Reference to the VNF level monitoring parameter
141                        that is aggregated";
142                     type string;
143                     
144                 }
145             }
146         }
147
148         list scaling-config-action {
149             description
150               "List of scaling config actions";
151             key "trigger";
152
153             leaf trigger {
154                 description
155                   "scaling trigger";
156                 type common:scaling-trigger;
157             }
158
159             leaf vnf-config-primitive-name-ref {
160                 description
161                   "Reference to the VNF config primitive";
162                 type leafref {
163                     path "/vnfd:vnfd/vnfd:df/vnfd:lcm-operations-configuration/vnfd:operate-vnf-op-config/day1-2:day1-2/day1-2:config-primitive/day1-2:name";
164                 }
165             }
166         }
167     }
168
169     grouping extended-kdu-resource-profile {
170       list kdu-resource-profile {
171         key "id";
172         description
173           "The Kdu resource profile describes additional instantiation data for
174            a given KDU used in a deployment flavour.";
175
176         leaf id {
177           type string;
178         }
179
180         leaf min-number-of-instances {
181           type uint16;
182           default 1;
183           description
184             "Minimum number of instances of the KNFC based on this
185              KDU resource that is permitted to exist for this flavour.";
186         }
187
188         leaf max-number-of-instances {
189           type uint16;
190           default 1;
191           must ". >= ../min-number-of-instances";
192         }
193
194         leaf resource-name {
195           type string;
196           description
197             "Name of the application of KDU";
198         }
199
200         leaf kdu-name {
201           type leafref {
202             path "/vnfd:vnfd/kdu:kdu/kdu:name";
203           }
204           description
205             "Name of the KDU";
206         }
207       }
208     }
209
210     grouping extended-deltas {
211       list kdu-resource-delta {
212         key "id";
213         description
214           "The number of KNFC instances based on particular
215             KDUs to be created or removed.";
216
217         leaf id {
218           type leafref {
219             path "../../../../../kdu-resource-profile/id";
220           }
221           description
222             "Uniquely identifies a KDU profile.";
223         }
224
225         leaf number-of-instances {
226           type uint32 {
227             range "0..max";
228           }
229           description
230             "Number of instances of KNFC based on this KDU to
231               deploy for an instantiation level or for a
232               scaling delta. Shall be zero or greater.";
233         }
234       }
235     }
236
237     augment "/vnfd:vnfd/vnfd:df" {
238         uses extended-kdu-resource-profile;
239     }
240
241     augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect" {
242         uses extended-scaling;
243     }
244
245     augment "/vnfd:vnfd/vnfd:df/vnfd:scaling-aspect/vnfd:aspect-delta-details/vnfd:deltas" {
246         uses extended-deltas;
247     }
248 }