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