Update vnfc-relations
[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         }
204     }
205
206     grouping vnfc-metrics {
207         description
208           "Information about the VNF or VDU metrics";
209         list metrics {
210             description
211               "List of VNFC related metrics";
212             key "name";
213             leaf name {
214                 description
215                   "Name of the metric, as defined in the Juju charm.";
216                 type string;
217             }
218         }
219     }
220
221     grouping configuration-method {
222         choice config-method {
223             description
224               "Defines the configuration method for the VNF or VDU.";
225             case script {
226                 description
227                   "Use custom script for configuring the VNF or VDU.
228                    This script is executed in the context of
229                    Orchestrator (The same system and environment
230                    as the Launchpad).";
231                 container script {
232                     leaf script-type {
233                         description
234                           "Script type - currently supported - Scripts confirming to Rift CA plugin";
235                         type enumeration {
236                             enum rift;
237                         }
238                     }
239                 }
240             }
241
242             case juju {
243                 description
244                   "Configure the VNF or VDU through Juju.";
245                 container juju {
246                     leaf charm {
247                         description
248                           "Juju charm to use with the VNF or VDU.";
249                         type string;
250                     }
251                     leaf proxy {
252                         description
253                           "Is this a proxy charm?";
254                         type boolean;
255                         default true;
256                     }
257                     leaf cloud {
258                         description
259                           "Type of cloud where the charm will be deployed. It only
260                            applies to proxy charms (not native)";
261                         type enumeration {
262                           enum lxd;
263                           enum k8s;
264                         }
265                         default lxd;
266                     }
267                 }
268             }
269
270             case execution-environment-list {
271                 description
272                   "List of Execution Environments to configure or monitor VNF or VDU.";
273                 list execution-environment-list {
274                     key "id";
275                     leaf id {
276                       description "Execution environment identifier.";
277                     type string;
278                     }
279                     choice execution-environment-model {
280                         description
281                           "Execution environment model (juju, helm-chart)";
282                         case juju {
283                             description
284                               "Interact with the VNF or xDU through Juju.";
285                             container juju {
286                                 leaf charm {
287                                   description
288                                     "Juju charm to use with the VNF or VDU.";
289                                   type string;
290                                 }
291                                 leaf proxy {
292                                   description
293                                     "Is this a proxy charm?";
294                                   type boolean;
295                                   default true;
296                                 }
297                                 leaf cloud {
298                                   description
299                                     "Type of cloud where the charm will be deployed. It only
300                                      applies to proxy charms (not native)";
301                                   type enumeration {
302                                     enum lxd;
303                                     enum k8s;
304                                   }
305                                   default lxd;
306                                 }
307                             }
308                         }
309                         case helm-chart {
310                             description
311                               "Interact with the VNF or xDU through Helm.";
312                             leaf helm-chart {
313                                 description
314                                   "Helm chart that models the execution environment, in any of the following ways:
315                                    - <helm-repo>/<helm-chart>
316                                    - <helm-chart folder name under helm-charts folder in the package>
317                                    - <helm-chart tgz file (w/ or w/o extension) under helm-charts folder in the package>
318                                    - <URL_where_to_fetch_chart>
319                                   ";
320                                 type string;
321                             }
322                             leaf helm-version {
323                                 description
324                                   "Helm version to use for this helm-chart, v3 by default";
325                                 type enumeration {
326                                   enum "v2";
327                                   enum "v3";
328                                 }
329                                 default "v3";
330                             }
331                         }
332                     }
333                     leaf metric-service {
334                         description
335                           "Service name in the execution environment. For helm charts, it will be
336                            the name of the kubernetes service used by the exporter to expose metrics
337                            to the OSM collector.
338                           ";
339                         type string;
340                     }
341                     leaf external-connection-point-ref {
342                         description
343                           "String representing a leaf reference to the particular external connection point
344                            This field should match /vnfd:vnfd-catalog/vnfd:vnfd/vnfd:id/vnfd:connection-point/vnfd:name
345                           ";
346                         type string;
347                     }
348                 }
349             }
350         }
351     }
352
353     grouping vdu-config-access {
354
355         container config-access {
356
357             description
358               "Indicates the way to access to the xNF or xDU for VCA configuration.
359                For the moment there is a single way (ssh-access).";
360
361             container ssh-access {
362
363                 description
364                   "If the xNF requires ssh and this parameter is set, SSH keys
365                    will be injected so that VCA can configure the xNF or xDU via ssh.";
366
367                 leaf required {
368                     description
369                       "whether ssh access is needed or not";
370                     type boolean;
371                     default false;
372                 }
373
374                 leaf default-user {
375                     description
376                       "Default user for ssh";
377                     type string;
378                 }
379             }
380         }
381     }
382     
383     grouping vnfc-configuration {
384         description
385           "Common information in the descriptors for NS, VNF or VDU configuration.
386            Note: If the NS contains multiple instances of the
387            same VNF or VDU, each instance could have a different
388            configuration.";
389
390         uses common:configuration-method;
391
392         list config-primitive {
393             description
394               "List of config primitives supported by the
395                configuration agent for this VNF or VDU.";
396             key "name";
397
398             leaf name {
399                 description
400                   "Name of the config primitive.";
401                 type string;
402             }
403
404             leaf execution-environment-ref {
405                 description
406                   "Leaf reference to the particular execution environment";
407                 type leafref {
408                   path "../../execution-environment-list/id";
409                 }
410             }
411
412             leaf execution-environment-primitive {
413                 description
414                   "Name of the primitive in the execution enviroment. If not explicit,
415                    the leaf 'name' will be used as the name of the primitive.";
416                 type string;
417             }
418
419
420             list parameter {
421                 description
422                   "List of parameters to the config primitive.";
423                 key "name";
424                 uses primitive-parameter;
425             }
426
427             leaf user-defined-script {
428                 description
429                   "A user defined script. If user defined script is defined,
430                    the script will be executed using bash";
431                 type string;
432             }
433         }
434
435         list initial-config-primitive {
436             description
437               "Initial set of configuration primitives.";
438             key "seq";
439             leaf seq {
440                 description
441                   "Sequence number for the configuration primitive.";
442                 type uint64;
443             }
444
445             choice primitive-type {
446                 case primitive-definition {
447                     leaf name {
448                         description
449                           "Name of the configuration primitive.";
450                         type string;
451                     }
452
453                     leaf execution-environment-ref {
454                         description
455                           "Leaf reference to the particular execution environment";
456                         type leafref {
457                           path "../../execution-environment-list/id";
458                         }
459                     }
460
461                     uses primitive-parameter-value;
462
463                     leaf user-defined-script {
464                         description
465                           "A user defined script.";
466                         type string;
467                     }
468                 }
469             }
470         }
471
472         list terminate-config-primitive {
473             description
474               "Terminate set of configuration primitives.";
475             key "seq";
476             leaf seq {
477                 description
478                   "Sequence number for the configuration primitive.";
479                 type uint64;
480             }
481             leaf name {
482                 description
483                   "Name of the configuration primitive.";
484                 type string;
485             }
486
487             leaf execution-environment-ref {
488                 description
489                   "Leaf reference to the particular execution environment";
490                 type leafref {
491                   path "../../execution-environment-list/id";
492                 }
493             }
494
495             uses primitive-parameter-value;
496
497             leaf user-defined-script {
498                 description
499                   "A user defined script.";
500                 type string;
501             }
502         }
503         uses common:vnfc-metrics;
504     }
505
506     typedef alarm-severity-type {
507         description
508           "An indication of the importance or urgency of the alarm";
509         type enumeration {
510             enum LOW;
511             enum MODERATE;
512             enum CRITICAL;
513         }
514     }
515
516     typedef alarm-statistic-type {
517         description
518           "Statistic type to use to determine threshold crossing
519            for an alarm.";
520         type enumeration {
521             enum AVERAGE;
522             enum MINIMUM;
523             enum MAXIMUM;
524             enum COUNT;
525             enum SUM;
526         }
527     }
528
529     typedef relational-operation-type {
530         description
531           "The relational operator used to define whether an alarm,
532            scaling event, etc. should be triggered in certain scenarios,
533            such as if the metric statistic goes above or below a specified
534            value.";
535         type enumeration {
536             enum GE; // greater than or equal
537             enum LE; // less than or equal
538             enum GT; // greater than
539             enum LT; // less than
540             enum EQ; // equal
541         }
542     }
543
544     grouping alarm-properties {
545         leaf name {
546             description
547               "A human readable string to identify the alarm";
548             type string;
549         }
550
551         leaf description {
552             description
553               "A description of this alarm";
554             type string;
555         }
556
557         leaf vdur-id {
558             description
559               "The identifier of the VDUR that the alarm is associated with";
560             type string;
561         }
562
563         container actions {
564             list ok {
565                 key "url";
566                 leaf url {
567                     type string;
568                 }
569             }
570
571             list insufficient-data {
572                 key "url";
573                 leaf url {
574                     type string;
575                 }
576             }
577
578             list alarm {
579                 key "url";
580                 leaf url {
581                     type string;
582                 }
583             }
584         }
585
586         leaf repeat {
587             description
588               "This flag indicates whether the alarm should be repeatedly emitted
589                while the associated threshold has been crossed.";
590
591             type boolean;
592             default true;
593         }
594
595         leaf enabled {
596             description
597               "This flag indicates whether the alarm has been enabled or
598                disabled.";
599
600             type boolean;
601             default true;
602         }
603
604         leaf severity {
605             description
606               "A measure of the importance or urgency of the alarm";
607             type alarm-severity-type;
608         }
609
610         leaf statistic {
611             description
612               "The type of metric statistic that is tracked by this alarm";
613             type alarm-statistic-type;
614         }
615
616         leaf operation {
617             description
618               "The relational operator used to define whether an alarm should be
619                triggered in certain scenarios, such as if the metric statistic
620                goes above or below a specified value.";
621             type relational-operation-type;
622         }
623
624         leaf value {
625             description
626               "This value defines the threshold that, if crossed, will trigger
627                the alarm.";
628             type decimal64 {
629                 fraction-digits 4;
630             }
631         }
632
633         leaf period {
634             description
635               "The period defines the length of time (seconds) that the metric
636                data are collected over in oreder to evaluate the chosen
637                statistic.";
638             type uint32;
639         }
640
641         leaf evaluations {
642             description
643               "Defines the length of time (seconds) in which metric data are
644                collected in order to evaluate the chosen statistic.";
645             type uint32;
646         }
647     }
648
649     grouping virtual-interface {
650         container virtual-interface {
651             description
652               "Container for the virtual interface properties";
653
654             leaf type {
655                 description
656                   "Specifies the type of virtual interface
657                    between VM and host.
658                    PARAVIRT        : Use the default paravirtualized interface for the VIM (virtio, vmxnet3, etc.).
659                    VIRTIO          : Deprecated! Use the traditional VIRTIO interface.
660                    PCI-PASSTHROUGH : Use PCI-PASSTHROUGH interface.
661                    SR-IOV          : Use SR-IOV interface.
662                    E1000           : Emulate E1000 interface.
663                    RTL8139         : Emulate RTL8139 interface.
664                    PCNET           : Emulate PCNET interface.
665                    OM-MGMT         : Deprecated! Use PARAVIRT instead and set the VNF management interface at vnfd:mgmt-interface:cp";
666
667                 type enumeration {
668                     enum PARAVIRT;
669                     enum OM-MGMT;
670                     enum PCI-PASSTHROUGH;
671                     enum SR-IOV;
672                     enum VIRTIO;
673                     enum E1000;
674                     enum RTL8139;
675                     enum PCNET;
676                 }
677                 default "PARAVIRT";
678             }
679
680             leaf vpci {
681                 description
682                   "Specifies the virtual PCI address. Expressed in
683                    the following format dddd:dd:dd.d. For example
684                    0000:00:12.0. This information can be used to
685                    pass as metadata during the VM creation.";
686                 type string;
687             }
688
689             leaf bandwidth {
690                 description
691                   "Aggregate bandwidth of the NIC.";
692                 type uint64;
693             }
694         }
695     }
696
697     grouping description {
698         leaf description {
699             type string;
700         }
701     }
702
703     typedef scaling-trigger {
704         type enumeration {
705             enum pre-scale-in {
706                 value 1;
707             }
708             enum post-scale-in {
709                 value 2;
710             }
711             enum pre-scale-out {
712                 value 3;
713             }
714             enum post-scale-out {
715                 value 4;
716             }
717         }
718     }
719
720     typedef scaling-policy-type {
721         type enumeration {
722             enum manual {
723                 value 1;
724             }
725             enum automatic {
726                 value 2;
727             }
728         }
729     }
730
731     typedef scaling-criteria-operation {
732         type enumeration {
733             enum AND {
734                 value 1;
735             }
736             enum OR {
737                 value 2;
738             }
739         }
740     }
741 }