Day-2 primitives for CNF with proxy charms
[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             list service {
99               description
100                 "List of Kubernetes services exposed by the KDU.
101                  If empty, all services are assumed to be exposed in the CP associated to the first network
102                  in k8s-cluster.nets.";
103               key name;
104
105               leaf name {
106                 description "Name of the Kubernetes service exposed by he KDU model";
107                 type string;
108               }
109
110               leaf external-connection-point-ref {
111                 description
112                   "String representing a leaf reference to the particular external connection point.
113                    This field should match /etsi-nfv-vnfd:vnfd/etsi-nfv-vnfd:ext-cpd/etsi-nfv-vnfd:id
114                   ";
115                 type string;
116               }
117             }
118
119         }
120
121         container k8s-cluster {
122             leaf-list version {
123                 description
124                   "List of supported K8s versions.
125                    The cluster where the KDUs will be deployed will have to match
126                    one of these versions.";
127
128                 type string;
129             }
130
131             leaf-list cni {
132                 description
133                   "List of supported CNI plugins.
134                    The cluster where the KDUs will be deployed will have to use
135                    one of these CNI plugins.";
136
137                 type enumeration {
138                     enum calico;
139                     enum flannel;
140                     enum multus;
141                 }
142             }
143
144             list nets {
145                 description
146                   "List of required networks in the K8s cluster.
147                    The cluster where the KDUs will be deployed will have to use
148                    one of these CNI plugins.";
149
150                 key "id";
151
152                 leaf id {
153                     description
154                       "Internal identifier for the K8s cluster network in this VNF";
155                     type string;
156                 }
157             }
158         }
159     }
160
161     augment "/vnfd:vnfd" {
162         uses extended-kdu;
163     }
164
165     augment "/vnfd:vnfd/vnfd:ext-cpd/vnfd:cp-connection" {
166         uses extended-ext-cpd;
167     }
168 }