blob: de009cc039e6acbddf8f49cd00c93465b3feeaa1 [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 {
Matteo Scandolof7ca6312020-11-16 15:57:15 -080024 timeout(time: 120, unit: 'MINUTES')
Matteo Scandolo4b006ae2020-11-09 16:14:40 -080025 }
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
Matteo Scandolo9fe8cad2020-11-13 12:54:19 -080096 NAMESPACES="voltha1 voltha2 infra default"
97 for NS in \$NAMESPACES
Matteo Scandolo4b006ae2020-11-09 16:14:40 -080098 do
Matteo Scandolo9fe8cad2020-11-13 12:54:19 -080099 for hchart in \$(helm list -n \$NS -q | grep -E -v 'docker-registry|kafkacat');
100 do
101 echo "Purging chart: \${hchart}"
102 helm delete -n \$NS "\${hchart}"
103 done
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800104 done
105 bash /home/cord/voltha-scale/wait_for_pods.sh
106
107 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
108
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800109 ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs kill -9
110
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800111 cd $WORKSPACE
112 rm -rf $WORKSPACE/*
113 """
114 }
115 }
116 }
117 stage('Clone kind-voltha') {
118 steps {
119 checkout([
120 $class: 'GitSCM',
121 userRemoteConfigs: [[
122 url: "https://gerrit.opencord.org/kind-voltha",
123 refspec: "${kindVolthaChange}"
124 ]],
125 branches: [[ name: "master", ]],
126 extensions: [
127 [$class: 'WipeWorkspace'],
128 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
129 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
130 ],
131 ])
132 script {
133 sh(script:"""
134 if [ '${kindVolthaChange}' != '' ] ; then
135 cd $WORKSPACE/kind-voltha;
136 git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD
137 fi
138 """)
139 }
140 }
141 }
142 stage('Clone voltha-system-tests') {
143 steps {
144 checkout([
145 $class: 'GitSCM',
146 userRemoteConfigs: [[
147 url: "https://gerrit.opencord.org/voltha-system-tests",
148 refspec: "${volthaSystemTestsChange}"
149 ]],
150 branches: [[ name: "${release}", ]],
151 extensions: [
152 [$class: 'WipeWorkspace'],
153 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
154 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
155 ],
156 ])
157 script {
158 sh(script:"""
159 if [ '${volthaSystemTestsChange}' != '' ] ; then
160 cd $WORKSPACE/voltha-system-tests;
161 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
162 fi
163 """)
164 }
165 }
166 }
167 stage('Build patch') {
168 when {
169 expression {
170 return params.GERRIT_PROJECT
171 }
172 }
173 steps {
174 sh """
175 git clone https://\$GERRIT_HOST/\$GERRIT_PROJECT
176 cd \$GERRIT_PROJECT
177 git fetch https://\$GERRIT_HOST/\$GERRIT_PROJECT \$GERRIT_REFSPEC && git checkout FETCH_HEAD
178
179 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-build
180 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-push
181 """
182 }
183 }
184 stage('Deploy common infrastructure') {
185 // includes monitoring, kafka, etcd
186 steps {
187 sh '''
188 if [ ${withMonitoring} = true ] ; then
189 helm install nem-monitoring cord/nem-monitoring \
190 -f $HOME/voltha-scale/grafana.yaml \
191 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
192 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
193 fi
194
195 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
196 bash /home/cord/voltha-scale/wait_for_pods.sh
197 '''
198 }
199 }
200 stage('Deploy VOLTHA infrastructure') {
201 steps {
202 sh returnStdout: false, script: '''
203 cd $WORKSPACE/kind-voltha/
204
Matteo Scandolof6656562020-11-16 14:45:44 -0800205 export ETCD_CHART=$HOME/teone/helm-charts/etcd
206 export KAFKA_CHART=$HOME/teone/helm-charts/kafka
Matteo Scandolob28a97b2020-11-13 10:58:32 -0800207
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800208 # KAFKA config
Matteo Scandolof6656562020-11-16 14:45:44 -0800209 export NUM_OF_KAFKA=${kafkaReplicas}
210 export EXTRA_HELM_FLAGS+=' --set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default '
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800211
212 # ETCD config
Matteo Scandolof6656562020-11-16 14:45:44 -0800213 export EXTRA_HELM_FLAGS+=" --set memoryMode=${inMemoryEtcdStorage} "
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800214
215 NAME=infra JUST_INFRA=y ./voltha up
216
217 # Forward the ETCD port onto $VOLTHA_ETCD_PORT
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800218 _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 -0800219 '''
220 }
221 }
222 stage('Deploy Voltha') {
223 steps {
224 deploy_voltha_stacks(params.volthaStacks)
225 }
226 }
227 stage('Start logging') {
228 steps {
229 sh returnStdout: false, script: '''
230 # start logging with kail
231
232 mkdir -p $LOG_FOLDER
233
234 list=($APPS_TO_LOG)
235 for app in "${list[@]}"
236 do
237 echo "Starting logs for: ${app}"
238 _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log&
239 done
240 '''
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800241 }
242 }
243 stage('Configuration') {
244 steps {
245 script {
246 sh returnStdout: false, script: """
247 #Setting link discovery
248 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}
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.flow.impl.FlowRuleManager allowExtraneousRules true
251 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
252
253
254 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
255
256 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
257
258 ONOSES=\$((\$NUM_OF_ONOS - 1))
259 for i in \$(seq 0 \$ONOSES); do
260 INSTANCE="onos-onos-classic-\$i"
261
262 #Setting LOG level to ${logLevel}
263 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.onosproject
264 kubectl -n \$INFRA_NS exec \$INSTANCE -- bash /root/onos/${karafHome}/bin/client log:set ${logLevel} org.opencord
265
Matteo Scandolod4064492020-11-13 10:48:30 -0800266 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 -0800267 done
268
269 # Set Flows/Ports/Meters poll frequency
270 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}
271 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}
272
273 if [ ${withFlows} = false ]; then
274 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
275 fi
276
277 if [ ${withMibTemplate} = true ] ; then
278 rm -f BBSM-12345123451234512345-00000000000001-v1.json
279 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800280 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 -0800281 fi
282
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800283 if [ ${withPcap} = true ] && [ ${volthaStacks} -eq 1 ] ; then
284 # FIXME ofagent pcap has to be replicated per stack
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800285 # Start the tcp-dump in ofagent
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800286 export OF_AGENT=\$(kubectl -n \$INFRA_NS get pods -l app=ofagent -o name)
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800287 kubectl exec \$OF_AGENT -- apk update
288 kubectl exec \$OF_AGENT -- apk add tcpdump
289 kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800290 _TAG=ofagent-tcpdump kubectl -n \$INFRA_NS exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap&
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800291
292 # Start the tcp-dump in radius
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800293 export RADIUS=\$(kubectl -n \$INFRA_NS get pods -l app=radius -o name)
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800294 kubectl exec \$RADIUS -- apt-get update
295 kubectl exec \$RADIUS -- apt-get install -y tcpdump
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800296 _TAG=radius-tcpdump kubectl -n \$INFRA_NS exec \$RADIUS -- tcpdump -w out.pcap&
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800297
298 # Start the tcp-dump in ONOS
299 for i in \$(seq 0 \$ONOSES); do
300 INSTANCE="onos-onos-classic-\$i"
301 kubectl exec \$INSTANCE -- apt-get update
302 kubectl exec \$INSTANCE -- apt-get install -y tcpdump
303 kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800304 _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 -0800305 done
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800306 else
307 echo "PCAP not supported for multiple VOLTHA stacks"
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800308 fi
309 """
310 }
311 }
312 }
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800313 stage('Setup Test') {
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800314 steps {
315 sh '''
316 mkdir -p $WORKSPACE/RobotLogs
317 cd $WORKSPACE/voltha-system-tests
318 make vst_venv
319 '''
320 sh '''
321 if [ ${withProfiling} = true ] ; then
322 mkdir -p $LOG_FOLDER/pprof
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800323 cat << EOF > $WORKSPACE/pprof.sh
324timestamp() {
325 date +"%T"
326}
327
328i=0
329while [[ true ]]; do
330 ((i++))
331 ts=$(timestamp)
332 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png
333 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png
334 curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
335 go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png
336
337 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png
338 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png
339 curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
340 go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png
341
342 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png
343 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png
344 curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
345 go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png
346
347 sleep 10
348done
349EOF
350
351 _TAG="pprof"
352 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
353 fi
354 '''
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800355 // bbsim-sadis server takes a while to cache the subscriber entries
356 // wait for that before starting the tests
357 sleep(60)
358 }
359 }
360 stage('Run Test') {
361 steps {
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800362 test_voltha_stacks(params.volthaStacks)
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800363 }
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800364 }
365 }
366 post {
367 always {
368 // collect result, done in the "post" step so it's executed even in the
369 // event of a timeout in the tests
370 sh '''
371
372 # stop the kail processes
373 list=($APPS_TO_LOG)
374 for app in "${list[@]}"
375 do
376 echo "Stopping logs for: ${app}"
377 _TAG="kail-$app"
378 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
379 if [ -n "$P_IDS" ]; then
380 echo $P_IDS
381 for P_ID in $P_IDS; do
382 kill -9 $P_ID
383 done
384 fi
385 done
386
387 if [ ${withPcap} = true ] ; then
388 # stop ofAgent tcpdump
389 P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')"
390 if [ -n "\$P_ID" ]; then
391 kill -9 \$P_ID
392 fi
393
394 # stop radius tcpdump
395 P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')"
396 if [ -n "\$P_ID" ]; then
397 kill -9 \$P_ID
398 fi
399
400 # stop onos tcpdump
401 LIMIT=$(($NUM_OF_ONOS - 1))
402 for i in $(seq 0 $LIMIT); do
403 INSTANCE="onos-onos-classic-$i"
404 P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')"
405 if [ -n "\$P_ID" ]; then
406 kill -9 \$P_ID
407 fi
408 done
409
410 # copy the file
411 export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true
412 kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true
413
414 export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true
415 kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true
416
417 LIMIT=$(($NUM_OF_ONOS - 1))
418 for i in $(seq 0 $LIMIT); do
419 INSTANCE="onos-onos-classic-$i"
420 kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true
421 done
422 fi
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800423 '''
424 sh '''
425 if [ ${withProfiling} = true ] ; then
426 _TAG="pprof"
427 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
428 if [ -n "$P_IDS" ]; then
429 echo $P_IDS
430 for P_ID in $P_IDS; do
431 kill -9 $P_ID
432 done
433 fi
434 fi
435 '''
436 plot([
437 csvFileName: 'scale-test.csv',
438 csvSeries: [
439 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
440 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
441 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
442 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
443 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
444 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
445 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
446 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
447 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
448 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
449 ],
450 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
451 ])
452 step([$class: 'RobotPublisher',
453 disableArchiveOutput: false,
Matteo Scandolod4064492020-11-13 10:48:30 -0800454 logFileName: 'RobotLogs/**/log.html',
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800455 otherFiles: '',
Matteo Scandolod4064492020-11-13 10:48:30 -0800456 outputFileName: 'RobotLogs/**/output.xml',
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800457 outputPath: '.',
458 passThreshold: 100,
Matteo Scandolod4064492020-11-13 10:48:30 -0800459 reportFileName: 'RobotLogs/**/report.html',
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800460 unstableThreshold: 0]);
461 // get all the logs from kubernetes PODs
462 sh returnStdout: false, script: '''
463
464 # store information on running charts
Matteo Scandolod4064492020-11-13 10:48:30 -0800465 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800466
467 # store information on the running pods
468 kubectl get pods -o wide > $LOG_FOLDER/pods.txt || true
469 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
470 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
471
472 # copy the ONOS logs directly from the container to avoid the color codes
Matteo Scandolod4064492020-11-13 10:48:30 -0800473 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 -0800474
475 # get radius logs out of the container
Matteo Scandolod4064492020-11-13 10:48:30 -0800476 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 -0800477 '''
478 // dump all the BBSim(s) ONU information
Matteo Scandolod4064492020-11-13 10:48:30 -0800479 script {
480 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
481 stack_ns="voltha"+i
482 sh """
483 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
484 IDS=(\$BBSIM_IDS)
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800485
Matteo Scandolod4064492020-11-13 10:48:30 -0800486 for bbsim in "\${IDS[@]}"
487 do
Matteo Scandolof6656562020-11-16 14:45:44 -0800488 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > $LOG_FOLDER/\$bbsim-device-list.txt || true
489 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > $LOG_FOLDER/\$bbsim-service-list.txt || true
Matteo Scandolod4064492020-11-13 10:48:30 -0800490 done
491 """
492 }
493 }
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800494 // get ONOS debug infos
495 sh '''
496
497 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
498 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
499 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
500 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
501
502 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
503 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
504
505 if [ ${withFlows} = true ] ; then
506 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
507 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
508 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
509 fi
510
511 if [ ${provisionSubscribers} = true ]; then
512 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
513 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
514 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
515 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
516 fi
517
518 if [ ${withEapol} = true ] ; then
519 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
520 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
521 fi
522
523 if [ ${withDhcp} = true ] ; then
524 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
525 fi
526 '''
527 // collect etcd metrics
528 sh '''
529 mkdir -p $WORKSPACE/etcd-metrics
530 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
531 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
532 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
533 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
534 '''
535 // get VOLTHA debug infos
536 script {
Matteo Scandolod4064492020-11-13 10:48:30 -0800537 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
538 stack_ns="voltha"+i
539 voltcfg="~/.volt/config-voltha"+i
540 println stack_ns
541 try {
542 sh """
543 voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB device list -o json > $LOG_FOLDER/device-list.json || true
544 python -m json.tool $LOG_FOLDER/device-list.json > $LOG_FOLDER/voltha-devices-list.json || true
545 rm $LOG_FOLDER/device-list.json || true
546 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 -0800547
Matteo Scandolod4064492020-11-13 10:48:30 -0800548 DEVICE_LIST=
549 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
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 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 -0800551
Matteo Scandolod4064492020-11-13 10:48:30 -0800552 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
553 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
554 """
555 } catch(e) {
556 sh '''
557 echo "Can't get device list from voltclt"
558 '''
559 }
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800560 }
561 }
562 // get cpu usage by container
563 sh '''
564 if [ ${withMonitoring} = true ] ; then
565 cd $WORKSPACE/voltha-system-tests
566 source ./vst_venv/bin/activate
567 sleep 60 # we have to wait for prometheus to collect all the information
568 python tests/scale/sizing.py -o $WORKSPACE/plots || true
569 fi
570 '''
Matteo Scandolo5f6c5492020-11-12 17:37:25 -0800571 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/**/*,plots/*,etcd-metrics/*'
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800572 }
573 }
574}
575
576def deploy_voltha_stacks(numberOfStacks) {
577 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
578 stage("Deploy VOLTHA stack " + i) {
579 sh returnStdout: false, script: """
580 cd $WORKSPACE/kind-voltha/
581
582 export NAME=voltha${i}
583 export VOLTHA_NS=voltha${i}
584 export ADAPTER_NS=voltha${i}
585 export BBSIM_NS=voltha${i}
586 export BBSIM_BASE_INDEX=${i}
587 export WITH_ETCD=etcd.\$INFRA_NS.svc:2379
588 export WITH_KAFKA=kafka.\$INFRA_NS.svc:9092
589 export WITH_ONOS=onos-onos-classic-hs.\$INFRA_NS.svc:6653
590
591 export EXTRA_HELM_FLAGS+=' '
592
593 # Load the release defaults
594 if [ '${release.trim()}' != 'master' ]; then
595 source $WORKSPACE/kind-voltha/releases/${release}
596 EXTRA_HELM_FLAGS+=" ${extraHelmFlags} "
597 fi
598
599 # BBSim custom image handling
600 if [ '${bbsimImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'bbsim' ]; then
601 IFS=: read -r bbsimRepo bbsimTag <<< '${bbsimImg.trim()}'
602 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
603 fi
604
605 # VOLTHA and ofAgent custom image handling
606 # NOTE to override the rw-core image in a released version you must set the ofAgent image too
607 # TODO split ofAgent and voltha-go
608 if [ '${rwCoreImg.trim()}' != '' ] && [ '${ofAgentImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-go' ]; then
609 IFS=: read -r rwCoreRepo rwCoreTag <<< '${rwCoreImg.trim()}'
610 IFS=: read -r ofAgentRepo ofAgentTag <<< '${ofAgentImg.trim()}'
611 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=\$rwCoreRepo,images.rw_core.tag=\$rwCoreTag,images.ofagent.repository=\$ofAgentRepo,images.ofagent.tag=\$ofAgentTag "
612 fi
613
614 # OpenOLT custom image handling
615 if [ '${openoltAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openolt-adapter' ]; then
616 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< '${openoltAdapterImg.trim()}'
617 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=\$openoltAdapterRepo,images.adapter_open_olt.tag=\$openoltAdapterTag "
618 fi
619
620 # OpenONU custom image handling
621 if [ '${openonuAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter' ]; then
622 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< '${openonuAdapterImg.trim()}'
623 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=\$openonuAdapterRepo,images.adapter_open_onu.tag=\$openonuAdapterTag "
624 fi
625
Andrea Campanella28763082020-11-18 10:55:31 +0100626 # OpenONU Go custom image handling
627 if [ '${openonuAdapterGoImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter-go' ]; then
628 IFS=: read -r openonuAdapterGoRepo openonuAdapterGoTag <<< '${openonuAdapterGoImg.trim()}'
629 EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,images.adapter_open_onu_go.repository=\$openonuAdapterGoRepo,images.adapter_open_onu.tag=\$openonuAdapterGoTag "
630 fi
631
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800632 # ONOS custom image handling
633 if [ '${onosImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-onos' ]; then
634 IFS=: read -r onosRepo onosTag <<< '${onosImg.trim()}'
635 EXTRA_HELM_FLAGS+="--set images.onos.repository=\$onosRepo,images.onos.tag=\$onosTag "
636 fi
637
638 # set BBSim parameters
639 EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
640
641 # disable the securityContext, this is a development cluster
642 EXTRA_HELM_FLAGS+='--set securityContext.enabled=false '
643
644 # No persistent-volume-claims in Atomix
645 EXTRA_HELM_FLAGS+="--set atomix.persistence.enabled=false "
646
647 echo "Installing with the following extra arguments:"
648 echo $EXTRA_HELM_FLAGS
649
650 # if it's newer than voltha-2.4 set the correct BBSIM_CFG
651 if [ '${release.trim()}' != 'voltha-2.4' ]; then
652 export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-${workflow}.yaml"
653 fi
654
655 # Use custom built images
656
657 if [ '\$GERRIT_PROJECT' == 'voltha-go' ]; then
658 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=${dockerRegistry}/voltha/voltha-rw-core,images.rw_core.tag=voltha-scale "
659 fi
660
661 if [ '\$GERRIT_PROJECT' == 'voltha-openolt-adapter' ]; then
662 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=${dockerRegistry}/voltha/voltha-openolt-adapter,images.adapter_open_olt.tag=voltha-scale "
663 fi
664
665 if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter' ]; then
666 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=${dockerRegistry}/voltha/voltha-openonu-adapter,images.adapter_open_onu.tag=voltha-scale "
667 fi
668
669 if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then
670 EXTRA_HELM_FLAGS+="--set images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,images.ofagent.tag=voltha-scale "
671 fi
672
673 if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then
674 EXTRA_HELM_FLAGS+="--set images.onos.repository=${dockerRegistry}/voltha/voltha-onos,images.onos.tag=voltha-scale "
675 fi
676
677 if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then
678 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale "
679 fi
680
681 ./voltha up
682 """
683 }
684 }
685}
686
687def test_voltha_stacks(numberOfStacks) {
688 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
689 stage("Test VOLTHA stack " + i) {
690 timeout(time: 15, unit: 'MINUTES') {
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800691 sh """
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800692 export VOLTCONFIG="$HOME/.volt/config-voltha${i}"
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800693 ROBOT_PARAMS="-v stackId:${i} \
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800694 -v olt:${olts} \
695 -v pon:${pons} \
696 -v onu:${onus} \
697 -v workflow:${workflow} \
698 -v withEapol:${withEapol} \
699 -v withDhcp:${withDhcp} \
700 -v withIgmp:${withIgmp} \
701 --noncritical non-critical \
702 -e teardown "
703
704 if [ ${withEapol} = false ] ; then
705 ROBOT_PARAMS+="-e authentication "
706 fi
707
708 if [ ${withDhcp} = false ] ; then
709 ROBOT_PARAMS+="-e dhcp "
710 fi
711
712 if [ ${provisionSubscribers} = false ] ; then
713 # if we're not considering subscribers then we don't care about authentication and dhcp
714 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
715 fi
716
717 if [ ${withFlows} = false ] ; then
718 ROBOT_PARAMS+="-i setup -i activation "
719 fi
720
721 cd $WORKSPACE/voltha-system-tests
722 source ./vst_venv/bin/activate
Matteo Scandolo5f6c5492020-11-12 17:37:25 -0800723 robot -d $WORKSPACE/RobotLogs/voltha${i} \
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800724 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
Matteo Scandolof7ca6312020-11-16 15:57:15 -0800725
726 # collect results
727 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
728 cat $WORKSPACE/execution-time-voltha${i}.txt
Matteo Scandolodc4608c2020-11-12 16:48:16 -0800729 """
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800730 }
731 }
Matteo Scandolo4b006ae2020-11-09 16:14:40 -0800732 }
733}