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