SOL006 augment: KDU support for helm v3
[osm/IM.git] / models / augments / common-augments.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 common-augments {
19     yang-version 1.1;
20     namespace "urn:etsi:osm:yang:augments";
21     prefix "common";
22
23     typedef parameter-data-type {
24         type enumeration {
25             enum STRING;
26             enum INTEGER;
27             enum BOOLEAN;
28         }
29     }
30
31     grouping primitive-parameter-value {
32         list parameter {
33             description
34               "List of parameters to the configuration primitive.";
35             key "name";
36             leaf name {
37                 description
38                   "Name of the parameter.";
39                 type string;
40             }
41
42             leaf data-type {
43                 description
44                   "Data type associated with the value.";
45                 type common:parameter-data-type;
46             }
47
48             leaf value {
49                 description
50                   "Value associated with the name.";
51                 type string;
52             }
53         }
54     }
55
56     grouping primitive-parameter {
57         leaf name {
58             description
59               "Name of the parameter.";
60             type string;
61         }
62
63         leaf data-type {
64             description
65               "Data type associated with the name.";
66             type common:parameter-data-type;
67         }
68
69         leaf mandatory {
70             description
71               "Is this field mandatory";
72             type boolean;
73             default false;
74         }
75
76         leaf default-value {
77             description
78               "The default value for this field";
79             type string;
80         }
81
82         leaf parameter-pool {
83             description
84               "NSD parameter pool name to use for this parameter";
85             type string;
86         }
87
88         leaf read-only {
89             description
90               "The value should be dimmed by the UI.
91                Only applies to parameters with default values.";
92             type boolean;
93             default false;
94         }
95
96         leaf hidden {
97             description
98               "The value should be hidden by the UI.
99                Only applies to parameters with default values.";
100             type boolean;
101             default false;
102         }
103     }
104
105     grouping vnfc-relations {
106         list relation {
107             description
108               "List of relations between elements in this descriptor.";
109             key "name";
110
111             leaf name {
112                 description
113                   "Name of the relation.";
114
115                 type string;
116             }
117
118             list entities {
119                 description
120                   "List of two elements to be related.
121                    Elements to be related are identified by a pair (id, endpoint).
122                    The relation will relate (id1, endpoint1) to (id2, endpoint2).";
123                 key "id";
124
125                 leaf id {
126                     description
127                       "A string, reference to the element id in the descriptor.
128                        It could be a vnfd-id or a vdu-id in a VNFD,
129                        or a nsd-id or member-vnf-index in a NSD.";
130                     type string;
131                 }
132
133                 leaf endpoint {
134                     description
135                       "Endpoint name defining the relation.";
136                     type string;
137                 }
138             }
139         }
140     }
141
142     grouping vnfc-metrics {
143         description
144           "Information about the VNF or VDU metrics";
145         list metrics {
146             description
147               "List of VNFC related metrics";
148             key "name";
149             leaf name {
150                 description
151                   "Name of the metric, as defined in the Juju charm.";
152                 type string;
153             }
154         }
155     }
156
157     grouping configuration-method {
158         choice config-method {
159             description
160               "Defines the configuration method for the VNF or VDU.";
161             case script {
162                 description
163                   "Use custom script for configuring the VNF or VDU.
164                    This script is executed in the context of
165                    Orchestrator (The same system and environment
166                    as the Launchpad).";
167                 container script {
168                     leaf script-type {
169                         description
170                           "Script type - currently supported - Scripts confirming to Rift CA plugin";
171                         type enumeration {
172                             enum rift;
173                         }
174                     }
175                 }
176             }
177
178             case juju {
179                 description
180                   "Configure the VNF or VDU through Juju.";
181                 container juju {
182                     leaf charm {
183                         description
184                           "Juju charm to use with the VNF or VDU.";
185                         type string;
186                     }
187                     leaf proxy {
188                         description
189                           "Is this a proxy charm?";
190                         type boolean;
191                         default true;
192                     }
193                     leaf cloud {
194                         description
195                           "Type of cloud where the charm will be deployed. It only
196                            applies to proxy charms (not native)";
197                         type enumeration {
198                           enum lxd;
199                           enum k8s;
200                         }
201                         default lxd;
202                     }
203                 }
204             }
205
206             case execution-environment-list {
207                 description
208                   "List of Execution Environments to configure or monitor VNF or VDU.";
209                 list execution-environment-list {
210                     key "id";
211                     leaf id {
212                       description "Execution environment identifier.";
213                     type string;
214                     }
215                     choice execution-environment-model {
216                         description
217                           "Execution environment model (juju, helm-chart)";
218                         case juju {
219                             description
220                               "Interact with the VNF or xDU through Juju.";
221                             container juju {
222                                 leaf charm {
223                                   description
224                                     "Juju charm to use with the VNF or VDU.";
225                                   type string;
226                                 }
227                                 leaf proxy {
228                                   description
229                                     "Is this a proxy charm?";
230                                   type boolean;
231                                   default true;
232                                 }
233                                 leaf cloud {
234                                   description
235                                     "Type of cloud where the charm will be deployed. It only
236                                      applies to proxy charms (not native)";
237                                   type enumeration {
238                                     enum lxd;
239                                     enum k8s;
240                                   }
241                                   default lxd;
242                                 }
243                             }
244                         }
245                         case helm-chart {
246                             description
247                               "Interact with the VNF or xDU through Helm.";
248                             leaf helm-chart {
249                                 description
250                                   "Helm chart that models the execution environment, in any of the following ways:
251                                    - <helm-repo>/<helm-chart>
252                                    - <helm-chart folder name under helm-charts folder in the package>
253                                    - <helm-chart tgz file (w/ or w/o extension) under helm-charts folder in the package>
254                                    - <URL_where_to_fetch_chart>
255                                   ";
256                                 type string;
257                             }
258                             leaf helm-version {
259                                 description
260                                   "Helm version to use for this helm-chart, v3 by default";
261                                 type enumeration {
262                                   enum "v2";
263                                   enum "v3";
264                                 }
265                                 default "v3";
266                             }
267                         }
268                     }
269                     leaf metric-service {
270                         description
271                           "Service name in the execution environment. For helm charts, it will be
272                            the name of the kubernetes service used by the exporter to expose metrics
273                            to the OSM collector.
274                           ";
275                         type string;
276                     }
277                     leaf connection-point-ref {
278                         description
279                           "String representing a leaf reference to the particular external connection point
280                            This field should match /vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id/vnfd:connection-point/vnfd:name
281                           ";
282                         type string;
283                     }
284                 }
285             }
286         }
287     }
288
289     grouping vdu-config-access {
290
291         container config-access {
292
293             description
294               "Indicates the way to access to the xNF or xDU for VCA configuration.
295                For the moment there is a single way (ssh-access).";
296
297             container ssh-access {
298
299                 description
300                   "If the xNF requires ssh and this parameter is set, SSH keys
301                    will be injected so that VCA can configure the xNF or xDU via ssh.";
302
303                 leaf required {
304                     description
305                       "whether ssh access is needed or not";
306                     type boolean;
307                     default false;
308                 }
309
310                 leaf default-user {
311                     description
312                       "Default user for ssh";
313                     type string;
314                 }
315             }
316         }
317     }
318     
319     grouping vnfc-configuration {
320         description
321           "Common information in the descriptors for NS, VNF or VDU configuration.
322            Note: If the NS contains multiple instances of the
323            same VNF or VDU, each instance could have a different
324            configuration.";
325
326         uses common:configuration-method;
327
328         list config-primitive {
329             description
330               "List of config primitives supported by the
331                configuration agent for this VNF or VDU.";
332             key "name";
333
334             leaf name {
335                 description
336                   "Name of the config primitive.";
337                 type string;
338             }
339
340             leaf execution-environment-ref {
341                 description
342                   "Leaf reference to the particular execution environment";
343                 type leafref {
344                   path "../../execution-environment-list/id";
345                 }
346             }
347
348             leaf execution-environment-primitive {
349                 description
350                   "Name of the primitive in the execution enviroment. If not explicit,
351                    the leaf 'name' will be used as the name of the primitive.";
352                 type string;
353             }
354
355
356             list parameter {
357                 description
358                   "List of parameters to the config primitive.";
359                 key "name";
360                 uses primitive-parameter;
361             }
362
363             leaf user-defined-script {
364                 description
365                   "A user defined script. If user defined script is defined,
366                    the script will be executed using bash";
367                 type string;
368             }
369         }
370
371         list initial-config-primitive {
372             description
373               "Initial set of configuration primitives.";
374             key "seq";
375             leaf seq {
376                 description
377                   "Sequence number for the configuration primitive.";
378                 type uint64;
379             }
380
381             choice primitive-type {
382                 case primitive-definition {
383                     leaf name {
384                         description
385                           "Name of the configuration primitive.";
386                         type string;
387                     }
388
389                     leaf execution-environment-ref {
390                         description
391                           "Leaf reference to the particular execution environment";
392                         type leafref {
393                           path "../../execution-environment-list/id";
394                         }
395                     }
396
397                     uses primitive-parameter-value;
398
399                     leaf user-defined-script {
400                         description
401                           "A user defined script.";
402                         type string;
403                     }
404                 }
405             }
406         }
407
408         list terminate-config-primitive {
409             description
410               "Terminate set of configuration primitives.";
411             key "seq";
412             leaf seq {
413                 description
414                   "Sequence number for the configuration primitive.";
415                 type uint64;
416             }
417             leaf name {
418                 description
419                   "Name of the configuration primitive.";
420                 type string;
421             }
422
423             leaf execution-environment-ref {
424                 description
425                   "Leaf reference to the particular execution environment";
426                 type leafref {
427                   path "../../execution-environment-list/id";
428                 }
429             }
430
431             uses primitive-parameter-value;
432
433             leaf user-defined-script {
434                 description
435                   "A user defined script.";
436                 type string;
437             }
438         }
439         uses common:vnfc-metrics;
440     }
441
442     typedef alarm-severity-type {
443         description
444           "An indication of the importance or urgency of the alarm";
445         type enumeration {
446             enum LOW;
447             enum MODERATE;
448             enum CRITICAL;
449         }
450     }
451
452     typedef alarm-statistic-type {
453         description
454           "Statistic type to use to determine threshold crossing
455            for an alarm.";
456         type enumeration {
457             enum AVERAGE;
458             enum MINIMUM;
459             enum MAXIMUM;
460             enum COUNT;
461             enum SUM;
462         }
463     }
464
465     typedef relational-operation-type {
466         description
467           "The relational operator used to define whether an alarm,
468            scaling event, etc. should be triggered in certain scenarios,
469            such as if the metric statistic goes above or below a specified
470            value.";
471         type enumeration {
472             enum GE; // greater than or equal
473             enum LE; // less than or equal
474             enum GT; // greater than
475             enum LT; // less than
476             enum EQ; // equal
477         }
478     }
479
480     grouping alarm-properties {
481         leaf name {
482             description
483               "A human readable string to identify the alarm";
484             type string;
485         }
486
487         leaf description {
488             description
489               "A description of this alarm";
490             type string;
491         }
492
493         leaf vdur-id {
494             description
495               "The identifier of the VDUR that the alarm is associated with";
496             type string;
497         }
498
499         container actions {
500             list ok {
501                 key "url";
502                 leaf url {
503                     type string;
504                 }
505             }
506
507             list insufficient-data {
508                 key "url";
509                 leaf url {
510                     type string;
511                 }
512             }
513
514             list alarm {
515                 key "url";
516                 leaf url {
517                     type string;
518                 }
519             }
520         }
521
522         leaf repeat {
523             description
524               "This flag indicates whether the alarm should be repeatedly emitted
525                while the associated threshold has been crossed.";
526
527             type boolean;
528             default true;
529         }
530
531         leaf enabled {
532             description
533               "This flag indicates whether the alarm has been enabled or
534                disabled.";
535
536             type boolean;
537             default true;
538         }
539
540         leaf severity {
541             description
542               "A measure of the importance or urgency of the alarm";
543             type alarm-severity-type;
544         }
545
546         leaf statistic {
547             description
548               "The type of metric statistic that is tracked by this alarm";
549             type alarm-statistic-type;
550         }
551
552         leaf operation {
553             description
554               "The relational operator used to define whether an alarm should be
555                triggered in certain scenarios, such as if the metric statistic
556                goes above or below a specified value.";
557             type relational-operation-type;
558         }
559
560         leaf value {
561             description
562               "This value defines the threshold that, if crossed, will trigger
563                the alarm.";
564             type decimal64 {
565                 fraction-digits 4;
566             }
567         }
568
569         leaf period {
570             description
571               "The period defines the length of time (seconds) that the metric
572                data are collected over in oreder to evaluate the chosen
573                statistic.";
574             type uint32;
575         }
576
577         leaf evaluations {
578             description
579               "Defines the length of time (seconds) in which metric data are
580                collected in order to evaluate the chosen statistic.";
581             type uint32;
582         }
583     }
584
585     grouping virtual-interface {
586         container virtual-interface {
587             description
588               "Container for the virtual interface properties";
589
590             leaf type {
591                 description
592                   "Specifies the type of virtual interface
593                    between VM and host.
594                    PARAVIRT        : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.).
595                    VIRTIO          : Deprecated! Use the traditional VIRTIO interface.
596                    PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
597                    SR-IOV          : Use SR-IOV interface.
598                    E1000           : Emulate E1000 interface.
599                    RTL8139         : Emulate RTL8139 interface.
600                    PCNET           : Emulate PCNET interface.
601                    OM-MGMT         : Deprecated! Use PARAVIRT instead and set the VNF management interface at vnfd:mgmt-interface:cp";
602
603                 type enumeration {
604                     enum PARAVIRT;
605                     enum OM-MGMT;
606                     enum PCI-PASSTHROUGH;
607                     enum SR-IOV;
608                     enum VIRTIO;
609                     enum E1000;
610                     enum RTL8139;
611                     enum PCNET;
612                 }
613                 default "PARAVIRT";
614             }
615
616             leaf vpci {
617                 description
618                   "Specifies the virtual PCI address. Expressed in
619                    the following format dddd:dd:dd.d. For example
620                    0000:00:12.0. This information can be used to
621                    pass as metadata during the VM creation.";
622                 type string;
623             }
624
625             leaf bandwidth {
626                 description
627                   "Aggregate bandwidth of the NIC.";
628                 type uint64;
629             }
630         }
631     }
632
633     grouping description {
634         leaf description {
635             type string;
636         }
637     }
638
639     typedef scaling-trigger {
640         type enumeration {
641             enum pre-scale-in {
642                 value 1;
643             }
644             enum post-scale-in {
645                 value 2;
646             }
647             enum pre-scale-out {
648                 value 3;
649             }
650             enum post-scale-out {
651                 value 4;
652             }
653         }
654     }
655
656     typedef scaling-policy-type {
657         type enumeration {
658             enum manual {
659                 value 1;
660             }
661             enum automatic {
662                 value 2;
663             }
664         }
665     }
666
667     typedef scaling-criteria-operation {
668         type enumeration {
669             enum AND {
670                 value 1;
671             }
672             enum OR {
673                 value 2;
674             }
675         }
676     }
677 }