blob: 1254fcb4885b841e0c9ef43fc45d8ed31fd79696 [file] [log] [blame]
Matteo Scandolo4b006ae2020-11-09 16:14:40 -08001// Copyright 2019-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// deploy VOLTHA using kind-voltha and performs a scale test
16
17pipeline {
18
19 /* no label, executor is determined by JJB */
20 agent {
21 label "${params.buildNode}"
22 }
23 options {
24 timeout(time: 60, unit: 'MINUTES')
25 }
26 environment {
27 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
28 KUBECONFIG="$HOME/.kube/config"
29 SSHPASS="karaf"
30 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
31 SCHEDULE_ON_CONTROL_NODES="yes"
32 FANCY=0
33 WAIT_ON_DOWN="yes"
34 WITH_SIM_ADAPTERS="no"
35 WITH_RADIUS="${withRadius}"
36 WITH_BBSIM="yes"
37 LEGACY_BBSIM_INDEX="no"
38 DEPLOY_K8S="no"
39 CONFIG_SADIS="external"
40 WITH_KAFKA="yes"
41 WITH_ETCD="yes"
42 VOLTHA_ETCD_PORT=9999
43
44 // VOLTHA namespaces are defined at runtime depending on the stack we're installing
45 // VOLTHA_NS="default"
46 // ADAPTER_NS="default"
47 // BBSIM_NS="default"
48 INFRA_NS="infra"
49
50 // configurable options
51 WITH_EAPOL="${withEapol}"
52 WITH_DHCP="${withDhcp}"
53 WITH_IGMP="${withIgmp}"
54 VOLTHA_LOG_LEVEL="${logLevel}"
55 NUM_OF_BBSIM="${olts}"
56 NUM_OF_OPENONU="${openonuAdapterReplicas}"
57 NUM_OF_ONOS="${onosReplicas}"
58 NUM_OF_ATOMIX="${atomixReplicas}"
59 NUM_OF_KAFKA="${kafkaReplicas}"
60 NUM_OF_ETCD="${etcdReplicas}"
61 WITH_PPROF="${withProfiling}"
62 EXTRA_HELM_FLAGS="${extraHelmFlags} " // note that the trailing space is required to separate the parameters from appends done later
63 VOLTHA_CHART="${volthaChart}"
64 VOLTHA_BBSIM_CHART="${bbsimChart}"
65 VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}"
66 VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}"
67 ONOS_CLASSIC_CHART="${onosChart}"
68 RADIUS_CHART="${radiusChart}"
69
70 APPS_TO_LOG="etcd kafka onos-onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius"
71 LOG_FOLDER="$WORKSPACE/logs"
72
73 GERRIT_PROJECT="${GERRIT_PROJECT}"
74 }
75
76 stages {
77 stage ('Cleanup') {
78 steps {
79 timeout(time: 11, unit: 'MINUTES') {
80 sh returnStdout: false, script: """
81 helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com
82 helm repo add stable https://kubernetes-charts.storage.googleapis.com
83 helm repo add onf https://charts.opencord.org
84 helm repo add cord https://charts.opencord.org
85 helm repo add onos https://charts.onosproject.org
86 helm repo add atomix https://charts.atomix.io
87 helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts
88 helm repo update
89
90 # removing ETCD port forward
91 P_ID="\$(ps e -ww -A | grep "_TAG=etcd-port-forward" | grep -v grep | awk '{print \$1}')"
92 if [ -n "\$P_ID" ]; then
93 kill -9 \$P_ID
94 fi
95
96 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat');
97 do
98 echo "Purging chart: \${hchart}"
99 helm delete "\${hchart}"
100 done
101 bash /home/cord/voltha-scale/wait_for_pods.sh
102
103 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
104
105 cd $WORKSPACE
106 rm -rf $WORKSPACE/*
107 """
108 }
109 }
110 }
111 stage('Clone kind-voltha') {
112 steps {
113 checkout([
114 $class: 'GitSCM',
115 userRemoteConfigs: [[
116 url: "https://gerrit.opencord.org/kind-voltha",
117 refspec: "${kindVolthaChange}"
118 ]],
119 branches: [[ name: "master", ]],
120 extensions: [
121 [$class: 'WipeWorkspace'],
122 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
123 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
124 ],
125 ])
126 script {
127 sh(script:"""
128 if [ '${kindVolthaChange}' != '' ] ; then
129 cd $WORKSPACE/kind-voltha;
130 git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
131 fi
132 """)
133 }
134 }
135 }
136 stage('Clone voltha-system-tests') {
137 steps {
138 checkout([
139 $class: 'GitSCM',
140 userRemoteConfigs: [[
141 url: "https://gerrit.opencord.org/voltha-system-tests",
142 refspec: "${volthaSystemTestsChange}"
143 ]],
144 branches: [[ name: "${release}", ]],
145 extensions: [
146 [$class: 'WipeWorkspace'],
147 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
148 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
149 ],
150 ])
151 script {
152 sh(script:"""
153 if [ '${volthaSystemTestsChange}' != '' ] ; then
154 cd $WORKSPACE/voltha-system-tests;
155 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
156 fi
157 """)
158 }
159 }
160 }
161 stage('Build patch') {
162 when {
163 expression {
164 return params.GERRIT_PROJECT
165 }
166 }
167 steps {
168 sh """
169 git clone https://\$GERRIT_HOST/\$GERRIT_PROJECT
170 cd \$GERRIT_PROJECT
171 git fetch https://\$GERRIT_HOST/\$GERRIT_PROJECT \$GERRIT_REFSPEC && git checkout FETCH_HEAD
172
173 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-build
174 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-push
175 """
176 }
177 }
178 stage('Deploy common infrastructure') {
179 // includes monitoring, kafka, etcd
180 steps {
181 sh '''
182 if [ ${withMonitoring} = true ] ; then
183 helm install nem-monitoring cord/nem-monitoring \
184 -f $HOME/voltha-scale/grafana.yaml \
185 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
186 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
187 fi
188
189 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
190 bash /home/cord/voltha-scale/wait_for_pods.sh
191 '''
192 }
193 }
194 stage('Deploy VOLTHA infrastructure') {
195 steps {
196 sh returnStdout: false, script: '''
197 cd $WORKSPACE/kind-voltha/
198
199 # KAFKA config
200 NUM_OF_KAFKA=${kafkaReplicas}
201 EXTRA_HELM_FLAGS+=' --set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default '
202
203 # ETCD config
204 EXTRA_HELM_FLAGS+=" --set memoryMode=${inMemoryEtcdStorage} "
205
206 NAME=infra JUST_INFRA=y ./voltha up
207
208 # Forward the ETCD port onto $VOLTHA_ETCD_PORT
209 _TAG=etcd-port-forward kubectl port-forward --address 0.0.0.0 -n default service/etcd $VOLTHA_ETCD_PORT:2379&
210 '''
211 }
212 }
213 stage('Deploy Voltha') {
214 steps {
215 deploy_voltha_stacks(params.volthaStacks)
216 }
217 }
218 stage('Start logging') {
219 steps {
220 sh returnStdout: false, script: '''
221 # start logging with kail
222
223 mkdir -p $LOG_FOLDER
224
225 list=($APPS_TO_LOG)
226 for app in "${list[@]}"
227 do
228 echo "Starting logs for: ${app}"
229 _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log&
230 done
231 '''
232 // bbsim-sadis server takes a while to cache the subscriber entries
233 // wait for that before starting the tests
234 sleep(120)
235 }
236 }
237 stage('Configuration') {
238 steps {
239 script {
240 sh returnStdout: false, script: """
241 #Setting link discovery
242 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${withLLDP}
243
244 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager allowExtraneousRules true
245 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager importExtraneousRules true
246
247
248 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 1000
249
250 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxIdleMillis 500
251
252 ONOSES=\$((\$NUM_OF_ONOS - 1))
253 for i in \$(seq 0 \$ONOSES); do
254 INSTANCE="onos-onos-classic-\$i"
255
256 #Setting LOG level to ${logLevel}
257 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.onosproject
258 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.opencord
259
260 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set DEBUG org.opencord.olt
261
262 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set TRACE org.onosproject.net.meter.impl
263 done
264
265 # Set Flows/Ports/Meters poll frequency
266 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${onosStatInterval}
267 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${onosStatInterval}
268
269 if [ ${withFlows} = false ]; then
270 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
271 fi
272
273 if [ ${withMibTemplate} = true ] ; then
274 rm -f BBSM-12345123451234512345-00000000000001-v1.json
275 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
276 cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it \$(kubectl get pods -l app=etcd | awk 'NR==2{print \$1}') -- etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001
277 fi
278
279 if [ ${withPcap} = true ] ; then
280 # Start the tcp-dump in ofagent
281 export OF_AGENT=\$(kubectl get pods -l app=ofagent -o name)
282 kubectl exec \$OF_AGENT -- apk update
283 kubectl exec \$OF_AGENT -- apk add tcpdump
284 kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
285 _TAG=ofagent-tcpdump kubectl exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap&
286
287 # Start the tcp-dump in radius
288 export RADIUS=\$(kubectl get pods -l app=radius -o name)
289 kubectl exec \$RADIUS -- apt-get update
290 kubectl exec \$RADIUS -- apt-get install -y tcpdump
291 _TAG=radius-tcpdump kubectl exec \$RADIUS -- tcpdump -w out.pcap&
292
293 # Start the tcp-dump in ONOS
294 for i in \$(seq 0 \$ONOSES); do
295 INSTANCE="onos-onos-classic-\$i"
296 kubectl exec \$INSTANCE -- apt-get update
297 kubectl exec \$INSTANCE -- apt-get install -y tcpdump
298 kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
299 _TAG=\$INSTANCE kubectl exec \$INSTANCE -- /usr/bin/tcpdump -nei eth0 port 1812 -w out.pcap&
300 done
301 fi
302 """
303 }
304 }
305 }
306 stage('Run Test') {
307 steps {
308 sh '''
309 mkdir -p $WORKSPACE/RobotLogs
310 cd $WORKSPACE/voltha-system-tests
311 make vst_venv
312 '''
313 sh '''
314 if [ ${withProfiling} = true ] ; then
315 mkdir -p $LOG_FOLDER/pprof
316 echo $PATH
317 #Creating Python script for ONU Detection
318 cat << EOF > $WORKSPACE/pprof.sh
319timestamp() {
320 date +"%T"
321}
322
323i=0
324while [[ true ]]; do
325 ((i++))
326 ts=$(timestamp)
327 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png
328 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png
329 curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
330 go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png
331
332 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png
333 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png
334 curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
335 go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png
336
337 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png
338 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png
339 curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
340 go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png
341
342 sleep 10
343done
344EOF
345
346 _TAG="pprof"
347 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
348 fi
349 '''
350 test_voltha_stacks(params.volthaStacks)
351 }
352 }
353 post {
354 always {
355 // collect result, done in the "post" step so it's executed even in the
356 // event of a timeout in the tests
357 sh '''
358
359 # stop the kail processes
360 list=($APPS_TO_LOG)
361 for app in "${list[@]}"
362 do
363 echo "Stopping logs for: ${app}"
364 _TAG="kail-$app"
365 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
366 if [ -n "$P_IDS" ]; then
367 echo $P_IDS
368 for P_ID in $P_IDS; do
369 kill -9 $P_ID
370 done
371 fi
372 done
373
374 if [ ${withPcap} = true ] ; then
375 # stop ofAgent tcpdump
376 P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')"
377 if [ -n "\$P_ID" ]; then
378 kill -9 \$P_ID
379 fi
380
381 # stop radius tcpdump
382 P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')"
383 if [ -n "\$P_ID" ]; then
384 kill -9 \$P_ID
385 fi
386
387 # stop onos tcpdump
388 LIMIT=$(($NUM_OF_ONOS - 1))
389 for i in $(seq 0 $LIMIT); do
390 INSTANCE="onos-onos-classic-$i"
391 P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')"
392 if [ -n "\$P_ID" ]; then
393 kill -9 \$P_ID
394 fi
395 done
396
397 # copy the file
398 export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true
399 kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true
400
401 export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true
402 kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true
403
404 LIMIT=$(($NUM_OF_ONOS - 1))
405 for i in $(seq 0 $LIMIT); do
406 INSTANCE="onos-onos-classic-$i"
407 kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true
408 done
409 fi
410
411 cd voltha-system-tests
412 source ./vst_venv/bin/activate
413 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt || true
414 cat $WORKSPACE/execution-time.txt
415 '''
416 sh '''
417 if [ ${withProfiling} = true ] ; then
418 _TAG="pprof"
419 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
420 if [ -n "$P_IDS" ]; then
421 echo $P_IDS
422 for P_ID in $P_IDS; do
423 kill -9 $P_ID
424 done
425 fi
426 fi
427 '''
428 plot([
429 csvFileName: 'scale-test.csv',
430 csvSeries: [
431 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
432 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
433 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
434 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
435 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
436 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
437 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
438 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
439 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
440 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
441 ],
442 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
443 ])
444 step([$class: 'RobotPublisher',
445 disableArchiveOutput: false,
446 logFileName: 'RobotLogs/log.html',
447 otherFiles: '',
448 outputFileName: 'RobotLogs/output.xml',
449 outputPath: '.',
450 passThreshold: 100,
451 reportFileName: 'RobotLogs/report.html',
452 unstableThreshold: 0]);
453 // get all the logs from kubernetes PODs
454 sh returnStdout: false, script: '''
455
456 # store information on running charts
457 helm ls > $LOG_FOLDER/helm-list.txt || true
458
459 # store information on the running pods
460 kubectl get pods -o wide > $LOG_FOLDER/pods.txt || true
461 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
462 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
463
464 # copy the ONOS logs directly from the container to avoid the color codes
465 printf '%s\n' $(kubectl get pods -l app=onos-onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I# bash -c "kubectl cp #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true
466
467 # get radius logs out of the container
468 kubectl cp $(kubectl get pods -l app=radius --no-headers | awk '{print $1}'):/var/log/freeradius/radius.log $LOG_FOLDER//radius.log || true
469 '''
470 // dump all the BBSim(s) ONU information
471 sh '''
472 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
473 IDS=($BBSIM_IDS)
474
475 for bbsim in "${IDS[@]}"
476 do
477 kubectl exec -t $bbsim -- bbsimctl onu list > $LOG_FOLDER/$bbsim-device-list.txt || true
478 kubectl exec -t $bbsim -- bbsimctl service list > $LOG_FOLDER/$bbsim-service-list.txt || true
479 done
480 '''
481 // get DHCP server stats
482 sh '''
483 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
484 IDS=($BBSIM_IDS)
485
486 for bbsim in "${IDS[@]}"
487 do
488 kubectl exec -t $bbsim -- dhcpd -lf /var/lib/dhcp/dhcpd.leases -play /tmp/dhcplog 2>&1 | tee $LOG_FOLDER/$bbsim-dhcp-replay.txt || true
489 kubectl cp $bbsim:/tmp/dhcplog $LOG_FOLDER/$bbsim-dhcp-logs || true
490 kubectl cp $bbsim:/var/lib/dhcp/dhcpd.leases $LOG_FOLDER/$bbsim-dhcp-leases || true
491 done
492 '''
493 // get ONOS debug infos
494 sh '''
495
496 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 apps -a -s > $LOG_FOLDER/onos-apps.txt || true
497 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 nodes > $LOG_FOLDER/onos-nodes.txt || true
498 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 masters > $LOG_FOLDER/onos-masters.txt || true
499 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 roles > $LOG_FOLDER/onos-roles.txt || true
500
501 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 ports > $LOG_FOLDER/onos-ports-list.txt || true
502 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 hosts > $LOG_FOLDER/onos-hosts-list.txt || true
503
504 if [ ${withFlows} = true ] ; then
505 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-olts > $LOG_FOLDER/onos-olt-list.txt || true
506 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 flows -s > $LOG_FOLDER/onos-flows-list.txt || true
507 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 meters > $LOG_FOLDER/onos-meters-list.txt || true
508 fi
509
510 if [ ${provisionSubscribers} = true ]; then
511 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-subscribers > $LOG_FOLDER/onos-programmed-subscribers.txt || true
512 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-meters > $LOG_FOLDER/onos-programmed-meters.txt || true
513 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-bpmeter-mappings > $LOG_FOLDER/onos-bpmeter-mappings.txt || true
514 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-failed-subscribers > $LOG_FOLDER/onos-failed-subscribers.txt || true
515 fi
516
517 if [ ${withEapol} = true ] ; then
518 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 aaa-users > $LOG_FOLDER/onos-aaa-users.txt || true
519 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 aaa-statistics > $LOG_FOLDER/onos-aaa-statistics.txt || true
520 fi
521
522 if [ ${withDhcp} = true ] ; then
523 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 dhcpl2relay-allocations > $LOG_FOLDER/onos-dhcp-allocations.txt || true
524 fi
525 '''
526 // collect etcd metrics
527 sh '''
528 mkdir -p $WORKSPACE/etcd-metrics
529 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_debugging_mvcc_keys_total' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-key-count.json || true
530 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=grpc_server_handled_total{grpc_service="etcdserverpb.KV"}' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-rpc-count.json || true
531 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_debugging_mvcc_db_total_size_in_bytes' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-db-size.json || true
532 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_backend_commit_duration_seconds_sum' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-backend-write-time.json || true
533 '''
534 // get VOLTHA debug infos
535 script {
536 try {
537 sh '''
538 voltctl -m 8MB device list -o json > $LOG_FOLDER/device-list.json || true
539 python -m json.tool $LOG_FOLDER/device-list.json > $LOG_FOLDER/voltha-devices-list.json || true
540 rm $LOG_FOLDER/device-list.json || true
541 voltctl -m 8MB device list > $LOG_FOLDER/voltha-devices-list.txt || true
542
543 printf '%s\n' $(voltctl -m 8MB device list | grep olt | awk '{print $1}') | xargs -I# bash -c "voltctl -m 8MB device flows # > $LOG_FOLDER/voltha-device-flows-#.txt" || true
544 printf '%s\n' $(voltctl -m 8MB device list | grep olt | awk '{print $1}') | xargs -I# bash -c "voltctl -m 8MB device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' # > $LOG_FOLDER/voltha-device-ports-#.txt" || true
545
546 printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs -I# bash -c "voltctl -m 8MB logicaldevice flows # > $LOG_FOLDER/voltha-logicaldevice-flows-#.txt" || true
547 printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs -I# bash -c "voltctl -m 8MB logicaldevice port list # > $LOG_FOLDER/voltha-logicaldevice-ports-#.txt" || true
548 '''
549 } catch(e) {
550 sh '''
551 echo "Can't get device list from voltclt"
552 '''
553 }
554 }
555 // get cpu usage by container
556 sh '''
557 if [ ${withMonitoring} = true ] ; then
558 cd $WORKSPACE/voltha-system-tests
559 source ./vst_venv/bin/activate
560 sleep 60 # we have to wait for prometheus to collect all the information
561 python tests/scale/sizing.py -o $WORKSPACE/plots || true
562 fi
563 '''
564 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*,etcd-metrics/*'
565 }
566 }
567}
568
569def deploy_voltha_stacks(numberOfStacks) {
570 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
571 stage("Deploy VOLTHA stack " + i) {
572 sh returnStdout: false, script: """
573 cd $WORKSPACE/kind-voltha/
574
575 export NAME=voltha${i}
576 export VOLTHA_NS=voltha${i}
577 export ADAPTER_NS=voltha${i}
578 export BBSIM_NS=voltha${i}
579 export BBSIM_BASE_INDEX=${i}
580 export WITH_ETCD=etcd.\$INFRA_NS.svc:2379
581 export WITH_KAFKA=kafka.\$INFRA_NS.svc:9092
582 export WITH_ONOS=onos-onos-classic-hs.\$INFRA_NS.svc:6653
583
584 export EXTRA_HELM_FLAGS+=' '
585
586 # Load the release defaults
587 if [ '${release.trim()}' != 'master' ]; then
588 source $WORKSPACE/kind-voltha/releases/${release}
589 EXTRA_HELM_FLAGS+=" ${extraHelmFlags} "
590 fi
591
592 # BBSim custom image handling
593 if [ '${bbsimImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'bbsim' ]; then
594 IFS=: read -r bbsimRepo bbsimTag <<< '${bbsimImg.trim()}'
595 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
596 fi
597
598 # VOLTHA and ofAgent custom image handling
599 # NOTE to override the rw-core image in a released version you must set the ofAgent image too
600 # TODO split ofAgent and voltha-go
601 if [ '${rwCoreImg.trim()}' != '' ] && [ '${ofAgentImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-go' ]; then
602 IFS=: read -r rwCoreRepo rwCoreTag <<< '${rwCoreImg.trim()}'
603 IFS=: read -r ofAgentRepo ofAgentTag <<< '${ofAgentImg.trim()}'
604 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=\$rwCoreRepo,images.rw_core.tag=\$rwCoreTag,images.ofagent.repository=\$ofAgentRepo,images.ofagent.tag=\$ofAgentTag "
605 fi
606
607 # OpenOLT custom image handling
608 if [ '${openoltAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openolt-adapter' ]; then
609 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< '${openoltAdapterImg.trim()}'
610 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=\$openoltAdapterRepo,images.adapter_open_olt.tag=\$openoltAdapterTag "
611 fi
612
613 # OpenONU custom image handling
614 if [ '${openonuAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter' ]; then
615 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< '${openonuAdapterImg.trim()}'
616 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=\$openonuAdapterRepo,images.adapter_open_onu.tag=\$openonuAdapterTag "
617 fi
618
619 # ONOS custom image handling
620 if [ '${onosImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-onos' ]; then
621 IFS=: read -r onosRepo onosTag <<< '${onosImg.trim()}'
622 EXTRA_HELM_FLAGS+="--set images.onos.repository=\$onosRepo,images.onos.tag=\$onosTag "
623 fi
624
625 # set BBSim parameters
626 EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
627
628 # disable the securityContext, this is a development cluster
629 EXTRA_HELM_FLAGS+='--set securityContext.enabled=false '
630
631 # No persistent-volume-claims in Atomix
632 EXTRA_HELM_FLAGS+="--set atomix.persistence.enabled=false "
633
634 echo "Installing with the following extra arguments:"
635 echo $EXTRA_HELM_FLAGS
636
637 # if it's newer than voltha-2.4 set the correct BBSIM_CFG
638 if [ '${release.trim()}' != 'voltha-2.4' ]; then
639 export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-${workflow}.yaml"
640 fi
641
642 # Use custom built images
643
644 if [ '\$GERRIT_PROJECT' == 'voltha-go' ]; then
645 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=${dockerRegistry}/voltha/voltha-rw-core,images.rw_core.tag=voltha-scale "
646 fi
647
648 if [ '\$GERRIT_PROJECT' == 'voltha-openolt-adapter' ]; then
649 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=${dockerRegistry}/voltha/voltha-openolt-adapter,images.adapter_open_olt.tag=voltha-scale "
650 fi
651
652 if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter' ]; then
653 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=${dockerRegistry}/voltha/voltha-openonu-adapter,images.adapter_open_onu.tag=voltha-scale "
654 fi
655
656 if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then
657 EXTRA_HELM_FLAGS+="--set images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,images.ofagent.tag=voltha-scale "
658 fi
659
660 if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then
661 EXTRA_HELM_FLAGS+="--set images.onos.repository=${dockerRegistry}/voltha/voltha-onos,images.onos.tag=voltha-scale "
662 fi
663
664 if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then
665 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale "
666 fi
667
668 ./voltha up
669 """
670 }
671 }
672}
673
674def test_voltha_stacks(numberOfStacks) {
675 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
676 stage("Test VOLTHA stack " + i) {
677 timeout(time: 15, unit: 'MINUTES') {
678 sh '''
679 export VOLTCONFIG="$HOME/.volt/config-voltha${i}"
680 ROBOT_PARAMS="-v stackId:%{i} \
681 -v olt:${olts} \
682 -v pon:${pons} \
683 -v onu:${onus} \
684 -v workflow:${workflow} \
685 -v withEapol:${withEapol} \
686 -v withDhcp:${withDhcp} \
687 -v withIgmp:${withIgmp} \
688 --noncritical non-critical \
689 -e teardown "
690
691 if [ ${withEapol} = false ] ; then
692 ROBOT_PARAMS+="-e authentication "
693 fi
694
695 if [ ${withDhcp} = false ] ; then
696 ROBOT_PARAMS+="-e dhcp "
697 fi
698
699 if [ ${provisionSubscribers} = false ] ; then
700 # if we're not considering subscribers then we don't care about authentication and dhcp
701 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
702 fi
703
704 if [ ${withFlows} = false ] ; then
705 ROBOT_PARAMS+="-i setup -i activation "
706 fi
707
708 cd $WORKSPACE/voltha-system-tests
709 source ./vst_venv/bin/activate
710 robot -d $WORKSPACE/RobotLogs \
711 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
712 '''
713 }
714 }
715 }
716 }
717}