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