blob: 5414449b35ee788c7564a27db1f82524d85adc9b [file] [log] [blame]
Matteo Scandolo2bc660a2021-02-12 10:52:25 -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
17// NOTE we are importing the library even if it's global so that it's
18// easier to change the keywords during a replay
19library identifier: 'cord-jenkins-libraries@master',
20 retriever: modernSCM([
21 $class: 'GitSCMSource',
22 remote: 'https://gerrit.opencord.org/ci-management.git'
23])
24
25pipeline {
26
27 /* no label, executor is determined by JJB */
28 agent {
29 label "${params.buildNode}"
30 }
31 options {
32 timeout(time: 120, unit: 'MINUTES')
33 }
34 environment {
35 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
36 KUBECONFIG="$HOME/.kube/config"
37 SSHPASS="karaf"
38 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
39
40 APPS_TO_LOG="etcd kafka onos-onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server"
41 LOG_FOLDER="$WORKSPACE/logs"
42 }
43
44 stages {
45 stage ('Cleanup') {
46 steps {
47 timeout(time: 11, unit: 'MINUTES') {
48 script {
49 def namespaces = ["infra"]
50 // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks)
51 volthaStacks.toInteger().times {
52 namespaces += "voltha${it + 1}"
53 }
54 helmTeardown(namespaces)
55 }
56 sh returnStdout: false, script: """
57 helm repo add onf https://charts.opencord.org
58 helm repo add cord https://charts.opencord.org
59 helm repo update
60
61 # remove all port-forward from different namespaces
62 ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9
63 """
64 }
65 }
66 }
67 stage('Download Code') {
68 steps {
69 getVolthaCode([
70 branch: "${release}",
71 volthaSystemTestsChange: "${volthaSystemTestsChange}",
72 //volthaHelmChartsChange: "${volthaHelmChartsChange}",
73 ])
74 }
75 }
76 stage('Deploy common infrastructure') {
77 // includes monitoring
78 steps {
79 sh '''
80 if [ ${withMonitoring} = true ] ; then
81 helm install -n infra nem-monitoring cord/nem-monitoring \
82 -f $HOME/voltha-scale/grafana.yaml \
83 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
84 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
85 fi
86 '''
87 }
88 }
89 stage('Deploy VOLTHA infrastructure') {
90 steps {
91 sh returnStdout: false, script: '''
92
93 helm install kafka -n infra $HOME/teone/helm-charts/kafka --set replicaCount=${kafkaReplicas},replicas=${kafkaReplicas} --set persistence.enabled=false \
94 --set zookeeper.replicaCount=${kafkaReplicas} --set zookeeper.persistence.enabled=false \
95 --set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default
96
97 # the ETCD chart use "auth" for resons different than BBsim, so strip that away
98 ETCD_FLAGS=$(echo ${extraHelmFlags} | sed -e 's/--set auth=false / /g') | sed -e 's/--set auth=true / /g'
99 ETCD_FLAGS+=" --set auth.rbac.enabled=false,persistence.enabled=false,statefulset.replicaCount=${etcdReplicas}"
100 ETCD_FLAGS+=" --set memoryMode=${inMemoryEtcdStorage} "
101 helm install -n infra --set replicas=${etcdReplicas} etcd $HOME/teone/helm-charts/etcd $ETCD_FLAGS
102
103 helm upgrade --install -n infra voltha-infra onf/voltha-infra \
104 -f $WORKSPACE/voltha-helm-charts/examples/${workflow}-values.yaml \
105 --set onos-classic.replicas=${onosReplicas},onos-classic.atomix.replicas=${atomixReplicas} \
106 --set radius.enabled=${withEapol} \
107 --set kafka.enabled=false \
108 --set etcd.enabled=false
109 '''
110 }
111 }
112 stage('Deploy Voltha') {
113 steps {
114 deploy_voltha_stacks(params.volthaStacks)
115 }
116 }
117 stage('Start logging') {
118 steps {
119 sh returnStdout: false, script: '''
120 # start logging with kail
121
122 mkdir -p $LOG_FOLDER
123
124 list=($APPS_TO_LOG)
125 for app in "${list[@]}"
126 do
127 echo "Starting logs for: ${app}"
128 _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log&
129 done
130 '''
131 }
132 }
133 stage('Configuration') {
134 steps {
135 script {
136 sh returnStdout: false, script: """
137
138 # forward ETCD port
139 _TAG=etcd-port-forward kubectl -n infra port-forward --address 0.0.0.0 service/etcd 9999:2379& 2>&1 > /dev/null
140
141 # forward ONOS ports
142 _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8101:8101& 2>&1 > /dev/null
143 _TAG=onos-port-forward kubectl port-forward --address 0.0.0.0 -n infra svc/voltha-infra-onos-classic-hs 8181:8181& 2>&1 > /dev/null
144 """
145 sh returnStdout: false, script: """
146 # TODO this needs to be repeated per stack
147 # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
148
149 #Setting link discovery
150 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}
151 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
152 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
153 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
154 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
155
156 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject
157 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord
158
159 # Set Flows/Ports/Meters poll frequency
160 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}
161 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}
162
163 if [ ${withFlows} = false ]; then
164 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
165 fi
166 """
167 }
168 }
169 }
170 stage('Setup Test') {
171 steps {
172 sh '''
173 mkdir -p $WORKSPACE/RobotLogs
174 cd $WORKSPACE/voltha-system-tests
175 make vst_venv
176 '''
177 }
178 }
179 stage('Run Test') {
180 steps {
181 test_voltha_stacks(params.volthaStacks)
182 }
183 }
184 }
185 post {
186 always {
187 // collect result, done in the "post" step so it's executed even in the
188 // event of a timeout in the tests
189 sh '''
190
191 # stop the kail processes
192 list=($APPS_TO_LOG)
193 for app in "${list[@]}"
194 do
195 echo "Stopping logs for: ${app}"
196 _TAG="kail-$app"
197 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
198 if [ -n "$P_IDS" ]; then
199 echo $P_IDS
200 for P_ID in $P_IDS; do
201 kill -9 $P_ID
202 done
203 fi
204 done
205 '''
206 plot([
207 csvFileName: 'scale-test.csv',
208 csvSeries: [
209 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
210 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
211 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
212 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
213 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
214 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
215 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
216 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
217 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
218 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
219 ],
220 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (Stacks: ${params.volthaStacks}, OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
221 ])
222 step([$class: 'RobotPublisher',
223 disableArchiveOutput: false,
224 logFileName: 'RobotLogs/**/log.html',
225 otherFiles: '',
226 outputFileName: 'RobotLogs/**/output.xml',
227 outputPath: '.',
228 passThreshold: 100,
229 reportFileName: 'RobotLogs/**/report.html',
230 unstableThreshold: 0]);
231 // get all the logs from kubernetes PODs
232 sh returnStdout: false, script: '''
233
234 # store information on running charts
235 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
236
237 # store information on the running pods
238 kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true
239 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
240 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
241
242 # copy the ONOS logs directly from the container to avoid the color codes
243 printf '%s\n' $(kubectl -n \$INFRA_NS get pods -l app=onos-onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs --no-run-if-empty -I# bash -c "kubectl -n \$INFRA_NS cp #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true
244
245 # get radius logs out of the container
246 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
247 '''
248 // dump all the BBSim(s) ONU information
249 script {
250 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
251 stack_ns="voltha"+i
252 sh """
253 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
254 IDS=(\$BBSIM_IDS)
255
256 for bbsim in "\${IDS[@]}"
257 do
258 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > $LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true
259 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > $LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true
260 done
261 """
262 }
263 }
264 // get ONOS debug infos
265 sh '''
266
267 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
268 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
269 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
270 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
271
272 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
273 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
274
275 if [ ${withFlows} = true ] ; then
276 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
277 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
278 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
279 fi
280
281 if [ ${provisionSubscribers} = true ]; then
282 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
283 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
284 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
285 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
286 fi
287
288 if [ ${withEapol} = true ] ; then
289 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
290 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
291 fi
292
293 if [ ${withDhcp} = true ] ; then
294 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
295 fi
296 '''
297 // collect etcd metrics
298 sh '''
299 mkdir -p $WORKSPACE/etcd-metrics
300 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
301 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
302 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
303 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
304 '''
305 // get VOLTHA debug infos
306 script {
307 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
308 stack_ns="voltha"+i
309 voltcfg="~/.volt/config-voltha"+i
310 try {
311 sh """
312
313 _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555& 2>&1 > /dev/null
314
315 voltctl -m 8MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true
316 python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true
317 rm $LOG_FOLDER/${stack_ns}/device-list.json || true
318 voltctl -m 8MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true
319
320 DEVICE_LIST=
321 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/${stack_ns}/voltha-device-flows-#.txt" || true
322 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/${stack_ns}/voltha-device-ports-#.txt" || true
323
324 printf '%s\n' \$(voltctl -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB logicaldevice flows # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-flows-#.txt" || true
325 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/${stack_ns}/voltha-logicaldevice-ports-#.txt" || true
326
327 # remove VOLTHA port-forward
328 ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9
329 """
330 } catch(e) {
331 sh '''
332 echo "Can't get device list from voltclt"
333 '''
334 }
335 }
336 }
337 // get cpu usage by container
338 sh '''
339 if [ ${withMonitoring} = true ] ; then
340 cd $WORKSPACE/voltha-system-tests
341 source ./vst_venv/bin/activate
342 sleep 60 # we have to wait for prometheus to collect all the information
343 python tests/scale/sizing.py -o $WORKSPACE/plots || true
344 fi
345 '''
346 archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*,RobotLogs/**/*,plots/*,etcd-metrics/*'
347 }
348 }
349}
350
351def deploy_voltha_stacks(numberOfStacks) {
352 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
353 stage("Deploy VOLTHA stack " + i) {
354 // ${logLevel}
Matteo Scandolo8877ab82021-02-24 15:54:23 -0800355 def extraHelmFlags = "${extraHelmFlags} --set global.log_level=${logLevel},enablePerf=true,onu=${onus},pon=${pons} "
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800356 extraHelmFlags += " --set securityContext.enabled=false,atomix.persistence.enabled=false "
357 // FIXME having to set all of these values is annoying, is there a better solution?
358 def controllerFlags = " "
359 onosReplicas.toInteger().times {
360 controllerFlags += " --set services.controller[${it}].address=onos-onos-classic-${it}.onos-onos-classic-hs.infra.svc:6653"
361 }
362
363 def volthaHelmFlags = "${controllerFlags} " + extraHelmFlags +
364 "--set voltha.services.kafka.adapter.address=kafka.infra.svc:9092 " +
365 "--set voltha.services.kafka.cluster.address=kafka.infra.svc:9092 " +
366 "--set voltha.services.etcd.address=etcd.infra.svc:2379 " +
367 "--set voltha-adapter-openolt.services.kafka.adapter.address=kafka.infra.svc:9092 " +
368 "--set voltha-adapter-openolt.services.kafka.cluster.address=kafka.infra.svc:9092 " +
369 "--set voltha-adapter-openolt.services.etcd.address=etcd.infra.svc:2379 " +
370 "--set voltha-adapter-openonu.services.kafka.adapter.address=kafka.infra.svc:9092 " +
371 "--set voltha-adapter-openonu.services.kafka.cluster.address=kafka.infra.svc:9092 " +
372 "--set voltha-adapter-openonu.services.etcd.address=etcd.infra.svc:2379"
373 volthaStackDeploy([
374 bbsimReplica: olts.toInteger(),
375 infraNamespace: "infra",
376 volthaNamespace: "voltha${i}",
377 stackName: "voltha${i}",
378 stackId: i,
379 workflow: workflow,
380 extraHelmFlags: volthaHelmFlags
381 ])
382 }
383 }
384}
385
386def test_voltha_stacks(numberOfStacks) {
387 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
388 stage("Test VOLTHA stack " + i) {
389 timeout(time: 15, unit: 'MINUTES') {
390 sh """
391
392 # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file
393 voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config
394 export VOLTCONFIG=$HOME/.volt/config
395
396 _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555& 2>&1 > /dev/null
397
398 ROBOT_PARAMS="-v stackId:${i} \
399 -v olt:${olts} \
400 -v pon:${pons} \
401 -v onu:${onus} \
402 -v workflow:${workflow} \
403 -v withEapol:${withEapol} \
404 -v withDhcp:${withDhcp} \
405 -v withIgmp:${withIgmp} \
406 --noncritical non-critical \
407 -e igmp \
408 -e teardown "
409
410 if [ ${withEapol} = false ] ; then
411 ROBOT_PARAMS+="-e authentication "
412 fi
413
414 if [ ${withDhcp} = false ] ; then
415 ROBOT_PARAMS+="-e dhcp "
416 fi
417
418 if [ ${provisionSubscribers} = false ] ; then
419 # if we're not considering subscribers then we don't care about authentication and dhcp
420 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
421 fi
422
423 if [ ${withFlows} = false ] ; then
424 ROBOT_PARAMS+="-i setup -i activation "
425 fi
426
427 cd $WORKSPACE/voltha-system-tests
428 source ./vst_venv/bin/activate
429 robot -d $WORKSPACE/RobotLogs/voltha${i} \
430 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
431
432 # collect results
433 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
434 cat $WORKSPACE/execution-time-voltha${i}.txt
435 """
436 sh """
437 # remove VOLTHA port-forward
438 ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 2>&1 > /dev/null
439 """
440 }
441 }
442 }
443}