blob: 56ddf59edcb56ef487f24c7f0a9370d8688f082c [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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080040 LOG_FOLDER="$WORKSPACE/logs"
41 }
42
43 stages {
44 stage ('Cleanup') {
45 steps {
46 timeout(time: 11, unit: 'MINUTES') {
47 script {
48 def namespaces = ["infra"]
49 // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks)
50 volthaStacks.toInteger().times {
51 namespaces += "voltha${it + 1}"
52 }
53 helmTeardown(namespaces)
54 }
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070055 sh returnStdout: false, script: '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080056 helm repo add onf https://charts.opencord.org
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080057 helm repo update
58
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070059 # remove all persistent volume claims
60 kubectl delete pvc --all-namespaces --all
61 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
62 while [[ \$PVCS != 0 ]]; do
63 sleep 5
64 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
65 done
66
67 # remove orphaned port-forward from different namespaces
68 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
69
70 cd $WORKSPACE
71 rm -rf $WORKSPACE/*
72 '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080073 }
74 }
75 }
76 stage('Download Code') {
77 steps {
78 getVolthaCode([
79 branch: "${release}",
80 volthaSystemTestsChange: "${volthaSystemTestsChange}",
Girish Gowdraa5b1de22021-06-07 14:20:27 -070081 volthaHelmChartsChange: "${volthaHelmChartsChange}",
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080082 ])
83 }
84 }
85 stage('Deploy common infrastructure') {
86 // includes monitoring
87 steps {
88 sh '''
89 if [ ${withMonitoring} = true ] ; then
90 helm install -n infra nem-monitoring cord/nem-monitoring \
91 -f $HOME/voltha-scale/grafana.yaml \
92 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
93 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
94 fi
95 '''
96 }
97 }
Matteo Scandolo529e8822021-07-21 10:20:18 -070098 stage('Start logging') {
99 steps {
100 script {
101 startComponentsLogs([
102 appsToLog: [
103 'app.kubernetes.io/name=etcd',
104 'app.kubernetes.io/name=kafka',
105 'app=onos-classic',
106 'app=adapter-open-onu',
107 'app=adapter-open-olt',
108 'app=rw-core',
109 'app=ofagent',
110 'app=bbsim',
111 'app=radius',
112 'app=bbsim-sadis-server',
113 'app=onos-config-loader',
114 ]
115 ])
116 }
117 }
118 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800119 stage('Deploy VOLTHA infrastructure') {
120 steps {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700121 timeout(time: 5, unit: 'MINUTES') {
122 script {
123 def localCharts = false
124 if (volthaHelmChartsChange != "" || release != "master") {
125 localCharts = true
126 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800127
Matteo Scandolo529e8822021-07-21 10:20:18 -0700128 def infraHelmFlags =
129 "--set global.log_level=${logLevel} " +
130 "--set radius.enabled=${withEapol} " +
131 "--set onos-classic.onosSshPort=30115 " +
Matteo Scandoloee163802022-01-14 17:02:43 -0800132 "--set onos-classic.onosApiPort=30120 " +
Matteo Scandolo529e8822021-07-21 10:20:18 -0700133 params.extraHelmFlags
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800134
Matteo Scandolo529e8822021-07-21 10:20:18 -0700135 volthaInfraDeploy([
136 workflow: workflow,
137 infraNamespace: "infra",
138 extraHelmFlags: infraHelmFlags,
139 localCharts: localCharts,
140 onosReplica: onosReplicas,
141 atomixReplica: atomixReplicas,
142 kafkaReplica: kafkaReplicas,
143 etcdReplica: etcdReplicas,
144 ])
145 }
146 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800147 }
148 }
149 stage('Deploy Voltha') {
150 steps {
Hardik Windlassb5f82662022-03-04 08:11:15 +0000151 installVoltctl("${release}")
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800152 deploy_voltha_stacks(params.volthaStacks)
153 }
154 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800155 stage('Configuration') {
156 steps {
157 script {
158 sh returnStdout: false, script: """
159
160 # forward ETCD port
Matteo Scandolo89f58332021-03-26 15:40:00 -0700161 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 Scandolo2bc660a2021-02-12 10:52:25 -0800162
163 # forward ONOS ports
Matteo Scandolo89f58332021-03-26 15:40:00 -0700164 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 " &
165 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 " &
Matteo Scandolo2d30c7d2021-02-25 15:39:51 -0800166
167 # make sure the the port-forward has started before moving forward
168 sleep 5
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800169 """
170 sh returnStdout: false, script: """
171 # TODO this needs to be repeated per stack
172 # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
173
174 #Setting link discovery
175 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}
176 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
177 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
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700178 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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800179 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
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700180 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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800181
182 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject
183 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord
184
185 # Set Flows/Ports/Meters poll frequency
186 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}
187 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}
188
Andrea Campanella71856eb2021-07-02 17:36:21 +0200189 #SR is not needed in scale tests and not currently used by operators in production, can be disabled.
190 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.onosproject.segmentrouting
191
192
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800193 if [ ${withFlows} = false ]; then
194 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
195 fi
196 """
197 }
198 }
199 }
200 stage('Setup Test') {
201 steps {
202 sh '''
203 mkdir -p $WORKSPACE/RobotLogs
204 cd $WORKSPACE/voltha-system-tests
205 make vst_venv
206 '''
207 }
208 }
209 stage('Run Test') {
210 steps {
211 test_voltha_stacks(params.volthaStacks)
212 }
213 }
214 }
215 post {
216 always {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700217 stopComponentsLogs([compress: true])
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800218 // collect result, done in the "post" step so it's executed even in the
219 // event of a timeout in the tests
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800220 plot([
221 csvFileName: 'scale-test.csv',
222 csvSeries: [
223 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
224 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
225 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
226 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
227 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
228 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
229 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
230 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
231 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
232 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
233 ],
234 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
235 ])
236 step([$class: 'RobotPublisher',
237 disableArchiveOutput: false,
238 logFileName: 'RobotLogs/**/log.html',
239 otherFiles: '',
240 outputFileName: 'RobotLogs/**/output.xml',
241 outputPath: '.',
242 passThreshold: 100,
243 reportFileName: 'RobotLogs/**/report.html',
Matteo Scandolo18077db2021-07-01 15:21:26 +0200244 onlyCritical: true,
Andrea Campanella98b6e2b2021-06-22 09:34:48 +0200245 unstableThreshold: 0]);
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800246 // get all the logs from kubernetes PODs
247 sh returnStdout: false, script: '''
248
249 # store information on running charts
250 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
251
252 # store information on the running pods
253 kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true
254 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
255 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
256
257 # copy the ONOS logs directly from the container to avoid the color codes
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700258 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 -n infra #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800259
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800260 '''
261 // dump all the BBSim(s) ONU information
262 script {
263 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
264 stack_ns="voltha"+i
265 sh """
Andrea Campanella06ca3622021-05-26 12:14:44 +0200266 mkdir -p \$LOG_FOLDER/${stack_ns}
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800267 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
268 IDS=(\$BBSIM_IDS)
269
270 for bbsim in "\${IDS[@]}"
271 do
Andrea Campanella06ca3622021-05-26 12:14:44 +0200272 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > \$LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true
273 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > \$LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true
274 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true
275 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true
276 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt pons > \$LOG_FOLDER/${stack_ns}/\$bbsim-pon-resources.txt || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800277 done
278 """
279 }
280 }
281 // get ONOS debug infos
282 sh '''
283
284 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
285 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
286 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
287 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
288
Matteo Scandolo529e8822021-07-21 10:20:18 -0700289 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt || true
290 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
291
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800292 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
293 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
294
295 if [ ${withFlows} = true ] ; then
296 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
297 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
298 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
Matteo Scandolo38c6adf2022-01-20 16:47:17 -0800299 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-port-status > $LOG_FOLDER/onos-volt-port-status.txt || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800300 fi
301
302 if [ ${provisionSubscribers} = true ]; then
303 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
304 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
305 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
306 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
307 fi
308
309 if [ ${withEapol} = true ] ; then
310 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
311 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
312 fi
313
314 if [ ${withDhcp} = true ] ; then
315 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
316 fi
317 '''
318 // collect etcd metrics
319 sh '''
320 mkdir -p $WORKSPACE/etcd-metrics
321 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
322 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
323 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
324 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
325 '''
326 // get VOLTHA debug infos
327 script {
328 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
329 stack_ns="voltha"+i
330 voltcfg="~/.volt/config-voltha"+i
331 try {
332 sh """
333
Andrea Campanella06ca3622021-05-26 12:14:44 +0200334 # _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
335 _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"&
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800336
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100337 voltctl -m 32MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800338 python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true
339 rm $LOG_FOLDER/${stack_ns}/device-list.json || true
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100340 voltctl -m 32MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800341
342 DEVICE_LIST=
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100343 printf '%s\n' \$(voltctl -m 32MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB device flows # > $LOG_FOLDER/${stack_ns}/voltha-device-flows-#.txt" || true
344 printf '%s\n' \$(voltctl -m 32MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' # > $LOG_FOLDER/${stack_ns}/voltha-device-ports-#.txt" || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800345
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100346 printf '%s\n' \$(voltctl -m 32MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB logicaldevice flows # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-flows-#.txt" || true
347 printf '%s\n' \$(voltctl -m 32MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB logicaldevice port list # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-ports-#.txt" || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800348
349 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200350 ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800351 """
352 } catch(e) {
Andrea Campanella06ca3622021-05-26 12:14:44 +0200353 println e
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800354 sh '''
Andrea Campanella06ca3622021-05-26 12:14:44 +0200355 echo "Can't get device list from voltctl"
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800356 '''
357 }
358 }
359 }
360 // get cpu usage by container
361 sh '''
362 if [ ${withMonitoring} = true ] ; then
363 cd $WORKSPACE/voltha-system-tests
364 source ./vst_venv/bin/activate
365 sleep 60 # we have to wait for prometheus to collect all the information
Hardik Windlass5cfb29a2021-08-10 09:39:29 +0000366 python scripts/sizing.py -o $WORKSPACE/plots || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800367 fi
368 '''
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700369 archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*.txt,logs/**/*.tar.gz,logs/**/*.tgz,RobotLogs/**/*,plots/*,etcd-metrics/*'
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800370 }
371 }
372}
373
374def deploy_voltha_stacks(numberOfStacks) {
375 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700376 timeout(time: 5, unit: 'MINUTES') {
377 stage("Deploy VOLTHA stack " + i) {
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800378
Matteo Scandolo529e8822021-07-21 10:20:18 -0700379 def localCharts = false
380 if (volthaHelmChartsChange != "" || release != "master") {
381 localCharts = true
382 }
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700383
Matteo Scandolo529e8822021-07-21 10:20:18 -0700384 def volthaHelmFlags =
385 "--set global.log_level=${logLevel} " +
386 "--set enablePerf=true,onu=${onus},pon=${pons} " +
387 "--set securityContext.enabled=false " +
388 params.extraHelmFlags
389
390 volthaStackDeploy([
391 bbsimReplica: olts.toInteger(),
392 infraNamespace: "infra",
393 volthaNamespace: "voltha${i}",
394 stackName: "voltha${i}",
395 stackId: i,
396 workflow: workflow,
397 extraHelmFlags: volthaHelmFlags,
398 localCharts: localCharts,
399 onosReplica: onosReplicas,
400 ])
Girish Gowdraa5b1de22021-06-07 14:20:27 -0700401 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800402 }
403 }
404}
405
406def test_voltha_stacks(numberOfStacks) {
407 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
408 stage("Test VOLTHA stack " + i) {
409 timeout(time: 15, unit: 'MINUTES') {
410 sh """
411
412 # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file
413 voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config
414 export VOLTCONFIG=$HOME/.volt/config
415
Andrea Campanella06ca3622021-05-26 12:14:44 +0200416 # _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
417 _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"&
418
Matteo Scandoloee163802022-01-14 17:02:43 -0800419 # wait a bit to make sure the port-forwarding has started
420 sleep 5
421
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800422
423 ROBOT_PARAMS="-v stackId:${i} \
424 -v olt:${olts} \
425 -v pon:${pons} \
426 -v onu:${onus} \
427 -v workflow:${workflow} \
428 -v withEapol:${withEapol} \
429 -v withDhcp:${withDhcp} \
430 -v withIgmp:${withIgmp} \
431 --noncritical non-critical \
432 -e igmp \
Matteo Scandoloafa43b52022-02-01 13:09:26 -0800433 -e onu-upgrade \
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800434 -e teardown "
435
436 if [ ${withEapol} = false ] ; then
437 ROBOT_PARAMS+="-e authentication "
438 fi
439
440 if [ ${withDhcp} = false ] ; then
441 ROBOT_PARAMS+="-e dhcp "
442 fi
443
444 if [ ${provisionSubscribers} = false ] ; then
445 # if we're not considering subscribers then we don't care about authentication and dhcp
446 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
447 fi
448
449 if [ ${withFlows} = false ] ; then
450 ROBOT_PARAMS+="-i setup -i activation "
451 fi
452
453 cd $WORKSPACE/voltha-system-tests
454 source ./vst_venv/bin/activate
455 robot -d $WORKSPACE/RobotLogs/voltha${i} \
456 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
457
458 # collect results
459 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
460 cat $WORKSPACE/execution-time-voltha${i}.txt
461 """
462 sh """
463 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200464 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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800465 """
466 }
467 }
468 }
469}