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 "v3";
352                                 }
353                                 default "v3";
354                             }
355                         }
356                     }
357                     leaf metric-service {
358                         description
359                           "Service name in the execution environment. For helm charts, it will be
360                            the name of the kubernetes service used by the exporter to expose metrics
361                            to the OSM collector.
362                           ";
363                         type string;
364                     }
365                     leaf external-connection-point-ref {
366                         description
367                           "String representing a leaf reference to the particular external connection point
368                            This field should match /vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id/vnfd:connection-point/vnfd:name
369                           ";
370                         type string;
371                     }
372                 }
373             }
374         }
375     }
376
377     grouping vdu-config-access {
378
379         container config-access {
380
381             description
382               "Indicates the way to access to the xNF or xDU for VCA configuration.
383                For the moment there is a single way (ssh-access).";
384
385             container ssh-access {
386
387                 description
388                   "If the xNF requires ssh and this parameter is set, SSH keys
389                    will be injected so that VCA can configure the xNF or xDU via ssh.";
390
391                 leaf required {
392                     description
393                       "whether ssh access is needed or not";
394                     type boolean;
395                     default false;
396                 }
397
398                 leaf default-user {
399                     description
400                       "Default user for ssh";
401                     type string;
402                 }
403             }
404         }
405     }
406     
407     grouping vnfc-configuration {
408         description
409           "Common information in the descriptors for NS, VNF or VDU configuration.
410            Note: If the NS contains multiple instances of the
411            same VNF or VDU, each instance could have a different
412            configuration.";
413
414         uses common:configuration-method;
415
416         list config-primitive {
417             description
418               "List of config primitives supported by the
419                configuration agent for this VNF or VDU.";
420             key "name";
421
422             leaf name {
423                 description
424                   "Name of the config primitive.";
425                 type string;
426             }
427
428             leaf execution-environment-ref {
429                 description
430                   "Leaf reference to the particular execution environment";
431                 type leafref {
432                   path "../../execution-environment-list/id";
433                 }
434             }
435
436             leaf execution-environment-primitive {
437                 description
438                   "Name of the primitive in the execution enviroment. If not explicit,
439                    the leaf 'name' will be used as the name of the primitive.";
440                 type string;
441             }
442
443
444             list parameter {
445                 description
446                   "List of parameters to the config primitive.";
447                 key "name";
448                 uses primitive-parameter;
449             }
450
451             leaf user-defined-script {
452                 description
453                   "A user defined script. If user defined script is defined,
454                    the script will be executed using bash";
455                 type string;
456             }
457         }
458
459         list initial-config-primitive {
460             description
461               "Initial set of configuration primitives.";
462             key "seq";
463             leaf seq {
464                 description
465                   "Sequence number for the configuration primitive.";
466                 type uint64;
467             }
468
469             choice primitive-type {
470                 case primitive-definition {
471                     leaf name {
472                         description
473                           "Name of the configuration primitive.";
474                         type string;
475                     }
476
477                     leaf execution-environment-ref {
478                         description
479                           "Leaf reference to the particular execution environment";
480                         type leafref {
481                           path "../../execution-environment-list/id";
482                         }
483                     }
484
485                     uses primitive-parameter-value;
486
487                     leaf user-defined-script {
488                         description
489                           "A user defined script.";
490                         type string;
491                     }
492                 }
493             }
494         }
495
496         list terminate-config-primitive {
497             description
498               "Terminate set of configuration primitives.";
499             key "seq";
500             leaf seq {
501                 description
502                   "Sequence number for the configuration primitive.";
503                 type uint64;
504             }
505             leaf name {
506                 description
507                   "Name of the configuration primitive.";
508                 type string;
509             }
510
511             leaf execution-environment-ref {
512                 description
513                   "Leaf reference to the particular execution environment";
514                 type leafref {
515                   path "../../execution-environment-list/id";
516                 }
517             }
518
519             uses primitive-parameter-value;
520
521             leaf user-defined-script {
522                 description
523                   "A user defined script.";
524                 type string;
525             }
526         }
527         uses common:vnfc-metrics;
528     }
529
530     typedef alarm-severity-type {
531         description
532           "An indication of the importance or urgency of the alarm";
533         type enumeration {
534             enum LOW;
535             enum MODERATE;
536             enum CRITICAL;
537         }
538     }
539
540     typedef alarm-statistic-type {
541         description
542           "Statistic type to use to determine threshold crossing
543            for an alarm.";
544         type enumeration {
545             enum AVERAGE;
546             enum MINIMUM;
547             enum MAXIMUM;
548             enum COUNT;
549             enum SUM;
550         }
551     }
552
553     typedef relational-operation-type {
554         description
555           "The relational operator used to define whether an alarm,
556            scaling event, etc. should be triggered in certain scenarios,
557            such as if the metric statistic goes above or below a specified
558            value.";
559         type enumeration {
560             enum GE; // greater than or equal
561             enum LE; // less than or equal
562             enum GT; // greater than
563             enum LT; // less than
564             enum EQ; // equal
565             enum NE; // not equal
566         }
567     }
568
569     grouping alarm-properties {
570         leaf name {
571             description
572               "A human readable string to identify the alarm";
573             type string;
574         }
575
576         leaf description {
577             description
578               "A description of this alarm";
579             type string;
580         }
581
582         leaf vdur-id {
583             description
584               "The identifier of the VDUR that the alarm is associated with";
585             type string;
586         }
587
588         container actions {
589             list ok {
590                 key "url";
591                 leaf url {
592                     type string;
593                 }
594             }
595
596             list insufficient-data {
597                 key "url";
598                 leaf url {
599                     type string;
600                 }
601             }
602
603             list alarm {
604                 key "url";
605                 leaf url {
606                     type string;
607                 }
608             }
609         }
610
611         leaf repeat {
612             description
613               "This flag indicates whether the alarm should be repeatedly emitted
614                while the associated threshold has been crossed.";
615
616             type boolean;
617             default true;
618         }
619
620         leaf enabled {
621             description
622               "This flag indicates whether the alarm has been enabled or
623                disabled.";
624
625             type boolean;
626             default true;
627         }
628
629         leaf severity {
630             description
631               "A measure of the importance or urgency of the alarm";
632             type alarm-severity-type;
633         }
634
635         leaf statistic {
636             description
637               "The type of metric statistic that is tracked by this alarm";
638             type alarm-statistic-type;
639         }
640
641         leaf operation {
642             description
643               "The relational operator used to define whether an alarm should be
644                triggered in certain scenarios, such as if the metric statistic
645                goes above or below a specified value.";
646             type relational-operation-type;
647         }
648
649         leaf value {
650             description
651               "This value defines the threshold that, if crossed, will trigger
652                the alarm.";
653             type decimal64 {
654                 fraction-digits 4;
655             }
656         }
657
658         leaf period {
659             description
660               "The period defines the length of time (seconds) that the metric
661                data are collected over in oreder to evaluate the chosen
662                statistic.";
663             type uint32;
664         }
665
666         leaf evaluations {
667             description
668               "Defines the length of time (seconds) in which metric data are
669                collected in order to evaluate the chosen statistic.";
670             type uint32;
671         }
672     }
673
674     grouping virtual-interface {
675         container virtual-interface {
676             description
677               "Container for the virtual interface properties";
678
679             leaf type {
680                 description
681                   "Specifies the type of virtual interface
682                    between VM and host.
683                    PARAVIRT        : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.).
684                    VIRTIO          : Deprecated! Use the traditional VIRTIO interface.
685                    PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
686                    SR-IOV          : Use SR-IOV interface.
687                    E1000           : Emulate E1000 interface.
688                    RTL8139         : Emulate RTL8139 interface.
689                    PCNET           : Emulate PCNET interface.
690                    OM-MGMT         : Deprecated! Use PARAVIRT instead and set the VNF management interface at vnfd:mgmt-interface:cp";
691
692                 type enumeration {
693                     enum PARAVIRT;
694                     enum OM-MGMT;
695                     enum PCI-PASSTHROUGH;
696                     enum SR-IOV;
697                     enum VIRTIO;
698                     enum E1000;
699                     enum RTL8139;
700                     enum PCNET;
701                 }
702                 default "PARAVIRT";
703             }
704
705             leaf vpci {
706                 description
707                   "Specifies the virtual PCI address. Expressed in
708                    the following format dddd:dd:dd.d. For example
709                    0000:00:12.0. This information can be used to
710                    pass as metadata during the VM creation.";
711                 type string;
712             }
713
714             leaf bandwidth {
715                 description
716                   "Aggregate bandwidth of the NIC.";
717                 type uint64;
718             }
719         }
720     }
721
722     grouping description {
723         leaf description {
724             type string;
725         }
726     }
727
728     grouping vdu-storage-requirements {
729         list vdu-storage-requirements {
730             description
731               "Array of key-value pairs that articulate the storage
732                deployment requirements.
733
734                If the storage type is persistent-storage, the following setting
735                holds the persistent volume upon VM deletion:
736                  key: keep-volume
737                  value: true
738
739                If storage volume can be attached to several VMs, the following setting
740                will allow it:
741                  key: multiattach
742                  value: true";
743
744             key "key";
745
746             leaf key {
747                 type string;
748             }
749
750             leaf value {
751                 type string;
752             }
753         }
754     }
755
756     typedef scaling-trigger {
757         type enumeration {
758             enum pre-scale-in {
759                 value 1;
760             }
761             enum post-scale-in {
762                 value 2;
763             }
764             enum pre-scale-out {
765                 value 3;
766             }
767             enum post-scale-out {
768                 value 4;
769             }
770         }
771     }
772
773     typedef scaling-policy-type {
774         type enumeration {
775             enum manual {
776                 value 1;
777             }
778             enum automatic {
779                 value 2;
780             }
781         }
782     }
783
784     typedef scaling-criteria-operation {
785         type enumeration {
786             enum AND {
787                 value 1;
788             }
789             enum OR {
790                 value 2;
791             }
792         }
793     }
794 }