blob: e3395a97d5361824ff38d4f25b5dfbfa8acff5cd [file] [log] [blame]
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -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
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070015node ("${TestNodeName}") {
Luca Pretee3105152018-08-20 14:42:30 -070016 timeout (100) {
17 try {
18 stage ("Parse deployment configuration file") {
19 sh returnStdout: true, script: 'rm -rf ${configRepoBaseDir}'
20 sh returnStdout: true, script: 'git clone -b ${branch} ${configRepoUrl}'
21 deployment_config = readYaml file: "${configRepoBaseDir}${configRepoFile}"
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070022 }
Luca Pretee3105152018-08-20 14:42:30 -070023 stage('Clean up') {
24 timeout(10) {
25 sh returnStdout: true, script: """
26 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
27 for hchart in \$(helm list -q);
28 do
29 echo "Purging chart: \${hchart}"
30 helm delete --purge "\${hchart}"
31 done
You Wanga40496a2018-08-28 15:15:39 -070032 rm -rf helm-charts cord-tester
33 git clone -b ${branch} https://gerrit.opencord.org/helm-charts
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070034 """
Luca Pretee3105152018-08-20 14:42:30 -070035 timeout(5) {
36 waitUntil {
37 helm_deleted = sh returnStdout: true, script: """
38 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
39 helm ls | wc -l
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070040 """
Luca Pretee3105152018-08-20 14:42:30 -070041 return helm_deleted.toInteger() == 0
42 }
43 }
44 timeout(5) {
45 waitUntil {
46 kubectl_deleted = sh returnStdout: true, script: """
47 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
48 kubectl get pods --all-namespaces --no-headers | grep -v kube-system | wc -l
49 """
50 return kubectl_deleted.toInteger() == 0
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070051 }
52 }
53 }
54 }
Luca Pretee3105152018-08-20 14:42:30 -070055 dir ("helm-charts") {
56 stage('Install Voltha Kafka') {
57 timeout(10) {
58 sh returnStdout: true, script: """
59 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
60 helm install --name voltha-kafka --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false incubator/kafka
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070061 """
Luca Pretee3105152018-08-20 14:42:30 -070062 }
63 timeout(10) {
64 waitUntil {
65 kafka_instances_running = sh returnStdout: true, script: """
66 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
67 kubectl get pods | grep voltha-kafka | grep -i running | grep 1/1 | wc -l
68 """
69 return kafka_instances_running.toInteger() == 2
70 }
71 }
72 }
73 stage('Install voltha') {
74 timeout(10) {
75 sh returnStdout: true, script: """
76 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
77 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
78 helm dep build voltha
79 helm install -n voltha --set etcd-operator.customResources.createEtcdClusterCRD=false voltha
80 helm upgrade --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha
81 """
82 }
83 timeout(10) {
84 waitUntil {
85 voltha_completed = sh returnStdout: true, script: """
86 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
87 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
88 """
89 return voltha_completed.toInteger() == 11
90 }
91 }
92 }
Luca Preteb1d2db22018-08-28 10:31:44 -070093 stage('Install CORD Kafka') {
94 timeout(10) {
95 sh returnStdout: true, script: """
96 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
97 helm install --name cord-kafka --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false incubator/kafka
98 """
99 }
100 timeout(10) {
101 waitUntil {
102 kafka_instances_running = sh returnStdout: true, script: """
103 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
104 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
105 """
106 return kafka_instances_running.toInteger() == 2
107 }
108 }
109 }
Luca Pretee3105152018-08-20 14:42:30 -0700110 stage('Install ONOS-Voltha') {
111 timeout(10) {
112 sh returnStdout: true, script: """
113 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
114 helm install -n onos-voltha -f configs/onos-voltha.yaml onos
115 """
116 }
117 timeout(10) {
118 waitUntil {
119 onos_voltha_completed = sh returnStdout: true, script: """
120 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
121 kubectl get pods -n voltha | grep -i onos-voltha | grep -i running | grep 1/1 | wc -l
122 """
123 return onos_voltha_completed.toInteger() == 1
124 }
125 }
126 }
127 stage('Install ONOS-Fabric') {
128 timeout(10) {
129 sh returnStdout: true, script: """
130 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
131 helm install -n onos-fabric -f configs/onos-fabric.yaml onos
132 """
133 }
134 timeout(10) {
135 waitUntil {
136 onos_fabric_completed = sh returnStdout: true, script: """
137 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
138 kubectl get pods | grep -i onos-fabric | grep -i running | grep 1/1 | wc -l
139 """
140 return onos_fabric_completed.toInteger() == 1
141 }
142 }
143 }
144 stage('Install xos-core') {
145 timeout(10) {
146 sh returnStdout: true, script: """
147 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
148 helm dep update xos-core
149 helm install -n xos-core xos-core
150 """
151 }
152 timeout(10) {
153 waitUntil {
154 xos_core_completed = sh returnStdout: true, script: """
155 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
156 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
157 """
158 return xos_core_completed.toInteger() == 7
159 }
160 }
161 }
162 stage('Install rcord-lite') {
163 timeout(10) {
164 sh returnStdout: true, script: """
165 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
166 helm dep update xos-profiles/rcord-lite
167 helm install -n rcord-lite xos-profiles/rcord-lite
168 """
169 }
170 timeout(10) {
171 waitUntil {
172 rcord_tosca_completed = sh returnStdout: true, script: """
173 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
174 kubectl get pods | grep -i tosca-loader | grep -i completed | wc -l
175 """
176 return rcord_tosca_completed.toInteger() == 1
177 }
178 }
179 }
Luca Pretee3105152018-08-20 14:42:30 -0700180 stage('Install hippie-oss') {
181 timeout(10) {
182 sh returnStdout: true, script: """
183 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
184 helm install -n hippie-oss xos-services/hippie-oss
185 """
186 }
187 timeout(10) {
188 waitUntil {
189 hippie_oss_running = sh returnStdout: true, script: """
190 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
191 kubectl get pods | grep -i hippie-oss | grep -i running | grep 1/1 | wc -l
192 """
193 return hippie_oss_running.toInteger() == 1
194 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700195 }
196 }
197 }
Luca Pretee3105152018-08-20 14:42:30 -0700198 stage('Reinstall OLT software') {
199 for(int i=0; i < deployment_config.olts.size(); i++) {
200 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 --remove asfvolt16 && dpkg --purge asfvolt16'
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700202 """
Luca Pretee3105152018-08-20 14:42:30 -0700203 timeout(5) {
204 waitUntil {
205 olt_sw_present = sh returnStdout: true, script: """
206 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'
207 """
208 return olt_sw_present.toInteger() == 0
209 }
210 }
211 sh returnStdout: true, script: """
212 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
213 """
214 timeout(5) {
215 waitUntil {
216 olt_sw_present = sh returnStdout: true, script: """
217 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'
218 """
219 return olt_sw_present.toInteger() == 1
220 }
221 }
222 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
223 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
224 sh returnStdout: true, script: """
225 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'
226 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
227 """
228 }
229 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700230 }
Luca Pretee3105152018-08-20 14:42:30 -0700231 stage('Restart OLT processes') {
232 for(int i=0; i < deployment_config.olts.size(); i++) {
233 timeout(5) {
234 sh returnStdout: true, script: """
235 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
236 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill bal_core_dist' || true
237 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill openolt' || true
238 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/bal.log'
239 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/openolt.log'
240 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 &'
241 sleep 5
242 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 &'
243 """
244 }
245 timeout(15) {
246 waitUntil {
247 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'"
248 return onu_discovered.toInteger() > 0
249 }
250 }
251 }
252 }
253 stage('Download cord-tester repo') {
254 timeout(2) {
255 sh returnStdout: true, script: """
Luca Pretee3105152018-08-20 14:42:30 -0700256 git clone -b ${branch} https://gerrit.opencord.org/cord-tester
257 """
258 }
259 }
260 stage('Validate installed PODs') {
261 timeout(10) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700262 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700263 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700264 cd $WORKSPACE/cord-tester/src/test/robot/
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700265 rm -rf Log/ || true
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700266 pybot -d Log -T SanityK8POD.robot || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700267 """
Luca Pretee3105152018-08-20 14:42:30 -0700268 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700269 }
Luca Pretee3105152018-08-20 14:42:30 -0700270 stage('Configurations and Tests') {
271 timeout(10) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700272 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700273 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700274 cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/
Kailash Khalasi2bd58942018-08-28 09:10:20 -0700275 sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700276 sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py
277 sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py
278 sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700279 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700280 rm -rf Log/ || true
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700281 pybot -d Log -T FabricConfig.txt || true
282 pybot -d Log -T HippieOSS.txt || true
Suchitra Vemuri65556762018-08-22 13:52:38 -0700283 sleep 5
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700284 pybot -d Log -T OSSVolt.txt || true
285 pybot -d Log -T RealOLT_Test.txt || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700286 """
Luca Pretee3105152018-08-20 14:42:30 -0700287 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700288 }
Luca Pretee3105152018-08-20 14:42:30 -0700289 stage('Subscriber Validation and Ping Tests') {
Kailash Khalasi2bd58942018-08-28 09:10:20 -0700290 timeout(30) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700291 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700292 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700293 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
Suchitra Vemuri65556762018-08-22 13:52:38 -0700294 pybot -d Log -T HippieOSS_instances.txt || true
Luca Pretee3105152018-08-20 14:42:30 -0700295 pybot -d Log -T -v src_ip:${deployment_config.srcHost.ip} -v src_user:${deployment_config.srcHost.user} -v src_pass:${deployment_config.srcHost.pass} -v dst_user:${deployment_config.dstHost.user} -v dst_pass:${deployment_config.dstHost.pass} -v dst_ip:${deployment_config.dstHost.ip} -v dst_host_ip:${deployment_config.dstHost.hostIp} -v src_gateway:${deployment_config.srcHost.gateway} -v dst_gateway:${deployment_config.dstHost.gateway} -v init_state:awaiting-auth -v INITIAL_STATUS:FAIL -v ENABLE_STATUS:FAIL -v MACIP_STATUS:PASS Subscriber_StatusChecks.txt || true
Suchitra Vemuri65556762018-08-22 13:52:38 -0700296 """
Luca Pretee3105152018-08-20 14:42:30 -0700297 }
Suchitra Vemuri65556762018-08-22 13:52:38 -0700298 }
Luca Pretee3105152018-08-20 14:42:30 -0700299 stage('Publish test results') {
300 sh returnStdout: true, script: """
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700301 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
302 mkdir RobotLogs/TestDoc || true
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700303 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE//RobotLogs || true
304 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700305 """
306 step([$class: 'RobotPublisher',
307 disableArchiveOutput: false,
308 logFileName: 'RobotLogs/log*.html',
309 otherFiles: '',
310 outputFileName: 'RobotLogs/output*.xml',
311 outputPath: '.',
312 passThreshold: 100,
313 reportFileName: 'RobotLogs/report*.html',
Luca Pretee3105152018-08-20 14:42:30 -0700314 unstableThreshold: 0
315 ])
316 }
317 currentBuild.result = 'SUCCESS'
318 } catch (err) {
319 currentBuild.result = 'FAILURE'
320 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700321 }
Luca Pretee3105152018-08-20 14:42:30 -0700322 echo "RESULT: ${currentBuild.result}"
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700323 }
324}