blob: ac0c88c629e0f7d7e6ab762ae993bafe0de7023b [file] [log] [blame]
Luca Prete45401c82019-01-15 15:31:22 -08001// Copyright 2017-present Open Networking Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15node ("${TestNodeName}") {
16 timeout (100) {
17 try {
18 stage ("Parse deployment configuration file") {
Matteo Scandolo9f8056b2019-01-17 10:33:51 -080019 sh returnStdout: true, script: "rm -rf helm-charts helm-repo-tools ${configBaseDir}"
Luca Prete45401c82019-01-15 15:31:22 -080020 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-repo-tools"
Wei-Yu Chen992665b2019-01-17 10:21:32 -080021 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/helm-charts"
Luca Prete45401c82019-01-15 15:31:22 -080022 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
23 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
24 }
25 stage('Clean up') {
26 timeout(10) {
27 sh returnStdout: true, script: """
28 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
29 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
30 do
31 echo "Purging chart: \${hchart}"
32 helm delete --purge "\${hchart}"
33 done
34 """
35 timeout(5) {
36 waitUntil {
37 helm_deleted = sh returnStdout: true, script: """
38 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
39 helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l
40 """
41 return helm_deleted.toInteger() == 0
42 }
43 }
Wei-Yu Chen9de5f162019-01-17 10:40:38 -080044 timeout(5) {
Wei-Yu Chen213821c2019-01-17 10:21:32 -080045 dir ("helm-charts") {
46 stage("Cleanup SR-IOV CNI and SR-IOV Network Device Plugin") {
47 sh returnStdout: true, script: """
48 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo736f6b82019-01-24 15:29:07 -080049 kubectl delete -f mcord/cni-config/05-sriov-device-plugin.yaml || true
50 kubectl delete -f mcord/cni-config/04-sriov-device-plugin-configmap.yaml || true
51 kubectl delete -f mcord/cni-config/03-network-definition.yaml || true
52 kubectl delete -f mcord/cni-config/02-network-crd.yaml || true
53 kubectl delete -f mcord/cni-config/01-cni-service-account.yaml || true
Wei-Yu Chen213821c2019-01-17 10:21:32 -080054 """
55 }
56 }
57 }
Luca Prete45401c82019-01-15 15:31:22 -080058 timeout(5) {
59 waitUntil {
60 kubectl_deleted = sh returnStdout: true, script: """
61 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Matteo Scandolo736f6b82019-01-24 15:29:07 -080062 kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet|test' | wc -l
Luca Prete45401c82019-01-15 15:31:22 -080063 """
64 return kubectl_deleted.toInteger() == 0
65 }
66 }
67 }
68 }
Luca Prete62a48c82019-01-16 10:40:01 -080069 stage('Add Helm repositories') {
Luca Prete45401c82019-01-15 15:31:22 -080070 sh returnStdout: true, script: """
71 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Wei-Yu Chen76dd7932019-01-18 14:14:23 -080072 helm init --upgrade --force-upgrade
Luca Prete45401c82019-01-15 15:31:22 -080073 helm repo add cord https://charts.opencord.org
Luca Prete62a48c82019-01-16 10:40:01 -080074 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
Luca Prete45401c82019-01-15 15:31:22 -080075 helm repo update
76 """
77 timeout(1) {
78 waitUntil {
Wei-Yu Chen76dd7932019-01-18 14:14:23 -080079 tillerpod_running = sh returnStdout: true, script: """
80 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
81 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
82 """
83 return tillerpod_running.toInteger() == 1
84 }
85 }
86 timeout(1) {
87 waitUntil {
Luca Prete45401c82019-01-15 15:31:22 -080088 cord_repo_present = sh returnStdout: true, script: """
89 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
90 helm repo list | grep cord | wc -l
91 """
92 return cord_repo_present.toInteger() == 1
93 }
94 }
95 }
Matteo Scandolo08aea472019-01-23 11:45:37 -080096
97 stage('Install etcd-cluster') {
98 timeout(10) {
99 sh returnStdout: true, script: """
100 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
101 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.3 -n etcd-operator stable/etcd-operator
Wei-Yu Chen396d24e2019-01-28 11:48:52 -0800102 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcdNodePort=32379 -n etcd cord/etcd-cluster
Matteo Scandolo08aea472019-01-23 11:45:37 -0800103 """
104 }
105 timeout(10) {
106 waitUntil {
107 etcd_running = sh returnStdout: true, script: """
108 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
109 kubectl get pods | grep etcd | grep -i running | grep 1/1 | wc -l
110 """
111 return etcd_running.toInteger() == 6
112 }
113 }
114 }
115
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800116 dir ("helm-charts") {
117 stage('Install SR-IOV CNI and SR-IOV Network Device Plugin') {
Luca Prete45401c82019-01-15 15:31:22 -0800118 sh returnStdout: true, script: """
119 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800120 kubectl apply -f mcord/cni-config/02-network-crd.yaml
121 kubectl apply -f mcord/cni-config/
Wei-Yu Chen7f8c4dd2019-01-17 15:32:03 -0800122 sleep 5
Luca Prete45401c82019-01-15 15:31:22 -0800123 """
124 }
125 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800126
Wei-Yu Chen037762d2019-01-24 11:12:39 -0800127 // In current development progress, we prefered to keep this for testing eNodeB's functionality
Andy Bavier77df9fb2019-02-02 10:49:04 -0700128 stage("Install M-CORD Data Plane Services") {
129 sh returnStdout: true, script: """
130 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
131 helm install -n mcord-data-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-data-plane
132 """
133 }
134
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800135 if ( params.installEpcControlPlane ) {
136 stage("Install M-CORD Control Plane Services") {
137 sh returnStdout: true, script: """
138 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
139 helm install -n mcord-control-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-control-plane
140 """
141 }
Luca Prete45401c82019-01-15 15:31:22 -0800142 }
Andy Bavier77df9fb2019-02-02 10:49:04 -0700143
144 stage("Install M-CORD BBU Services") {
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800145 sh returnStdout: true, script: """
146 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andy Bavier77df9fb2019-02-02 10:49:04 -0700147 helm install -n mcord-bbu --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-bbu
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800148 """
Luca Prete45401c82019-01-15 15:31:22 -0800149 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800150
Matteo Scandolo202064f2019-01-24 15:01:39 -0800151 stage('Install CORD Kafka') {
152 timeout(10) {
153 sh returnStdout: true, script: """
154 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
155 helm install --version 0.8.8 --set configurationOverrides."offsets\\.topic\\.replication\\.factor"=1 --set configurationOverrides."log\\.retention\\.hours"=4 --set configurationOverrides."log\\.message\\.timestamp\\.type"="LogAppendTime" --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false -n cord-kafka incubator/kafka
156 """
157 }
158 timeout(10) {
159 waitUntil {
160 kafka_instances_running = sh returnStdout: true, script: """
161 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
162 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
163 """
164 return kafka_instances_running.toInteger() == 2
165 }
166 }
167 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800168 // stage('Install Logging Infrastructure') {
169 // timeout(10) {
170 // sh returnStdout: true, script: """
171 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
172 // helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set elasticsearch.cluster.env.MINIMUM_MASTER_NODES="1" --set elasticsearch.client.replicas=1 --set elasticsearch.master.replicas=2 --set elasticsearch.master.persistence.enabled=false --set elasticsearch.data.replicas=1 --set elasticsearch.data.persistence.enabled=false -n logging cord/logging
173 // helm-repo-tools/wait_for_pods.sh
174 // """
175 // }
176 // }
177 // stage('Install Monitoring Infrastructure') {
178 // timeout(10) {
179 // sh returnStdout: true, script: """
180 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
181 // helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring
182 // helm-repo-tools/wait_for_pods.sh
183 // """
184 // }
185 // }
Matteo Scandolo202064f2019-01-24 15:01:39 -0800186 stage('Install ONOS') {
187 timeout(10) {
188 sh returnStdout: true, script: """
189 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800190 helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos --version 1.1.0
Matteo Scandolo202064f2019-01-24 15:01:39 -0800191 """
192 }
193 timeout(10) {
194 waitUntil {
195 onos_completed = sh returnStdout: true, script: """
196 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
197 kubectl get pods | grep -i onos | grep -i running | grep 2/2 | wc -l
198 """
199 return onos_completed.toInteger() == 1
200 }
201 }
202 }
203 stage('Install xos-core') {
204 timeout(10) {
205 sh returnStdout: true, script: """
206 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800207 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core cord/xos-core --version 2.3.3
Matteo Scandolo202064f2019-01-24 15:01:39 -0800208 """
209 }
210 timeout(10) {
211 waitUntil {
212 xos_core_completed = sh returnStdout: true, script: """
213 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
214 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
215 """
216 return xos_core_completed.toInteger() == 6
217 }
218 }
219 }
220 stage('Install M-CORD Profile') {
221 timeout(10) {
222 sh returnStdout: true, script: """
223 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
224 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n mcord cord/mcord
225 """
226 }
227 timeout(10) {
228 waitUntil {
229 tosca_completed = sh returnStdout: true, script: """
230 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
231 kubectl get pods | grep -i mcord-tosca-loader | grep -i completed | wc -l
232 """
233 return tosca_completed.toInteger() == 1
234 }
235 }
236 }
Luca Prete45401c82019-01-15 15:31:22 -0800237
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800238 // SEBA Begin
239 stage('Install SEBA Profile') {
240 timeout(10) {
241 sh returnStdout: true, script: """
242 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800243 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n seba cord/seba-services --set fabric.enabled=false --set onos-service.enabled=false --version 1.0.5
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800244 """
245 }
246 timeout(10) {
247 waitUntil {
248 tosca_completed = sh returnStdout: true, script: """
249 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
250 kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
251 """
252 return tosca_completed.toInteger() == 1
253 }
254 }
255 }
256
257 stage('Install base-kubernetes') {
258 timeout(10) {
259 sh returnStdout: true, script: """
260 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800261 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n base-kubernetes cord/base-kubernetes --version 1.0.2
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800262 """
263 }
264 timeout(10) {
265 waitUntil {
266 base_kubernetes_tosca_running = sh returnStdout: true, script: """
267 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
268 kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
269 """
270 return base_kubernetes_tosca_running.toInteger() == 1
271 }
272 }
273 }
274
275 stage('Install att workflow') {
276 timeout(10) {
277 sh returnStdout: true, script: """
278 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
279 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set att-workflow-driver.kafkaService=cord-kafka -n att-workflow --version 1.0.2 cord/att-workflow
280 """
281 }
282 timeout(10) {
283 waitUntil {
284 att_workflow_tosca_completed = sh returnStdout: true, script: """
285 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
286 kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
287 """
288 return att_workflow_tosca_completed.toInteger() == 1
289 }
290 }
291 }
292
293 stage('Install voltha') {
294 timeout(10) {
295 sh returnStdout: true, script: """
296 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800297 helm install -n voltha -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/voltha --set etcd.cluster.enabled=false --version 1.0.3
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800298 """
299 }
300 timeout(10) {
301 waitUntil {
302 voltha_completed = sh returnStdout: true, script: """
303 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
304 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
305 """
306 return voltha_completed.toInteger() == 8
307 }
308 }
309 }
310 // SEBA end
311
Luca Prete45401c82019-01-15 15:31:22 -0800312 if ( params.configurePod ) {
Matteo Scandolo202064f2019-01-24 15:01:39 -0800313 dir ("${configBaseDir}/${configToscaDir}/mcord") {
314 stage('Configure MCORD - Fabric') {
Luca Prete45401c82019-01-15 15:31:22 -0800315 timeout(1) {
316 waitUntil {
317 out_fabric = sh returnStdout: true, script: """
318 curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-fabric.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l
319 """
320 return out_fabric.toInteger() == 1
321 }
322 }
323 }
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800324 }
325 dir ("${configBaseDir}/${configToscaDir}/att-workflow") {
326 stage('Configure SEBA - Fabric and whitelist') {
327 timeout(1) {
328 waitUntil {
329 out_fabric = sh returnStdout: true, script: """
330 curl -s -H "xos-username:admin@opencord.org" -H "xos-password:letmein" -X POST --data-binary @${configFileName}-fabric.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l
331 """
332 return out_fabric.toInteger() == 1
333 }
334 }
335 }
336 stage('Configure SEBA - Subscriber') {
337 timeout(1) {
338 waitUntil {
339 out_subscriber = sh returnStdout: true, script: """
340 curl -s -H 'xos-username:admin@opencord.org' -H 'xos-password:letmein' -X POST --data-binary @${configFileName}-subscriber.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l
341 """
342 return out_subscriber.toInteger() == 1
343 }
344 }
345 }
346 stage('Configure SEBA - OLT') {
347 timeout(1) {
348 waitUntil {
349 out_olt = sh returnStdout: true, script: """
350 curl -H 'xos-username:admin@opencord.org' -H 'xos-password:letmein' -X POST --data-binary @${configFileName}-olt.yaml http://${deployment_config.nodes[0].ip}:30007/run | grep -i "created models" | wc -l
351 """
352 return out_olt.toInteger() == 1
353 }
354 }
355 }
Luca Prete45401c82019-01-15 15:31:22 -0800356 }
357 }
358 currentBuild.result = 'SUCCESS'
359 } catch (err) {
360 currentBuild.result = 'FAILURE'
361 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
362 }
363 echo "RESULT: ${currentBuild.result}"
364 }
365}