blob: a2c3c62fbec5af57fdd312062c30ad3e72649217 [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
105 """
106 }
107 }
108
109 stage('Run E2E Tests 1t1gem') {
110 environment {
111 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t1gem"
112 }
113 steps {
114 sh '''
115 # start logging
116 mkdir -p $WORKSPACE/1t1gem
117 _TAG=kail-1t1gem kail -n voltha -n default > $WORKSPACE/1t1gem/onos-voltha-combined.log &
118
119 mkdir -p $ROBOT_LOGS_DIR/1t1gem
120 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
121 export TARGET_DEFAULT=openonu-go-adapter-test
TorstenThieme582d0342021-01-25 14:16:55 +0000122 export NAME=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000123
124 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
125
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"
161 export TARGET_DEFAULT=1t4gem-openonu-go-adapter-test
TorstenThieme582d0342021-01-25 14:16:55 +0000162 export NAME=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000163
164 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
165
166 # stop logging
167 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t4gem" | grep -v grep | awk '{print $1}')"
168 if [ -n "$P_IDS" ]; then
169 echo $P_IDS
170 for P_ID in $P_IDS; do
171 kill -9 $P_ID
172 done
173 fi
174
175 # get pods information
176 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t4gem/pods.txt || true
177 '''
178 }
179 }
180
181 stage('Run E2E Tests 1t8gem') {
182 environment {
183 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
184 }
185 steps {
186 sh '''
TorstenThieme582d0342021-01-25 14:16:55 +0000187 cd $WORKSPACE/kind-voltha/
188 #source $NAME-env.sh
189 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
190
191 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
192
TorstenThieme326e7972021-01-19 14:27:59 +0000193 # start logging
194 mkdir -p $WORKSPACE/1t8gem
195 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
196
197 DEPLOY_K8S=n ./voltha up
198
199 mkdir -p $ROBOT_LOGS_DIR/1t8gem
200 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
201 export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
TorstenThieme582d0342021-01-25 14:16:55 +0000202 export NAME=voltha_voltha
TorstenThieme326e7972021-01-19 14:27:59 +0000203
204 make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
205
206 # stop logging
207 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
208 if [ -n "$P_IDS" ]; then
209 echo $P_IDS
210 for P_ID in $P_IDS; do
211 kill -9 $P_ID
212 done
213 fi
214
215 # get pods information
216 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
217 '''
218 }
219 }
220
221 stage('Run MIB Upload Tests') {
222 environment {
223 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
224 }
225 steps {
226 sh '''
227 cd $WORKSPACE/kind-voltha/
228 #source $NAME-env.sh
229 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
230
231 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
232
233 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
234
235 # start logging
236 mkdir -p $WORKSPACE/mib
237 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
238
239 DEPLOY_K8S=n ./voltha up
240
241 mkdir -p $ROBOT_LOGS_DIR
242 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
243 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
244
245 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
246
247 # stop logging
248 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
249 if [ -n "$P_IDS" ]; then
250 echo $P_IDS
251 for P_ID in $P_IDS; do
252 kill -9 $P_ID
253 done
254 fi
255
256 # get pods information
257 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
258 '''
259 }
260 }
261
262 stage('Reconcile DT workflow') {
263 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
283 mkdir -p $WORKSPACE/dt
284 _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') {
312 environment {
313 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileATT"
314 }
315 steps {
316 sh '''
317 cd $WORKSPACE/kind-voltha/
318 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
319
320 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
321
322 # Workflow-specific flags
323 export WITH_RADIUS=yes
324 export WITH_EAPOL=yes
325 export WITH_BBSIM=yes
326 export DEPLOY_K8S=yes
327 export CONFIG_SADIS="external"
328 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
329
330 if [ "${gerritProject}" = "voltctl" ]; then
331 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
332 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
333 md5sum $WORKSPACE/kind-voltha/bin/voltctl
334 fi
335
336 # start logging
337 mkdir -p $WORKSPACE/att
338 _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
339
340 DEPLOY_K8S=n ./voltha up
341
342 mkdir -p $ROBOT_LOGS_DIR
343 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
344
345 export TARGET=reconcile-openonu-go-adapter-test
346
347
348 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
349
350 # stop logging
351 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-att" | grep -v grep | awk '{print $1}')"
352 if [ -n "$P_IDS" ]; then
353 echo $P_IDS
354 for P_ID in $P_IDS; do
355 kill -9 $P_ID
356 done
357 fi
358
359 # get pods information
360 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcileatt/pods.txt || true
361 '''
362 }
363 }
364
365 stage('Reconcile TT workflow') {
366 environment {
367 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileTT"
368 }
369 steps {
370 sh '''
371 cd $WORKSPACE/kind-voltha/
372 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
373
374 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
375
376 # Workflow-specific flags
377 export WITH_RADIUS=no
378 export WITH_EAPOL=no
379 export WITH_DHCP=yes
380 export WITH_IGMP=yes
381 export CONFIG_SADIS="external"
382 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
383
384 # start logging
385 mkdir -p $WORKSPACE/tt
386 _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
387
388 DEPLOY_K8S=n ./voltha up
389
390 mkdir -p $ROBOT_LOGS_DIR
391 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
392
393 export TARGET=reconcile-openonu-go-adapter-test-tt
394
395 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
396
397 # stop logging
398 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-tt" | grep -v grep | awk '{print $1}')"
399 if [ -n "$P_IDS" ]; then
400 echo $P_IDS
401 for P_ID in $P_IDS; do
402 kill -9 $P_ID
403 done
404 fi
405
406 # get pods information
407 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcilett/pods.txt || true
408 '''
409 }
410 }
411 }
412 post {
413 always {
414 sh '''
415 set +e
416 # get pods information
417 kubectl get pods -o wide
418 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
419 helm ls
420
421 sync
422 pkill kail || true
423 md5sum $WORKSPACE/kind-voltha/bin/voltctl
424
425 ## Pull out errors from log files
426 extract_errors_go() {
427 echo
428 echo "Error summary for $1:"
429 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
430 echo
431 }
432
433 extract_errors_python() {
434 echo
435 echo "Error summary for $1:"
436 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
437 echo
438 }
439
440 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
441 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
442 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
443 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
444
445 gzip $WORKSPACE/onos-voltha-combined.log || true
446 '''
447 step([$class: 'RobotPublisher',
448 disableArchiveOutput: false,
449 logFileName: 'RobotLogs/*/log*.html',
450 otherFiles: '',
451 outputFileName: 'RobotLogs/*/output*.xml',
452 outputPath: '.',
453 passThreshold: 100,
454 reportFileName: 'RobotLogs/*/report*.html',
455 unstableThreshold: 0]);
456 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
457 }
458 }
459}