blob: 22ec908561d10f7ccf6233a1306f51a64b663aed [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 {
26 timeout(time: 90, unit: 'MINUTES')
27 }
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
122
123 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
124
125 # stop logging
126 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')"
127 if [ -n "$P_IDS" ]; then
128 echo $P_IDS
129 for P_ID in $P_IDS; do
130 kill -9 $P_ID
131 done
132 fi
133
134 # get pods information
135 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true
136 '''
137 }
138 }
139
140 stage('Run E2E Tests 1t4gem') {
141 environment {
142 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t4gem"
143 }
144 steps {
145 sh '''
146 # start logging
147 mkdir -p $WORKSPACE/1t4gem
148 _TAG=kail-1t4gem kail -n voltha -n default > $WORKSPACE/1t4gem/onos-voltha-combined.log &
149
150 mkdir -p $ROBOT_LOGS_DIR/1t4gem
151 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
152 export TARGET_DEFAULT=1t4gem-openonu-go-adapter-test
153
154 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
155
156 # stop logging
157 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t4gem" | grep -v grep | awk '{print $1}')"
158 if [ -n "$P_IDS" ]; then
159 echo $P_IDS
160 for P_ID in $P_IDS; do
161 kill -9 $P_ID
162 done
163 fi
164
165 # get pods information
166 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t4gem/pods.txt || true
167 '''
168 }
169 }
170
171 stage('Run E2E Tests 1t8gem') {
172 environment {
173 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem"
174 }
175 steps {
176 sh '''
177 # start logging
178 mkdir -p $WORKSPACE/1t8gem
179 _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log &
180
181 DEPLOY_K8S=n ./voltha up
182
183 mkdir -p $ROBOT_LOGS_DIR/1t8gem
184 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
185 export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test
186
187 make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true
188
189 # stop logging
190 P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')"
191 if [ -n "$P_IDS" ]; then
192 echo $P_IDS
193 for P_ID in $P_IDS; do
194 kill -9 $P_ID
195 done
196 fi
197
198 # get pods information
199 kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true
200 '''
201 }
202 }
203
204 stage('Run MIB Upload Tests') {
205 environment {
206 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB"
207 }
208 steps {
209 sh '''
210 cd $WORKSPACE/kind-voltha/
211 #source $NAME-env.sh
212 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
213
214 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
215
216 export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu "
217
218 # start logging
219 mkdir -p $WORKSPACE/mib
220 _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log &
221
222 DEPLOY_K8S=n ./voltha up
223
224 mkdir -p $ROBOT_LOGS_DIR
225 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR"
226 export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test
227
228 make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true
229
230 # stop logging
231 P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')"
232 if [ -n "$P_IDS" ]; then
233 echo $P_IDS
234 for P_ID in $P_IDS; do
235 kill -9 $P_ID
236 done
237 fi
238
239 # get pods information
240 kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true
241 '''
242 }
243 }
244
245 stage('Reconcile DT workflow') {
246 environment {
247 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileDT"
248 }
249 steps {
250 sh '''
251 cd $WORKSPACE/kind-voltha/
252 #source $NAME-env.sh
253 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
254
255 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
256
257 # Workflow-specific flags
258 export WITH_RADIUS=no
259 export WITH_EAPOL=no
260 export WITH_DHCP=no
261 export WITH_IGMP=no
262 export CONFIG_SADIS="external"
263 export BBSIM_CFG="configs/bbsim-sadis-dt.yaml"
264
265 # start logging
266 mkdir -p $WORKSPACE/dt
267 _TAG=kail-reconcile-dt kail -n voltha -n default > $WORKSPACE/reconciledt/onos-voltha-combined.log &
268
269 DEPLOY_K8S=n ./voltha up
270
271 mkdir -p $ROBOT_LOGS_DIR
272 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
273
274 export TARGET=reconcile-openonu-go-adapter-test-dt
275
276
277 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
278
279 # stop logging
280 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-dt" | grep -v grep | awk '{print $1}')"
281 if [ -n "$P_IDS" ]; then
282 echo $P_IDS
283 for P_ID in $P_IDS; do
284 kill -9 $P_ID
285 done
286 fi
287
288 # get pods information
289 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconciledt/pods.txt || true
290 '''
291 }
292 }
293
294 stage('Reconcile ATT workflow') {
295 environment {
296 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileATT"
297 }
298 steps {
299 sh '''
300 cd $WORKSPACE/kind-voltha/
301 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
302
303 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
304
305 # Workflow-specific flags
306 export WITH_RADIUS=yes
307 export WITH_EAPOL=yes
308 export WITH_BBSIM=yes
309 export DEPLOY_K8S=yes
310 export CONFIG_SADIS="external"
311 export BBSIM_CFG="configs/bbsim-sadis-att.yaml"
312
313 if [ "${gerritProject}" = "voltctl" ]; then
314 export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION)
315 cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl
316 md5sum $WORKSPACE/kind-voltha/bin/voltctl
317 fi
318
319 # start logging
320 mkdir -p $WORKSPACE/att
321 _TAG=kail-reconcile-att kail -n voltha -n default > $WORKSPACE/reconcileatt/onos-voltha-combined.log &
322
323 DEPLOY_K8S=n ./voltha up
324
325 mkdir -p $ROBOT_LOGS_DIR
326 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
327
328 export TARGET=reconcile-openonu-go-adapter-test
329
330
331 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
332
333 # stop logging
334 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-att" | grep -v grep | awk '{print $1}')"
335 if [ -n "$P_IDS" ]; then
336 echo $P_IDS
337 for P_ID in $P_IDS; do
338 kill -9 $P_ID
339 done
340 fi
341
342 # get pods information
343 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcileatt/pods.txt || true
344 '''
345 }
346 }
347
348 stage('Reconcile TT workflow') {
349 environment {
350 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ReconcileTT"
351 }
352 steps {
353 sh '''
354 cd $WORKSPACE/kind-voltha/
355 WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down
356
357 export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} "
358
359 # Workflow-specific flags
360 export WITH_RADIUS=no
361 export WITH_EAPOL=no
362 export WITH_DHCP=yes
363 export WITH_IGMP=yes
364 export CONFIG_SADIS="external"
365 export BBSIM_CFG="configs/bbsim-sadis-tt.yaml"
366
367 # start logging
368 mkdir -p $WORKSPACE/tt
369 _TAG=kail-reconcile-tt kail -n voltha -n default > $WORKSPACE/reconcilett/onos-voltha-combined.log &
370
371 DEPLOY_K8S=n ./voltha up
372
373 mkdir -p $ROBOT_LOGS_DIR
374 export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch"
375
376 export TARGET=reconcile-openonu-go-adapter-test-tt
377
378 make -C $WORKSPACE/voltha-system-tests \$TARGET || true
379
380 # stop logging
381 P_IDS="$(ps e -ww -A | grep "_TAG=kail-reconcile-tt" | grep -v grep | awk '{print $1}')"
382 if [ -n "$P_IDS" ]; then
383 echo $P_IDS
384 for P_ID in $P_IDS; do
385 kill -9 $P_ID
386 done
387 fi
388
389 # get pods information
390 kubectl get pods -o wide --all-namespaces > $WORKSPACE/reconcilett/pods.txt || true
391 '''
392 }
393 }
394 }
395 post {
396 always {
397 sh '''
398 set +e
399 # get pods information
400 kubectl get pods -o wide
401 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}"
402 helm ls
403
404 sync
405 pkill kail || true
406 md5sum $WORKSPACE/kind-voltha/bin/voltctl
407
408 ## Pull out errors from log files
409 extract_errors_go() {
410 echo
411 echo "Error summary for $1:"
412 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
413 echo
414 }
415
416 extract_errors_python() {
417 echo
418 echo "Error summary for $1:"
419 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
420 echo
421 }
422
423 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true
424 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true
425 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true
426 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true
427
428 gzip $WORKSPACE/onos-voltha-combined.log || true
429 '''
430 step([$class: 'RobotPublisher',
431 disableArchiveOutput: false,
432 logFileName: 'RobotLogs/*/log*.html',
433 otherFiles: '',
434 outputFileName: 'RobotLogs/*/output*.xml',
435 outputPath: '.',
436 passThreshold: 100,
437 reportFileName: 'RobotLogs/*/report*.html',
438 unstableThreshold: 0]);
439 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt'
440 }
441 }
442}