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