blob: d3f5482ff62e2257d93788e611f0bcee396a6f92 [file] [log] [blame]
Kailash Khalasi164dc142018-09-14 11:49:08 -07001// 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") {
19 sh returnStdout: true, script: "rm -rf ${configBaseDir}"
20 sh returnStdout: true, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
21 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}.yml"
22 }
23 stage('Clean up') {
24 timeout(10) {
25 sh returnStdout: true, script: """
26 rm -rf helm-charts cord-tester
27 git clone -b ${branch} ${cordRepoUrl}/helm-charts
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 }
44 timeout(5) {
45 waitUntil {
46 kubectl_deleted = sh returnStdout: true, script: """
47 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
48 kubectl get pods --all-namespaces --no-headers | grep -E -v 'kube-system|docker-registry|mavenrepo|ponnet' | wc -l
49 """
50 return kubectl_deleted.toInteger() == 0
51 }
52 }
53 }
54 }
55 dir ("helm-charts") {
56 stage('Install Voltha Kafka') {
57 timeout(10) {
58 sh returnStdout: true, script: """
59 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
Kailash Khalasidef2f4e2018-09-17 10:39:14 -070060 helm repo add incubator http://storage.googleapis.com/kubernetes-charts-incubator
61 helm install -f examples/kafka-single.yaml --version 0.8.8 -n voltha-kafka incubator/kafka
Kailash Khalasi164dc142018-09-14 11:49:08 -070062 """
63 }
64 timeout(10) {
65 waitUntil {
66 kafka_instances_running = sh returnStdout: true, script: """
67 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
68 kubectl get pods | grep voltha-kafka | grep -i running | grep 1/1 | wc -l
69 """
70 return kafka_instances_running.toInteger() == 2
71 }
72 }
73 }
74 stage('Install voltha') {
75 timeout(10) {
76 sh returnStdout: true, script: """
77 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
78 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
79 helm dep build voltha
80 helm install -n voltha -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcd-operator.customResources.createEtcdClusterCRD=false voltha
81 helm upgrade -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha
82 """
83 }
84 timeout(10) {
85 waitUntil {
86 voltha_completed = sh returnStdout: true, script: """
87 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
88 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
89 """
90 return voltha_completed.toInteger() == 8
91 }
92 }
93 }
94 stage('Install CORD Kafka') {
95 timeout(10) {
96 sh returnStdout: true, script: """
97 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
98 helm install --name cord-kafka --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false incubator/kafka
99 """
100 }
101 timeout(10) {
102 waitUntil {
103 kafka_instances_running = sh returnStdout: true, script: """
104 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
105 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
106 """
107 return kafka_instances_running.toInteger() == 2
108 }
109 }
110 }
111 stage('Install ONOS') {
112 timeout(10) {
113 sh returnStdout: true, script: """
114 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
115 helm install -n onos -f configs/onos.yaml -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml onos
116 """
117 }
118 timeout(10) {
119 waitUntil {
120 onos_completed = sh returnStdout: true, script: """
121 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
122 kubectl get pods | grep -i onos | grep -i running | grep 1/1 | wc -l
123 """
124 return onos_completed.toInteger() == 1
125 }
126 }
127 }
128 stage('Install xos-core') {
129 timeout(10) {
130 sh returnStdout: true, script: """
131 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
132 helm dep update xos-core
133 helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n xos-core xos-core
134 """
135 }
136 timeout(10) {
137 waitUntil {
138 xos_core_completed = sh returnStdout: true, script: """
139 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
140 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
141 """
142 return xos_core_completed.toInteger() == 7
143 }
144 }
145 }
146 stage('Install rcord-lite') {
147 timeout(10) {
148 sh returnStdout: true, script: """
149 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
150 helm dep update xos-profiles/rcord-lite
151 helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n rcord-lite xos-profiles/rcord-lite
152 """
153 }
154 timeout(10) {
155 waitUntil {
156 rcord_tosca_completed = sh returnStdout: true, script: """
157 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf &&
158 kubectl get pods | grep -i tosca-loader | grep -i completed | wc -l
159 """
160 return rcord_tosca_completed.toInteger() == 1
161 }
162 }
163 }
164 stage('Install hippie-oss') {
165 timeout(10) {
166 sh returnStdout: true, script: """
167 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
168 helm install -f ../${configBaseDir}/${configKubernetesDir}/${configFileName}.yml -n hippie-oss xos-services/hippie-oss
169 """
170 }
171 timeout(10) {
172 waitUntil {
173 hippie_oss_running = sh returnStdout: true, script: """
174 export KUBECONFIG=$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf
175 kubectl get pods | grep -i hippie-oss | grep -i running | grep 1/1 | wc -l
176 """
177 return hippie_oss_running.toInteger() == 1
178 }
179 }
180 }
181 }
182 stage('Reinstall OLT software') {
183 for(int i=0; i < deployment_config.olts.size(); i++) {
184 sh returnStdout: true, script: """
185 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'
186 """
187 timeout(5) {
188 waitUntil {
189 olt_sw_present = sh returnStdout: true, script: """
190 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'
191 """
192 return olt_sw_present.toInteger() == 0
193 }
194 }
195 sh returnStdout: true, script: """
196 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
197 """
198 timeout(5) {
199 waitUntil {
200 olt_sw_present = sh returnStdout: true, script: """
201 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'
202 """
203 return olt_sw_present.toInteger() == 1
204 }
205 }
206 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
207 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
208 sh returnStdout: true, script: """
209 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'
210 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
211 """
212 }
213 }
214 }
215 stage('Restart OLT processes') {
216 for(int i=0; i < deployment_config.olts.size(); i++) {
217 timeout(5) {
218 sh returnStdout: true, script: """
219 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
220 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill bal_core_dist' || true
221 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill openolt' || true
222 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/bal.log'
223 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/openolt.log'
224 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'cd /broadcom; ./bal_core_dist -C :55001 < /dev/tty1 > ./bal.log 2>&1 &'
225 sleep 5
226 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'cd /broadcom; ./openolt -C 127.0.0.1:55001 < /dev/tty1 > ./openolt.log 2>&1 &'
227 """
228 }
229 timeout(15) {
230 waitUntil {
Kailash Khalasi23b693c2018-09-14 14:46:50 -0700231 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 /broadcom/openolt.log | grep \"oper_state: up\" | wc -l'"
Kailash Khalasi164dc142018-09-14 11:49:08 -0700232 return onu_discovered.toInteger() > 0
233 }
234 }
235 }
236 }
Kailash Khalasi4d18e202018-09-14 13:32:16 -0700237 if ( params.configurePod ) {
238 dir ("${configBaseDir}/${configToscaDir}/${profile}") {
Kailash Khalasi164dc142018-09-14 11:49:08 -0700239 stage('Configure R-CORD - Fabric and whitelist') {
240 timeout(1) {
241 waitUntil {
242 out_fabric = sh returnStdout: true, script: """
Kailash Khalasi4d18e202018-09-14 13:32:16 -0700243 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
Kailash Khalasi164dc142018-09-14 11:49:08 -0700244 """
245 return out_fabric.toInteger() == 1
246 }
247 }
248 }
249 stage('Configure R-CORD - Subscriber') {
250 timeout(1) {
251 waitUntil {
252 out_subscriber = sh returnStdout: true, script: """
Kailash Khalasi4d18e202018-09-14 13:32:16 -0700253 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
Kailash Khalasi164dc142018-09-14 11:49:08 -0700254 """
255 return out_subscriber.toInteger() == 1
256 }
257 }
258 }
259 stage('Configure R-CORD - OLT') {
260 timeout(1) {
261 waitUntil {
262 out_olt = sh returnStdout: true, script: """
Kailash Khalasi4d18e202018-09-14 13:32:16 -0700263 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
Kailash Khalasi164dc142018-09-14 11:49:08 -0700264 """
265 return out_olt.toInteger() == 1
266 }
267 }
268 }
269 }
270 }
271 currentBuild.result = 'SUCCESS'
272 } catch (err) {
273 currentBuild.result = 'FAILURE'
274 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
275 }
276 echo "RESULT: ${currentBuild.result}"
277 }
278}