blob: dc94736b037fdb7c22c3c19ccf2f44e1ea5cefa1 [file] [log] [blame]
Matteo Scandolofed6bab2021-03-31 14:19:57 -07001// Copyright 2019-present Open Networking Foundation
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// deploy VOLTHA and performs a scale test
16
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000017library identifier: 'cord-jenkins-libraries@master',
18 retriever: modernSCM([
19 $class: 'GitSCMSource',
20 remote: 'https://gerrit.opencord.org/ci-management.git'
21])
22
Matteo Scandolofed6bab2021-03-31 14:19:57 -070023// this function generates the correct parameters for ofAgent
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000024// to connect to multiple ONOS instances
Matteo Scandolofed6bab2021-03-31 14:19:57 -070025def ofAgentConnections(numOfOnos, releaseName, namespace) {
26 def params = " "
27 numOfOnos.times {
28 params += "--set voltha.services.controller[${it}].address=${releaseName}-onos-classic-${it}.${releaseName}-onos-classic-hs.${namespace}.svc:6653 "
29 }
30 return params
31}
32
33pipeline {
34
35 /* no label, executor is determined by JJB */
36 agent {
37 label "${params.buildNode}"
38 }
39 options {
40 timeout(time: 60, unit: 'MINUTES')
41 }
42 environment {
43 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
44 KUBECONFIG="$HOME/.kube/config"
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000045 VOLTCONFIG="$HOME/.volt/config"
Matteo Scandolofed6bab2021-03-31 14:19:57 -070046 SSHPASS="karaf"
47 VOLTHA_LOG_LEVEL="${logLevel}"
48 NUM_OF_BBSIM="${olts}"
49 NUM_OF_OPENONU="${openonuAdapterReplicas}"
50 NUM_OF_ONOS="${onosReplicas}"
51 NUM_OF_ATOMIX="${atomixReplicas}"
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000052 EXTRA_HELM_FLAGS=" "
Matteo Scandolofed6bab2021-03-31 14:19:57 -070053
54 APPS_TO_LOG="etcd kafka onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server onos-config-loader"
55 LOG_FOLDER="$WORKSPACE/logs"
56
57 GERRIT_PROJECT="${GERRIT_PROJECT}"
58 }
59
60 stages {
61 stage ('Cleanup') {
62 steps {
63 timeout(time: 11, unit: 'MINUTES') {
Matteo Scandoloaf11cda2021-10-05 13:05:33 -070064 sh returnStdout: false, script: '''
65 cd $WORKSPACE
66 rm -rf $WORKSPACE/*
67 '''
68 // removing the voltha-infra chart first
69 // if we don't ONOS might get stuck because of all the events when BBSim goes down
70 sh returnStdout: false, script: '''
71 set +x
72 helm del voltha-infra || true
73 echo -ne "\nWaiting for ONOS to be removed..."
74 onos=$(kubectl get pod -n default -l app=onos-classic --no-headers | wc -l)
75 while [[ $onos != 0 ]]; do
76 onos=$(kubectl get pod -n default -l app=onos-classic --no-headers | wc -l)
77 sleep 5
78 echo -ne "."
79 done
80 '''
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000081 script {
82 helmTeardown(["default"])
83 }
Matteo Scandolofed6bab2021-03-31 14:19:57 -070084 sh returnStdout: false, script: '''
85 helm repo add onf https://charts.opencord.org
86 helm repo update
87
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000088 # remove all persistent volume claims
89 kubectl delete pvc --all-namespaces --all
90 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
91 while [[ \$PVCS != 0 ]]; do
Matteo Scandolofed6bab2021-03-31 14:19:57 -070092 sleep 5
Hardik Windlass6d9a82e2021-07-08 16:23:21 +000093 PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l)
Matteo Scandolofed6bab2021-03-31 14:19:57 -070094 done
95
96 # remove orphaned port-forward from different namespaces
Andrea Campanella4c8af942021-05-12 10:12:13 +020097 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -070098 '''
99 }
100 }
101 }
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000102 stage('Download Code') {
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700103 steps {
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000104 getVolthaCode([
105 branch: "${release}",
106 volthaSystemTestsChange: "${volthaSystemTestsChange}",
107 volthaHelmChartsChange: "${volthaHelmChartsChange}",
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700108 ])
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700109 }
110 }
111 stage('Build patch') {
112 when {
113 expression {
114 return params.GERRIT_PROJECT
115 }
116 }
117 steps {
118 sh """
119 git clone https://\$GERRIT_HOST/\$GERRIT_PROJECT
120 cd \$GERRIT_PROJECT
121 git fetch https://\$GERRIT_HOST/\$GERRIT_PROJECT \$GERRIT_REFSPEC && git checkout FETCH_HEAD
122
123 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-build
124 DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-push
125 """
126 }
127 }
128 stage('Deploy common infrastructure') {
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700129 steps {
130 sh '''
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700131 if [ ${withMonitoring} = true ] ; then
132 helm install nem-monitoring onf/nem-monitoring \
133 -f $HOME/voltha-scale/grafana.yaml \
134 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
135 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
136 fi
137 '''
138 }
139 }
140 stage('Deploy Voltha') {
141 steps {
142 timeout(time: 10, unit: 'MINUTES') {
143 script {
144 sh returnStdout: false, script: '''
145 # start logging with kail
146
147 mkdir -p $LOG_FOLDER
148
149 list=($APPS_TO_LOG)
150 for app in "${list[@]}"
151 do
152 echo "Starting logs for: ${app}"
153 _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log&
154 done
155 '''
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000156 def returned_flags = sh (returnStdout: true, script: """
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700157
158 export EXTRA_HELM_FLAGS+=' '
159
160 # BBSim custom image handling
161 if [ '${bbsimImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'bbsim' ]; then
162 IFS=: read -r bbsimRepo bbsimTag <<< '${bbsimImg.trim()}'
163 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
164 fi
165
166 # VOLTHA custom image handling
167 if [ '${rwCoreImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-go' ]; then
168 IFS=: read -r rwCoreRepo rwCoreTag <<< '${rwCoreImg.trim()}'
169 EXTRA_HELM_FLAGS+="--set voltha.images.rw_core.repository=\$rwCoreRepo,voltha.images.rw_core.tag=\$rwCoreTag "
170 fi
171
172 # ofAgent custom image handling
173 if [ '${ofAgentImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'of-agent' ]; then
174 IFS=: read -r ofAgentRepo ofAgentTag <<< '${ofAgentImg.trim()}'
175 EXTRA_HELM_FLAGS+="--set voltha.images.ofagent.repository=\$ofAgentRepo,voltha.images.ofagent.tag=\$ofAgentTag "
176 fi
177
178 # OpenOLT custom image handling
179 if [ '${openoltAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openolt-adapter' ]; then
180 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< '${openoltAdapterImg.trim()}'
181 EXTRA_HELM_FLAGS+="--set voltha-adapter-openolt.images.adapter_open_olt.repository=\$openoltAdapterRepo,voltha-adapter-openolt.images.adapter_open_olt.tag=\$openoltAdapterTag "
182 fi
183
184 # OpenONU custom image handling
185 if [ '${openonuAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter' ]; then
186 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< '${openonuAdapterImg.trim()}'
187 EXTRA_HELM_FLAGS+="--set voltha-adapter-openonu.images.adapter_open_onu.repository=\$openonuAdapterRepo,voltha-adapter-openonu.images.adapter_open_onu.tag=\$openonuAdapterTag "
188 fi
189
190 # OpenONU GO custom image handling
191 if [ '${openonuAdapterGoImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter-go' ]; then
192 IFS=: read -r openonuAdapterGoRepo openonuAdapterGoTag <<< '${openonuAdapterGoImg.trim()}'
193 EXTRA_HELM_FLAGS+="--set voltha-adapter-openonu.images.adapter_open_onu_go.repository=\$openonuAdapterGoRepo,voltha-adapter-openonu.images.adapter_open_onu_go.tag=\$openonuAdapterGoTag "
194 fi
195
196 # ONOS custom image handling
197 if [ '${onosImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-onos' ]; then
198 IFS=: read -r onosRepo onosTag <<< '${onosImg.trim()}'
199 EXTRA_HELM_FLAGS+="--set onos-classic.image.repository=\$onosRepo,onos-classic.image.tag=\$onosTag "
200 fi
201
202 # set BBSim parameters
203 EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
204
205 # disable the securityContext, this is a development cluster
206 EXTRA_HELM_FLAGS+='--set securityContext.enabled=false '
207
208 # No persistent-volume-claims in Atomix
209 EXTRA_HELM_FLAGS+="--set onos-classic.atomix.persistence.enabled=false "
210
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700211 # Use custom built images
212
213 if [ '\$GERRIT_PROJECT' == 'voltha-go' ]; then
214 EXTRA_HELM_FLAGS+="--set voltha.images.rw_core.repository=${dockerRegistry}/voltha/voltha-rw-core,voltha.images.rw_core.tag=voltha-scale "
215 fi
216
217 if [ '\$GERRIT_PROJECT' == 'voltha-openolt-adapter' ]; then
218 EXTRA_HELM_FLAGS+="--set voltha-openolt-adapter.images.adapter_open_olt.repository=${dockerRegistry}/voltha/voltha-openolt-adapter,voltha-openolt-adapter.images.adapter_open_olt.tag=voltha-scale "
219 fi
220
221 if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter' ]; then
222 EXTRA_HELM_FLAGS+="--set voltha-openonu-adapter.images.adapter_open_onu.repository=${dockerRegistry}/voltha/voltha-openonu-adapter,voltha-openonu-adapter.images.adapter_open_onu.tag=voltha-scale "
223 fi
224
225 if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter-go' ]; then
226 EXTRA_HELM_FLAGS+="--set voltha-openonu-adapter-go.images.adapter_open_onu_go.repository=${dockerRegistry}/voltha/voltha-openonu-adapter-go,voltha-openonu-adapter-go.images.adapter_open_onu_go.tag=voltha-scale "
227 fi
228
229 if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then
230 EXTRA_HELM_FLAGS+="--set voltha.images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,ofagent-go.images.ofagent.tag=voltha-scale "
231 fi
232
233 if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then
234 EXTRA_HELM_FLAGS+="--set onos-classic.image.repository=${dockerRegistry}/voltha/voltha-onos,onos-classic.image.tag=voltha-scale "
235 fi
236
237 if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then
238 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale "
239 fi
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000240 echo \$EXTRA_HELM_FLAGS
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700241
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000242 """).trim()
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700243
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000244 def extraHelmFlags = returned_flags
245 // The added space before params.extraHelmFlags is required due to the .trim() above
246 def infraHelmFlags =
Matteo Scandolo529e8822021-07-21 10:20:18 -0700247 "--set global.log_level=${logLevel} " +
248 "--set radius.enabled=${withEapol} " +
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000249 "--set onos-classic.onosSshPort=30115 " +
250 "--set onos-classic.onosApiPort=30120 " +
251 extraHelmFlags + " " + params.extraHelmFlags
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700252
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000253 println "Passing the following parameters to the VOLTHA infra deploy: ${infraHelmFlags}."
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700254
Matteo Scandoloc11b0ad2021-07-13 10:55:08 -0700255 // in a released version we always want to use the local version of the helm-charts
256 def localCharts = true
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000257
258 volthaInfraDeploy([
259 workflow: workflow,
260 infraNamespace: "default",
261 extraHelmFlags: infraHelmFlags,
262 localCharts: localCharts,
263 onosReplica: onosReplicas,
264 atomixReplica: atomixReplicas,
265 kafkaReplica: kafkaReplicas,
266 etcdReplica: etcdReplicas,
Matteo Scandolo529e8822021-07-21 10:20:18 -0700267 onosReplica: onosReplicas,
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000268 ])
269
270 stackHelmFlags = " --set onu=${onus},pon=${pons} --set global.log_level=${logLevel.toLowerCase()} "
271 stackHelmFlags += " --set voltha.ingress.enabled=true --set voltha.ingress.enableVirtualHosts=true --set voltha.fullHostnameOverride=voltha.scale1.dev "
272 stackHelmFlags += extraHelmFlags + " " + params.extraHelmFlags
273
274 volthaStackDeploy([
275 bbsimReplica: olts.toInteger(),
276 infraNamespace: "default",
277 volthaNamespace: "default",
278 stackName: "voltha1", // TODO support custom charts
279 workflow: workflow,
280 extraHelmFlags: stackHelmFlags,
281 localCharts: localCharts,
282 ])
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700283 sh """
284 set +x
285
286 echo -ne "\nWaiting for VOLTHA and ONOS to start..."
287 voltha=\$(kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l)
288 onos=\$(kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l)
289 while [[ \$voltha != 0 || \$onos != 0 ]]; do
290 sleep 5
291 echo -ne "."
292 voltha=\$(kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l)
293 onos=\$(kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l)
294 done
295 echo -ne "\nVOLTHA and ONOS pods ready\n"
296 kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l
297 kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l
298 """
299 start_port_forward(olts)
300 }
301 }
302 }
303 }
304 stage('Configuration') {
305 steps {
306 script {
307 def tech_prof_directory = "XGS-PON"
308 sh returnStdout: false, script: """
309 #Setting link discovery
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700310 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${withLLDP}
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700311
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700312 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager allowExtraneousRules true
313 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager importExtraneousRules true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700314
315
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700316 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 900
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700317
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700318 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxIdleMillis 500
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700319
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700320 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.opencord.olt.impl.Olt provisionDelay 1000
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700321
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700322 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set ${logLevel} org.onosproject
323 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set ${logLevel} org.opencord
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700324
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700325 # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.cordmcast
326 # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.onosproject.mcast
327 # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.igmpproxy
328 # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.olt
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000329 # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.onosproject.net.flowobjective.impl.FlowObjectiveManager
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700330
331 kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false
332
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000333 # Set Flows/Ports/Meters/Groups poll frequency
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700334 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${onosStatInterval}
335 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${onosStatInterval}
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000336 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.group.impl.OpenFlowGroupProvider groupPollInterval ${onosGroupInterval}
337 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.FlowObjectiveManager numThreads ${flowObjWorkerThreads}
338 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager objectiveTimeoutMs 300000
339
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700340 if [ ${withFlows} = false ]; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700341 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.olt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700342 fi
343
344 if [ '${workflow}' = 'tt' ]; then
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000345 etcd_container=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$2}')
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700346 kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json
347 put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/hsia.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64')
348 kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json
349 put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/voip.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/65')
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000350 kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast.json
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700351 put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66')
352 fi
353
354 if [ ${withPcap} = true ] ; then
355 # Start the tcp-dump in ofagent
356 export OF_AGENT=\$(kubectl get pods -l app=ofagent -o name)
357 kubectl exec \$OF_AGENT -- apk update
358 kubectl exec \$OF_AGENT -- apk add tcpdump
359 kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
360 _TAG=ofagent-tcpdump kubectl exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap&
361
362 # Start the tcp-dump in radius
363 export RADIUS=\$(kubectl get pods -l app=radius -o name)
364 kubectl exec \$RADIUS -- apt-get update
365 kubectl exec \$RADIUS -- apt-get install -y tcpdump
366 _TAG=radius-tcpdump kubectl exec \$RADIUS -- tcpdump -w out.pcap&
367
368 # Start the tcp-dump in ONOS
369 for i in \$(seq 0 \$ONOSES); do
370 INSTANCE="onos-onos-classic-\$i"
371 kubectl exec \$INSTANCE -- apt-get update
372 kubectl exec \$INSTANCE -- apt-get install -y tcpdump
373 kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump
374 _TAG=\$INSTANCE kubectl exec \$INSTANCE -- /usr/bin/tcpdump -nei eth0 port 1812 -w out.pcap&
375 done
376 fi
377 """
378 }
379 }
380 }
Matteo Scandolofcb75632021-04-06 16:25:19 -0700381 stage('Load MIB Template') {
382 when {
383 expression {
384 return params.withMibTemplate
385 }
386 }
387 steps {
388 sh """
389 # load MIB template
390 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter-go/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000391 cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it \$(kubectl get pods |grep etcd-0 | awk 'NR==1{print \$1}') -- etcdctl put service/voltha/omci_mibs/go_templates/BBSM/12345123451234512345/00000000000001
Matteo Scandolofcb75632021-04-06 16:25:19 -0700392 """
393 }
394 }
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700395 stage('Run Test') {
396 steps {
397 sh '''
398 mkdir -p $WORKSPACE/RobotLogs
399 cd $WORKSPACE/voltha-system-tests
400 make vst_venv
401 '''
402 sh '''
403 if [ ${withProfiling} = true ] ; then
404 mkdir -p $LOG_FOLDER/pprof
405 echo $PATH
406 #Creating Python script for ONU Detection
407 cat << EOF > $WORKSPACE/pprof.sh
408timestamp() {
409 date +"%T"
410}
411
412i=0
413while [[ true ]]; do
414 ((i++))
415 ts=$(timestamp)
416 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png
417 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png
418 curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
419 go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png
420
421 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png
422 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png
423 curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
424 go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png
425
426 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png
427 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png
428 curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
429 go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png
430
431 sleep 10
432done
433EOF
434
435 _TAG="pprof"
436 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
437 fi
438 '''
439 timeout(time: 15, unit: 'MINUTES') {
440 sh '''
441 ROBOT_PARAMS="--exitonfailure \
442 -v olt:${olts} \
443 -v pon:${pons} \
444 -v onu:${onus} \
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000445 -v ONOS_SSH_PORT:30115 \
446 -v ONOS_REST_PORT:30120 \
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700447 -v workflow:${workflow} \
448 -v withEapol:${withEapol} \
449 -v withDhcp:${withDhcp} \
450 -v withIgmp:${withIgmp} \
451 --noncritical non-critical \
452 -e igmp -e teardown "
453
454 if [ ${withEapol} = false ] ; then
455 ROBOT_PARAMS+="-e authentication "
456 fi
457
458 if [ ${withDhcp} = false ] ; then
459 ROBOT_PARAMS+="-e dhcp "
460 fi
461
462 if [ ${provisionSubscribers} = false ] ; then
463 # if we're not considering subscribers then we don't care about authentication and dhcp
464 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
465 fi
466
467 if [ ${withFlows} = false ] ; then
468 ROBOT_PARAMS+="-i setup -i activation "
469 fi
470
471 cd $WORKSPACE/voltha-system-tests
472 source ./vst_venv/bin/activate
473 robot -d $WORKSPACE/RobotLogs \
474 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
475 '''
476 }
477 }
478 }
Matteo Scandolo36d897c2021-07-14 10:26:55 -0700479 }
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700480 post {
481 always {
482 // collect result, done in the "post" step so it's executed even in the
483 // event of a timeout in the tests
484 sh '''
485
486 # stop the kail processes
487 list=($APPS_TO_LOG)
488 for app in "${list[@]}"
489 do
490 echo "Stopping logs for: ${app}"
491 _TAG="kail-$app"
492 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
493 if [ -n "$P_IDS" ]; then
494 echo $P_IDS
495 for P_ID in $P_IDS; do
496 kill -9 $P_ID
497 done
498 fi
499 done
500
501 if [ ${withPcap} = true ] ; then
502 # stop ofAgent tcpdump
503 P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')"
504 if [ -n "\$P_ID" ]; then
505 kill -9 \$P_ID
506 fi
507
508 # stop radius tcpdump
509 P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')"
510 if [ -n "\$P_ID" ]; then
511 kill -9 \$P_ID
512 fi
513
514 # stop onos tcpdump
515 LIMIT=$(($NUM_OF_ONOS - 1))
516 for i in $(seq 0 $LIMIT); do
517 INSTANCE="onos-onos-classic-$i"
518 P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')"
519 if [ -n "\$P_ID" ]; then
520 kill -9 \$P_ID
521 fi
522 done
523
524 # copy the file
525 export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true
526 kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true
527
528 export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true
529 kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true
530
531 LIMIT=$(($NUM_OF_ONOS - 1))
532 for i in $(seq 0 $LIMIT); do
533 INSTANCE="onos-onos-classic-$i"
534 kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true
535 done
536 fi
537
538 cd voltha-system-tests
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000539 source ./vst_venv/bin/activate || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700540 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt || true
541 cat $WORKSPACE/execution-time.txt
542 '''
543 sh '''
544 if [ ${withProfiling} = true ] ; then
545 _TAG="pprof"
546 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
547 if [ -n "$P_IDS" ]; then
548 echo $P_IDS
549 for P_ID in $P_IDS; do
550 kill -9 $P_ID
551 done
552 fi
553 fi
554 '''
555 plot([
556 csvFileName: 'scale-test.csv',
557 csvSeries: [
558 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
559 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
560 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
561 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
562 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
563 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
564 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
565 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
566 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
567 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
568 ],
569 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
570 ])
571 step([$class: 'RobotPublisher',
572 disableArchiveOutput: false,
573 logFileName: '**/log*.html',
574 otherFiles: '',
575 outputFileName: '**/output*.xml',
576 outputPath: 'RobotLogs',
577 passThreshold: 100,
578 reportFileName: '**/report*.html',
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000579 onlyCritical: true,
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700580 unstableThreshold: 0]);
581 // get all the logs from kubernetes PODs
582 sh returnStdout: false, script: '''
583
584 # store information on running charts
585 helm ls > $LOG_FOLDER/helm-list.txt || true
586
587 # store information on the running pods
588 kubectl get pods -o wide > $LOG_FOLDER/pods.txt || true
589 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true
590 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true
591
592 # copy the ONOS logs directly from the container to avoid the color codes
593 printf '%s\n' $(kubectl get pods -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
594
595 # get ONOS cfg from the 3 nodes
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000596 # kubectl exec -t voltha-infra-onos-classic-0 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-0-cfg.txt || true
597 # kubectl exec -t voltha-infra-onos-classic-1 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-1-cfg.txt || true
598 # kubectl exec -t voltha-infra-onos-classic-2 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-2-cfg.txt || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700599
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000600 # kubectl exec -t voltha-infra-onos-classic-0 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-0-next-objs.txt || true
601 # kubectl exec -t voltha-infra-onos-classic-1 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-1-next-objs.txt || true
602 # kubectl exec -t voltha-infra-onos-classic-2 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-2-next-objs.txt || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700603
604 # get radius logs out of the container
605 kubectl cp $(kubectl get pods -l app=radius --no-headers | awk '{print $1}'):/var/log/freeradius/radius.log $LOG_FOLDER/radius.log || true
606 '''
607 // dump all the BBSim(s) ONU information
608 sh '''
609 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
610 IDS=($BBSIM_IDS)
611
612 for bbsim in "${IDS[@]}"
613 do
614 kubectl exec -t $bbsim -- bbsimctl onu list > $LOG_FOLDER/$bbsim-device-list.txt || true
615 kubectl exec -t $bbsim -- bbsimctl service list > $LOG_FOLDER/$bbsim-service-list.txt || true
616 kubectl exec -t $bbsim -- bbsimctl olt resources GEM_PORT > $LOG_FOLDER/$bbsim-flows-gem-ports.txt || true
617 kubectl exec -t $bbsim -- bbsimctl olt resources ALLOC_ID > $LOG_FOLDER/$bbsim-flows-alloc-ids.txt || true
618 kubectl exec -t $bbsim -- bbsimctl olt pons > $LOG_FOLDER/$bbsim-pon-resources.txt || true
619 done
620 '''
621 script {
622 // first make sure the port-forward is still running,
623 // sometimes Jenkins kills it relardless of the JENKINS_NODE_COOKIE=dontKillMe
624 def running = sh (
625 script: 'ps aux | grep port-forw | grep -E "onos|voltha" | grep -v grep | wc -l',
626 returnStdout: true
627 ).trim()
628 // if any of the voltha-api, onos-rest, onos-ssh port-forwards are not there
629 // kill all and restart
630 if (running != "3") {
631 start_port_forward(olts)
632 }
633 }
634 // get ONOS debug infos
635 sh '''
636
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700637 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 apps -a -s > $LOG_FOLDER/onos-apps.txt
638 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 nodes > $LOG_FOLDER/onos-nodes.txt
639 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 masters > $LOG_FOLDER/onos-masters.txt
640 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 roles > $LOG_FOLDER/onos-roles.txt
641 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg get > $LOG_FOLDER/onos-cfg.txt
642 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700643
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700644 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports > $LOG_FOLDER/onos-ports-list.txt
645 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 hosts > $LOG_FOLDER/onos-hosts-list.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700646
647 if [ ${withFlows} = true ] ; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700648 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-olts > $LOG_FOLDER/onos-olt-list.txt
649 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s > $LOG_FOLDER/onos-flows-list.txt
650 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 meters > $LOG_FOLDER/onos-meters-list.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700651 fi
652
653 if [ ${provisionSubscribers} = true ]; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700654 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-programmed-subscribers > $LOG_FOLDER/onos-programmed-subscribers.txt
655 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-programmed-meters > $LOG_FOLDER/onos-programmed-meters.txt
656 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-bpmeter-mappings > $LOG_FOLDER/onos-bpmeter-mappings.txt
657 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-failed-subscribers > $LOG_FOLDER/onos-failed-subscribers.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700658 fi
659
660 if [ ${withEapol} = true ] ; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700661 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 aaa-users > $LOG_FOLDER/onos-aaa-users.txt
662 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 aaa-statistics > $LOG_FOLDER/onos-aaa-statistics.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700663 fi
664
665 if [ ${withDhcp} = true ] ; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700666 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 dhcpl2relay-allocations > $LOG_FOLDER/onos-dhcp-allocations.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700667 fi
668
669 if [ ${withIgmp} = true ] ; then
Matteo Scandolo8731a1f2021-04-09 13:05:06 -0700670 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 mcast-host-routes > $LOG_FOLDER/onos-mcast-host-routes.txt
671 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 mcast-host-show > $LOG_FOLDER/onos-mcast-host-show.txt
672 sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 groups > $LOG_FOLDER/onos-groups.txt
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700673 fi
674 '''
675 // collect etcd metrics
676 sh '''
677 mkdir -p $WORKSPACE/etcd-metrics
678 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
679 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
680 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
681 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
682 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-sum.json || true
683 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_backend_commit_duration_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-backend-write-time-bucket.json || true
684 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_wal_fsync_duration_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-wal-fsync-time-bucket.json || true
685 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_network_peer_round_trip_time_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-network-peer-round-trip-time-seconds.json || true
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000686 etcd_namespace=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$1}')
687 etcd_container=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$2}')
688 kubectl exec -it -n \$etcd_namespace \$etcd_container -- etcdctl defrag --cluster || true
689 kubectl exec -it -n \$etcd_namespace \$etcd_container -- etcdctl endpoint status -w table > $WORKSPACE/etcd-metrics/etcd-status-table.txt || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700690
691 '''
692 // get VOLTHA debug infos
693 script {
694 try {
695 sh '''
696 voltctl -m 8MB device list -o json > $LOG_FOLDER/device-list.json || true
697 python -m json.tool $LOG_FOLDER/device-list.json > $LOG_FOLDER/voltha-devices-list.json || true
698 rm $LOG_FOLDER/device-list.json || true
699 voltctl -m 8MB device list > $LOG_FOLDER/voltha-devices-list.txt || true
700
701 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/voltha-device-flows-#.txt" || true
702 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/voltha-device-ports-#.txt" || true
703
704 printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB logicaldevice flows # > $LOG_FOLDER/voltha-logicaldevice-flows-#.txt" || true
705 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/voltha-logicaldevice-ports-#.txt" || true
706 '''
707 } catch(e) {
708 sh '''
709 echo "Can't get device list from voltclt"
710 '''
711 }
712 }
713 // get cpu usage by container
714 sh '''
715 if [ ${withMonitoring} = true ] ; then
716 cd $WORKSPACE/voltha-system-tests
Hardik Windlass6d9a82e2021-07-08 16:23:21 +0000717 source ./vst_venv/bin/activate || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700718 sleep 60 # we have to wait for prometheus to collect all the information
Hardik Windlass5cfb29a2021-08-10 09:39:29 +0000719 python scripts/sizing.py -o $WORKSPACE/plots || true
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700720 fi
721 '''
722 archiveArtifacts artifacts: 'execution-time.txt,logs/*,logs/pprof/*,RobotLogs/**/*,plots/*,etcd-metrics/*'
723 }
724 }
725}
726
727def start_port_forward(olts) {
728 sh """
Matteo Scandolofed6bab2021-03-31 14:19:57 -0700729 bbsimRestPortFwd=50071
730 for i in {0..${olts.toInteger() - 1}}; do
731 daemonize -E JENKINS_NODE_COOKIE="dontKillMe" /usr/local/bin/kubectl port-forward --address 0.0.0.0 -n default svc/bbsim\${i} \${bbsimRestPortFwd}:50071
732 ((bbsimRestPortFwd++))
733 done
734 """
735}