blob: 0a4bac3b5bbff5069a85a64b644548c1cc5c1e1c [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
Andrea Campanellaed026982020-11-20 10:06:42 +0100297 if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter-go' ]; then
298 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu_go.repository=${dockerRegistry}/voltha/voltha-openonu-adapter-go,images.adapter_open_onu_go.tag=voltha-scale "
299 fi
300
Andrea Campanella642e5502020-11-19 19:47:02 +0100301 if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then
302 EXTRA_HELM_FLAGS+="--set images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,images.ofagent.tag=voltha-scale "
303 fi
304
305 if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then
306 EXTRA_HELM_FLAGS+="--set images.onos.repository=${dockerRegistry}/voltha/voltha-onos,images.onos.tag=voltha-scale "
307 fi
308
309 if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then
310 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale "
311 fi
312
313 ./voltha up
314
315 # Forward the ETCD port onto $VOLTHA_ETCD_PORT
316 _TAG=etcd-port-forward kubectl port-forward --address 0.0.0.0 -n default service/etcd $VOLTHA_ETCD_PORT:2379&
317 """
318 }
319 sh returnStdout: false, script: '''
320 # start logging with kail
321
322 mkdir -p $LOG_FOLDER
323
324 list=($APPS_TO_LOG)
325 for app in "${list[@]}"
326 do
327 echo "Starting logs for: ${app}"
328 _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log&
329 done
330
331 _TAG=kail-etcd-bintami kail -l app.kubernetes.io/name=etcd --since 1h > $LOG_FOLDER/etcd-bitnami.log&
332
333 '''
334 // bbsim-sadis server takes a while to cache the subscriber entries
335 // wait for that before starting the tests
336 sleep(120)
337 }
338 }
339 stage('Configuration') {
340 steps {
341 script {
342 sh returnStdout: false, script: """
343 #Setting link discovery
344 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}
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.flow.impl.FlowRuleManager allowExtraneousRules true
347 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
348
349
350 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
351
352 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
353
354 ONOSES=\$((\$NUM_OF_ONOS - 1))
355 for i in \$(seq 0 \$ONOSES); do
356 INSTANCE="onos-onos-classic-\$i"
357
358 #Setting LOG level to ${logLevel}
359 kubectl exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.onosproject
360 kubectl exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.opencord
361
362 kubectl exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set DEBUG org.opencord.olt
363
364 kubectl exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set TRACE org.onosproject.net.meter.impl
365 done
366
367
368 kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
369
370 # Set Flows/Ports/Meters poll frequency
371 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}
372 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}
373
374 if [ ${withFlows} = false ]; then
375 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
376 fi
377
378 if [ ${withMibTemplate} = true ] ; then
379 rm -f BBSM-12345123451234512345-00000000000001-v1.json
380 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
381 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
382 fi
383
384 if [ ${withPcap} = true ] ; then
385 # Start the tcp-dump in ofagent
386 export OF_AGENT=\$(kubectl get pods -l app=ofagent -o name)
387 kubectl exec \$OF_AGENT -- apk update
388 kubectl exec \$OF_AGENT -- apk add tcpdump
389 kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
390 _TAG=ofagent-tcpdump kubectl exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap&
391
392 # Start the tcp-dump in radius
393 export RADIUS=\$(kubectl get pods -l app=radius -o name)
394 kubectl exec \$RADIUS -- apt-get update
395 kubectl exec \$RADIUS -- apt-get install -y tcpdump
396 _TAG=radius-tcpdump kubectl exec \$RADIUS -- tcpdump -w out.pcap&
397
398 # Start the tcp-dump in ONOS
399 for i in \$(seq 0 \$ONOSES); do
400 INSTANCE="onos-onos-classic-\$i"
401 kubectl exec \$INSTANCE -- apt-get update
402 kubectl exec \$INSTANCE -- apt-get install -y tcpdump
403 kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
404 _TAG=\$INSTANCE kubectl exec \$INSTANCE -- /usr/bin/tcpdump -nei eth0 port 1812 -w out.pcap&
405 done
406 fi
407 """
408 }
409 }
410 }
411 stage('Run Test') {
412 steps {
413 sh '''
414 mkdir -p $WORKSPACE/RobotLogs
415 cd $WORKSPACE/voltha-system-tests
416 make vst_venv
417 '''
418 sh '''
419 if [ ${withProfiling} = true ] ; then
420 mkdir -p $LOG_FOLDER/pprof
421 echo $PATH
422 #Creating Python script for ONU Detection
423 cat << EOF > $WORKSPACE/pprof.sh
424timestamp() {
425 date +"%T"
426}
427
428i=0
429while [[ true ]]; do
430 ((i++))
431 ts=$(timestamp)
432 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png
433 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png
434 curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
435 go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png
436
437 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png
438 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png
439 curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
440 go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png
441
442 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png
443 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png
444 curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
445 go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png
446
447 sleep 10
448done
449EOF
450
451 _TAG="pprof"
452 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
453 fi
454 '''
455 timeout(time: 15, unit: 'MINUTES') {
456 sh '''
457 ROBOT_PARAMS="-v olt:${olts} \
458 -v pon:${pons} \
459 -v onu:${onus} \
460 -v workflow:${workflow} \
461 -v withEapol:${withEapol} \
462 -v withDhcp:${withDhcp} \
463 -v withIgmp:${withIgmp} \
464 --noncritical non-critical \
465 -e teardown "
466
467 if [ ${withEapol} = false ] ; then
468 ROBOT_PARAMS+="-e authentication "
469 fi
470
471 if [ ${withDhcp} = false ] ; then
472 ROBOT_PARAMS+="-e dhcp "
473 fi
474
475 if [ ${provisionSubscribers} = false ] ; then
476 # if we're not considering subscribers then we don't care about authentication and dhcp
477 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
478 fi
479
480 if [ ${withFlows} = false ] ; then
481 ROBOT_PARAMS+="-i setup -i activation "
482 fi
483
484 cd $WORKSPACE/voltha-system-tests
485 source ./vst_venv/bin/activate
486 robot -d $WORKSPACE/RobotLogs \
487 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
488 '''
489 }
490 }
491 }
492 }
493 post {
494 always {
495 // collect result, done in the "post" step so it's executed even in the
496 // event of a timeout in the tests
497 sh '''
498
499 # stop the kail processes
500 list=($APPS_TO_LOG)
501 for app in "${list[@]}"
502 do
503 echo "Stopping logs for: ${app}"
504 _TAG="kail-$app"
505 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
506 if [ -n "$P_IDS" ]; then
507 echo $P_IDS
508 for P_ID in $P_IDS; do
509 kill -9 $P_ID
510 done
511 fi
512 done
513
514 if [ ${withPcap} = true ] ; then
515 # stop ofAgent tcpdump
516 P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')"
517 if [ -n "\$P_ID" ]; then
518 kill -9 \$P_ID
519 fi
520
521 # stop radius tcpdump
522 P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')"
523 if [ -n "\$P_ID" ]; then
524 kill -9 \$P_ID
525 fi
526
527 # stop onos tcpdump
528 LIMIT=$(($NUM_OF_ONOS - 1))
529 for i in $(seq 0 $LIMIT); do
530 INSTANCE="onos-onos-classic-$i"
531 P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')"
532 if [ -n "\$P_ID" ]; then
533 kill -9 \$P_ID
534 fi
535 done
536
537 # copy the file
538 export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true
539 kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true
540
541 export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true
542 kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true
543
544 LIMIT=$(($NUM_OF_ONOS - 1))
545 for i in $(seq 0 $LIMIT); do
546 INSTANCE="onos-onos-classic-$i"
547 kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true
548 done
549 fi
550
551 cd voltha-system-tests
552 source ./vst_venv/bin/activate
553 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt || true
554 cat $WORKSPACE/execution-time.txt
555 '''
556 sh '''
557 if [ ${withProfiling} = true ] ; then
558 _TAG="pprof"
559 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
560 if [ -n "$P_IDS" ]; then
561 echo $P_IDS
562 for P_ID in $P_IDS; do
563 kill -9 $P_ID
564 done
565 fi
566 fi
567 '''
568 plot([
569 csvFileName: 'scale-test.csv',
570 csvSeries: [
571 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
572 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
573 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
574 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
575 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
576 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
577 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
578 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
579 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
580 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
581 ],
582 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
583 ])
584 step([$class: 'RobotPublisher',
585 disableArchiveOutput: false,
586 logFileName: 'RobotLogs/log.html',
587 otherFiles: '',
588 outputFileName: 'RobotLogs/output.xml',
589 outputPath: '.',
590 passThreshold: 100,
591 reportFileName: 'RobotLogs/report.html',
592 unstableThreshold: 0]);
593 // get all the logs from kubernetes PODs
594 sh returnStdout: false, script: '''
595
596 # store information on running charts
597 helm ls > $LOG_FOLDER/helm-list.txt || true
598
599 # store information on the running pods
600 kubectl get pods -o wide > $LOG_FOLDER/pods.txt || true
601 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
602 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
603
604 # copy the ONOS logs directly from the container to avoid the color codes
605 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
606
607 # get radius logs out of the container
608 kubectl cp $(kubectl get pods -l app=radius --no-headers | awk '{print $1}'):/var/log/freeradius/radius.log $LOG_FOLDER//radius.log || true
609 '''
610 // dump all the BBSim(s) ONU information
611 sh '''
612 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
613 IDS=($BBSIM_IDS)
614
615 for bbsim in "${IDS[@]}"
616 do
617 kubectl exec -t $bbsim -- bbsimctl onu list > $LOG_FOLDER/$bbsim-device-list.txt || true
618 kubectl exec -t $bbsim -- bbsimctl service list > $LOG_FOLDER/$bbsim-service-list.txt || true
619 done
620 '''
621 // get DHCP server stats
622 sh '''
623 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
624 IDS=($BBSIM_IDS)
625
626 for bbsim in "${IDS[@]}"
627 do
628 kubectl exec -t $bbsim -- dhcpd -lf /var/lib/dhcp/dhcpd.leases -play /tmp/dhcplog 2>&1 | tee $LOG_FOLDER/$bbsim-dhcp-replay.txt || true
629 kubectl cp $bbsim:/tmp/dhcplog $LOG_FOLDER/$bbsim-dhcp-logs || true
630 kubectl cp $bbsim:/var/lib/dhcp/dhcpd.leases $LOG_FOLDER/$bbsim-dhcp-leases || true
631 done
632 '''
633 // get ONOS debug infos
634 sh '''
635
636 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
637 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
638 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
639 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
640
641 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
642 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
643
644 if [ ${withFlows} = true ] ; then
645 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
646 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
647 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
648 fi
649
650 if [ ${provisionSubscribers} = true ]; then
651 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
652 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
653 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
654 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
655 fi
656
657 if [ ${withEapol} = true ] ; then
658 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
659 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
660 fi
661
662 if [ ${withDhcp} = true ] ; then
663 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
664 fi
665 '''
666 // collect etcd metrics
667 sh '''
668 mkdir -p $WORKSPACE/etcd-metrics
669 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
670 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
671 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
672 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
673 '''
674 // get VOLTHA debug infos
675 script {
676 try {
677 sh '''
678 voltctl -m 8MB device list -o json > $LOG_FOLDER/device-list.json || true
679 python -m json.tool $LOG_FOLDER/device-list.json > $LOG_FOLDER/voltha-devices-list.json || true
680 rm $LOG_FOLDER/device-list.json || true
681 voltctl -m 8MB device list > $LOG_FOLDER/voltha-devices-list.txt || true
682
683 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
684 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
685
686 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
687 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
688 '''
689 } catch(e) {
690 sh '''
691 echo "Can't get device list from voltclt"
692 '''
693 }
694 }
695 // get cpu usage by container
696 sh '''
697 if [ ${withMonitoring} = true ] ; then
698 cd $WORKSPACE/voltha-system-tests
699 source ./vst_venv/bin/activate
700 sleep 60 # we have to wait for prometheus to collect all the information
701 python tests/scale/sizing.py -o $WORKSPACE/plots || true
702 fi
703 '''
704 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*,etcd-metrics/*'
705 }
706 }
707}