blob: 78425591805f0bd26362badefc5accca83643753 [file] [log] [blame]
TorstenThieme326e7972021-01-19 14:27:59 +00001// 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
15// voltha-2.x e2e tests
16// uses kind-voltha to deploy voltha-2.X
17// uses bbsim to simulate OLT/ONUs
18
19pipeline {
20
21 /* no label, executor is determined by JJB */
22 agent {
23 label "${params.buildNode}"
24 }
25 options {
TorstenThieme685b89b2021-01-28 12:59:23 +000026 timeout(time: 130, unit: 'MINUTES')
TorstenThieme326e7972021-01-19 14:27:59 +000027 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
31 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
32 NAME="minimal"
33 FANCY=0
34 WITH_SIM_ADAPTERS="no"
35 WITH_RADIUS="yes"
36 WITH_BBSIM="yes"
37 DEPLOY_K8S="yes"
38 VOLTHA_LOG_LEVEL="DEBUG"
39 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
41 ROBOT_MISC_ARGS="-e PowerSwitch ${params.extraRobotArgs}"
42 KARAF_HOME="${params.karafHome}"
43 DIAGS_PROFILE="VOLTHA_PROFILE"
44 NUM_OF_BBSIM="${olts}"
45 }
46 stages {
47 stage('Clone kind-voltha') {
48 steps {
49 checkout([
50 $class: 'GitSCM',
51 userRemoteConfigs: [[
52 url: "https://gerrit.opencord.org/kind-voltha",
53 // refspec: "${kindVolthaChange}"
54 ]],
55 branches: [[ name: "master", ]],
56 extensions: [
57 [$class: 'WipeWorkspace'],
58 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
59 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
60 ],
61 ])
62 }
63 }
64 stage('Cleanup') {
65 steps {
66 sh """
67 cd $WORKSPACE/kind-voltha/
68 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down
69 """
70 }
71 }
72 stage('Clone voltha-system-tests') {
73 steps {
74 checkout([
75 $class: 'GitSCM',
76 userRemoteConfigs: [[
77 url: "https://gerrit.opencord.org/voltha-system-tests",
78 // refspec: "${volthaSystemTestsChange}"
79 ]],
80 branches: [[ name: "${branch}", ]],
81 extensions: [
82 [$class: 'WipeWorkspace'],
83 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
84 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
85 ],
86 ])
87 }
88 }
89
90 stage('Deploy Voltha') {
91 steps {
92 sh """
93 export EXTRA_HELM_FLAGS=""
94 if [ "${branch}" != "master" ]; then
95 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
96 source "$WORKSPACE/kind-voltha/releases/${branch}"
97 else
98 echo "on master, using default settings for kind-voltha"
99 fi
100
101 EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} --set defaults.image_registry=mirror.registry.opennetworking.org/ "
102
103 cd $WORKSPACE/kind-voltha/
104 ./voltha up
TorstenThieme669258d2021-01-29 09:03:10 +0000105 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
TorstenThieme326e7972021-01-19 14:27:59 +0000106 """
107 }
108 }
109
110 stage('Run E2E Tests 1t1gem') {
111 environment {
112 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t1gem"
113 }
114 steps {
115 sh '''
116 # start logging
117 mkdir -p $WORKSPACE/1t1gem
118 _TAG=kail-1t1gem kail -n voltha -n default > $WORKSPACE/1t1gem/onos-voltha-combined.log &
119
120 mkdir -p $ROBOT_LOGS_DIR/1t1gem
121 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme41c08632021-02-11 11:08:18 +0000122 export KVSTOREPREFIX=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000123
TorstenThieme669258d2021-01-29 09:03:10 +0000124 make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000125
126 # stop logging
127 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')"
128 if [ -n "$P_IDS" ]; then
129 echo $P_IDS
130 for P_ID in $P_IDS; do
131 kill -9 $P_ID
132 done
133 fi
134
135 # get pods information
136 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true
137 '''
138 }
139 }
140
141 stage('Run E2E Tests 1t4gem') {
142 environment {
143 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t4gem"
144 }
145 steps {
146 sh '''
TorstenThieme582d0342021-01-25 14:16:55 +0000147 cd $WORKSPACE/kind-voltha/
TorstenThieme582d0342021-01-25 14:16:55 +0000148 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
149
150 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
151
TorstenThieme326e7972021-01-19 14:27:59 +0000152 # start logging
153 mkdir -p $WORKSPACE/1t4gem
154 _TAG=kail-1t4gem kail -n voltha -n default > $WORKSPACE/1t4gem/onos-voltha-combined.log &
155
TorstenThieme582d0342021-01-25 14:16:55 +0000156 DEPLOY_K8S=n ./voltha up
157
TorstenThieme326e7972021-01-19 14:27:59 +0000158 mkdir -p $ROBOT_LOGS_DIR/1t4gem
159 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme41c08632021-02-11 11:08:18 +0000160 export KVSTOREPREFIX=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000161
TorstenThieme669258d2021-01-29 09:03:10 +0000162 make -C $WORKSPACE/voltha-system-tests ${make1t4gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000163
164 # stop logging
165 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t4gem" | grep -v grep | awk '{print $1}')"
166 if [ -n "$P_IDS" ]; then
167 echo $P_IDS
168 for P_ID in $P_IDS; do
169 kill -9 $P_ID
170 done
171 fi
172
173 # get pods information
174 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t4gem/pods.txt || true
175 '''
176 }
177 }
178
179 stage('Run E2E Tests 1t8gem') {
180 environment {
181 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
182 }
183 steps {
184 sh '''
TorstenThieme582d0342021-01-25 14:16:55 +0000185 cd $WORKSPACE/kind-voltha/
TorstenThieme582d0342021-01-25 14:16:55 +0000186 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
187
188 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
189
TorstenThieme326e7972021-01-19 14:27:59 +0000190 # start logging
191 mkdir -p $WORKSPACE/1t8gem
192 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
193
194 DEPLOY_K8S=n ./voltha up
195
196 mkdir -p $ROBOT_LOGS_DIR/1t8gem
197 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme41c08632021-02-11 11:08:18 +0000198 export KVSTOREPREFIX=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000199
TorstenThieme669258d2021-01-29 09:03:10 +0000200 make -C $WORKSPACE/voltha-system-tests ${make1t8gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000201
202 # stop logging
203 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
204 if [ -n "$P_IDS" ]; then
205 echo $P_IDS
206 for P_ID in $P_IDS; do
207 kill -9 $P_ID
208 done
209 fi
210
211 # get pods information
212 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
213 '''
214 }
215 }
216
217 stage('Run MIB Upload Tests') {
TorstenThieme669258d2021-01-29 09:03:10 +0000218 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000219 environment {
220 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
221 }
222 steps {
223 sh '''
224 cd $WORKSPACE/kind-voltha/
TorstenThieme326e7972021-01-19 14:27:59 +0000225 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
226
227 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
228
229 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
230
231 # start logging
232 mkdir -p $WORKSPACE/mib
233 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
234
235 DEPLOY_K8S=n ./voltha up
236
237 mkdir -p $ROBOT_LOGS_DIR
238 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
239 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
240
241 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
242
243 # stop logging
244 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
245 if [ -n "$P_IDS" ]; then
246 echo $P_IDS
247 for P_ID in $P_IDS; do
248 kill -9 $P_ID
249 done
250 fi
251
252 # get pods information
253 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
254 '''
255 }
256 }
257
258 stage('Reconcile DT workflow') {
259 environment {
260 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileDT"
261 }
262 steps {
263 sh '''
264 cd $WORKSPACE/kind-voltha/
TorstenThieme326e7972021-01-19 14:27:59 +0000265 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
266
267 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
268
269 # Workflow-specific flags
270 export WITH_RADIUS=no
271 export WITH_EAPOL=no
272 export WITH_DHCP=no
273 export WITH_IGMP=no
274 export CONFIG_SADIS="external"
275 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
276
277 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000278 mkdir -p $WORKSPACE/reconciledt
TorstenThieme326e7972021-01-19 14:27:59 +0000279 _TAG=kail-reconcile-dt kail -n voltha -n default > $WORKSPACE/reconciledt/onos-voltha-combined.log &
280
281 DEPLOY_K8S=n ./voltha up
282
283 mkdir -p $ROBOT_LOGS_DIR
284 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
285
TorstenThieme45422612021-03-23 10:38:59 +0000286 make -C $WORKSPACE/voltha-system-tests ${makeReconcileDtTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000287
288 # stop logging
289 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-dt" | grep -v grep | awk '{print $1}')"
290 if [ -n "$P_IDS" ]; then
291 echo $P_IDS
292 for P_ID in $P_IDS; do
293 kill -9 $P_ID
294 done
295 fi
296
297 # get pods information
298 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconciledt/pods.txt || true
299 '''
300 }
301 }
302
303 stage('Reconcile ATT workflow') {
304 environment {
305 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileATT"
306 }
307 steps {
308 sh '''
309 cd $WORKSPACE/kind-voltha/
310 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
311
312 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
313
314 # Workflow-specific flags
315 export WITH_RADIUS=yes
316 export WITH_EAPOL=yes
317 export WITH_BBSIM=yes
318 export DEPLOY_K8S=yes
319 export CONFIG_SADIS="external"
320 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
321
322 if [ "${gerritProject}" = "voltctl" ]; then
323 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
324 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
325 md5sum $WORKSPACE/kind-voltha/bin/voltctl
326 fi
327
328 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000329 mkdir -p $WORKSPACE/reconcileatt
TorstenThieme326e7972021-01-19 14:27:59 +0000330 _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
331
332 DEPLOY_K8S=n ./voltha up
333
334 mkdir -p $ROBOT_LOGS_DIR
335 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
336
TorstenThieme45422612021-03-23 10:38:59 +0000337 make -C $WORKSPACE/voltha-system-tests ${makeReconcileTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000338
339 # stop logging
340 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-att" | grep -v grep | awk '{print $1}')"
341 if [ -n "$P_IDS" ]; then
342 echo $P_IDS
343 for P_ID in $P_IDS; do
344 kill -9 $P_ID
345 done
346 fi
347
348 # get pods information
349 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcileatt/pods.txt || true
350 '''
351 }
352 }
353
354 stage('Reconcile TT workflow') {
355 environment {
356 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileTT"
357 }
358 steps {
359 sh '''
360 cd $WORKSPACE/kind-voltha/
361 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
362
363 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
364
365 # Workflow-specific flags
366 export WITH_RADIUS=no
367 export WITH_EAPOL=no
368 export WITH_DHCP=yes
369 export WITH_IGMP=yes
370 export CONFIG_SADIS="external"
371 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
372
373 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000374 mkdir -p $WORKSPACE/reconcilett
TorstenThieme326e7972021-01-19 14:27:59 +0000375 _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
376
377 DEPLOY_K8S=n ./voltha up
378
379 mkdir -p $ROBOT_LOGS_DIR
380 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
381
TorstenThieme45422612021-03-23 10:38:59 +0000382 make -C $WORKSPACE/voltha-system-tests ${makeReconcileTtTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000383
384 # stop logging
385 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-tt" | grep -v grep | awk '{print $1}')"
386 if [ -n "$P_IDS" ]; then
387 echo $P_IDS
388 for P_ID in $P_IDS; do
389 kill -9 $P_ID
390 done
391 fi
392
393 # get pods information
394 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcilett/pods.txt || true
395 '''
396 }
397 }
398 }
399 post {
400 always {
401 sh '''
TorstenThieme326e7972021-01-19 14:27:59 +0000402 # get pods information
403 kubectl get pods -o wide
404 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
405 helm ls
406
407 sync
408 pkill kail || true
409 md5sum $WORKSPACE/kind-voltha/bin/voltctl
410
411 ## Pull out errors from log files
412 extract_errors_go() {
413 echo
414 echo "Error summary for $1:"
415 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
416 echo
417 }
418
419 extract_errors_python() {
420 echo
421 echo "Error summary for $1:"
422 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
423 echo
424 }
425
426 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
427 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
428 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
429 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
430
431 gzip $WORKSPACE/onos-voltha-combined.log || true
432 '''
433 step([$class: 'RobotPublisher',
434 disableArchiveOutput: false,
435 logFileName: 'RobotLogs/*/log*.html',
436 otherFiles: '',
437 outputFileName: 'RobotLogs/*/output*.xml',
438 outputPath: '.',
439 passThreshold: 100,
440 reportFileName: 'RobotLogs/*/report*.html',
441 unstableThreshold: 0]);
442 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
443 }
444 }
445}