blob: e41a9a21cb72c8d067fd344a2c49471c7e23955b [file] [log] [blame]
Matteo Scandolofff6e062020-04-29 13:36:33 -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
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 {
26 timeout(time: 90, unit: 'MINUTES')
27 }
28 environment {
29 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
30 VOLTCONFIG="$HOME/.volt/config-minimal"
Andrea Campanella919361e2020-09-21 14:27:19 +020031 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Matteo Scandolo4d1a12f2020-12-07 16:17:12 -080032 NAME="minimal"
Matteo Scandolofff6e062020-04-29 13:36:33 -070033 FANCY=0
34 WITH_SIM_ADAPTERS="n"
35 WITH_RADIUS="y"
36 WITH_BBSIM="y"
37 DEPLOY_K8S="y"
38 VOLTHA_LOG_LEVEL="DEBUG"
Andrea Campanellaa0cd5be2020-09-07 15:47:18 +020039 CONFIG_SADIS="external"
40 BBSIM_CFG="configs/bbsim-sadis-att.yaml"
Matteo Scandolofff6e062020-04-29 13:36:33 -070041 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs"
42 }
Matteo Scandolofff6e062020-04-29 13:36:33 -070043 stages {
Andrea Campanella919361e2020-09-21 14:27:19 +020044 stage('Clone kind-voltha') {
Matteo Scandolofff6e062020-04-29 13:36:33 -070045 steps {
Andrea Campanella919361e2020-09-21 14:27:19 +020046 checkout([
47 $class: 'GitSCM',
48 userRemoteConfigs: [[
49 url: "https://gerrit.opencord.org/kind-voltha",
50 refspec: "${kindVolthaChange}"
51 ]],
52 branches: [[ name: "master", ]],
53 extensions: [
54 [$class: 'WipeWorkspace'],
55 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
56 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
57 ],
58 ])
59 sh """
60 if [ '${kindVolthaChange}' != '' ] ; then
61 cd $WORKSPACE/kind-voltha
62 git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
63 fi
64 """
Matteo Scandolofff6e062020-04-29 13:36:33 -070065 }
66 }
Andrea Campanella919361e2020-09-21 14:27:19 +020067 stage('Clone voltha-system-tests') {
68 steps {
69 checkout([
70 $class: 'GitSCM',
71 userRemoteConfigs: [[
72 url: "https://gerrit.opencord.org/voltha-system-tests",
73 refspec: "${volthaSystemTestsChange}"
74 ]],
75 branches: [[ name: "${branch}", ]],
76 extensions: [
77 [$class: 'WipeWorkspace'],
78 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
79 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
80 ],
81 ])
82 sh """
83 if [ '${volthaSystemTestsChange}' != '' ] ; then
84 cd $WORKSPACE/voltha-system-tests
85 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
86 fi
87 """
88 }
89 }
90 // If the repo under test is not kind-voltha
91 // then download it and checkout the patch
92 stage('Download Patch') {
93 when {
94 expression {
95 return "${gerritProject}" != 'kind-voltha';
96 }
97 }
98 steps {
99 checkout([
100 $class: 'GitSCM',
101 userRemoteConfigs: [[
102 url: "https://gerrit.opencord.org/${gerritProject}",
103 refspec: "${gerritRefspec}"
104 ]],
105 branches: [[ name: "${branch}", ]],
106 extensions: [
107 [$class: 'WipeWorkspace'],
108 [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"],
109 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
110 ],
111 ])
112 sh """
113 pushd $WORKSPACE/${gerritProject}
114 git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD
115 echo "Currently on commit: \n"
116 git log -1 --oneline
117 popd
118 """
119 }
120 }
121 // If the repo under test is kind-voltha we don't need to download it again,
122 // as we already have it, simply checkout the patch
123 stage('Checkout kind-voltha patch') {
124 when {
125 expression {
126 return "${gerritProject}" == 'kind-voltha';
127 }
128 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700129 steps {
130 sh """
Andrea Campanella919361e2020-09-21 14:27:19 +0200131 cd $WORKSPACE/kind-voltha
132 git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD
133 """
Matteo Scandolofff6e062020-04-29 13:36:33 -0700134 }
135 }
136 stage('Create K8s Cluster') {
137 steps {
138 sh """
Andrea Campanella919361e2020-09-21 14:27:19 +0200139 cd $WORKSPACE/kind-voltha/
Matteo Scandolofff6e062020-04-29 13:36:33 -0700140 JUST_K8S=y ./voltha up
Andrea Campanella919361e2020-09-21 14:27:19 +0200141 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
Matteo Scandolofff6e062020-04-29 13:36:33 -0700142 """
143 }
144 }
145
146 stage('Build Images') {
147 steps {
148 sh """
Andrea Campanella919361e2020-09-21 14:27:19 +0200149 make -C $WORKSPACE/voltha-openonu-adapter-go DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
Matteo Scandolofff6e062020-04-29 13:36:33 -0700150 """
151 }
152 }
153
154 stage('Push Images') {
155 steps {
156 sh '''
157 docker images | grep citest
Matteo Scandolo4d1a12f2020-12-07 16:17:12 -0800158 for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2; done
Matteo Scandolofff6e062020-04-29 13:36:33 -0700159 '''
160 }
161 }
162 stage('Deploy Voltha') {
163 steps {
164 sh '''
Matteo Scandolof21ae312020-04-29 21:04:15 -0700165 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
Matteo Scandolofff6e062020-04-29 13:36:33 -0700166
167 IMAGES="adapter_open_onu_go"
168
169 for I in \$IMAGES
170 do
171 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
172 done
173
Andrea Campanella919361e2020-09-21 14:27:19 +0200174 cd $WORKSPACE/kind-voltha/
Matteo Scandolofff6e062020-04-29 13:36:33 -0700175 echo \$EXTRA_HELM_FLAGS
Matteo Scandoloaca27622020-12-11 09:04:07 -0800176
Matteo Scandolofff6e062020-04-29 13:36:33 -0700177 ./voltha up
178 '''
179 }
180 }
181
182 stage('Run E2E Tests') {
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200183 environment {
184 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go"
185 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700186 steps {
187 sh '''
Matteo Scandoloaca27622020-12-11 09:04:07 -0800188 # start logging
Matteo Scandolof566cc42020-12-11 14:05:29 -0800189 mkdir -p $WORKSPACE/1t1gem
190 _TAG=kail-1t1gem kail -n voltha -n default > $WORKSPACE/1t1gem/onos-voltha-combined.log &
Matteo Scandolofff6e062020-04-29 13:36:33 -0700191
Matteo Scandolof566cc42020-12-11 14:05:29 -0800192 mkdir -p $ROBOT_LOGS_DIR/1t1gem
193 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR/1t1gem"
Matteo Scandoloaca27622020-12-11 09:04:07 -0800194 export TARGET_DEFAULT=openonu-go-adapter-test
Andrea Campanella27ddf062020-08-07 10:35:15 +0200195
Matteo Scandoloaca27622020-12-11 09:04:07 -0800196 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Andrea Campanella27ddf062020-08-07 10:35:15 +0200197
Matteo Scandoloaca27622020-12-11 09:04:07 -0800198 # stop logging
Matteo Scandolof566cc42020-12-11 14:05:29 -0800199 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')"
Matteo Scandoloaca27622020-12-11 09:04:07 -0800200 if [ -n "$P_IDS" ]; then
201 echo $P_IDS
202 for P_ID in $P_IDS; do
203 kill -9 $P_ID
204 done
205 fi
206
207 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800208 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true
209
210 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
211
212 mkdir -p $ROBOT_LOGS_DIR/1t8gem
213 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR/1t8gem"
214 export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
215
216 make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
217
218 # stop logging
219 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
220 if [ -n "$P_IDS" ]; then
221 echo $P_IDS
222 for P_ID in $P_IDS; do
223 kill -9 $P_ID
224 done
225 fi
226
227 # get pods information
228 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700229 '''
230 }
231 }
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200232
TorstenThieme0a0fc522020-10-08 10:31:29 +0000233 stage('Run MIB Upload Tests') {
234 environment {
235 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
236 }
237 steps {
238 sh '''
239 cd $WORKSPACE/kind-voltha/
240 #source $NAME-env.sh
241 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
242
243 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
244
Andrea Campanella12146d52020-10-13 23:35:17 +0200245 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
TorstenThieme0a0fc522020-10-08 10:31:29 +0000246
247 IMAGES="adapter_open_onu_go"
248
249 for I in \$IMAGES
250 do
251 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
252 done
253
Matteo Scandoloaca27622020-12-11 09:04:07 -0800254 # start logging
255 mkdir -p $WORKSPACE/mib
256 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
257
TorstenThieme0a0fc522020-10-08 10:31:29 +0000258 DEPLOY_K8S=n ./voltha up
259
260 mkdir -p $ROBOT_LOGS_DIR
261 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
262 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
263
264 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800265
266 # stop logging
267 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
268 if [ -n "$P_IDS" ]; then
269 echo $P_IDS
270 for P_ID in $P_IDS; do
271 kill -9 $P_ID
272 done
273 fi
274
275 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800276 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
TorstenThieme0a0fc522020-10-08 10:31:29 +0000277 '''
278 }
279 }
280
TorstenThieme987a7302020-09-23 08:54:58 +0000281 stage('DT workflow') {
282 environment {
283 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow"
284 }
285 steps {
286 sh '''
287 cd $WORKSPACE/kind-voltha/
288 #source $NAME-env.sh
289 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
290
291 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
292
293 IMAGES="adapter_open_onu_go"
294
295 for I in \$IMAGES
296 do
297 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
298 done
299
300 # Workflow-specific flags
301 export WITH_RADIUS=no
302 export WITH_EAPOL=no
303 export WITH_DHCP=no
304 export WITH_IGMP=no
305 export CONFIG_SADIS="external"
306 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
307
Matteo Scandoloaca27622020-12-11 09:04:07 -0800308 # start logging
309 mkdir -p $WORKSPACE/dt
310 _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log &
311
TorstenThieme987a7302020-09-23 08:54:58 +0000312 DEPLOY_K8S=n ./voltha up
313
314 mkdir -p $ROBOT_LOGS_DIR
315 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
316
317 # By default, all tests tagged 'sanityDt' are run. This covers basic functionality
318 # like running through the DT workflow for a single subscriber.
319 export TARGET=sanity-kind-dt
320
321 # If the Gerrit comment contains a line with "functional tests" then run the full
322 # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'.
323 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
324 REGEX="functional tests"
325 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
326 TARGET=functional-single-kind-dt
327 fi
328
329 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800330
331 # stop logging
332 P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')"
333 if [ -n "$P_IDS" ]; then
334 echo $P_IDS
335 for P_ID in $P_IDS; do
336 kill -9 $P_ID
337 done
338 fi
339
340 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800341 kubectl get pods -o wide --all-namespaces > $WORKSPACE/dt/pods.txt || true
TorstenThieme987a7302020-09-23 08:54:58 +0000342 '''
343 }
344 }
345
TorstenThieme30b7a322020-09-28 11:13:18 +0000346 stage('ATT workflow') {
347 environment {
348 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow"
349 }
350 steps {
351 sh '''
352 cd $WORKSPACE/kind-voltha/
353 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
Matteo Scandolofff6e062020-04-29 13:36:33 -0700354
TorstenThieme30b7a322020-09-28 11:13:18 +0000355 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
356
357 IMAGES="adapter_open_onu_go"
358
359 for I in \$IMAGES
360 do
361 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
362 done
363
364 # Workflow-specific flags
365 export WITH_RADIUS=yes
366 export WITH_EAPOL=yes
367 export WITH_BBSIM=yes
368 export DEPLOY_K8S=yes
369 export CONFIG_SADIS="external"
370 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
371
372 if [ "${gerritProject}" = "voltctl" ]; then
373 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
374 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
375 md5sum $WORKSPACE/kind-voltha/bin/voltctl
376 fi
377
Matteo Scandoloaca27622020-12-11 09:04:07 -0800378 # start logging
379 mkdir -p $WORKSPACE/att
380 _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log &
381
TorstenThieme30b7a322020-09-28 11:13:18 +0000382 DEPLOY_K8S=n ./voltha up
383
384 mkdir -p $ROBOT_LOGS_DIR
385 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
386
387 # By default, all tests tagged 'sanity' are run. This covers basic functionality
388 # like running through the ATT workflow for a single subscriber.
389 export TARGET=sanity-single-kind
390
391 # If the Gerrit comment contains a line with "functional tests" then run the full
392 # functional test suite. This covers tests tagged either 'sanity' or 'functional'.
393 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
394 REGEX="functional tests"
395 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
396 TARGET=functional-single-kind
397 fi
398
399 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800400
401 # stop logging
402 P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')"
403 if [ -n "$P_IDS" ]; then
404 echo $P_IDS
405 for P_ID in $P_IDS; do
406 kill -9 $P_ID
407 done
408 fi
409
410 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800411 kubectl get pods -o wide --all-namespaces > $WORKSPACE/att/pods.txt || true
TorstenThieme30b7a322020-09-28 11:13:18 +0000412 '''
413 }
414 }
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000415
416 stage('TT workflow') {
417 environment {
418 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow"
419 }
420 steps {
421 sh '''
422 cd $WORKSPACE/kind-voltha/
423 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
424
425 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
426
427 IMAGES="adapter_open_onu_go"
428
429 for I in \$IMAGES
430 do
431 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
432 done
433
434 # Workflow-specific flags
435 export WITH_RADIUS=no
436 export WITH_EAPOL=no
437 export WITH_DHCP=yes
438 export WITH_IGMP=yes
439 export CONFIG_SADIS="external"
440 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
441
Matteo Scandoloaca27622020-12-11 09:04:07 -0800442 # start logging
443 mkdir -p $WORKSPACE/tt
444 _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log &
445
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000446 DEPLOY_K8S=n ./voltha up
447
448 mkdir -p $ROBOT_LOGS_DIR
449 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
450
451 # By default, all tests tagged 'sanityTt' are run. This covers basic functionality
452 # like running through the TT workflow for a single subscriber.
453 export TARGET=sanity-kind-tt
454
455 # If the Gerrit comment contains a line with "functional tests" then run the full
456 # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'.
457 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
458 REGEX="functional tests"
459 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
460 TARGET=functional-single-kind-tt
461 fi
462
463 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800464
465 # stop logging
466 P_IDS="$(ps e -ww -A | grep "_TAG=kail-tt" | grep -v grep | awk '{print $1}')"
467 if [ -n "$P_IDS" ]; then
468 echo $P_IDS
469 for P_ID in $P_IDS; do
470 kill -9 $P_ID
471 done
472 fi
473
474 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800475 kubectl get pods -o wide --all-namespaces > $WORKSPACE/tt/pods.txt || true
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000476 '''
477 }
478 }
TorstenThieme30b7a322020-09-28 11:13:18 +0000479 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700480 post {
481 always {
482 sh '''
483 set +e
Matteo Scandolofff6e062020-04-29 13:36:33 -0700484 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
485 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Matteo Scandolofff6e062020-04-29 13:36:33 -0700486
487 sync
488 pkill kail || true
Andrea Campanella919361e2020-09-21 14:27:19 +0200489 md5sum $WORKSPACE/kind-voltha/bin/voltctl
Matteo Scandolofff6e062020-04-29 13:36:33 -0700490
491 ## Pull out errors from log files
492 extract_errors_go() {
493 echo
494 echo "Error summary for $1:"
495 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
496 echo
497 }
498
499 extract_errors_python() {
500 echo
501 echo "Error summary for $1:"
502 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
503 echo
504 }
505
506 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
507 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
508 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
509 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
510
511 gzip $WORKSPACE/onos-voltha-combined.log
512
513
514 ## shut down kind-voltha
515 if [ "${branch}" != "master" ]; then
516 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Andrea Campanella919361e2020-09-21 14:27:19 +0200517 source "$WORKSPACE/kind-voltha/releases/${branch}"
Matteo Scandolofff6e062020-04-29 13:36:33 -0700518 else
519 echo "on master, using default settings for kind-voltha"
520 fi
521
Andrea Campanella919361e2020-09-21 14:27:19 +0200522 cd $WORKSPACE/kind-voltha
Matteo Scandolofff6e062020-04-29 13:36:33 -0700523 WAIT_ON_DOWN=y ./voltha down
524 '''
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200525 step([$class: 'RobotPublisher',
526 disableArchiveOutput: false,
527 logFileName: 'RobotLogs/*/log*.html',
528 otherFiles: '',
529 outputFileName: 'RobotLogs/*/output*.xml',
530 outputPath: '.',
531 passThreshold: 100,
532 reportFileName: 'RobotLogs/*/report*.html',
533 unstableThreshold: 0]);
Matteo Scandoloaca27622020-12-11 09:04:07 -0800534 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
Matteo Scandolofff6e062020-04-29 13:36:33 -0700535 }
536 }
537}