blob: 7a1ab22a30f8f4bef57cf63de5bd049b09a4d851 [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"
TorstenThieme582d0342021-01-25 14:16:55 +0000122 export NAME=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/
148 #source $NAME-env.sh
149 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
150
151 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
152
TorstenThieme326e7972021-01-19 14:27:59 +0000153 # start logging
154 mkdir -p $WORKSPACE/1t4gem
155 _TAG=kail-1t4gem kail -n voltha -n default > $WORKSPACE/1t4gem/onos-voltha-combined.log &
156
TorstenThieme582d0342021-01-25 14:16:55 +0000157 DEPLOY_K8S=n ./voltha up
158
TorstenThieme326e7972021-01-19 14:27:59 +0000159 mkdir -p $ROBOT_LOGS_DIR/1t4gem
160 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme582d0342021-01-25 14:16:55 +0000161 export NAME=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000162
TorstenThieme669258d2021-01-29 09:03:10 +0000163 make -C $WORKSPACE/voltha-system-tests ${make1t4gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000164
165 # stop logging
166 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t4gem" | grep -v grep | awk '{print $1}')"
167 if [ -n "$P_IDS" ]; then
168 echo $P_IDS
169 for P_ID in $P_IDS; do
170 kill -9 $P_ID
171 done
172 fi
173
174 # get pods information
175 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t4gem/pods.txt || true
176 '''
177 }
178 }
179
180 stage('Run E2E Tests 1t8gem') {
181 environment {
182 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
183 }
184 steps {
185 sh '''
TorstenThieme582d0342021-01-25 14:16:55 +0000186 cd $WORKSPACE/kind-voltha/
187 #source $NAME-env.sh
188 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
189
190 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
191
TorstenThieme326e7972021-01-19 14:27:59 +0000192 # start logging
193 mkdir -p $WORKSPACE/1t8gem
194 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
195
196 DEPLOY_K8S=n ./voltha up
197
198 mkdir -p $ROBOT_LOGS_DIR/1t8gem
199 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
TorstenThieme582d0342021-01-25 14:16:55 +0000200 export NAME=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000201
TorstenThieme669258d2021-01-29 09:03:10 +0000202 make -C $WORKSPACE/voltha-system-tests ${make1t8gemTestTarget} || true
TorstenThieme326e7972021-01-19 14:27:59 +0000203
204 # stop logging
205 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
206 if [ -n "$P_IDS" ]; then
207 echo $P_IDS
208 for P_ID in $P_IDS; do
209 kill -9 $P_ID
210 done
211 fi
212
213 # get pods information
214 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
215 '''
216 }
217 }
218
219 stage('Run MIB Upload Tests') {
TorstenThieme669258d2021-01-29 09:03:10 +0000220 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000221 environment {
222 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
223 }
224 steps {
225 sh '''
226 cd $WORKSPACE/kind-voltha/
227 #source $NAME-env.sh
228 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
229
230 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
231
232 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
233
234 # start logging
235 mkdir -p $WORKSPACE/mib
236 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
237
238 DEPLOY_K8S=n ./voltha up
239
240 mkdir -p $ROBOT_LOGS_DIR
241 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
242 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
243
244 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
245
246 # stop logging
247 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | 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/mib/pods.txt || true
257 '''
258 }
259 }
260
261 stage('Reconcile DT workflow') {
TorstenThieme669258d2021-01-29 09:03:10 +0000262 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000263 environment {
264 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileDT"
265 }
266 steps {
267 sh '''
268 cd $WORKSPACE/kind-voltha/
269 #source $NAME-env.sh
270 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
271
272 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
273
274 # Workflow-specific flags
275 export WITH_RADIUS=no
276 export WITH_EAPOL=no
277 export WITH_DHCP=no
278 export WITH_IGMP=no
279 export CONFIG_SADIS="external"
280 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
281
282 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000283 mkdir -p $WORKSPACE/reconciledt
TorstenThieme326e7972021-01-19 14:27:59 +0000284 _TAG=kail-reconcile-dt kail -n voltha -n default > $WORKSPACE/reconciledt/onos-voltha-combined.log &
285
286 DEPLOY_K8S=n ./voltha up
287
288 mkdir -p $ROBOT_LOGS_DIR
289 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
290
291 export TARGET=reconcile-openonu-go-adapter-test-dt
292
293
294 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
295
296 # stop logging
297 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-dt" | grep -v grep | awk '{print $1}')"
298 if [ -n "$P_IDS" ]; then
299 echo $P_IDS
300 for P_ID in $P_IDS; do
301 kill -9 $P_ID
302 done
303 fi
304
305 # get pods information
306 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconciledt/pods.txt || true
307 '''
308 }
309 }
310
311 stage('Reconcile ATT workflow') {
TorstenThieme669258d2021-01-29 09:03:10 +0000312 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000313 environment {
314 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileATT"
315 }
316 steps {
317 sh '''
318 cd $WORKSPACE/kind-voltha/
319 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
320
321 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
322
323 # Workflow-specific flags
324 export WITH_RADIUS=yes
325 export WITH_EAPOL=yes
326 export WITH_BBSIM=yes
327 export DEPLOY_K8S=yes
328 export CONFIG_SADIS="external"
329 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
330
331 if [ "${gerritProject}" = "voltctl" ]; then
332 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
333 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
334 md5sum $WORKSPACE/kind-voltha/bin/voltctl
335 fi
336
337 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000338 mkdir -p $WORKSPACE/reconcileatt
TorstenThieme326e7972021-01-19 14:27:59 +0000339 _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
340
341 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 export TARGET=reconcile-openonu-go-adapter-test
347
348
349 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
350
351 # stop logging
352 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-att" | grep -v grep | awk '{print $1}')"
353 if [ -n "$P_IDS" ]; then
354 echo $P_IDS
355 for P_ID in $P_IDS; do
356 kill -9 $P_ID
357 done
358 fi
359
360 # get pods information
361 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcileatt/pods.txt || true
362 '''
363 }
364 }
365
366 stage('Reconcile TT workflow') {
TorstenThieme669258d2021-01-29 09:03:10 +0000367 when { beforeAgent true; expression { return "${olts}" == "1" } }
TorstenThieme326e7972021-01-19 14:27:59 +0000368 environment {
369 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileTT"
370 }
371 steps {
372 sh '''
373 cd $WORKSPACE/kind-voltha/
374 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
375
376 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
377
378 # Workflow-specific flags
379 export WITH_RADIUS=no
380 export WITH_EAPOL=no
381 export WITH_DHCP=yes
382 export WITH_IGMP=yes
383 export CONFIG_SADIS="external"
384 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
385
386 # start logging
TorstenThiemea223e1e2021-01-29 13:22:14 +0000387 mkdir -p $WORKSPACE/reconcilett
TorstenThieme326e7972021-01-19 14:27:59 +0000388 _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
389
390 DEPLOY_K8S=n ./voltha up
391
392 mkdir -p $ROBOT_LOGS_DIR
393 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
394
395 export TARGET=reconcile-openonu-go-adapter-test-tt
396
397 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
398
399 # stop logging
400 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-tt" | grep -v grep | awk '{print $1}')"
401 if [ -n "$P_IDS" ]; then
402 echo $P_IDS
403 for P_ID in $P_IDS; do
404 kill -9 $P_ID
405 done
406 fi
407
408 # get pods information
409 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcilett/pods.txt || true
410 '''
411 }
412 }
413 }
414 post {
415 always {
416 sh '''
TorstenThieme326e7972021-01-19 14:27:59 +0000417 # get pods information
418 kubectl get pods -o wide
419 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
420 helm ls
421
422 sync
423 pkill kail || true
424 md5sum $WORKSPACE/kind-voltha/bin/voltctl
425
426 ## Pull out errors from log files
427 extract_errors_go() {
428 echo
429 echo "Error summary for $1:"
430 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
431 echo
432 }
433
434 extract_errors_python() {
435 echo
436 echo "Error summary for $1:"
437 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
438 echo
439 }
440
441 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
442 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
443 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
444 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
445
446 gzip $WORKSPACE/onos-voltha-combined.log || true
447 '''
448 step([$class: 'RobotPublisher',
449 disableArchiveOutput: false,
450 logFileName: 'RobotLogs/*/log*.html',
451 otherFiles: '',
452 outputFileName: 'RobotLogs/*/output*.xml',
453 outputPath: '.',
454 passThreshold: 100,
455 reportFileName: 'RobotLogs/*/report*.html',
456 unstableThreshold: 0]);
457 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
458 }
459 }
460}