blob: 7ea3737ad4517ea83e39a01bc701cd923b2a243c [file] [log] [blame]
Joey Armstrong56fdfec2024-03-01 13:43:36 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
3// Copyright 2019-2024 Open Networking Foundation Contributors
4//
Matteo Scandolo2bc660a2021-02-12 10:52:25 -08005// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
Joey Armstrong56fdfec2024-03-01 13:43:36 -050016// -----------------------------------------------------------------------
17// SPDX-FileCopyrightText: 2019-2024 Open Networking Foundation Contributors
18// SPDX-License-Identifier: Apache-2.0
19// -----------------------------------------------------------------------
20// Entropy: 0fcb5ffa-d1a4-11ee-be5e-9f44b7181764
21// -----------------------------------------------------------------------
22// Intent: Deploy VOLTHA using kind-voltha and performs a scale test
23// -----------------------------------------------------------------------
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080024
25// NOTE we are importing the library even if it's global so that it's
26// easier to change the keywords during a replay
27library identifier: 'cord-jenkins-libraries@master',
28 retriever: modernSCM([
29 $class: 'GitSCMSource',
30 remote: 'https://gerrit.opencord.org/ci-management.git'
31])
32
33pipeline {
34
35 /* no label, executor is determined by JJB */
36 agent {
37 label "${params.buildNode}"
38 }
39 options {
40 timeout(time: 120, unit: 'MINUTES')
41 }
42 environment {
43 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
44 KUBECONFIG="$HOME/.kube/config"
45 SSHPASS="karaf"
46 PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin"
47
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080048 LOG_FOLDER="$WORKSPACE/logs"
49 }
50
51 stages {
52 stage ('Cleanup') {
53 steps {
54 timeout(time: 11, unit: 'MINUTES') {
55 script {
56 def namespaces = ["infra"]
57 // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks)
58 volthaStacks.toInteger().times {
59 namespaces += "voltha${it + 1}"
60 }
61 helmTeardown(namespaces)
62 }
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070063 sh returnStdout: false, script: '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080064 helm repo add onf https://charts.opencord.org
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080065 helm repo update
66
Matteo Scandolo544fa7b2021-07-23 11:03:24 -070067 # remove all persistent volume claims
68 kubectl delete pvc --all-namespaces --all
69 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
70 while [[ \$PVCS != 0 ]]; do
71 sleep 5
72 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
73 done
74
75 # remove orphaned port-forward from different namespaces
76 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
77
78 cd $WORKSPACE
79 rm -rf $WORKSPACE/*
80 '''
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080081 }
82 }
83 }
84 stage('Download Code') {
85 steps {
86 getVolthaCode([
87 branch: "${release}",
88 volthaSystemTestsChange: "${volthaSystemTestsChange}",
Girish Gowdraa5b1de22021-06-07 14:20:27 -070089 volthaHelmChartsChange: "${volthaHelmChartsChange}",
Matteo Scandolo2bc660a2021-02-12 10:52:25 -080090 ])
91 }
92 }
93 stage('Deploy common infrastructure') {
94 // includes monitoring
95 steps {
96 sh '''
97 if [ ${withMonitoring} = true ] ; then
98 helm install -n infra nem-monitoring cord/nem-monitoring \
99 -f $HOME/voltha-scale/grafana.yaml \
100 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
101 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
102 fi
103 '''
104 }
105 }
Matteo Scandolo529e8822021-07-21 10:20:18 -0700106 stage('Start logging') {
107 steps {
108 script {
109 startComponentsLogs([
110 appsToLog: [
111 'app.kubernetes.io/name=etcd',
112 'app.kubernetes.io/name=kafka',
113 'app=onos-classic',
114 'app=adapter-open-onu',
115 'app=adapter-open-olt',
116 'app=rw-core',
117 'app=ofagent',
118 'app=bbsim',
119 'app=radius',
120 'app=bbsim-sadis-server',
121 'app=onos-config-loader',
122 ]
123 ])
124 }
125 }
126 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800127 stage('Deploy VOLTHA infrastructure') {
128 steps {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700129 timeout(time: 5, unit: 'MINUTES') {
130 script {
131 def localCharts = false
132 if (volthaHelmChartsChange != "" || release != "master") {
133 localCharts = true
134 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800135
Matteo Scandolo529e8822021-07-21 10:20:18 -0700136 def infraHelmFlags =
137 "--set global.log_level=${logLevel} " +
138 "--set radius.enabled=${withEapol} " +
139 "--set onos-classic.onosSshPort=30115 " +
Matteo Scandoloee163802022-01-14 17:02:43 -0800140 "--set onos-classic.onosApiPort=30120 " +
Matteo Scandolo529e8822021-07-21 10:20:18 -0700141 params.extraHelmFlags
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800142
Matteo Scandolo529e8822021-07-21 10:20:18 -0700143 volthaInfraDeploy([
144 workflow: workflow,
145 infraNamespace: "infra",
146 extraHelmFlags: infraHelmFlags,
147 localCharts: localCharts,
148 onosReplica: onosReplicas,
149 atomixReplica: atomixReplicas,
150 kafkaReplica: kafkaReplicas,
151 etcdReplica: etcdReplicas,
152 ])
153 }
154 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800155 }
156 }
157 stage('Deploy Voltha') {
158 steps {
Hardik Windlassb5f82662022-03-04 08:11:15 +0000159 installVoltctl("${release}")
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800160 deploy_voltha_stacks(params.volthaStacks)
161 }
162 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800163 stage('Configuration') {
164 steps {
165 script {
166 sh returnStdout: false, script: """
167
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800168 # forward ONOS ports
Matteo Scandolo89f58332021-03-26 15:40:00 -0700169 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 " &
170 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 -0800171
172 # make sure the the port-forward has started before moving forward
173 sleep 5
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800174 """
175 sh returnStdout: false, script: """
176 # TODO this needs to be repeated per stack
177 # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
178
179 #Setting link discovery
180 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}
181 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
182 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 -0700183 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 -0800184 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 -0700185 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 -0800186
187 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject
188 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord
189
190 # Set Flows/Ports/Meters poll frequency
191 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}
192 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}
193
Andrea Campanella71856eb2021-07-02 17:36:21 +0200194 #SR is not needed in scale tests and not currently used by operators in production, can be disabled.
195 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.onosproject.segmentrouting
196
197
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800198 if [ ${withFlows} = false ]; then
199 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
200 fi
201 """
202 }
203 }
204 }
205 stage('Setup Test') {
206 steps {
207 sh '''
208 mkdir -p $WORKSPACE/RobotLogs
209 cd $WORKSPACE/voltha-system-tests
210 make vst_venv
211 '''
212 }
213 }
214 stage('Run Test') {
215 steps {
216 test_voltha_stacks(params.volthaStacks)
217 }
218 }
219 }
220 post {
221 always {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700222 stopComponentsLogs([compress: true])
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800223 // collect result, done in the "post" step so it's executed even in the
224 // event of a timeout in the tests
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800225 plot([
226 csvFileName: 'scale-test.csv',
227 csvSeries: [
228 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
229 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
230 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
231 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
232 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
233 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
234 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
235 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
236 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
237 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
238 ],
239 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
240 ])
241 step([$class: 'RobotPublisher',
242 disableArchiveOutput: false,
243 logFileName: 'RobotLogs/**/log.html',
244 otherFiles: '',
245 outputFileName: 'RobotLogs/**/output.xml',
246 outputPath: '.',
247 passThreshold: 100,
248 reportFileName: 'RobotLogs/**/report.html',
Matteo Scandolo18077db2021-07-01 15:21:26 +0200249 onlyCritical: true,
Andrea Campanella98b6e2b2021-06-22 09:34:48 +0200250 unstableThreshold: 0]);
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800251 // get all the logs from kubernetes PODs
252 sh returnStdout: false, script: '''
253
254 # store information on running charts
255 helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true
256
257 # store information on the running pods
258 kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true
259 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
260 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
261
262 # copy the ONOS logs directly from the container to avoid the color codes
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700263 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 -0800264
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800265 '''
266 // dump all the BBSim(s) ONU information
267 script {
268 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
269 stack_ns="voltha"+i
270 sh """
Andrea Campanella06ca3622021-05-26 12:14:44 +0200271 mkdir -p \$LOG_FOLDER/${stack_ns}
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800272 BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}')
273 IDS=(\$BBSIM_IDS)
274
275 for bbsim in "\${IDS[@]}"
276 do
Andrea Campanella06ca3622021-05-26 12:14:44 +0200277 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > \$LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true
278 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > \$LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true
279 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true
280 kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true
281 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 -0800282 done
283 """
284 }
285 }
286 // get ONOS debug infos
287 sh '''
288
289 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
290 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
291 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
292 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
293
Matteo Scandolo529e8822021-07-21 10:20:18 -0700294 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt || true
295 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
296
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800297 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
298 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
299
300 if [ ${withFlows} = true ] ; then
301 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
302 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
303 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 -0800304 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 -0800305 fi
306
307 if [ ${provisionSubscribers} = true ]; then
308 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
309 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
310 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
311 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
312 fi
313
314 if [ ${withEapol} = true ] ; then
315 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
316 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
317 fi
318
319 if [ ${withDhcp} = true ] ; then
320 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
321 fi
322 '''
323 // collect etcd metrics
324 sh '''
325 mkdir -p $WORKSPACE/etcd-metrics
326 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
327 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
328 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
329 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
330 '''
331 // get VOLTHA debug infos
332 script {
333 for (int i = 1; i <= params.volthaStacks.toInteger(); i++) {
334 stack_ns="voltha"+i
335 voltcfg="~/.volt/config-voltha"+i
336 try {
337 sh """
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100338 voltctl -m 32MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800339 python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true
340 rm $LOG_FOLDER/${stack_ns}/device-list.json || true
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100341 voltctl -m 32MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800342
343 DEVICE_LIST=
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100344 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
345 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 -0800346
Andrea Campanellad0c8fee2022-01-27 17:07:43 +0100347 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
348 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 -0800349
350 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200351 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 -0800352 """
353 } catch(e) {
Andrea Campanella06ca3622021-05-26 12:14:44 +0200354 println e
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800355 sh '''
Andrea Campanella06ca3622021-05-26 12:14:44 +0200356 echo "Can't get device list from voltctl"
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800357 '''
358 }
359 }
360 }
361 // get cpu usage by container
362 sh '''
363 if [ ${withMonitoring} = true ] ; then
364 cd $WORKSPACE/voltha-system-tests
365 source ./vst_venv/bin/activate
366 sleep 60 # we have to wait for prometheus to collect all the information
Hardik Windlass5cfb29a2021-08-10 09:39:29 +0000367 python scripts/sizing.py -o $WORKSPACE/plots || true
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800368 fi
369 '''
Matteo Scandolo544fa7b2021-07-23 11:03:24 -0700370 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 -0800371 }
372 }
373}
374
375def deploy_voltha_stacks(numberOfStacks) {
376 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
Matteo Scandolo529e8822021-07-21 10:20:18 -0700377 timeout(time: 5, unit: 'MINUTES') {
378 stage("Deploy VOLTHA stack " + i) {
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800379
Matteo Scandolo529e8822021-07-21 10:20:18 -0700380 def localCharts = false
381 if (volthaHelmChartsChange != "" || release != "master") {
382 localCharts = true
383 }
Matteo Scandolo433f60d2021-03-26 12:04:34 -0700384
Matteo Scandolo529e8822021-07-21 10:20:18 -0700385 def volthaHelmFlags =
386 "--set global.log_level=${logLevel} " +
387 "--set enablePerf=true,onu=${onus},pon=${pons} " +
388 "--set securityContext.enabled=false " +
389 params.extraHelmFlags
390
391 volthaStackDeploy([
392 bbsimReplica: olts.toInteger(),
393 infraNamespace: "infra",
394 volthaNamespace: "voltha${i}",
395 stackName: "voltha${i}",
396 stackId: i,
397 workflow: workflow,
398 extraHelmFlags: volthaHelmFlags,
399 localCharts: localCharts,
400 onosReplica: onosReplicas,
401 ])
Girish Gowdraa5b1de22021-06-07 14:20:27 -0700402 }
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800403 }
404 }
405}
406
407def test_voltha_stacks(numberOfStacks) {
408 for (int i = 1; i <= numberOfStacks.toInteger(); i++) {
409 stage("Test VOLTHA stack " + i) {
410 timeout(time: 15, unit: 'MINUTES') {
411 sh """
412
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800413 export VOLTCONFIG=$HOME/.volt/config
414
Matteo Scandoloee163802022-01-14 17:02:43 -0800415 # wait a bit to make sure the port-forwarding has started
416 sleep 5
417
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800418
419 ROBOT_PARAMS="-v stackId:${i} \
420 -v olt:${olts} \
421 -v pon:${pons} \
422 -v onu:${onus} \
423 -v workflow:${workflow} \
424 -v withEapol:${withEapol} \
425 -v withDhcp:${withDhcp} \
426 -v withIgmp:${withIgmp} \
427 --noncritical non-critical \
428 -e igmp \
Matteo Scandoloafa43b52022-02-01 13:09:26 -0800429 -e onu-upgrade \
Matteo Scandolo2bc660a2021-02-12 10:52:25 -0800430 -e teardown "
431
432 if [ ${withEapol} = false ] ; then
433 ROBOT_PARAMS+="-e authentication "
434 fi
435
436 if [ ${withDhcp} = false ] ; then
437 ROBOT_PARAMS+="-e dhcp "
438 fi
439
440 if [ ${provisionSubscribers} = false ] ; then
441 # if we're not considering subscribers then we don't care about authentication and dhcp
442 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
443 fi
444
445 if [ ${withFlows} = false ] ; then
446 ROBOT_PARAMS+="-i setup -i activation "
447 fi
448
449 cd $WORKSPACE/voltha-system-tests
450 source ./vst_venv/bin/activate
451 robot -d $WORKSPACE/RobotLogs/voltha${i} \
452 \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
453
454 # collect results
455 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true
456 cat $WORKSPACE/execution-time-voltha${i}.txt
457 """
458 sh """
459 # remove VOLTHA port-forward
Andrea Campanella4c8af942021-05-12 10:12:13 +0200460 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 -0800461 """
462 }
463 }
464 }
465}
Joey Armstrong56fdfec2024-03-01 13:43:36 -0500466
467// [EOF]