Fixes bug 1424 by adding ip-address on virtual-network-interface-requirement
[osm/IM.git] / models / augments / kdu.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 kdu {
19     yang-version 1.1;
20     namespace "urn:etsi:osm:yang:augments:kdu";
21     prefix "kdu";
22
23     import etsi-nfv-vnfd {
24         prefix vnfd;
25     }
26
27     import common-augments {
28         prefix common;
29     }
30
31     grouping extended-ext-cpd {
32         leaf k8s-cluster-net {
33             description
34               "Reference to the K8s cluster network
35                to which CPs instantiated from this external CP
36                Descriptor (CPD) connect.";
37             type leafref {
38                 path "/vnfd:vnfd/kdu:k8s-cluster/kdu:nets/kdu:id";
39             }
40         }
41     }
42
43     grouping extended-kdu-configuration {
44         container kdu-configuration {
45             uses common:vnfc-configuration;
46             uses common:vdu-config-access;
47
48             leaf-list blacklist-config-primitive {
49                 description
50                   "List of blacklisted config primitives from the list of
51                    default kdu config primitives";
52
53                 type enumeration {
54                     enum upgrade;
55                     enum rollback;
56                 }
57             }
58         }
59     }
60
61     grouping extended-kdu {
62         list kdu {
63             description
64               "List of K8s Deployment Units";
65             key "name";
66
67             leaf name {
68                 description
69                   "Unique name for the KDU";
70                 type string;
71             }
72
73             leaf description {
74                 description
75                   "Description of the KDU.";
76                 type string;
77             }
78
79             choice kdu-model {
80                 description
81                   "Indicates the KDU model, either as a helm-chart or as a juju-bundle.";
82
83                 case helm-chart {
84                     leaf helm-chart {
85                         description
86                           "Helm chart that models the KDU, in any of the following ways:
87                            - <helm-repo>/<helm-chart>
88                            - <helm-chart folder under k8s_models folder in the package>
89                            - <helm-chart tgz file (w/ or w/o extension) under k8s_models folder in the package>
90                            - <URL_where_to_fetch_chart>
91                           ";
92                         type string;
93                     }
94
95                     leaf helm-version {
96                         description
97                           "Helm version to use for this helm-chart, v3 by default";
98                         type enumeration {
99                             enum v2;
100                             enum v3;
101                         }
102                         default v3;
103                     }
104                 }
105
106                 case juju-bundle {
107                     leaf juju-bundle {
108                         description
109                           "Juju bundle that models the KDU, in any of the following ways:
110                            - <juju-repo>/<juju-bundle>
111                            - <juju-bundle folder under k8s_models folder in the package>
112                            - <juju-bundle tgz file (w/ or w/o extension) under k8s_models folder in the package>
113                            - <URL_where_to_fetch_juju_bundle>
114                           ";
115                         type string;
116                     }
117                 }
118             }
119
120             uses extended-kdu-configuration;
121
122         }
123
124         container k8s-cluster {
125             leaf-list version {
126                 description
127                   "List of supported K8s versions.
128                    The cluster where the KDUs will be deployed will have to match
129                    one of these versions.";
130
131                 type string;
132             }
133
134             leaf-list cni {
135                 description
136                   "List of supported CNI plugins.
137                    The cluster where the KDUs will be deployed will have to use
138                    one of these CNI plugins.";
139
140                 type enumeration {
141                     enum calico;
142                     enum flannel;
143                     enum multus;
144                 }
145             }
146
147             list nets {
148                 description
149                   "List of required networks in the K8s cluster.
150                    The cluster where the KDUs will be deployed will have to use
151                    one of these CNI plugins.";
152
153                 key "id";
154
155                 leaf id {
156                     description
157                       "Internal identifier for the K8s cluster network in this VNF";
158                     type string;
159                 }
160             }
161         }
162
163         list service {
164           description
165             "List of Kubernetes services exposed by the KDU.
166              If empty, all services are assumed to be exposed in the CP associated to the first network
167              in k8s-cluster.nets.";
168           key name;
169
170           leaf name {
171             description "Name of the Kubernetes service exposed by he KDU model";
172             type string;
173           }
174
175           leaf mgmt-service {
176             description
177                 "Flag to indicate that this Kubernetes service is a mgmt service
178                 to be used for KDU configuration. Defaults to false (if no present).
179                 All services with mgmt-service set to true will be passed to the execution
180                 environment in charge of the KDU configuration.";
181             type boolean;
182             default false;
183           }
184
185           leaf external-connection-point-ref {
186             description
187               "String representing a leaf reference to the particular external connection point.
188                This field should match /etsi-nfv-vnfd:vnfd/etsi-nfv-vnfd:ext-cpd/etsi-nfv-vnfd:id
189               ";
190             type string;
191           }
192
193         }
194
195     }
196
197     augment "/vnfd:vnfd" {
198         uses extended-kdu;
199     }
200
201     augment "/vnfd:vnfd/vnfd:ext-cpd/vnfd:cp-connection" {
202         uses extended-ext-cpd;
203     }
204 }