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