blob: af419359c441bffa1726d7e76441921fd83da964 [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
Wei-Yu Chen53d303a2019-02-19 15:15:27 -080029 helm init --upgrade --force-upgrade
30 """
31
32 timeout(1) {
33 waitUntil {
34 tillerpod_running = sh returnStdout: true, script: """
35 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
36 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
37 """
38 return tillerpod_running.toInteger() == 1
39 }
40 }
41
42 sh returnStdout: true, script: """
43 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Luca Prete45401c82019-01-15 15:31:22 -080044 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
45 do
46 echo "Purging chart: \${hchart}"
47 helm delete --purge "\${hchart}"
48 done
49 """
50 timeout(5) {
51 waitUntil {
52 helm_deleted = sh returnStdout: true, script: """
53 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
54 helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l
55 """
56 return helm_deleted.toInteger() == 0
57 }
58 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080059
60 // In Multi-cluster scenario, we only need to install SR-IOV on data plane cluster
Wei-Yu Chenab221cb2019-02-15 14:59:31 -080061 // if ( ! params.installEpcControlPlane ) {
62 // timeout(5) {
63 // dir ("helm-charts") {
64 // stage("Cleanup SR-IOV Network Device Plugin Daemonset") {
65 // sh returnStdout: true, script: """
66 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
67 // kubectl delete -f mcord/cni-config/05-sriov-device-plugin.yaml || true
68 // kubectl delete -f mcord/cni-config/04-sriov-device-plugin-configmap.yaml || true
69 // kubectl delete -f mcord/cni-config/03-network-definition.yaml || true
70 // kubectl delete -f mcord/cni-config/02-network-crd.yaml || true
71 // kubectl delete -f mcord/cni-config/01-cni-service-account.yaml || true
72 // """
73 // }
74 // }
75 // }
76 // }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080077
Luca Prete45401c82019-01-15 15:31:22 -080078 timeout(5) {
79 waitUntil {
80 kubectl_deleted = sh returnStdout: true, script: """
81 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Matteo Scandolo736f6b82019-01-24 15:29:07 -080082 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 -080083 """
84 return kubectl_deleted.toInteger() == 0
85 }
86 }
87 }
88 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080089
Matteo Scandolo65046b22019-02-04 09:59:49 -080090 // OLT Software START
91 if ( params.reinstallOlt ) {
92 stage('Reinstall OLT software') {
93 for(int i=0; i < deployment_config.olts.size(); i++) {
94 sh returnStdout: true, script: """
95 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --remove asfvolt16 && dpkg --purge asfvolt16'
96 """
97 timeout(5) {
98 waitUntil {
99 olt_sw_present = sh returnStdout: true, script: """
100 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --list | grep asfvolt16 | wc -l'
101 """
102 return olt_sw_present.toInteger() == 0
103 }
104 }
105 sh returnStdout: true, script: """
106 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
107 """
108 timeout(5) {
109 waitUntil {
110 olt_sw_present = sh returnStdout: true, script: """
111 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'dpkg --list | grep asfvolt16 | wc -l'
112 """
113 return olt_sw_present.toInteger() == 1
114 }
115 }
116 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
117 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
118 sh returnStdout: true, script: """
119 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'echo "port ce128 sp=40000" >> /broadcom/qax.soc'
120 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
121 """
122 }
123 }
124 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800125
Matteo Scandolo65046b22019-02-04 09:59:49 -0800126 stage('Restart OLT processes') {
127 for(int i=0; i < deployment_config.olts.size(); i++) {
128 timeout(5) {
129 sh returnStdout: true, script: """
130 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
131 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist stop' || true
132 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true
133 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/bal_core_dist.log'
134 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log'
135 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &'
136 sleep 5
137 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &'
138 """
139 }
140 timeout(15) {
141 waitUntil {
142 onu_discovered = sh returnStdout: true, script: "sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'cat /var/log/openolt.log | grep \"oper_state: up\" | wc -l'"
143 return onu_discovered.toInteger() > 0
144 }
145 }
146 }
147 }
148 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800149
150 // Start to deploy etcd clusters and M-CORD Services
Luca Prete62a48c82019-01-16 10:40:01 -0800151 stage('Add Helm repositories') {
Luca Prete45401c82019-01-15 15:31:22 -0800152 sh returnStdout: true, script: """
153 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
154 helm repo add cord https://charts.opencord.org
Luca Prete62a48c82019-01-16 10:40:01 -0800155 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
Luca Prete45401c82019-01-15 15:31:22 -0800156 helm repo update
157 """
158 timeout(1) {
159 waitUntil {
Wei-Yu Chen76dd7932019-01-18 14:14:23 -0800160 tillerpod_running = sh returnStdout: true, script: """
161 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
162 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
163 """
164 return tillerpod_running.toInteger() == 1
165 }
166 }
167 timeout(1) {
168 waitUntil {
Luca Prete45401c82019-01-15 15:31:22 -0800169 cord_repo_present = sh returnStdout: true, script: """
170 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
171 helm repo list | grep cord | wc -l
172 """
173 return cord_repo_present.toInteger() == 1
174 }
175 }
176 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800177 stage('Install etcd-cluster') {
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 --version 0.8.3 -n etcd-operator stable/etcd-operator
182 """
183 }
184 timeout(10) {
185 waitUntil {
186 etcd_operator_running = sh returnStdout: true, script: """
187 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
188 kubectl get pods | grep etcd-operator | grep -i running | grep 1/1 | wc -l
189 """
190 return etcd_operator_running.toInteger() == 3
191 }
192 }
193 timeout(1) {
194 waitUntil {
195 etcd_operator_definition = sh returnStdout: true, script: """
196 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
197 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="etcd.database.coreos.com").names.kind' | grep -E 'EtcdBackup|EtcdCluster|EtcdRestore' | wc -l
198 """
199 return etcd_operator_definition.toInteger() == 3
200 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800201
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800202 }
203 timeout(10) {
204 sh returnStdout: true, script: """
205 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
206 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcdNodePort=32379 --set clusterSize=1 -n etcd cord/etcd-cluster
207 """
208 }
209 timeout(10) {
210 waitUntil {
211 etcd_cluster_running = sh returnStdout: true, script: """
212 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
213 kubectl get pods | grep etcd-cluster | grep -i running | grep 1/1 | wc -l
214 """
215 return etcd_cluster_running.toInteger() == 1
216 }
217 }
218 }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800219
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800220 dir ("helm-charts") {
221 stage('Install SR-IOV CNI and SR-IOV Network Device Plugin') {
222 sh returnStdout: true, script: """
223 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
224 kubectl apply -f mcord/cni-config/02-network-crd.yaml
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800225 """
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800226
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800227 timeout(1) {
228 waitUntil {
229 network_crd_exist = sh returnStdout: true, script: """
230 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
231 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="k8s.cni.cncf.io").names.kind' | grep -E 'NetworkAttachmentDefinition' | wc -l
232 """
233 return network_crd_exist.toInteger() == 1
234 }
235 }
236
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800237 // sh returnStdout: true, script: """
238 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
239 // kubectl apply -f mcord/cni-config/
240 // """
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800241
242 // Because of SR-IOV daemonset will restart the kubelet and containerd, so we need to wait tiller up.
243 timeout(1) {
244 waitUntil {
245 tillerpod_running = sh returnStdout: true, script: """
246 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
247 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
248 """
249 return tillerpod_running.toInteger() == 1
250 }
251 }
252
253 // Sometimes tillerpod is up, but it's not ready to accept deployment yet, let's wait.
254 timeout(1) {
255 waitUntil {
256 helm_client_working = sh returnStatus: true, script: """
257 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
258 helm ls
259 """
260 return helm_client_working == 0
261 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800262 }
263 }
264 }
265
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800266 // Deploy Sequence: EPC Data plane > vBBU > EPC Control plane
Andy Bavier77df9fb2019-02-02 10:49:04 -0700267 stage("Install M-CORD Data Plane Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800268 mcord_dataplane_working = sh returnStdout: true, script: """
Andy Bavier77df9fb2019-02-02 10:49:04 -0700269 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
270 helm install -n mcord-data-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-data-plane
271 """
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800272
273 timeout (10) {
274 waitUntil {
275 mcord_dataplane_running = sh returnStdout: true, script: """
276 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
277 kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l
278 """
279 return mcord_dataplane_running.toInteger() == 1
280 }
281 }
Andy Bavier77df9fb2019-02-02 10:49:04 -0700282 }
283
Andy Bavier77df9fb2019-02-02 10:49:04 -0700284 stage("Install M-CORD BBU Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800285 mcord_bbu_working = sh returnStdout: true, script: """
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800286 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andy Bavier77df9fb2019-02-02 10:49:04 -0700287 helm install -n mcord-bbu --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-bbu
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800288 """
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800289
290 timeout (10) {
291 waitUntil {
292 mcord_bbu_running = sh returnStdout: true, script: """
293 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
294 kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l
295 """
296 return mcord_bbu_running.toInteger() == 1
297 }
298 }
Luca Prete45401c82019-01-15 15:31:22 -0800299 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800300
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800301 // if ( params.installEpcControlPlane ) {
302 // timeout(2) {
303 // waitUntil {
304 // mcord_bbu_running = sh returnStdout: true, script: """
305 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
306 // kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l
307 // """
308 // return mcord_bbu_running.toInteger() == 1
309 // }
310 // }
311 // stage("Install M-CORD Control Plane Services") {
312 // mcord_controlplane_working = sh returnStdout: true, script: """
313 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
314 // ngic_s1u_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
315 // bbu_eth0=\$(kubectl -n epc get pods accelleran-0 --template={{.status.podIP}})
316 // helm install -n mcord-control-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-control-plane --set accelleran_hostname=\$bbu_eth0 --set spgwu_s1u_ip=\$ngic_s1u_net_ip
317 // """
318 // }
319 // }
320
321 stage("Install CDN Local Services") {
322 timeout(2) {
323 waitUntil {
324 ngic_dataplane_running = sh returnStdout: true, script: """
325 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
326 kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l
327 """
328 return ngic_dataplane_running.toInteger() == 1
329 }
330 }
331
332 mcord_local_cdn_working = sh returnStdout: true, script: """
333 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
334 ngic_sgi_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig sgi-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
335 helm install -n cdn-local --set remote_ip="10.90.0.152" --set spgwu_sgiip=\$ngic_sgi_net_ip --namespace epc cord/mcord-cdn-local
336 """
337 }
338
Matteo Scandolo202064f2019-01-24 15:01:39 -0800339 stage('Install CORD Kafka') {
340 timeout(10) {
341 sh returnStdout: true, script: """
342 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
343 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
344 """
345 }
346 timeout(10) {
347 waitUntil {
348 kafka_instances_running = sh returnStdout: true, script: """
349 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
350 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
351 """
352 return kafka_instances_running.toInteger() == 2
353 }
354 }
355 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800356 // stage('Install Logging Infrastructure') {
357 // timeout(10) {
358 // sh returnStdout: true, script: """
359 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
360 // 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
361 // helm-repo-tools/wait_for_pods.sh
362 // """
363 // }
364 // }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800365 stage('Install Monitoring Infrastructure') {
366 timeout(10) {
367 sh returnStdout: true, script: """
368 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
369 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring --version 1.0.1
370 helm-repo-tools/wait_for_pods.sh
371 """
372 }
373 }
Matteo Scandolo202064f2019-01-24 15:01:39 -0800374 stage('Install ONOS') {
375 timeout(10) {
376 sh returnStdout: true, script: """
377 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800378 helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos --version 1.1.0
Matteo Scandolo202064f2019-01-24 15:01:39 -0800379 """
380 }
381 timeout(10) {
382 waitUntil {
383 onos_completed = sh returnStdout: true, script: """
384 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800385 kubectl get pods | grep -i onos | grep -i running | grep 1/1 | wc -l
Matteo Scandolo202064f2019-01-24 15:01:39 -0800386 """
387 return onos_completed.toInteger() == 1
388 }
389 }
390 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800391
392 stage('Install ONOS progRAN') {
393 timeout(10) {
394 sh returnStdout: true, script: """
395 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
396 echo \$(pwd)
397 helm install -n onos-progran -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos-progran
398 """
399 }
400 timeout(10) {
401 waitUntil {
402 onos_progran_completed = sh returnStdout: true, script: """
403 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
404 kubectl get pods | grep -i onos-progran | grep -i running | grep 1/1 | wc -l
405 """
406 return onos_progran_completed.toInteger() == 1
407 }
408 }
Matteo Scandolo8e1fc8a2019-02-15 14:50:27 -0800409 timeout(2) {
410 sh returnStdout: true, script: """
411 sshpass -p karaf ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30116 -l karaf ${deployment_config.nodes[0].ip} 'app deactivate org.onosproject.progran'
412 sshpass -p karaf ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30116 -l karaf ${deployment_config.nodes[0].ip} 'app activate org.onosproject.progran'
413 """
414 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800415 }
416
Matteo Scandolo202064f2019-01-24 15:01:39 -0800417 stage('Install xos-core') {
418 timeout(10) {
419 sh returnStdout: true, script: """
420 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800421 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 -0800422 """
423 }
424 timeout(10) {
425 waitUntil {
426 xos_core_completed = sh returnStdout: true, script: """
427 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
428 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
429 """
430 return xos_core_completed.toInteger() == 6
431 }
432 }
433 }
434 stage('Install M-CORD Profile') {
435 timeout(10) {
436 sh returnStdout: true, script: """
437 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
438 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n mcord cord/mcord
439 """
440 }
441 timeout(10) {
442 waitUntil {
443 tosca_completed = sh returnStdout: true, script: """
444 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
445 kubectl get pods | grep -i mcord-tosca-loader | grep -i completed | wc -l
446 """
447 return tosca_completed.toInteger() == 1
448 }
449 }
450 }
Luca Prete45401c82019-01-15 15:31:22 -0800451
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800452 // SEBA Begin
453 stage('Install SEBA Profile') {
454 timeout(10) {
455 sh returnStdout: true, script: """
456 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800457 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 -0800458 """
459 }
460 timeout(10) {
461 waitUntil {
462 tosca_completed = sh returnStdout: true, script: """
463 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
464 kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
465 """
466 return tosca_completed.toInteger() == 1
467 }
468 }
469 }
470
471 stage('Install base-kubernetes') {
472 timeout(10) {
473 sh returnStdout: true, script: """
474 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800475 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 -0800476 """
477 }
478 timeout(10) {
479 waitUntil {
480 base_kubernetes_tosca_running = sh returnStdout: true, script: """
481 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
482 kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
483 """
484 return base_kubernetes_tosca_running.toInteger() == 1
485 }
486 }
487 }
488
489 stage('Install att workflow') {
490 timeout(10) {
491 sh returnStdout: true, script: """
492 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
493 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
494 """
495 }
496 timeout(10) {
497 waitUntil {
498 att_workflow_tosca_completed = sh returnStdout: true, script: """
499 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
500 kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
501 """
502 return att_workflow_tosca_completed.toInteger() == 1
503 }
504 }
505 }
506
507 stage('Install voltha') {
508 timeout(10) {
509 sh returnStdout: true, script: """
510 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800511 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 -0800512 """
513 }
514 timeout(10) {
515 waitUntil {
516 voltha_completed = sh returnStdout: true, script: """
517 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
518 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
519 """
520 return voltha_completed.toInteger() == 8
521 }
522 }
523 }
524 // SEBA end
525
Luca Prete45401c82019-01-15 15:31:22 -0800526 if ( params.configurePod ) {
Matteo Scandolo202064f2019-01-24 15:01:39 -0800527 dir ("${configBaseDir}/${configToscaDir}/mcord") {
528 stage('Configure MCORD - Fabric') {
Luca Prete45401c82019-01-15 15:31:22 -0800529 timeout(1) {
530 waitUntil {
531 out_fabric = sh returnStdout: true, script: """
532 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
533 """
534 return out_fabric.toInteger() == 1
535 }
536 }
537 }
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800538 }
539 dir ("${configBaseDir}/${configToscaDir}/att-workflow") {
540 stage('Configure SEBA - Fabric and whitelist') {
541 timeout(1) {
542 waitUntil {
543 out_fabric = sh returnStdout: true, script: """
544 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
545 """
546 return out_fabric.toInteger() == 1
547 }
548 }
549 }
550 stage('Configure SEBA - Subscriber') {
551 timeout(1) {
552 waitUntil {
553 out_subscriber = sh returnStdout: true, script: """
554 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
555 """
556 return out_subscriber.toInteger() == 1
557 }
558 }
559 }
560 stage('Configure SEBA - OLT') {
561 timeout(1) {
562 waitUntil {
563 out_olt = sh returnStdout: true, script: """
564 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
565 """
566 return out_olt.toInteger() == 1
567 }
568 }
569 }
Luca Prete45401c82019-01-15 15:31:22 -0800570 }
571 }
572 currentBuild.result = 'SUCCESS'
573 } catch (err) {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800574 println err.message
Luca Prete45401c82019-01-15 15:31:22 -0800575 currentBuild.result = 'FAILURE'
576 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
577 }
578 echo "RESULT: ${currentBuild.result}"
579 }
580}