blob: 2cfd07309b5db4cbb3b3b05b44b6131f35d64995 [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
Matteo Scandoloaf7ef5f2021-01-22 16:09:03 -0800196 export NAME=voltha_voltha
Andrea Campanella27ddf062020-08-07 10:35:15 +0200197
Matteo Scandoloaca27622020-12-11 09:04:07 -0800198 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Andrea Campanella27ddf062020-08-07 10:35:15 +0200199
Matteo Scandoloaca27622020-12-11 09:04:07 -0800200 # stop logging
Matteo Scandolof566cc42020-12-11 14:05:29 -0800201 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')"
Matteo Scandoloaca27622020-12-11 09:04:07 -0800202 if [ -n "$P_IDS" ]; then
203 echo $P_IDS
204 for P_ID in $P_IDS; do
205 kill -9 $P_ID
206 done
207 fi
208
209 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800210 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100211 '''
212 }
213 }
Matteo Scandolof566cc42020-12-11 14:05:29 -0800214
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100215 stage('Run E2E Tests 1t8gem') {
216 environment {
217 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
218 }
219 steps {
220 sh '''
221 cd $WORKSPACE/kind-voltha/
222 #source $NAME-env.sh
223 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
224
225 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
226
227 IMAGES="adapter_open_onu_go"
228
229 for I in \$IMAGES
230 do
231 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
232 done
233 #1t8gem
234 mkdir -p $WORKSPACE/1t8gem
Matteo Scandolof566cc42020-12-11 14:05:29 -0800235 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
236
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100237 DEPLOY_K8S=n ./voltha up
238
Matteo Scandolof566cc42020-12-11 14:05:29 -0800239 mkdir -p $ROBOT_LOGS_DIR/1t8gem
Andrea Campanellaa2f32c32020-12-17 18:30:47 +0100240 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
Matteo Scandolof566cc42020-12-11 14:05:29 -0800241 export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
Matteo Scandoloaf7ef5f2021-01-22 16:09:03 -0800242 export NAME=voltha_voltha
Matteo Scandolof566cc42020-12-11 14:05:29 -0800243
244 make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
245
246 # stop logging
247 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
248 if [ -n "$P_IDS" ]; then
249 echo $P_IDS
250 for P_ID in $P_IDS; do
251 kill -9 $P_ID
252 done
253 fi
254
255 # get pods information
256 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700257 '''
258 }
259 }
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200260
TorstenThieme0a0fc522020-10-08 10:31:29 +0000261 stage('Run MIB Upload Tests') {
262 environment {
263 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
264 }
265 steps {
266 sh '''
267 cd $WORKSPACE/kind-voltha/
268 #source $NAME-env.sh
269 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
270
271 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
272
Andrea Campanella12146d52020-10-13 23:35:17 +0200273 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
TorstenThieme0a0fc522020-10-08 10:31:29 +0000274
275 IMAGES="adapter_open_onu_go"
276
277 for I in \$IMAGES
278 do
279 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
280 done
281
Matteo Scandoloaca27622020-12-11 09:04:07 -0800282 # start logging
283 mkdir -p $WORKSPACE/mib
284 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
285
TorstenThieme0a0fc522020-10-08 10:31:29 +0000286 DEPLOY_K8S=n ./voltha up
287
288 mkdir -p $ROBOT_LOGS_DIR
289 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
290 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
Matteo Scandoloaf7ef5f2021-01-22 16:09:03 -0800291 export NAME=voltha_voltha
TorstenThieme0a0fc522020-10-08 10:31:29 +0000292
293 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800294
295 # stop logging
296 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
297 if [ -n "$P_IDS" ]; then
298 echo $P_IDS
299 for P_ID in $P_IDS; do
300 kill -9 $P_ID
301 done
302 fi
303
304 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800305 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
TorstenThieme0a0fc522020-10-08 10:31:29 +0000306 '''
307 }
308 }
309
TorstenThieme987a7302020-09-23 08:54:58 +0000310 stage('DT workflow') {
311 environment {
312 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow"
313 }
314 steps {
315 sh '''
316 cd $WORKSPACE/kind-voltha/
317 #source $NAME-env.sh
318 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
319
320 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
321
322 IMAGES="adapter_open_onu_go"
323
324 for I in \$IMAGES
325 do
326 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
327 done
328
329 # Workflow-specific flags
330 export WITH_RADIUS=no
331 export WITH_EAPOL=no
332 export WITH_DHCP=no
333 export WITH_IGMP=no
334 export CONFIG_SADIS="external"
335 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
336
Matteo Scandoloaca27622020-12-11 09:04:07 -0800337 # start logging
338 mkdir -p $WORKSPACE/dt
339 _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log &
340
TorstenThieme987a7302020-09-23 08:54:58 +0000341 DEPLOY_K8S=n ./voltha up
342
343 mkdir -p $ROBOT_LOGS_DIR
344 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
345
346 # By default, all tests tagged 'sanityDt' are run. This covers basic functionality
347 # like running through the DT workflow for a single subscriber.
348 export TARGET=sanity-kind-dt
349
350 # If the Gerrit comment contains a line with "functional tests" then run the full
351 # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'.
352 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
353 REGEX="functional tests"
354 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
355 TARGET=functional-single-kind-dt
356 fi
357
358 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800359
360 # stop logging
361 P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')"
362 if [ -n "$P_IDS" ]; then
363 echo $P_IDS
364 for P_ID in $P_IDS; do
365 kill -9 $P_ID
366 done
367 fi
368
369 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800370 kubectl get pods -o wide --all-namespaces > $WORKSPACE/dt/pods.txt || true
TorstenThieme987a7302020-09-23 08:54:58 +0000371 '''
372 }
373 }
374
TorstenThieme30b7a322020-09-28 11:13:18 +0000375 stage('ATT workflow') {
376 environment {
377 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow"
378 }
379 steps {
380 sh '''
381 cd $WORKSPACE/kind-voltha/
382 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
Matteo Scandolofff6e062020-04-29 13:36:33 -0700383
TorstenThieme30b7a322020-09-28 11:13:18 +0000384 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
385
386 IMAGES="adapter_open_onu_go"
387
388 for I in \$IMAGES
389 do
390 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
391 done
392
393 # Workflow-specific flags
394 export WITH_RADIUS=yes
395 export WITH_EAPOL=yes
396 export WITH_BBSIM=yes
397 export DEPLOY_K8S=yes
398 export CONFIG_SADIS="external"
399 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
400
401 if [ "${gerritProject}" = "voltctl" ]; then
402 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
403 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
404 md5sum $WORKSPACE/kind-voltha/bin/voltctl
405 fi
406
Matteo Scandoloaca27622020-12-11 09:04:07 -0800407 # start logging
408 mkdir -p $WORKSPACE/att
409 _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log &
410
TorstenThieme30b7a322020-09-28 11:13:18 +0000411 DEPLOY_K8S=n ./voltha up
412
413 mkdir -p $ROBOT_LOGS_DIR
414 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
415
416 # By default, all tests tagged 'sanity' are run. This covers basic functionality
417 # like running through the ATT workflow for a single subscriber.
418 export TARGET=sanity-single-kind
419
420 # If the Gerrit comment contains a line with "functional tests" then run the full
421 # functional test suite. This covers tests tagged either 'sanity' or 'functional'.
422 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
423 REGEX="functional tests"
424 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
425 TARGET=functional-single-kind
426 fi
427
428 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800429
430 # stop logging
431 P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')"
432 if [ -n "$P_IDS" ]; then
433 echo $P_IDS
434 for P_ID in $P_IDS; do
435 kill -9 $P_ID
436 done
437 fi
438
439 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800440 kubectl get pods -o wide --all-namespaces > $WORKSPACE/att/pods.txt || true
TorstenThieme30b7a322020-09-28 11:13:18 +0000441 '''
442 }
443 }
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000444
445 stage('TT workflow') {
446 environment {
447 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow"
448 }
449 steps {
450 sh '''
451 cd $WORKSPACE/kind-voltha/
452 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
453
454 export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} "
455
456 IMAGES="adapter_open_onu_go"
457
458 for I in \$IMAGES
459 do
460 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
461 done
462
463 # Workflow-specific flags
464 export WITH_RADIUS=no
465 export WITH_EAPOL=no
466 export WITH_DHCP=yes
467 export WITH_IGMP=yes
468 export CONFIG_SADIS="external"
469 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
470
Matteo Scandoloaca27622020-12-11 09:04:07 -0800471 # start logging
472 mkdir -p $WORKSPACE/tt
473 _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log &
474
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000475 DEPLOY_K8S=n ./voltha up
476
477 mkdir -p $ROBOT_LOGS_DIR
478 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
479
480 # By default, all tests tagged 'sanityTt' are run. This covers basic functionality
481 # like running through the TT workflow for a single subscriber.
482 export TARGET=sanity-kind-tt
483
484 # If the Gerrit comment contains a line with "functional tests" then run the full
485 # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'.
486 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
487 REGEX="functional tests"
488 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
489 TARGET=functional-single-kind-tt
490 fi
491
492 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
Matteo Scandoloaca27622020-12-11 09:04:07 -0800493
494 # stop logging
495 P_IDS="$(ps e -ww -A | grep "_TAG=kail-tt" | grep -v grep | awk '{print $1}')"
496 if [ -n "$P_IDS" ]; then
497 echo $P_IDS
498 for P_ID in $P_IDS; do
499 kill -9 $P_ID
500 done
501 fi
502
503 # get pods information
Matteo Scandolof566cc42020-12-11 14:05:29 -0800504 kubectl get pods -o wide --all-namespaces > $WORKSPACE/tt/pods.txt || true
Andrea Campanella50e3a0b2020-10-01 06:28:08 +0000505 '''
506 }
507 }
TorstenThieme30b7a322020-09-28 11:13:18 +0000508 }
Matteo Scandolofff6e062020-04-29 13:36:33 -0700509 post {
510 always {
511 sh '''
512 set +e
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000513 # get pods information
514 kubectl get pods -o wide
515 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
516 helm ls
Matteo Scandolofff6e062020-04-29 13:36:33 -0700517
518 sync
519 pkill kail || true
Andrea Campanella919361e2020-09-21 14:27:19 +0200520 md5sum $WORKSPACE/kind-voltha/bin/voltctl
Matteo Scandolofff6e062020-04-29 13:36:33 -0700521
522 ## Pull out errors from log files
523 extract_errors_go() {
524 echo
525 echo "Error summary for $1:"
526 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
527 echo
528 }
529
530 extract_errors_python() {
531 echo
532 echo "Error summary for $1:"
533 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
534 echo
535 }
536
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000537 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
538 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
539 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
540 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700541
Matteo Scandolo7eba41c2020-12-15 08:59:36 -1000542 gzip $WORKSPACE/onos-voltha-combined.log || true
Matteo Scandolofff6e062020-04-29 13:36:33 -0700543 '''
Andrea Campanella40ff56f2020-05-11 15:22:29 +0200544 step([$class: 'RobotPublisher',
545 disableArchiveOutput: false,
546 logFileName: 'RobotLogs/*/log*.html',
547 otherFiles: '',
548 outputFileName: 'RobotLogs/*/output*.xml',
549 outputPath: '.',
550 passThreshold: 100,
551 reportFileName: 'RobotLogs/*/report*.html',
552 unstableThreshold: 0]);
Matteo Scandoloaca27622020-12-11 09:04:07 -0800553 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
Matteo Scandolofff6e062020-04-29 13:36:33 -0700554 }
555 }
556}