blob: cb9a0c2fedbb2be42a6bbf731595f573d35d075d [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"
Matteo Scandolo7eba41c2020-12-15 08:59:36 -100042 EXTRA_HELM_FLAGS=" --set defaults.image_registry=mirror.registry.opennetworking.org/ "
Matteo Scandolofff6e062020-04-29 13:36:33 -070043 }
Matteo Scandolofff6e062020-04-29 13:36:33 -070044 stages {
Andrea Campanella919361e2020-09-21 14:27:19 +020045 stage('Clone kind-voltha') {
Matteo Scandolofff6e062020-04-29 13:36:33 -070046 steps {
Andrea Campanella919361e2020-09-21 14:27:19 +020047 checkout([
48 $class: 'GitSCM',
49 userRemoteConfigs: [[
50 url: "https://gerrit.opencord.org/kind-voltha",
51 refspec: "${kindVolthaChange}"
52 ]],
53 branches: [[ name: "master", ]],
54 extensions: [
55 [$class: 'WipeWorkspace'],
56 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
57 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
58 ],
59 ])
60 sh """
61 if [ '${kindVolthaChange}' != '' ] ; then
62 cd $WORKSPACE/kind-voltha
63 git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
64 fi
65 """
Matteo Scandolofff6e062020-04-29 13:36:33 -070066 }
67 }
Andrea Campanella919361e2020-09-21 14:27:19 +020068 stage('Clone voltha-system-tests') {
69 steps {
70 checkout([
71 $class: 'GitSCM',
72 userRemoteConfigs: [[
73 url: "https://gerrit.opencord.org/voltha-system-tests",
74 refspec: "${volthaSystemTestsChange}"
75 ]],
76 branches: [[ name: "${branch}", ]],
77 extensions: [
78 [$class: 'WipeWorkspace'],
79 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
80 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
81 ],
82 ])
83 sh """
84 if [ '${volthaSystemTestsChange}' != '' ] ; then
85 cd $WORKSPACE/voltha-system-tests
86 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
87 fi
88 """
89 }
90 }
91 // If the repo under test is not kind-voltha
92 // then download it and checkout the patch
93 stage('Download Patch') {
94 when {
95 expression {
96 return "${gerritProject}" != 'kind-voltha';
97 }
98 }
99 steps {
100 checkout([
101 $class: 'GitSCM',
102 userRemoteConfigs: [[
103 url: "https://gerrit.opencord.org/${gerritProject}",
104 refspec: "${gerritRefspec}"
105 ]],
106 branches: [[ name: "${branch}", ]],
107 extensions: [
108 [$class: 'WipeWorkspace'],
109 [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"],
110 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
111 ],
112 ])
113 sh """
114 pushd $WORKSPACE/${gerritProject}
115 git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD
116 echo "Currently on commit: \n"
117 git log -1 --oneline
118 popd
119 """
120 }
121 }
122 // If the repo under test is kind-voltha we don't need to download it again,
123 // as we already have it, simply checkout the patch
124 stage('Checkout kind-voltha patch') {
125 when {
126 expression {
127 return "${gerritProject}" == 'kind-voltha';
128 }
129 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700130 steps {
131 sh """
Andrea Campanella919361e2020-09-21 14:27:19 +0200132 cd $WORKSPACE/kind-voltha
133 git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD
134 """
Matteo Scandolofff6e062020-04-29 13:36:33 -0700135 }
136 }
137 stage('Create K8s Cluster') {
138 steps {
139 sh """
Andrea Campanella919361e2020-09-21 14:27:19 +0200140 cd $WORKSPACE/kind-voltha/
Matteo Scandolofff6e062020-04-29 13:36:33 -0700141 JUST_K8S=y ./voltha up
Andrea Campanella919361e2020-09-21 14:27:19 +0200142 bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin"
Matteo Scandolofff6e062020-04-29 13:36:33 -0700143 """
144 }
145 }
146
147 stage('Build Images') {
148 steps {
149 sh """
Matteo Scandolo4adf1192020-12-15 09:44:14 -1000150 make -C $WORKSPACE/voltha-openonu-adapter-go DOCKER_REGISTRY=mirror.registry.opennetworking.org/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build
Matteo Scandolofff6e062020-04-29 13:36:33 -0700151 """
152 }
153 }
154
155 stage('Push Images') {
156 steps {
157 sh '''
158 docker images | grep citest
Matteo Scandolo4adf1192020-12-15 09:44:14 -1000159 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 -0700160 '''
161 }
162 }
163 stage('Deploy Voltha') {
164 steps {
165 sh '''
Matteo Scandolof21ae312020-04-29 21:04:15 -0700166 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
Matteo Scandolofff6e062020-04-29 13:36:33 -0700167
168 IMAGES="adapter_open_onu_go"
169
170 for I in \$IMAGES
171 do
172 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
173 done
174
Andrea Campanella919361e2020-09-21 14:27:19 +0200175 cd $WORKSPACE/kind-voltha/
Matteo Scandolofff6e062020-04-29 13:36:33 -0700176 echo \$EXTRA_HELM_FLAGS
Matteo Scandoloaca27622020-12-11 09:04:07 -0800177
Matteo Scandolofff6e062020-04-29 13:36:33 -0700178 ./voltha up
179 '''
180 }
181 }
182
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100183 stage('Run E2E Tests 1t1gem') {
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200184 environment {
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100185 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t1gem"
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200186 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700187 steps {
188 sh '''
Matteo Scandoloaca27622020-12-11 09:04:07 -0800189 # start logging
Matteo Scandolof566cc42020-12-11 14:05:29 -0800190 mkdir -p $WORKSPACE/1t1gem
191 _TAG=kail-1t1gem kail -n voltha -n default > $WORKSPACE/1t1gem/onos-voltha-combined.log &
Matteo Scandolofff6e062020-04-29 13:36:33 -0700192
Matteo Scandolof566cc42020-12-11 14:05:29 -0800193 mkdir -p $ROBOT_LOGS_DIR/1t1gem
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100194 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandoloaca27622020-12-11 09:04:07 -0800195 export TARGET_DEFAULT=openonu-go-adapter-test
Andrea Campanella27ddf062020-08-07 10:35:15 +0200196
Matteo Scandoloaca27622020-12-11 09:04:07 -0800197 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Andrea Campanella27ddf062020-08-07 10:35:15 +0200198
Matteo Scandoloaca27622020-12-11 09:04:07 -0800199 # stop logging
Matteo Scandolof566cc42020-12-11 14:05:29 -0800200 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')"
Matteo Scandoloaca27622020-12-11 09:04:07 -0800201 if [ -n "$P_IDS" ]; then
202 echo $P_IDS
203 for P_ID in $P_IDS; do
204 kill -9 $P_ID
205 done
206 fi
207
208 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800209 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100210 '''
211 }
212 }
Matteo Scandolof566cc42020-12-11 14:05:29 -0800213
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100214 stage('Run E2E Tests 1t8gem') {
215 environment {
216 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
217 }
218 steps {
219 sh '''
220 cd $WORKSPACE/kind-voltha/
221 #source $NAME-env.sh
222 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
223
224 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
225
226 IMAGES="adapter_open_onu_go"
227
228 for I in \$IMAGES
229 do
230 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
231 done
232 #1t8gem
233 mkdir -p $WORKSPACE/1t8gem
Matteo Scandolof566cc42020-12-11 14:05:29 -0800234 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
235
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100236 DEPLOY_K8S=n ./voltha up
237
Matteo Scandolof566cc42020-12-11 14:05:29 -0800238 mkdir -p $ROBOT_LOGS_DIR/1t8gem
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100239 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolof566cc42020-12-11 14:05:29 -0800240 export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
241
242 make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
243
244 # stop logging
245 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
246 if [ -n "$P_IDS" ]; then
247 echo $P_IDS
248 for P_ID in $P_IDS; do
249 kill -9 $P_ID
250 done
251 fi
252
253 # get pods information
254 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700255 '''
256 }
257 }
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200258
TorstenThieme0a0fc522020-10-08 10:31:29 +0000259 stage('Run MIB Upload Tests') {
260 environment {
261 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
262 }
263 steps {
264 sh '''
265 cd $WORKSPACE/kind-voltha/
266 #source $NAME-env.sh
267 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
268
269 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
270
Andrea Campanella12146d52020-10-13 23:35:17 +0200271 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
TorstenThieme0a0fc522020-10-08 10:31:29 +0000272
273 IMAGES="adapter_open_onu_go"
274
275 for I in \$IMAGES
276 do
277 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
278 done
279
Matteo Scandoloaca27622020-12-11 09:04:07 -0800280 # start logging
281 mkdir -p $WORKSPACE/mib
282 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
283
TorstenThieme0a0fc522020-10-08 10:31:29 +0000284 DEPLOY_K8S=n ./voltha up
285
286 mkdir -p $ROBOT_LOGS_DIR
287 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
288 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
289
290 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800291
292 # stop logging
293 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
294 if [ -n "$P_IDS" ]; then
295 echo $P_IDS
296 for P_ID in $P_IDS; do
297 kill -9 $P_ID
298 done
299 fi
300
301 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800302 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
TorstenThieme0a0fc522020-10-08 10:31:29 +0000303 '''
304 }
305 }
306
TorstenThieme987a7302020-09-23 08:54:58 +0000307 stage('DT workflow') {
308 environment {
309 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow"
310 }
311 steps {
312 sh '''
313 cd $WORKSPACE/kind-voltha/
314 #source $NAME-env.sh
315 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
316
317 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
318
319 IMAGES="adapter_open_onu_go"
320
321 for I in \$IMAGES
322 do
323 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
324 done
325
326 # Workflow-specific flags
327 export WITH_RADIUS=no
328 export WITH_EAPOL=no
329 export WITH_DHCP=no
330 export WITH_IGMP=no
331 export CONFIG_SADIS="external"
332 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
333
Matteo Scandoloaca27622020-12-11 09:04:07 -0800334 # start logging
335 mkdir -p $WORKSPACE/dt
336 _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log &
337
TorstenThieme987a7302020-09-23 08:54:58 +0000338 DEPLOY_K8S=n ./voltha up
339
340 mkdir -p $ROBOT_LOGS_DIR
341 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
342
343 # By default, all tests tagged 'sanityDt' are run. This covers basic functionality
344 # like running through the DT workflow for a single subscriber.
345 export TARGET=sanity-kind-dt
346
347 # If the Gerrit comment contains a line with "functional tests" then run the full
348 # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'.
349 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
350 REGEX="functional tests"
351 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
352 TARGET=functional-single-kind-dt
353 fi
354
355 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800356
357 # stop logging
358 P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')"
359 if [ -n "$P_IDS" ]; then
360 echo $P_IDS
361 for P_ID in $P_IDS; do
362 kill -9 $P_ID
363 done
364 fi
365
366 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800367 kubectl get pods -o wide --all-namespaces > $WORKSPACE/dt/pods.txt || true
TorstenThieme987a7302020-09-23 08:54:58 +0000368 '''
369 }
370 }
371
TorstenThieme30b7a322020-09-28 11:13:18 +0000372 stage('ATT workflow') {
373 environment {
374 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow"
375 }
376 steps {
377 sh '''
378 cd $WORKSPACE/kind-voltha/
379 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
Matteo Scandolofff6e062020-04-29 13:36:33 -0700380
TorstenThieme30b7a322020-09-28 11:13:18 +0000381 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
382
383 IMAGES="adapter_open_onu_go"
384
385 for I in \$IMAGES
386 do
387 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
388 done
389
390 # Workflow-specific flags
391 export WITH_RADIUS=yes
392 export WITH_EAPOL=yes
393 export WITH_BBSIM=yes
394 export DEPLOY_K8S=yes
395 export CONFIG_SADIS="external"
396 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
397
398 if [ "${gerritProject}" = "voltctl" ]; then
399 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
400 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
401 md5sum $WORKSPACE/kind-voltha/bin/voltctl
402 fi
403
Matteo Scandoloaca27622020-12-11 09:04:07 -0800404 # start logging
405 mkdir -p $WORKSPACE/att
406 _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log &
407
TorstenThieme30b7a322020-09-28 11:13:18 +0000408 DEPLOY_K8S=n ./voltha up
409
410 mkdir -p $ROBOT_LOGS_DIR
411 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
412
413 # By default, all tests tagged 'sanity' are run. This covers basic functionality
414 # like running through the ATT workflow for a single subscriber.
415 export TARGET=sanity-single-kind
416
417 # If the Gerrit comment contains a line with "functional tests" then run the full
418 # functional test suite. This covers tests tagged either 'sanity' or 'functional'.
419 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
420 REGEX="functional tests"
421 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
422 TARGET=functional-single-kind
423 fi
424
425 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800426
427 # stop logging
428 P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')"
429 if [ -n "$P_IDS" ]; then
430 echo $P_IDS
431 for P_ID in $P_IDS; do
432 kill -9 $P_ID
433 done
434 fi
435
436 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800437 kubectl get pods -o wide --all-namespaces > $WORKSPACE/att/pods.txt || true
TorstenThieme30b7a322020-09-28 11:13:18 +0000438 '''
439 }
440 }
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000441
442 stage('TT workflow') {
443 environment {
444 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow"
445 }
446 steps {
447 sh '''
448 cd $WORKSPACE/kind-voltha/
449 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
450
451 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
452
453 IMAGES="adapter_open_onu_go"
454
455 for I in \$IMAGES
456 do
457 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
458 done
459
460 # Workflow-specific flags
461 export WITH_RADIUS=no
462 export WITH_EAPOL=no
463 export WITH_DHCP=yes
464 export WITH_IGMP=yes
465 export CONFIG_SADIS="external"
466 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
467
Matteo Scandoloaca27622020-12-11 09:04:07 -0800468 # start logging
469 mkdir -p $WORKSPACE/tt
470 _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log &
471
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000472 DEPLOY_K8S=n ./voltha up
473
474 mkdir -p $ROBOT_LOGS_DIR
475 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
476
477 # By default, all tests tagged 'sanityTt' are run. This covers basic functionality
478 # like running through the TT workflow for a single subscriber.
479 export TARGET=sanity-kind-tt
480
481 # If the Gerrit comment contains a line with "functional tests" then run the full
482 # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'.
483 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
484 REGEX="functional tests"
485 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
486 TARGET=functional-single-kind-tt
487 fi
488
489 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800490
491 # stop logging
492 P_IDS="$(ps e -ww -A | grep "_TAG=kail-tt" | grep -v grep | awk '{print $1}')"
493 if [ -n "$P_IDS" ]; then
494 echo $P_IDS
495 for P_ID in $P_IDS; do
496 kill -9 $P_ID
497 done
498 fi
499
500 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800501 kubectl get pods -o wide --all-namespaces > $WORKSPACE/tt/pods.txt || true
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000502 '''
503 }
504 }
TorstenThieme30b7a322020-09-28 11:13:18 +0000505 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700506 post {
507 always {
508 sh '''
509 set +e
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000510 # get pods information
511 kubectl get pods -o wide
512 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
513 helm ls
Matteo Scandolofff6e062020-04-29 13:36:33 -0700514
515 sync
516 pkill kail || true
Andrea Campanella919361e2020-09-21 14:27:19 +0200517 md5sum $WORKSPACE/kind-voltha/bin/voltctl
Matteo Scandolofff6e062020-04-29 13:36:33 -0700518
519 ## Pull out errors from log files
520 extract_errors_go() {
521 echo
522 echo "Error summary for $1:"
523 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
524 echo
525 }
526
527 extract_errors_python() {
528 echo
529 echo "Error summary for $1:"
530 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
531 echo
532 }
533
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000534 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
535 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
536 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
537 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700538
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000539 gzip $WORKSPACE/onos-voltha-combined.log || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700540 '''
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200541 step([$class: 'RobotPublisher',
542 disableArchiveOutput: false,
543 logFileName: 'RobotLogs/*/log*.html',
544 otherFiles: '',
545 outputFileName: 'RobotLogs/*/output*.xml',
546 outputPath: '.',
547 passThreshold: 100,
548 reportFileName: 'RobotLogs/*/report*.html',
549 unstableThreshold: 0]);
Matteo Scandoloaca27622020-12-11 09:04:07 -0800550 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
Matteo Scandolofff6e062020-04-29 13:36:33 -0700551 }
552 }
553}