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