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