blob: f61295a54f9f030ddecc47a30d99a2da2aef3f6a [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
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070032 """
Luca Pretee3105152018-08-20 14:42:30 -070033 timeout(5) {
34 waitUntil {
35 helm_deleted = sh returnStdout: true, script: """
36 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
37 helm ls | wc -l
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070038 """
Luca Pretee3105152018-08-20 14:42:30 -070039 return helm_deleted.toInteger() == 0
40 }
41 }
42 timeout(5) {
43 waitUntil {
44 kubectl_deleted = sh returnStdout: true, script: """
45 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
46 kubectl get pods --all-namespaces --no-headers | grep -v kube-system | wc -l
47 """
48 return kubectl_deleted.toInteger() == 0
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -070049 }
50 }
51 }
52 }
Luca Pretee3105152018-08-20 14:42:30 -070053 dir ("helm-charts") {
54 stage('Install Voltha Kafka') {
55 timeout(10) {
56 sh returnStdout: true, script: """
57 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
58 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 -070059 """
Luca Pretee3105152018-08-20 14:42:30 -070060 }
61 timeout(10) {
62 waitUntil {
63 kafka_instances_running = sh returnStdout: true, script: """
64 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
65 kubectl get pods | grep voltha-kafka | grep -i running | grep 1/1 | wc -l
66 """
67 return kafka_instances_running.toInteger() == 2
68 }
69 }
70 }
71 stage('Install voltha') {
72 timeout(10) {
73 sh returnStdout: true, script: """
74 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
75 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com/
76 helm dep build voltha
77 helm install -n voltha --set etcd-operator.customResources.createEtcdClusterCRD=false voltha
78 helm upgrade --set etcd-operator.customResources.createEtcdClusterCRD=true voltha ./voltha
79 """
80 }
81 timeout(10) {
82 waitUntil {
83 voltha_completed = sh returnStdout: true, script: """
84 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
85 kubectl get pods -n voltha | grep -i running | grep 1/1 | wc -l
86 """
87 return voltha_completed.toInteger() == 11
88 }
89 }
90 }
Luca Preteb1d2db22018-08-28 10:31:44 -070091 stage('Install CORD Kafka') {
92 timeout(10) {
93 sh returnStdout: true, script: """
94 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
95 helm install --name cord-kafka --set replicas=1 --set persistence.enabled=false --set zookeeper.replicaCount=1 --set zookeeper.persistence.enabled=false incubator/kafka
96 """
97 }
98 timeout(10) {
99 waitUntil {
100 kafka_instances_running = sh returnStdout: true, script: """
101 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
102 kubectl get pods | grep cord-kafka | grep -i running | grep 1/1 | wc -l
103 """
104 return kafka_instances_running.toInteger() == 2
105 }
106 }
107 }
Luca Pretee3105152018-08-20 14:42:30 -0700108 stage('Install ONOS-Voltha') {
109 timeout(10) {
110 sh returnStdout: true, script: """
111 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
112 helm install -n onos-voltha -f configs/onos-voltha.yaml onos
113 """
114 }
115 timeout(10) {
116 waitUntil {
117 onos_voltha_completed = sh returnStdout: true, script: """
118 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
119 kubectl get pods -n voltha | grep -i onos-voltha | grep -i running | grep 1/1 | wc -l
120 """
121 return onos_voltha_completed.toInteger() == 1
122 }
123 }
124 }
125 stage('Install ONOS-Fabric') {
126 timeout(10) {
127 sh returnStdout: true, script: """
128 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
129 helm install -n onos-fabric -f configs/onos-fabric.yaml onos
130 """
131 }
132 timeout(10) {
133 waitUntil {
134 onos_fabric_completed = sh returnStdout: true, script: """
135 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
136 kubectl get pods | grep -i onos-fabric | grep -i running | grep 1/1 | wc -l
137 """
138 return onos_fabric_completed.toInteger() == 1
139 }
140 }
141 }
142 stage('Install xos-core') {
143 timeout(10) {
144 sh returnStdout: true, script: """
145 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
146 helm dep update xos-core
147 helm install -n xos-core xos-core
148 """
149 }
150 timeout(10) {
151 waitUntil {
152 xos_core_completed = sh returnStdout: true, script: """
153 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
154 kubectl get pods | grep -i xos | grep -i running | grep 1/1 | wc -l
155 """
156 return xos_core_completed.toInteger() == 7
157 }
158 }
159 }
160 stage('Install rcord-lite') {
161 timeout(10) {
162 sh returnStdout: true, script: """
163 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
164 helm dep update xos-profiles/rcord-lite
165 helm install -n rcord-lite xos-profiles/rcord-lite
166 """
167 }
168 timeout(10) {
169 waitUntil {
170 rcord_tosca_completed = sh returnStdout: true, script: """
171 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
172 kubectl get pods | grep -i tosca-loader | grep -i completed | wc -l
173 """
174 return rcord_tosca_completed.toInteger() == 1
175 }
176 }
177 }
Luca Pretee3105152018-08-20 14:42:30 -0700178 stage('Install hippie-oss') {
179 timeout(10) {
180 sh returnStdout: true, script: """
181 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
182 helm install -n hippie-oss xos-services/hippie-oss
183 """
184 }
185 timeout(10) {
186 waitUntil {
187 hippie_oss_running = sh returnStdout: true, script: """
188 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config} &&
189 kubectl get pods | grep -i hippie-oss | grep -i running | grep 1/1 | wc -l
190 """
191 return hippie_oss_running.toInteger() == 1
192 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700193 }
194 }
195 }
Luca Pretee3105152018-08-20 14:42:30 -0700196 stage('Reinstall OLT software') {
197 for(int i=0; i < deployment_config.olts.size(); i++) {
198 sh returnStdout: true, script: """
199 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 -0700200 """
Luca Pretee3105152018-08-20 14:42:30 -0700201 timeout(5) {
202 waitUntil {
203 olt_sw_present = sh returnStdout: true, script: """
204 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'
205 """
206 return olt_sw_present.toInteger() == 0
207 }
208 }
209 sh returnStdout: true, script: """
210 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} "dpkg --install ${oltDebVersion}"
211 """
212 timeout(5) {
213 waitUntil {
214 olt_sw_present = sh returnStdout: true, script: """
215 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'
216 """
217 return olt_sw_present.toInteger() == 1
218 }
219 }
220 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
221 if ("${deployment_config.olts[i].fortygig}" != null && "${deployment_config.olts[i].fortygig}" == 'true') {
222 sh returnStdout: true, script: """
223 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'
224 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '/opt/bcm68620/svk_init.sh'
225 """
226 }
227 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700228 }
Luca Pretee3105152018-08-20 14:42:30 -0700229 stage('Restart OLT processes') {
230 for(int i=0; i < deployment_config.olts.size(); i++) {
231 timeout(5) {
232 sh returnStdout: true, script: """
233 ssh-keyscan -H ${deployment_config.olts[i].ip} >> ~/.ssh/known_hosts
234 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill bal_core_dist' || true
235 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} 'pkill openolt' || true
236 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/bal.log'
237 sshpass -p ${deployment_config.olts[i].pass} ssh -l ${deployment_config.olts[i].user} ${deployment_config.olts[i].ip} '> /broadcom/openolt.log'
238 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 &'
239 sleep 5
240 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 &'
241 """
242 }
243 timeout(15) {
244 waitUntil {
245 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'"
246 return onu_discovered.toInteger() > 0
247 }
248 }
249 }
250 }
251 stage('Download cord-tester repo') {
252 timeout(2) {
253 sh returnStdout: true, script: """
254 rm -rf cord-tester
255 git clone -b ${branch} https://gerrit.opencord.org/cord-tester
256 """
257 }
258 }
259 stage('Validate installed PODs') {
260 timeout(10) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700261 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700262 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700263 cd $WORKSPACE/cord-tester/src/test/robot/
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700264 rm -rf Log/ || true
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700265 pybot -d Log -T SanityK8POD.robot || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700266 """
Luca Pretee3105152018-08-20 14:42:30 -0700267 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700268 }
Luca Pretee3105152018-08-20 14:42:30 -0700269 stage('Configurations and Tests') {
270 timeout(10) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700271 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700272 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700273 cd $WORKSPACE/cord-tester/src/test/cord-api/Properties/
Kailash Khalasi2bd58942018-08-28 09:10:20 -0700274 sed -i \"s/^\\(SERVER_IP = \\).*/\\1\'${deployment_config.nodes[0].ip}\'/\" RestApiProperties.py
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700275 sed -i \"s/^\\(SERVER_PORT = \\).*/\\1\'30006\'/\" RestApiProperties.py
276 sed -i \"s/^\\(XOS_USER = \\).*/\\1\'admin@opencord.org\'/\" RestApiProperties.py
277 sed -i \"s/^\\(XOS_PASSWD = \\).*/\\1\'letmein\'/\" RestApiProperties.py
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700278 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700279 rm -rf Log/ || true
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700280 pybot -d Log -T FabricConfig.txt || true
281 pybot -d Log -T HippieOSS.txt || true
Suchitra Vemuri65556762018-08-22 13:52:38 -0700282 sleep 5
Kailash Khalasie9ad83c2018-08-07 11:22:36 -0700283 pybot -d Log -T OSSVolt.txt || true
284 pybot -d Log -T RealOLT_Test.txt || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700285 """
Luca Pretee3105152018-08-20 14:42:30 -0700286 }
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700287 }
Luca Pretee3105152018-08-20 14:42:30 -0700288 stage('Subscriber Validation and Ping Tests') {
Kailash Khalasi2bd58942018-08-28 09:10:20 -0700289 timeout(30) {
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700290 sh """
Luca Pretee3105152018-08-20 14:42:30 -0700291 export KUBECONFIG=$WORKSPACE/pod-configs/kubernetes-configs/${deployment_config.kube_config}
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700292 cd $WORKSPACE/cord-tester/src/test/cord-api/Tests/
Suchitra Vemuri65556762018-08-22 13:52:38 -0700293 pybot -d Log -T HippieOSS_instances.txt || true
Luca Pretee3105152018-08-20 14:42:30 -0700294 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 -0700295 """
Luca Pretee3105152018-08-20 14:42:30 -0700296 }
Suchitra Vemuri65556762018-08-22 13:52:38 -0700297 }
Luca Pretee3105152018-08-20 14:42:30 -0700298 stage('Publish test results') {
299 sh returnStdout: true, script: """
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700300 if [ -d RobotLogs ]; then rm -r RobotLogs; fi; mkdir RobotLogs;
301 mkdir RobotLogs/TestDoc || true
Kailash Khalasi4f2ee5f2018-08-28 08:57:11 -0700302 cp -r $WORKSPACE/cord-tester/src/test/robot/Log/* $WORKSPACE//RobotLogs || true
303 cp -r $WORKSPACE/cord-tester/src/test/cord-api/Tests/Log/* $WORKSPACE/RobotLogs || true
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700304 """
305 step([$class: 'RobotPublisher',
306 disableArchiveOutput: false,
307 logFileName: 'RobotLogs/log*.html',
308 otherFiles: '',
309 outputFileName: 'RobotLogs/output*.xml',
310 outputPath: '.',
311 passThreshold: 100,
312 reportFileName: 'RobotLogs/report*.html',
Luca Pretee3105152018-08-20 14:42:30 -0700313 unstableThreshold: 0
314 ])
315 }
316 currentBuild.result = 'SUCCESS'
317 } catch (err) {
318 currentBuild.result = 'FAILURE'
319 step([$class: 'Mailer', notifyEveryUnstableBuild: true, recipients: "${notificationEmail}", sendToIndividuals: false])
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700320 }
Luca Pretee3105152018-08-20 14:42:30 -0700321 echo "RESULT: ${currentBuild.result}"
Suchitra Vemuri5d95aa92018-07-24 17:22:16 -0700322 }
323}