blob: a4584abbc66d7916476470117b251ffbd977193a [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
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000025pipeline {
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
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000040 LOG_FOLDER="$WORKSPACE/logs"
41 }
42
43 stages {
44 stage ('Cleanup') {
45 steps {
46 timeout(time: 11, unit: 'MINUTES') {
47 sh """
48 # remove orphaned port-forward from different namespaces
49 ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true
50 """
51 script {
52 def namespaces = ["infra"]
53 // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks)
54 volthaStacks.toInteger().times {
55 namespaces += "voltha${it + 1}"
56 }
57 helmTeardown(namespaces)
58 }
59 sh returnStdout: false, script: """
60 helm repo add onf https://charts.opencord.org
61 helm repo add cord https://charts.opencord.org
62 helm repo update
63
64 # remove all port-forward from different namespaces
65 ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true
66 """
67 }
68 }
69 }
70 stage('Download Code') {
71 steps {
72 getVolthaCode([
73 branch: "${release}",
74 volthaSystemTestsChange: "${volthaSystemTestsChange}",
75 volthaHelmChartsChange: "${volthaHelmChartsChange}",
76 ])
77 }
78 }
79 stage('Deploy common infrastructure') {
80 // includes monitoring
81 steps {
82 sh '''
83 if [ ${withMonitoring} = true ] ; then
84 helm install -n infra nem-monitoring cord/nem-monitoring \
85 -f $HOME/voltha-scale/grafana.yaml \
86 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
87 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
88 fi
89 '''
90 }
91 }
Matteo Scandolo529e8822021-07-21 10:20:18 -070092 stage('Start logging') {
93 steps {
94 script {
95 startComponentsLogs([
96 appsToLog: [
97 'app.kubernetes.io/name=etcd',
98 'app.kubernetes.io/name=kafka',
99 'app=onos-classic',
100 'app=adapter-open-onu',
101 'app=adapter-open-olt',
102 'app=rw-core',
103 'app=ofagent',
104 'app=bbsim',
105 'app=radius',
106 'app=bbsim-sadis-server',
107 'app=onos-config-loader',
108 ]
109 ])
110 }
111 }
112 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000113 stage('Deploy VOLTHA infrastructure') {
114 steps {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700115 timeout(time: 5, unit: 'MINUTES') {
116 script {
117 def localCharts = false
118 if (volthaHelmChartsChange != "" || release != "master") {
119 localCharts = true
120 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000121
Matteo Scandolo529e8822021-07-21 10:20:18 -0700122 def infraHelmFlags =
123 "--set global.log_level=${logLevel} " +
124 "--set radius.enabled=${withEapol} " +
125 "--set onos-classic.onosSshPort=30115 " +
126 "--set onos-classic.onosApiPort=30120 " +
127 params.extraHelmFlags
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000128
Matteo Scandolo529e8822021-07-21 10:20:18 -0700129 volthaInfraDeploy([
130 workflow: workflow,
131 infraNamespace: "infra",
132 extraHelmFlags: infraHelmFlags,
133 localCharts: localCharts,
134 onosReplica: onosReplicas,
135 atomixReplica: atomixReplicas,
136 kafkaReplica: kafkaReplicas,
137 etcdReplica: etcdReplicas,
138 ])
139 }
140 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000141 }
142 }
143 stage('Deploy Voltha') {
144 steps {
145 deploy_voltha_stacks(params.volthaStacks)
146 }
147 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000148 stage('Configuration') {
149 steps {
150 script {
151 sh returnStdout: false, script: """
152
153 # forward ETCD port
154 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 " &
155
156 # forward ONOS ports
157 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 " &
158 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 " &
159
160 # make sure the the port-forward has started before moving forward
161 sleep 5
162 """
163 sh returnStdout: false, script: """
164 # TODO this needs to be repeated per stack
165 # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
166
167 #Setting link discovery
168 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}
169 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
170 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
171 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
172 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
173 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
174
175 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject
176 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord
177
178 # Set Flows/Ports/Meters poll frequency
179 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}
180 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}
181
182 #SR is not needed in scale tests and not currently used by operators in production, can be disabled.
183 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.onosproject.segmentrouting
184
185
186 if [ ${withFlows} = false ]; then
187 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
188 fi
189 """
190 }
191 }
192 }
193 stage('Setup Test') {
194 steps {
195 sh '''
196 mkdir -p $WORKSPACE/RobotLogs
197 cd $WORKSPACE/voltha-system-tests
198 make vst_venv
199 '''
200 }
201 }
202 stage('Run Test') {
203 steps {
204 test_voltha_stacks(params.volthaStacks)
205 }
206 }
207 }
208 post {
209 always {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700210 stopComponentsLogs([compress: true])
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000211 // collect result, done in the "post" step so it's executed even in the
212 // event of a timeout in the tests
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000213 plot([
214 csvFileName: 'scale-test.csv',
215 csvSeries: [
216 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
217 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
218 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
219 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
220 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
221 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
222 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
223 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
224 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
225 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
226 ],
227 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
228 ])
229 step([$class: 'RobotPublisher',
230 disableArchiveOutput: false,
231 logFileName: 'RobotLogs/**/log.html',
232 otherFiles: '',
233 outputFileName: 'RobotLogs/**/output.xml',
234 outputPath: '.',
235 passThreshold: 100,
236 reportFileName: 'RobotLogs/**/report.html',
237 onlyCritical: true,
238 unstableThreshold: 0]);
239 // get all the logs from kubernetes PODs
240 sh returnStdout: false, script: '''
241
242 # store information on running charts
243 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
244
245 # store information on the running pods
246 kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true
247 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
248 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
249
250 # copy the ONOS logs directly from the container to avoid the color codes
251 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
252
253 '''
254 // dump all the BBSim(s) ONU information
255 script {
256 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
257 stack_ns="voltha"+i
258 sh """
259 mkdir -p \$LOG_FOLDER/${stack_ns}
260 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
261 IDS=(\$BBSIM_IDS)
262
263 for bbsim in "\${IDS[@]}"
264 do
265 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > \$LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true
266 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > \$LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true
267 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true
268 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true
269 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt pons > \$LOG_FOLDER/${stack_ns}/\$bbsim-pon-resources.txt || true
270 done
271 """
272 }
273 }
274 // get ONOS debug infos
275 sh '''
276
277 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
278 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
279 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
280 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
281
Matteo Scandolo529e8822021-07-21 10:20:18 -0700282 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt || true
283 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg get > $LOG_FOLDER/onos-cfg.txt || true
284
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000285 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
286 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
287
288 if [ ${withFlows} = true ] ; then
289 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
290 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
291 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
292 fi
293
294 if [ ${provisionSubscribers} = true ]; then
295 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
296 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
297 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
298 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
299 fi
300
301 if [ ${withEapol} = true ] ; then
302 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
303 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
304 fi
305
306 if [ ${withDhcp} = true ] ; then
307 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
308 fi
309 '''
310 // collect etcd metrics
311 sh '''
312 mkdir -p $WORKSPACE/etcd-metrics
313 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
314 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
315 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
316 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
317 '''
318 // get VOLTHA debug infos
319 script {
320 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
321 stack_ns="voltha"+i
322 voltcfg="~/.volt/config-voltha"+i
323 try {
324 sh """
325
326 # _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
327 _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"&
328
329 voltctl -m 8MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true
330 python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true
331 rm $LOG_FOLDER/${stack_ns}/device-list.json || true
332 voltctl -m 8MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true
333
334 DEVICE_LIST=
335 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
336 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
337
338 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
339 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
340
341 # remove VOLTHA port-forward
342 ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true
343 """
344 } catch(e) {
345 println e
346 sh '''
347 echo "Can't get device list from voltctl"
348 '''
349 }
350 }
351 }
352 // get cpu usage by container
353 sh '''
354 if [ ${withMonitoring} = true ] ; then
355 cd $WORKSPACE/voltha-system-tests
356 source ./vst_venv/bin/activate
357 sleep 60 # we have to wait for prometheus to collect all the information
358 python tests/scale/sizing.py -o $WORKSPACE/plots || true
359 fi
360 '''
361 archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*.txt,logs/**/*.tar.gz,RobotLogs/**/*,plots/*,etcd-metrics/*'
362 }
363 }
364}
365
366def deploy_voltha_stacks(numberOfStacks) {
367 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700368 timeout(time: 5, unit: 'MINUTES') {
369 stage("Deploy VOLTHA stack " + i) {
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000370
Matteo Scandolo529e8822021-07-21 10:20:18 -0700371 def localCharts = false
372 if (volthaHelmChartsChange != "" || release != "master") {
373 localCharts = true
374 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000375
Matteo Scandolo529e8822021-07-21 10:20:18 -0700376 def volthaHelmFlags =
377 "--set global.log_level=${logLevel} " +
378 "--set enablePerf=true,onu=${onus},pon=${pons} " +
379 "--set securityContext.enabled=false " +
380 params.extraHelmFlags
381
382 volthaStackDeploy([
383 bbsimReplica: olts.toInteger(),
384 infraNamespace: "infra",
385 volthaNamespace: "voltha${i}",
386 stackName: "voltha${i}",
387 stackId: i,
388 workflow: workflow,
389 extraHelmFlags: volthaHelmFlags,
390 localCharts: localCharts,
391 onosReplica: onosReplicas,
392 ])
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000393 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000394 }
395 }
396}
397
398def test_voltha_stacks(numberOfStacks) {
399 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
400 stage("Test VOLTHA stack " + i) {
401 timeout(time: 15, unit: 'MINUTES') {
402 sh """
403
404 # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file
405 voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config
406 export VOLTCONFIG=$HOME/.volt/config
407
408 # _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
409 _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"&
410
411
412 ROBOT_PARAMS="-v stackId:${i} \
413 -v olt:${olts} \
414 -v pon:${pons} \
415 -v onu:${onus} \
416 -v workflow:${workflow} \
417 -v withEapol:${withEapol} \
418 -v withDhcp:${withDhcp} \
419 -v withIgmp:${withIgmp} \
420 --noncritical non-critical \
421 -e igmp \
422 -e teardown "
423
424 if [ ${withEapol} = false ] ; then
425 ROBOT_PARAMS+="-e authentication "
426 fi
427
428 if [ ${withDhcp} = false ] ; then
429 ROBOT_PARAMS+="-e dhcp "
430 fi
431
432 if [ ${provisionSubscribers} = false ] ; then
433 # if we're not considering subscribers then we don't care about authentication and dhcp
434 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
435 fi
436
437 if [ ${withFlows} = false ] ; then
438 ROBOT_PARAMS+="-i setup -i activation "
439 fi
440
441 cd $WORKSPACE/voltha-system-tests
442 source ./vst_venv/bin/activate
443 robot -d $WORKSPACE/RobotLogs/voltha${i} \
444 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
445
446 # collect results
447 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
448 cat $WORKSPACE/execution-time-voltha${i}.txt
449 """
450 sh """
451 # remove VOLTHA port-forward
452 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
453 """
454 }
455 }
456 }
457}