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