blob: a82b9f173b6e812171318ad4ca52309ea7825516 [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
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700150 export EXTRA_HELM_FLAGS=""
151 if [ "${branch}" != "master" ]; then
152 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
153 source "$WORKSPACE/kind-voltha/releases/${branch}"
154 else
155 echo "on master, using default settings for kind-voltha"
156 fi
TorstenThieme582d0342021-01-25 14:16:55 +0000157 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
158
TorstenThieme326e7972021-01-19 14:27:59 +0000159 # start logging
160 mkdir -p $WORKSPACE/1t4gem
161 _TAG=kail-1t4gem kail -n voltha -n default > $WORKSPACE/1t4gem/onos-voltha-combined.log &
162
TorstenThieme582d0342021-01-25 14:16:55 +0000163 DEPLOY_K8S=n ./voltha up
164
TorstenThieme326e7972021-01-19 14:27:59 +0000165 mkdir -p $ROBOT_LOGS_DIR/1t4gem
166 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme41c08632021-02-11 11:08:18 +0000167 export KVSTOREPREFIX=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000168
TorstenThieme669258d2021-01-29 09:03:10 +0000169 make -C $WORKSPACE/voltha-system-tests ${make1t4gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000170
171 # stop logging
172 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t4gem" | grep -v grep | awk '{print $1}')"
173 if [ -n "$P_IDS" ]; then
174 echo $P_IDS
175 for P_ID in $P_IDS; do
176 kill -9 $P_ID
177 done
178 fi
179
180 # get pods information
181 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t4gem/pods.txt || true
182 '''
183 }
184 }
185
186 stage('Run E2E Tests 1t8gem') {
187 environment {
188 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
189 }
190 steps {
191 sh '''
TorstenThieme582d0342021-01-25 14:16:55 +0000192 cd $WORKSPACE/kind-voltha/
TorstenThieme582d0342021-01-25 14:16:55 +0000193 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
194
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700195 export EXTRA_HELM_FLAGS=""
196 if [ "${branch}" != "master" ]; then
197 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
198 source "$WORKSPACE/kind-voltha/releases/${branch}"
199 else
200 echo "on master, using default settings for kind-voltha"
201 fi
TorstenThieme582d0342021-01-25 14:16:55 +0000202 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
203
TorstenThieme326e7972021-01-19 14:27:59 +0000204 # start logging
205 mkdir -p $WORKSPACE/1t8gem
206 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
207
208 DEPLOY_K8S=n ./voltha up
209
210 mkdir -p $ROBOT_LOGS_DIR/1t8gem
211 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme41c08632021-02-11 11:08:18 +0000212 export KVSTOREPREFIX=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000213
TorstenThieme669258d2021-01-29 09:03:10 +0000214 make -C $WORKSPACE/voltha-system-tests ${make1t8gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000215
216 # stop logging
217 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
218 if [ -n "$P_IDS" ]; then
219 echo $P_IDS
220 for P_ID in $P_IDS; do
221 kill -9 $P_ID
222 done
223 fi
224
225 # get pods information
226 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
227 '''
228 }
229 }
230
231 stage('Run MIB Upload Tests') {
TorstenThieme669258d2021-01-29 09:03:10 +0000232 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000233 environment {
234 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
235 }
236 steps {
237 sh '''
238 cd $WORKSPACE/kind-voltha/
TorstenThieme326e7972021-01-19 14:27:59 +0000239 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
240
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700241 export EXTRA_HELM_FLAGS=""
242 if [ "${branch}" != "master" ]; then
243 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
244 source "$WORKSPACE/kind-voltha/releases/${branch}"
245 else
246 echo "on master, using default settings for kind-voltha"
247 fi
TorstenThieme326e7972021-01-19 14:27:59 +0000248 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
TorstenThieme326e7972021-01-19 14:27:59 +0000249 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
250
251 # start logging
252 mkdir -p $WORKSPACE/mib
253 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
254
255 DEPLOY_K8S=n ./voltha up
256
257 mkdir -p $ROBOT_LOGS_DIR
258 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
259 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
260
261 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
262
263 # stop logging
264 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
265 if [ -n "$P_IDS" ]; then
266 echo $P_IDS
267 for P_ID in $P_IDS; do
268 kill -9 $P_ID
269 done
270 fi
271
272 # get pods information
273 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
274 '''
275 }
276 }
277
278 stage('Reconcile DT workflow') {
279 environment {
280 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileDT"
281 }
282 steps {
283 sh '''
284 cd $WORKSPACE/kind-voltha/
TorstenThieme326e7972021-01-19 14:27:59 +0000285 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
286
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700287 export EXTRA_HELM_FLAGS=""
288 if [ "${branch}" != "master" ]; then
289 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
290 source "$WORKSPACE/kind-voltha/releases/${branch}"
291 else
292 echo "on master, using default settings for kind-voltha"
293 fi
TorstenThieme326e7972021-01-19 14:27:59 +0000294 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
295
296 # Workflow-specific flags
297 export WITH_RADIUS=no
298 export WITH_EAPOL=no
299 export WITH_DHCP=no
300 export WITH_IGMP=no
301 export CONFIG_SADIS="external"
302 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
303
304 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000305 mkdir -p $WORKSPACE/reconciledt
TorstenThieme326e7972021-01-19 14:27:59 +0000306 _TAG=kail-reconcile-dt kail -n voltha -n default > $WORKSPACE/reconciledt/onos-voltha-combined.log &
307
308 DEPLOY_K8S=n ./voltha up
309
310 mkdir -p $ROBOT_LOGS_DIR
311 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
312
TorstenThieme45422612021-03-23 10:38:59 +0000313 make -C $WORKSPACE/voltha-system-tests ${makeReconcileDtTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000314
315 # stop logging
316 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-dt" | grep -v grep | awk '{print $1}')"
317 if [ -n "$P_IDS" ]; then
318 echo $P_IDS
319 for P_ID in $P_IDS; do
320 kill -9 $P_ID
321 done
322 fi
323
324 # get pods information
325 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconciledt/pods.txt || true
326 '''
327 }
328 }
329
330 stage('Reconcile ATT workflow') {
331 environment {
332 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileATT"
333 }
334 steps {
335 sh '''
336 cd $WORKSPACE/kind-voltha/
337 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
338
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700339 export EXTRA_HELM_FLAGS=""
340 if [ "${branch}" != "master" ]; then
341 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
342 source "$WORKSPACE/kind-voltha/releases/${branch}"
343 else
344 echo "on master, using default settings for kind-voltha"
345 fi
TorstenThieme326e7972021-01-19 14:27:59 +0000346 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
347
348 # Workflow-specific flags
349 export WITH_RADIUS=yes
350 export WITH_EAPOL=yes
351 export WITH_BBSIM=yes
352 export DEPLOY_K8S=yes
353 export CONFIG_SADIS="external"
354 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
355
356 if [ "${gerritProject}" = "voltctl" ]; then
357 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
358 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
359 md5sum $WORKSPACE/kind-voltha/bin/voltctl
360 fi
361
362 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000363 mkdir -p $WORKSPACE/reconcileatt
TorstenThieme326e7972021-01-19 14:27:59 +0000364 _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
365
366 DEPLOY_K8S=n ./voltha up
367
368 mkdir -p $ROBOT_LOGS_DIR
369 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
370
TorstenThieme45422612021-03-23 10:38:59 +0000371 make -C $WORKSPACE/voltha-system-tests ${makeReconcileTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000372
373 # stop logging
374 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-att" | grep -v grep | awk '{print $1}')"
375 if [ -n "$P_IDS" ]; then
376 echo $P_IDS
377 for P_ID in $P_IDS; do
378 kill -9 $P_ID
379 done
380 fi
381
382 # get pods information
383 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcileatt/pods.txt || true
384 '''
385 }
386 }
387
388 stage('Reconcile TT workflow') {
389 environment {
390 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileTT"
391 }
392 steps {
393 sh '''
394 cd $WORKSPACE/kind-voltha/
395 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
396
Matteo Scandolof15a2c22021-05-05 13:21:15 -0700397 export EXTRA_HELM_FLAGS=""
398 if [ "${branch}" != "master" ]; then
399 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
400 source "$WORKSPACE/kind-voltha/releases/${branch}"
401 else
402 echo "on master, using default settings for kind-voltha"
403 fi
TorstenThieme326e7972021-01-19 14:27:59 +0000404 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
405
406 # Workflow-specific flags
407 export WITH_RADIUS=no
408 export WITH_EAPOL=no
409 export WITH_DHCP=yes
410 export WITH_IGMP=yes
411 export CONFIG_SADIS="external"
412 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
413
414 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000415 mkdir -p $WORKSPACE/reconcilett
TorstenThieme326e7972021-01-19 14:27:59 +0000416 _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
417
418 DEPLOY_K8S=n ./voltha up
419
420 mkdir -p $ROBOT_LOGS_DIR
421 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
422
TorstenThieme45422612021-03-23 10:38:59 +0000423 make -C $WORKSPACE/voltha-system-tests ${makeReconcileTtTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000424
425 # stop logging
426 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-tt" | grep -v grep | awk '{print $1}')"
427 if [ -n "$P_IDS" ]; then
428 echo $P_IDS
429 for P_ID in $P_IDS; do
430 kill -9 $P_ID
431 done
432 fi
433
434 # get pods information
435 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcilett/pods.txt || true
436 '''
437 }
438 }
439 }
440 post {
441 always {
442 sh '''
TorstenThieme326e7972021-01-19 14:27:59 +0000443 # get pods information
444 kubectl get pods -o wide
445 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
446 helm ls
447
448 sync
449 pkill kail || true
450 md5sum $WORKSPACE/kind-voltha/bin/voltctl
451
452 ## Pull out errors from log files
453 extract_errors_go() {
454 echo
455 echo "Error summary for $1:"
456 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
457 echo
458 }
459
460 extract_errors_python() {
461 echo
462 echo "Error summary for $1:"
463 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
464 echo
465 }
466
467 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
468 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
469 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
470 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
471
472 gzip $WORKSPACE/onos-voltha-combined.log || true
473 '''
474 step([$class: 'RobotPublisher',
475 disableArchiveOutput: false,
476 logFileName: 'RobotLogs/*/log*.html',
477 otherFiles: '',
478 outputFileName: 'RobotLogs/*/output*.xml',
479 outputPath: '.',
480 passThreshold: 100,
481 reportFileName: 'RobotLogs/*/report*.html',
482 unstableThreshold: 0]);
483 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
484 }
485 }
486}