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