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