blob: 609080fa697105246c34c7c02f3cef625272011d [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 Chen1a5f9ff2019-02-07 10:18:55 -080044
45 // In Multi-cluster scenario, we only need to install SR-IOV on data plane cluster
Wei-Yu Chenab221cb2019-02-15 14:59:31 -080046 // if ( ! params.installEpcControlPlane ) {
47 // timeout(5) {
48 // dir ("helm-charts") {
49 // stage("Cleanup SR-IOV Network Device Plugin Daemonset") {
50 // sh returnStdout: true, script: """
51 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
52 // kubectl delete -f mcord/cni-config/05-sriov-device-plugin.yaml || true
53 // kubectl delete -f mcord/cni-config/04-sriov-device-plugin-configmap.yaml || true
54 // kubectl delete -f mcord/cni-config/03-network-definition.yaml || true
55 // kubectl delete -f mcord/cni-config/02-network-crd.yaml || true
56 // kubectl delete -f mcord/cni-config/01-cni-service-account.yaml || true
57 // """
58 // }
59 // }
60 // }
61 // }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080062
Luca Prete45401c82019-01-15 15:31:22 -080063 timeout(5) {
64 waitUntil {
65 kubectl_deleted = sh returnStdout: true, script: """
66 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Matteo Scandolo736f6b82019-01-24 15:29:07 -080067 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 -080068 """
69 return kubectl_deleted.toInteger() == 0
70 }
71 }
72 }
73 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080074
Matteo Scandolo65046b22019-02-04 09:59:49 -080075 // OLT Software START
76 if ( params.reinstallOlt ) {
77 stage('Reinstall OLT software') {
78 for(int i=0; i < deployment_config.olts.size(); i++) {
79 sh returnStdout: true, script: """
80 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'
81 """
82 timeout(5) {
83 waitUntil {
84 olt_sw_present = sh returnStdout: true, script: """
85 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'
86 """
87 return olt_sw_present.toInteger() == 0
88 }
89 }
90 sh returnStdout: true, script: """
91 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
92 """
93 timeout(5) {
94 waitUntil {
95 olt_sw_present = sh returnStdout: true, script: """
96 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'
97 """
98 return olt_sw_present.toInteger() == 1
99 }
100 }
101 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
102 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
103 sh returnStdout: true, script: """
104 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'
105 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
106 """
107 }
108 }
109 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800110
Matteo Scandolo65046b22019-02-04 09:59:49 -0800111 stage('Restart OLT processes') {
112 for(int i=0; i < deployment_config.olts.size(); i++) {
113 timeout(5) {
114 sh returnStdout: true, script: """
115 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
116 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
117 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true
118 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'
119 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log'
120 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &'
121 sleep 5
122 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &'
123 """
124 }
125 timeout(15) {
126 waitUntil {
127 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'"
128 return onu_discovered.toInteger() > 0
129 }
130 }
131 }
132 }
133 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800134
135 // Start to deploy etcd clusters and M-CORD Services
Luca Prete62a48c82019-01-16 10:40:01 -0800136 stage('Add Helm repositories') {
Luca Prete45401c82019-01-15 15:31:22 -0800137 sh returnStdout: true, script: """
138 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Wei-Yu Chen76dd7932019-01-18 14:14:23 -0800139 helm init --upgrade --force-upgrade
Luca Prete45401c82019-01-15 15:31:22 -0800140 helm repo add cord https://charts.opencord.org
Luca Prete62a48c82019-01-16 10:40:01 -0800141 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
Luca Prete45401c82019-01-15 15:31:22 -0800142 helm repo update
143 """
144 timeout(1) {
145 waitUntil {
Wei-Yu Chen76dd7932019-01-18 14:14:23 -0800146 tillerpod_running = sh returnStdout: true, script: """
147 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
148 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
149 """
150 return tillerpod_running.toInteger() == 1
151 }
152 }
153 timeout(1) {
154 waitUntil {
Luca Prete45401c82019-01-15 15:31:22 -0800155 cord_repo_present = sh returnStdout: true, script: """
156 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
157 helm repo list | grep cord | wc -l
158 """
159 return cord_repo_present.toInteger() == 1
160 }
161 }
162 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800163 stage('Install etcd-cluster') {
164 timeout(10) {
165 sh returnStdout: true, script: """
166 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
167 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.3 -n etcd-operator stable/etcd-operator
168 """
169 }
170 timeout(10) {
171 waitUntil {
172 etcd_operator_running = sh returnStdout: true, script: """
173 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
174 kubectl get pods | grep etcd-operator | grep -i running | grep 1/1 | wc -l
175 """
176 return etcd_operator_running.toInteger() == 3
177 }
178 }
179 timeout(1) {
180 waitUntil {
181 etcd_operator_definition = sh returnStdout: true, script: """
182 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
183 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="etcd.database.coreos.com").names.kind' | grep -E 'EtcdBackup|EtcdCluster|EtcdRestore' | wc -l
184 """
185 return etcd_operator_definition.toInteger() == 3
186 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800187
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800188 }
189 timeout(10) {
190 sh returnStdout: true, script: """
191 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
192 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcdNodePort=32379 --set clusterSize=1 -n etcd cord/etcd-cluster
193 """
194 }
195 timeout(10) {
196 waitUntil {
197 etcd_cluster_running = sh returnStdout: true, script: """
198 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
199 kubectl get pods | grep etcd-cluster | grep -i running | grep 1/1 | wc -l
200 """
201 return etcd_cluster_running.toInteger() == 1
202 }
203 }
204 }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800205
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800206 dir ("helm-charts") {
207 stage('Install SR-IOV CNI and SR-IOV Network Device Plugin') {
208 sh returnStdout: true, script: """
209 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
210 kubectl apply -f mcord/cni-config/02-network-crd.yaml
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800211 """
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800212
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800213 timeout(1) {
214 waitUntil {
215 network_crd_exist = sh returnStdout: true, script: """
216 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
217 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="k8s.cni.cncf.io").names.kind' | grep -E 'NetworkAttachmentDefinition' | wc -l
218 """
219 return network_crd_exist.toInteger() == 1
220 }
221 }
222
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800223 // sh returnStdout: true, script: """
224 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
225 // kubectl apply -f mcord/cni-config/
226 // """
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800227
228 // Because of SR-IOV daemonset will restart the kubelet and containerd, so we need to wait tiller up.
229 timeout(1) {
230 waitUntil {
231 tillerpod_running = sh returnStdout: true, script: """
232 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
233 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
234 """
235 return tillerpod_running.toInteger() == 1
236 }
237 }
238
239 // Sometimes tillerpod is up, but it's not ready to accept deployment yet, let's wait.
240 timeout(1) {
241 waitUntil {
242 helm_client_working = sh returnStatus: true, script: """
243 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
244 helm ls
245 """
246 return helm_client_working == 0
247 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800248 }
249 }
250 }
251
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800252 // Deploy Sequence: EPC Data plane > vBBU > EPC Control plane
Andy Bavier77df9fb2019-02-02 10:49:04 -0700253 stage("Install M-CORD Data Plane Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800254 mcord_dataplane_working = sh returnStdout: true, script: """
Andy Bavier77df9fb2019-02-02 10:49:04 -0700255 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
256 helm install -n mcord-data-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-data-plane
257 """
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800258
259 timeout (10) {
260 waitUntil {
261 mcord_dataplane_running = sh returnStdout: true, script: """
262 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
263 kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l
264 """
265 return mcord_dataplane_running.toInteger() == 1
266 }
267 }
Andy Bavier77df9fb2019-02-02 10:49:04 -0700268 }
269
Andy Bavier77df9fb2019-02-02 10:49:04 -0700270 stage("Install M-CORD BBU Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800271 mcord_bbu_working = sh returnStdout: true, script: """
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800272 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andy Bavier77df9fb2019-02-02 10:49:04 -0700273 helm install -n mcord-bbu --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-bbu
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800274 """
Wei-Yu Chenab221cb2019-02-15 14:59:31 -0800275
276 timeout (10) {
277 waitUntil {
278 mcord_bbu_running = sh returnStdout: true, script: """
279 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
280 kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l
281 """
282 return mcord_bbu_running.toInteger() == 1
283 }
284 }
Luca Prete45401c82019-01-15 15:31:22 -0800285 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800286
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800287 // if ( params.installEpcControlPlane ) {
288 // timeout(2) {
289 // waitUntil {
290 // mcord_bbu_running = sh returnStdout: true, script: """
291 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
292 // kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l
293 // """
294 // return mcord_bbu_running.toInteger() == 1
295 // }
296 // }
297 // stage("Install M-CORD Control Plane Services") {
298 // mcord_controlplane_working = sh returnStdout: true, script: """
299 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
300 // ngic_s1u_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
301 // bbu_eth0=\$(kubectl -n epc get pods accelleran-0 --template={{.status.podIP}})
302 // 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
303 // """
304 // }
305 // }
306
307 stage("Install CDN Local Services") {
308 timeout(2) {
309 waitUntil {
310 ngic_dataplane_running = sh returnStdout: true, script: """
311 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
312 kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l
313 """
314 return ngic_dataplane_running.toInteger() == 1
315 }
316 }
317
318 mcord_local_cdn_working = sh returnStdout: true, script: """
319 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
320 ngic_sgi_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig sgi-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
321 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
322 """
323 }
324
Matteo Scandolo202064f2019-01-24 15:01:39 -0800325 stage('Install CORD Kafka') {
326 timeout(10) {
327 sh returnStdout: true, script: """
328 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
329 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
330 """
331 }
332 timeout(10) {
333 waitUntil {
334 kafka_instances_running = sh returnStdout: true, script: """
335 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
336 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
337 """
338 return kafka_instances_running.toInteger() == 2
339 }
340 }
341 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800342 // stage('Install Logging Infrastructure') {
343 // timeout(10) {
344 // sh returnStdout: true, script: """
345 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
346 // 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
347 // helm-repo-tools/wait_for_pods.sh
348 // """
349 // }
350 // }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800351 stage('Install Monitoring Infrastructure') {
352 timeout(10) {
353 sh returnStdout: true, script: """
354 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
355 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring --version 1.0.1
356 helm-repo-tools/wait_for_pods.sh
357 """
358 }
359 }
Matteo Scandolo202064f2019-01-24 15:01:39 -0800360 stage('Install ONOS') {
361 timeout(10) {
362 sh returnStdout: true, script: """
363 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800364 helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos --version 1.1.0
Matteo Scandolo202064f2019-01-24 15:01:39 -0800365 """
366 }
367 timeout(10) {
368 waitUntil {
369 onos_completed = sh returnStdout: true, script: """
370 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800371 kubectl get pods | grep -i onos | grep -i running | grep 1/1 | wc -l
Matteo Scandolo202064f2019-01-24 15:01:39 -0800372 """
373 return onos_completed.toInteger() == 1
374 }
375 }
376 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800377
378 stage('Install ONOS progRAN') {
379 timeout(10) {
380 sh returnStdout: true, script: """
381 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
382 echo \$(pwd)
383 helm install -n onos-progran -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos-progran
384 """
385 }
386 timeout(10) {
387 waitUntil {
388 onos_progran_completed = sh returnStdout: true, script: """
389 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
390 kubectl get pods | grep -i onos-progran | grep -i running | grep 1/1 | wc -l
391 """
392 return onos_progran_completed.toInteger() == 1
393 }
394 }
Matteo Scandolo8e1fc8a2019-02-15 14:50:27 -0800395 timeout(2) {
396 sh returnStdout: true, script: """
397 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'
398 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'
399 """
400 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800401 }
402
Matteo Scandolo202064f2019-01-24 15:01:39 -0800403 stage('Install xos-core') {
404 timeout(10) {
405 sh returnStdout: true, script: """
406 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800407 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 -0800408 """
409 }
410 timeout(10) {
411 waitUntil {
412 xos_core_completed = sh returnStdout: true, script: """
413 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
414 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
415 """
416 return xos_core_completed.toInteger() == 6
417 }
418 }
419 }
420 stage('Install M-CORD Profile') {
421 timeout(10) {
422 sh returnStdout: true, script: """
423 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
424 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n mcord cord/mcord
425 """
426 }
427 timeout(10) {
428 waitUntil {
429 tosca_completed = sh returnStdout: true, script: """
430 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
431 kubectl get pods | grep -i mcord-tosca-loader | grep -i completed | wc -l
432 """
433 return tosca_completed.toInteger() == 1
434 }
435 }
436 }
Luca Prete45401c82019-01-15 15:31:22 -0800437
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800438 // SEBA Begin
439 stage('Install SEBA Profile') {
440 timeout(10) {
441 sh returnStdout: true, script: """
442 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800443 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 -0800444 """
445 }
446 timeout(10) {
447 waitUntil {
448 tosca_completed = sh returnStdout: true, script: """
449 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
450 kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
451 """
452 return tosca_completed.toInteger() == 1
453 }
454 }
455 }
456
457 stage('Install base-kubernetes') {
458 timeout(10) {
459 sh returnStdout: true, script: """
460 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800461 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 -0800462 """
463 }
464 timeout(10) {
465 waitUntil {
466 base_kubernetes_tosca_running = sh returnStdout: true, script: """
467 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
468 kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
469 """
470 return base_kubernetes_tosca_running.toInteger() == 1
471 }
472 }
473 }
474
475 stage('Install att workflow') {
476 timeout(10) {
477 sh returnStdout: true, script: """
478 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
479 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
480 """
481 }
482 timeout(10) {
483 waitUntil {
484 att_workflow_tosca_completed = sh returnStdout: true, script: """
485 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
486 kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
487 """
488 return att_workflow_tosca_completed.toInteger() == 1
489 }
490 }
491 }
492
493 stage('Install voltha') {
494 timeout(10) {
495 sh returnStdout: true, script: """
496 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800497 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 -0800498 """
499 }
500 timeout(10) {
501 waitUntil {
502 voltha_completed = sh returnStdout: true, script: """
503 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
504 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
505 """
506 return voltha_completed.toInteger() == 8
507 }
508 }
509 }
510 // SEBA end
511
Luca Prete45401c82019-01-15 15:31:22 -0800512 if ( params.configurePod ) {
Matteo Scandolo202064f2019-01-24 15:01:39 -0800513 dir ("${configBaseDir}/${configToscaDir}/mcord") {
514 stage('Configure MCORD - Fabric') {
Luca Prete45401c82019-01-15 15:31:22 -0800515 timeout(1) {
516 waitUntil {
517 out_fabric = sh returnStdout: true, script: """
518 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
519 """
520 return out_fabric.toInteger() == 1
521 }
522 }
523 }
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800524 }
525 dir ("${configBaseDir}/${configToscaDir}/att-workflow") {
526 stage('Configure SEBA - Fabric and whitelist') {
527 timeout(1) {
528 waitUntil {
529 out_fabric = sh returnStdout: true, script: """
530 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
531 """
532 return out_fabric.toInteger() == 1
533 }
534 }
535 }
536 stage('Configure SEBA - Subscriber') {
537 timeout(1) {
538 waitUntil {
539 out_subscriber = sh returnStdout: true, script: """
540 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
541 """
542 return out_subscriber.toInteger() == 1
543 }
544 }
545 }
546 stage('Configure SEBA - OLT') {
547 timeout(1) {
548 waitUntil {
549 out_olt = sh returnStdout: true, script: """
550 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
551 """
552 return out_olt.toInteger() == 1
553 }
554 }
555 }
Luca Prete45401c82019-01-15 15:31:22 -0800556 }
557 }
558 currentBuild.result = 'SUCCESS'
559 } catch (err) {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800560 println err.message
Luca Prete45401c82019-01-15 15:31:22 -0800561 currentBuild.result = 'FAILURE'
562 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
563 }
564 echo "RESULT: ${currentBuild.result}"
565 }
566}