blob: 42b8e7328d4f8dc7c107ca9228560efc2753addc [file] [log] [blame]
Joey Armstrong6a9013e2024-02-01 17:56:57 -05001// Copyright 2019-2024 Open Networking Foundation (ONF) and the ONF Contributors
Matteo Scandolo2bc660a2021-02-12 10:52:25 -08002// Licensed under the Apache License, Version 2.0 (the "License");
3// you may not use this file except in compliance with the License.
4// You may obtain a copy of the License at
5//
6// http://www.apache.org/licenses/LICENSE-2.0
7//
8// Unless required by applicable law or agreed to in writing, software
9// distributed under the License is distributed on an "AS IS" BASIS,
10// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11// See the License for the specific language governing permissions and
12// limitations under the License.
13
14// deploy VOLTHA using kind-voltha and performs a scale test
15
16// NOTE we are importing the library even if it's global so that it's
17// easier to change the keywords during a replay
18library identifier: 'cord-jenkins-libraries@master',
19 retriever: modernSCM([
20 $class: 'GitSCMSource',
21 remote: 'https://gerrit.opencord.org/ci-management.git'
22])
23
24pipeline {
25
26 /* no label, executor is determined by JJB */
27 agent {
28 label "${params.buildNode}"
29 }
30 options {
31 timeout(time: 120, unit: 'MINUTES')
32 }
33 environment {
34 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
35 KUBECONFIG="$HOME/.kube/config"
36 SSHPASS="karaf"
37 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
38
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080039 LOG_FOLDER="$WORKSPACE/logs"
40 }
41
42 stages {
43 stage ('Cleanup') {
44 steps {
45 timeout(time: 11, unit: 'MINUTES') {
46 script {
47 def namespaces = ["infra"]
48 // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks)
49 volthaStacks.toInteger().times {
50 namespaces += "voltha${it + 1}"
51 }
52 helmTeardown(namespaces)
53 }
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070054 sh returnStdout: false, script: '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080055 helm repo add onf https://charts.opencord.org
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080056 helm repo update
57
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070058 # remove all persistent volume claims
59 kubectl delete pvc --all-namespaces --all
60 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
61 while [[ \$PVCS != 0 ]]; do
62 sleep 5
63 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
64 done
65
66 # remove orphaned port-forward from different namespaces
67 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
68
69 cd $WORKSPACE
70 rm -rf $WORKSPACE/*
71 '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080072 }
73 }
74 }
75 stage('Download Code') {
76 steps {
77 getVolthaCode([
78 branch: "${release}",
79 volthaSystemTestsChange: "${volthaSystemTestsChange}",
Girish Gowdraa5b1de22021-06-07 14:20:27 -070080 volthaHelmChartsChange: "${volthaHelmChartsChange}",
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080081 ])
82 }
83 }
84 stage('Deploy common infrastructure') {
85 // includes monitoring
86 steps {
87 sh '''
88 if [ ${withMonitoring} = true ] ; then
89 helm install -n infra nem-monitoring cord/nem-monitoring \
90 -f $HOME/voltha-scale/grafana.yaml \
91 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
92 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
93 fi
94 '''
95 }
96 }
Matteo Scandolo529e8822021-07-21 10:20:18 -070097 stage('Start logging') {
98 steps {
99 script {
100 startComponentsLogs([
101 appsToLog: [
102 'app.kubernetes.io/name=etcd',
103 'app.kubernetes.io/name=kafka',
104 'app=onos-classic',
105 'app=adapter-open-onu',
106 'app=adapter-open-olt',
107 'app=rw-core',
108 'app=ofagent',
109 'app=bbsim',
110 'app=radius',
111 'app=bbsim-sadis-server',
112 'app=onos-config-loader',
113 ]
114 ])
115 }
116 }
117 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800118 stage('Deploy VOLTHA infrastructure') {
119 steps {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700120 timeout(time: 5, unit: 'MINUTES') {
121 script {
122 def localCharts = false
123 if (volthaHelmChartsChange != "" || release != "master") {
124 localCharts = true
125 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800126
Matteo Scandolo529e8822021-07-21 10:20:18 -0700127 def infraHelmFlags =
128 "--set global.log_level=${logLevel} " +
129 "--set radius.enabled=${withEapol} " +
130 "--set onos-classic.onosSshPort=30115 " +
Matteo Scandoloee163802022-01-14 17:02:43 -0800131 "--set onos-classic.onosApiPort=30120 " +
Matteo Scandolo529e8822021-07-21 10:20:18 -0700132 params.extraHelmFlags
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800133
Matteo Scandolo529e8822021-07-21 10:20:18 -0700134 volthaInfraDeploy([
135 workflow: workflow,
136 infraNamespace: "infra",
137 extraHelmFlags: infraHelmFlags,
138 localCharts: localCharts,
139 onosReplica: onosReplicas,
140 atomixReplica: atomixReplicas,
141 kafkaReplica: kafkaReplicas,
142 etcdReplica: etcdReplicas,
143 ])
144 }
145 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800146 }
147 }
148 stage('Deploy Voltha') {
149 steps {
Hardik Windlassb5f82662022-03-04 08:11:15 +0000150 installVoltctl("${release}")
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800151 deploy_voltha_stacks(params.volthaStacks)
152 }
153 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800154 stage('Configuration') {
155 steps {
156 script {
157 sh returnStdout: false, script: """
158
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800159 # forward ONOS ports
Matteo Scandolo89f58332021-03-26 15:40:00 -0700160 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 " &
Matteo Scandolo2d30c7d2021-02-25 15:39:51 -0800162
163 # make sure the the port-forward has started before moving forward
164 sleep 5
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800165 """
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
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700174 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 -0800175 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 -0700176 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 -0800177
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
Andrea Campanella71856eb2021-07-02 17:36:21 +0200185 #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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800189 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 {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700213 stopComponentsLogs([compress: true])
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800214 // collect result, done in the "post" step so it's executed even in the
215 // event of a timeout in the tests
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800216 plot([
217 csvFileName: 'scale-test.csv',
218 csvSeries: [
219 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
220 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
221 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
222 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
223 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
224 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
225 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
226 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
227 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
228 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
229 ],
230 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
231 ])
232 step([$class: 'RobotPublisher',
233 disableArchiveOutput: false,
234 logFileName: 'RobotLogs/**/log.html',
235 otherFiles: '',
236 outputFileName: 'RobotLogs/**/output.xml',
237 outputPath: '.',
238 passThreshold: 100,
239 reportFileName: 'RobotLogs/**/report.html',
Matteo Scandolo18077db2021-07-01 15:21:26 +0200240 onlyCritical: true,
Andrea Campanella98b6e2b2021-06-22 09:34:48 +0200241 unstableThreshold: 0]);
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800242 // get all the logs from kubernetes PODs
243 sh returnStdout: false, script: '''
244
245 # store information on running charts
246 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
247
248 # store information on the running pods
249 kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true
250 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
251 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
252
253 # copy the ONOS logs directly from the container to avoid the color codes
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700254 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 -0800255
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800256 '''
257 // dump all the BBSim(s) ONU information
258 script {
259 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
260 stack_ns="voltha"+i
261 sh """
Andrea Campanella06ca3622021-05-26 12:14:44 +0200262 mkdir -p \$LOG_FOLDER/${stack_ns}
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800263 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
264 IDS=(\$BBSIM_IDS)
265
266 for bbsim in "\${IDS[@]}"
267 do
Andrea Campanella06ca3622021-05-26 12:14:44 +0200268 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > \$LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true
269 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > \$LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true
270 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true
271 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true
272 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 -0800273 done
274 """
275 }
276 }
277 // get ONOS debug infos
278 sh '''
279
280 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
281 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
282 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
283 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
284
Matteo Scandolo529e8822021-07-21 10:20:18 -0700285 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt || true
286 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
287
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800288 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
289 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
290
291 if [ ${withFlows} = true ] ; then
292 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
293 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
294 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 -0800295 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 -0800296 fi
297
298 if [ ${provisionSubscribers} = true ]; then
299 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
300 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
301 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
302 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
303 fi
304
305 if [ ${withEapol} = true ] ; then
306 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
307 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
308 fi
309
310 if [ ${withDhcp} = true ] ; then
311 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
312 fi
313 '''
314 // collect etcd metrics
315 sh '''
316 mkdir -p $WORKSPACE/etcd-metrics
317 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
318 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
319 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
320 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
321 '''
322 // get VOLTHA debug infos
323 script {
324 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
325 stack_ns="voltha"+i
326 voltcfg="~/.volt/config-voltha"+i
327 try {
328 sh """
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100329 voltctl -m 32MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800330 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
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100332 voltctl -m 32MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800333
334 DEVICE_LIST=
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100335 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
336 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 -0800337
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100338 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
339 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 -0800340
341 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200342 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 -0800343 """
344 } catch(e) {
Andrea Campanella06ca3622021-05-26 12:14:44 +0200345 println e
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800346 sh '''
Andrea Campanella06ca3622021-05-26 12:14:44 +0200347 echo "Can't get device list from voltctl"
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800348 '''
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
Hardik Windlass5cfb29a2021-08-10 09:39:29 +0000358 python scripts/sizing.py -o $WORKSPACE/plots || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800359 fi
360 '''
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700361 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 -0800362 }
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) {
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800370
Matteo Scandolo529e8822021-07-21 10:20:18 -0700371 def localCharts = false
372 if (volthaHelmChartsChange != "" || release != "master") {
373 localCharts = true
374 }
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700375
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 ])
Girish Gowdraa5b1de22021-06-07 14:20:27 -0700393 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800394 }
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
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800404 export VOLTCONFIG=$HOME/.volt/config
405
Matteo Scandoloee163802022-01-14 17:02:43 -0800406 # wait a bit to make sure the port-forwarding has started
407 sleep 5
408
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800409
410 ROBOT_PARAMS="-v stackId:${i} \
411 -v olt:${olts} \
412 -v pon:${pons} \
413 -v onu:${onus} \
414 -v workflow:${workflow} \
415 -v withEapol:${withEapol} \
416 -v withDhcp:${withDhcp} \
417 -v withIgmp:${withIgmp} \
418 --noncritical non-critical \
419 -e igmp \
Matteo Scandoloafa43b52022-02-01 13:09:26 -0800420 -e onu-upgrade \
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800421 -e teardown "
422
423 if [ ${withEapol} = false ] ; then
424 ROBOT_PARAMS+="-e authentication "
425 fi
426
427 if [ ${withDhcp} = false ] ; then
428 ROBOT_PARAMS+="-e dhcp "
429 fi
430
431 if [ ${provisionSubscribers} = false ] ; then
432 # if we're not considering subscribers then we don't care about authentication and dhcp
433 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
434 fi
435
436 if [ ${withFlows} = false ] ; then
437 ROBOT_PARAMS+="-i setup -i activation "
438 fi
439
440 cd $WORKSPACE/voltha-system-tests
441 source ./vst_venv/bin/activate
442 robot -d $WORKSPACE/RobotLogs/voltha${i} \
443 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
444
445 # collect results
446 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
447 cat $WORKSPACE/execution-time-voltha${i}.txt
448 """
449 sh """
450 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200451 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 -0800452 """
453 }
454 }
455 }
456}