blob: 48e8320f8882c078f03f34395f420b1bd735e49b [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}"
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080023 //sh returnStdout: true, script: "cd ${configBaseDir}; git fetch https://gerrit.opencord.org/pod-configs refs/changes/02/12902/1 && git checkout FETCH_HEAD; cd -"
Luca Prete45401c82019-01-15 15:31:22 -080024 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yaml"
25 }
26 stage('Clean up') {
27 timeout(10) {
28 sh returnStdout: true, script: """
29 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
30 for hchart in \$(helm list -q | grep -E -v 'docker-registry|mavenrepo|ponnet');
31 do
32 echo "Purging chart: \${hchart}"
33 helm delete --purge "\${hchart}"
34 done
35 """
36 timeout(5) {
37 waitUntil {
38 helm_deleted = sh returnStdout: true, script: """
39 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
40 helm ls -q | grep -E -v 'docker-registry|mavenrepo|ponnet' | wc -l
41 """
42 return helm_deleted.toInteger() == 0
43 }
44 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080045
46 // In Multi-cluster scenario, we only need to install SR-IOV on data plane cluster
47 if ( ! params.installEpcControlPlane ) {
48 timeout(5) {
49 dir ("helm-charts") {
50 stage("Cleanup SR-IOV Network Device Plugin Daemonset") {
51 sh returnStdout: true, script: """
52 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
53 kubectl delete -f mcord/cni-config/05-sriov-device-plugin.yaml || true
54 kubectl delete -f mcord/cni-config/04-sriov-device-plugin-configmap.yaml || true
55 kubectl delete -f mcord/cni-config/03-network-definition.yaml || true
56 kubectl delete -f mcord/cni-config/02-network-crd.yaml || true
57 kubectl delete -f mcord/cni-config/01-cni-service-account.yaml || true
58 """
59 }
Wei-Yu Chen213821c2019-01-17 10:21:32 -080060 }
61 }
62 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080063
Luca Prete45401c82019-01-15 15:31:22 -080064 timeout(5) {
65 waitUntil {
66 kubectl_deleted = sh returnStdout: true, script: """
67 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Matteo Scandolo736f6b82019-01-24 15:29:07 -080068 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 -080069 """
70 return kubectl_deleted.toInteger() == 0
71 }
72 }
73 }
74 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -080075
Matteo Scandolo65046b22019-02-04 09:59:49 -080076 // OLT Software START
77 if ( params.reinstallOlt ) {
78 stage('Reinstall OLT software') {
79 for(int i=0; i < deployment_config.olts.size(); i++) {
80 sh returnStdout: true, script: """
81 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'
82 """
83 timeout(5) {
84 waitUntil {
85 olt_sw_present = sh returnStdout: true, script: """
86 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'
87 """
88 return olt_sw_present.toInteger() == 0
89 }
90 }
91 sh returnStdout: true, script: """
92 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
93 """
94 timeout(5) {
95 waitUntil {
96 olt_sw_present = sh returnStdout: true, script: """
97 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'
98 """
99 return olt_sw_present.toInteger() == 1
100 }
101 }
102 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
103 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
104 sh returnStdout: true, script: """
105 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'
106 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
107 """
108 }
109 }
110 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800111
Matteo Scandolo65046b22019-02-04 09:59:49 -0800112 stage('Restart OLT processes') {
113 for(int i=0; i < deployment_config.olts.size(); i++) {
114 timeout(5) {
115 sh returnStdout: true, script: """
116 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
117 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
118 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt stop' || true
119 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'
120 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /var/log/openolt.log'
121 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service bal_core_dist start &'
122 sleep 5
123 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'service openolt start &'
124 """
125 }
126 timeout(15) {
127 waitUntil {
128 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'"
129 return onu_discovered.toInteger() > 0
130 }
131 }
132 }
133 }
134 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800135
136 // Start to deploy etcd clusters and M-CORD Services
Luca Prete62a48c82019-01-16 10:40:01 -0800137 stage('Add Helm repositories') {
Luca Prete45401c82019-01-15 15:31:22 -0800138 sh returnStdout: true, script: """
139 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Wei-Yu Chen76dd7932019-01-18 14:14:23 -0800140 helm init --upgrade --force-upgrade
Luca Prete45401c82019-01-15 15:31:22 -0800141 helm repo add cord https://charts.opencord.org
Luca Prete62a48c82019-01-16 10:40:01 -0800142 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
Luca Prete45401c82019-01-15 15:31:22 -0800143 helm repo update
144 """
145 timeout(1) {
146 waitUntil {
Wei-Yu Chen76dd7932019-01-18 14:14:23 -0800147 tillerpod_running = sh returnStdout: true, script: """
148 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
149 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
150 """
151 return tillerpod_running.toInteger() == 1
152 }
153 }
154 timeout(1) {
155 waitUntil {
Luca Prete45401c82019-01-15 15:31:22 -0800156 cord_repo_present = sh returnStdout: true, script: """
157 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
158 helm repo list | grep cord | wc -l
159 """
160 return cord_repo_present.toInteger() == 1
161 }
162 }
163 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800164 stage('Install etcd-cluster') {
165 timeout(10) {
166 sh returnStdout: true, script: """
167 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
168 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --version 0.8.3 -n etcd-operator stable/etcd-operator
169 """
170 }
171 timeout(10) {
172 waitUntil {
173 etcd_operator_running = sh returnStdout: true, script: """
174 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
175 kubectl get pods | grep etcd-operator | grep -i running | grep 1/1 | wc -l
176 """
177 return etcd_operator_running.toInteger() == 3
178 }
179 }
180 timeout(1) {
181 waitUntil {
182 etcd_operator_definition = sh returnStdout: true, script: """
183 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
184 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="etcd.database.coreos.com").names.kind' | grep -E 'EtcdBackup|EtcdCluster|EtcdRestore' | wc -l
185 """
186 return etcd_operator_definition.toInteger() == 3
187 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800188
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800189 }
190 timeout(10) {
191 sh returnStdout: true, script: """
192 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
193 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcdNodePort=32379 --set clusterSize=1 -n etcd cord/etcd-cluster
194 """
195 }
196 timeout(10) {
197 waitUntil {
198 etcd_cluster_running = sh returnStdout: true, script: """
199 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
200 kubectl get pods | grep etcd-cluster | grep -i running | grep 1/1 | wc -l
201 """
202 return etcd_cluster_running.toInteger() == 1
203 }
204 }
205 }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800206
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800207 dir ("helm-charts") {
208 stage('Install SR-IOV CNI and SR-IOV Network Device Plugin') {
209 sh returnStdout: true, script: """
210 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
211 kubectl apply -f mcord/cni-config/02-network-crd.yaml
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800212 """
Matteo Scandoloe7f232a2019-02-04 16:47:10 -0800213
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800214 timeout(1) {
215 waitUntil {
216 network_crd_exist = sh returnStdout: true, script: """
217 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
218 kubectl get crd -o json | jq -r '.items[].spec | select(.group=="k8s.cni.cncf.io").names.kind' | grep -E 'NetworkAttachmentDefinition' | wc -l
219 """
220 return network_crd_exist.toInteger() == 1
221 }
222 }
223
Matteo Scandolo08aea472019-01-23 11:45:37 -0800224 sh returnStdout: true, script: """
225 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800226 kubectl apply -f mcord/cni-config/
Matteo Scandolo08aea472019-01-23 11:45:37 -0800227 """
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800228
229 // Because of SR-IOV daemonset will restart the kubelet and containerd, so we need to wait tiller up.
230 timeout(1) {
231 waitUntil {
232 tillerpod_running = sh returnStdout: true, script: """
233 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
234 kubectl -n kube-system get pods | grep tiller-deploy | grep Running | wc -l
235 """
236 return tillerpod_running.toInteger() == 1
237 }
238 }
239
240 // Sometimes tillerpod is up, but it's not ready to accept deployment yet, let's wait.
241 timeout(1) {
242 waitUntil {
243 helm_client_working = sh returnStatus: true, script: """
244 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
245 helm ls
246 """
247 return helm_client_working == 0
248 }
Matteo Scandolo08aea472019-01-23 11:45:37 -0800249 }
250 }
251 }
252
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800253 // Deploy Sequence: EPC Data plane > vBBU > EPC Control plane
Andy Bavier77df9fb2019-02-02 10:49:04 -0700254 stage("Install M-CORD Data Plane Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800255 mcord_dataplane_working = sh returnStdout: true, script: """
Andy Bavier77df9fb2019-02-02 10:49:04 -0700256 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
257 helm install -n mcord-data-plane --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-data-plane
258 """
259 }
260
Andy Bavier77df9fb2019-02-02 10:49:04 -0700261 stage("Install M-CORD BBU Services") {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800262 mcord_bbu_working = sh returnStdout: true, script: """
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800263 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Andy Bavier77df9fb2019-02-02 10:49:04 -0700264 helm install -n mcord-bbu --namespace epc -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/mcord-bbu
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800265 """
Luca Prete45401c82019-01-15 15:31:22 -0800266 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800267
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800268 // if ( params.installEpcControlPlane ) {
269 // timeout(2) {
270 // waitUntil {
271 // mcord_bbu_running = sh returnStdout: true, script: """
272 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
273 // kubectl -n epc get pods | grep accelleran | grep -i running | grep 3/3 | wc -l
274 // """
275 // return mcord_bbu_running.toInteger() == 1
276 // }
277 // }
278 // stage("Install M-CORD Control Plane Services") {
279 // mcord_controlplane_working = sh returnStdout: true, script: """
280 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
281 // ngic_s1u_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig s1u-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
282 // bbu_eth0=\$(kubectl -n epc get pods accelleran-0 --template={{.status.podIP}})
283 // 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
284 // """
285 // }
286 // }
287
288 stage("Install CDN Local Services") {
289 timeout(2) {
290 waitUntil {
291 ngic_dataplane_running = sh returnStdout: true, script: """
292 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
293 kubectl -n epc get pods | grep ngic-dp | grep -i running | grep 1/1 | wc -l
294 """
295 return ngic_dataplane_running.toInteger() == 1
296 }
297 }
298
299 mcord_local_cdn_working = sh returnStdout: true, script: """
300 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
301 ngic_sgi_net_ip=\$(kubectl exec -n epc ngic-dp-0 ifconfig sgi-net | grep 'inet addr' | cut -d: -f2 | awk '{print \$1}')
302 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
303 """
304 }
305
Matteo Scandolo202064f2019-01-24 15:01:39 -0800306 stage('Install CORD Kafka') {
307 timeout(10) {
308 sh returnStdout: true, script: """
309 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
310 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
311 """
312 }
313 timeout(10) {
314 waitUntil {
315 kafka_instances_running = sh returnStdout: true, script: """
316 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
317 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
318 """
319 return kafka_instances_running.toInteger() == 2
320 }
321 }
322 }
Wei-Yu Chen992665b2019-01-17 10:21:32 -0800323 // stage('Install Logging Infrastructure') {
324 // timeout(10) {
325 // sh returnStdout: true, script: """
326 // export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
327 // 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
328 // helm-repo-tools/wait_for_pods.sh
329 // """
330 // }
331 // }
Matteo Scandolocf526e72019-02-14 17:46:50 -0800332 stage('Install Monitoring Infrastructure') {
333 timeout(10) {
334 sh returnStdout: true, script: """
335 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
336 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n nem-monitoring cord/nem-monitoring --version 1.0.1
337 helm-repo-tools/wait_for_pods.sh
338 """
339 }
340 }
Matteo Scandolo202064f2019-01-24 15:01:39 -0800341 stage('Install ONOS') {
342 timeout(10) {
343 sh returnStdout: true, script: """
344 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800345 helm install -n onos -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos --version 1.1.0
Matteo Scandolo202064f2019-01-24 15:01:39 -0800346 """
347 }
348 timeout(10) {
349 waitUntil {
350 onos_completed = sh returnStdout: true, script: """
351 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800352 kubectl get pods | grep -i onos | grep -i running | grep 1/1 | wc -l
Matteo Scandolo202064f2019-01-24 15:01:39 -0800353 """
354 return onos_completed.toInteger() == 1
355 }
356 }
357 }
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800358
359 stage('Install ONOS progRAN') {
360 timeout(10) {
361 sh returnStdout: true, script: """
362 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
363 echo \$(pwd)
364 helm install -n onos-progran -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml cord/onos-progran
365 """
366 }
367 timeout(10) {
368 waitUntil {
369 onos_progran_completed = sh returnStdout: true, script: """
370 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
371 kubectl get pods | grep -i onos-progran | grep -i running | grep 1/1 | wc -l
372 """
373 return onos_progran_completed.toInteger() == 1
374 }
375 }
376 }
377
Matteo Scandolo202064f2019-01-24 15:01:39 -0800378 stage('Install xos-core') {
379 timeout(10) {
380 sh returnStdout: true, script: """
381 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800382 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 -0800383 """
384 }
385 timeout(10) {
386 waitUntil {
387 xos_core_completed = sh returnStdout: true, script: """
388 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
389 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
390 """
391 return xos_core_completed.toInteger() == 6
392 }
393 }
394 }
395 stage('Install M-CORD Profile') {
396 timeout(10) {
397 sh returnStdout: true, script: """
398 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
399 helm install -f $WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n mcord cord/mcord
400 """
401 }
402 timeout(10) {
403 waitUntil {
404 tosca_completed = sh returnStdout: true, script: """
405 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
406 kubectl get pods | grep -i mcord-tosca-loader | grep -i completed | wc -l
407 """
408 return tosca_completed.toInteger() == 1
409 }
410 }
411 }
Luca Prete45401c82019-01-15 15:31:22 -0800412
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800413 // SEBA Begin
414 stage('Install SEBA Profile') {
415 timeout(10) {
416 sh returnStdout: true, script: """
417 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800418 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 -0800419 """
420 }
421 timeout(10) {
422 waitUntil {
423 tosca_completed = sh returnStdout: true, script: """
424 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
425 kubectl get pods | grep -i seba-services-tosca-loader | grep -i completed | wc -l
426 """
427 return tosca_completed.toInteger() == 1
428 }
429 }
430 }
431
432 stage('Install base-kubernetes') {
433 timeout(10) {
434 sh returnStdout: true, script: """
435 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800436 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 -0800437 """
438 }
439 timeout(10) {
440 waitUntil {
441 base_kubernetes_tosca_running = sh returnStdout: true, script: """
442 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
443 kubectl get pods | grep -i base-kubernetes-tosca-loader | grep -i completed | wc -l
444 """
445 return base_kubernetes_tosca_running.toInteger() == 1
446 }
447 }
448 }
449
450 stage('Install att workflow') {
451 timeout(10) {
452 sh returnStdout: true, script: """
453 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
454 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
455 """
456 }
457 timeout(10) {
458 waitUntil {
459 att_workflow_tosca_completed = sh returnStdout: true, script: """
460 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
461 kubectl get pods | grep -i att-workflow-tosca-loader | grep -i completed | wc -l
462 """
463 return att_workflow_tosca_completed.toInteger() == 1
464 }
465 }
466 }
467
468 stage('Install voltha') {
469 timeout(10) {
470 sh returnStdout: true, script: """
471 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Matteo Scandolo6c637ce2019-01-31 14:58:38 -0800472 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 -0800473 """
474 }
475 timeout(10) {
476 waitUntil {
477 voltha_completed = sh returnStdout: true, script: """
478 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
479 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
480 """
481 return voltha_completed.toInteger() == 8
482 }
483 }
484 }
485 // SEBA end
486
Luca Prete45401c82019-01-15 15:31:22 -0800487 if ( params.configurePod ) {
Matteo Scandolo202064f2019-01-24 15:01:39 -0800488 dir ("${configBaseDir}/${configToscaDir}/mcord") {
489 stage('Configure MCORD - Fabric') {
Luca Prete45401c82019-01-15 15:31:22 -0800490 timeout(1) {
491 waitUntil {
492 out_fabric = sh returnStdout: true, script: """
493 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
494 """
495 return out_fabric.toInteger() == 1
496 }
497 }
498 }
Matteo Scandoloef6e4022019-01-25 14:40:10 -0800499 }
500 dir ("${configBaseDir}/${configToscaDir}/att-workflow") {
501 stage('Configure SEBA - Fabric and whitelist') {
502 timeout(1) {
503 waitUntil {
504 out_fabric = sh returnStdout: true, script: """
505 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
506 """
507 return out_fabric.toInteger() == 1
508 }
509 }
510 }
511 stage('Configure SEBA - Subscriber') {
512 timeout(1) {
513 waitUntil {
514 out_subscriber = sh returnStdout: true, script: """
515 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
516 """
517 return out_subscriber.toInteger() == 1
518 }
519 }
520 }
521 stage('Configure SEBA - OLT') {
522 timeout(1) {
523 waitUntil {
524 out_olt = sh returnStdout: true, script: """
525 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
526 """
527 return out_olt.toInteger() == 1
528 }
529 }
530 }
Luca Prete45401c82019-01-15 15:31:22 -0800531 }
532 }
533 currentBuild.result = 'SUCCESS'
534 } catch (err) {
Wei-Yu Chen1a5f9ff2019-02-07 10:18:55 -0800535 println err.message
Luca Prete45401c82019-01-15 15:31:22 -0800536 currentBuild.result = 'FAILURE'
537 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
538 }
539 echo "RESULT: ${currentBuild.result}"
540 }
541}