blob: 02023a6643f1cb3881345f9afe308f212e020bf9 [file] [log] [blame]
Matteo Scandolofbcbdb82020-05-06 15:41:32 -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 using kind-voltha and performs a scale test
16
17pipeline {
18
19 /* no label, executor is determined by JJB */
20 agent {
21 label "${params.buildNode}"
22 }
23 options {
24 timeout(time: 30, unit: 'MINUTES')
25 }
26 environment {
Matteo Scandoloc3dea532020-06-04 10:46:49 -070027 JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070028 KUBECONFIG="$HOME/.kube/config"
29 VOLTCONFIG="$HOME/.volt/config"
Matteo Scandolob70b3e02020-05-07 11:50:26 -070030 SSHPASS="karaf"
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070031 PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070032 TYPE="minimal"
33 FANCY=0
34 WITH_SIM_ADAPTERS="no"
35 WITH_RADIUS="yes"
36 WITH_BBSIM="yes"
37 LEGACY_BBSIM_INDEX="no"
38 DEPLOY_K8S="no"
39 CONFIG_SADIS="external"
Matteo Scandolo0430f672020-05-07 11:50:26 -070040 WITH_KAFKA="kafka.default.svc.cluster.local"
Matteo Scandoloa8afe122020-05-11 10:45:56 -070041 WITH_ETCD="etcd-cluster-client.default.svc.cluster.local"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070042
43 // install everything in the default namespace
44 VOLTHA_NS="default"
45 ADAPTER_NS="default"
46 INFRA_NS="default"
47 BBSIM_NS="default"
48
Matteo Scandolo0430f672020-05-07 11:50:26 -070049 // configurable options
50 WITH_EAPOL="${withEapol}"
51 WITH_DHCP="${withDhcp}"
52 WITH_IGMP="${withIgmp}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070053 VOLTHA_LOG_LEVEL="${logLevel}"
54 NUM_OF_BBSIM="${olts}"
Matteo Scandolo0430f672020-05-07 11:50:26 -070055 NUM_OF_OPENONU="${openonuAdapterReplicas}"
56 NUM_OF_ONOS="${onosReplicas}"
57 NUM_OF_ATOMIX="${atomixReplicas}"
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070058 WITH_PPROF="${withProfiling}"
Matteo Scandolo3136cca2020-05-15 14:14:27 -070059 EXTRA_HELM_FLAGS="${extraHelmFlags} " // note that the trailing space is required to separate the parameters from appends done later
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070060
Matteo Scandolo0430f672020-05-07 11:50:26 -070061 VOLTHA_CHART="${volthaChart}"
62 VOLTHA_BBSIM_CHART="${bbsimChart}"
63 VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}"
64 VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070065 }
66
67 stages {
68 stage ('Cleanup') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070069 steps {
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070070 timeout(time: 11, unit: 'MINUTES') {
71 sh returnStdout: false, script: """
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070072 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat|etcd-operator');
73 do
74 echo "Purging chart: \${hchart}"
75 helm delete --purge "\${hchart}"
76 done
77 bash /home/cord/voltha-scale/wait_for_pods.sh
Matteo Scandolob70b3e02020-05-07 11:50:26 -070078
Matteo Scandoloed41d8a2020-06-03 13:13:49 -070079 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
80
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070081 cd $WORKSPACE
82 rm -rf $WORKSPACE/*
83 """
84 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070085 }
86 }
87 stage('Clone kind-voltha') {
88 steps {
89 checkout([
90 $class: 'GitSCM',
91 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
92 branches: [[ name: "master", ]],
93 extensions: [
94 [$class: 'WipeWorkspace'],
95 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
96 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
97 ],
98 ])
99 }
100 }
101 stage('Clone voltha-system-tests') {
102 steps {
103 checkout([
104 $class: 'GitSCM',
105 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
106 branches: [[ name: "master", ]],
107 extensions: [
108 [$class: 'WipeWorkspace'],
109 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
110 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
111 ],
112 ])
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700113 script {
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700114 sh(script:"""
115 if [ ${volthaSystemTestsChange} != '' ] ; then
Matteo Scandolo5708e2f2020-06-03 14:11:32 -0700116 cd $WORKSPACE/voltha-system-tests;
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700117 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
118 fi
Matteo Scandolo5708e2f2020-06-03 14:11:32 -0700119
120 if [ ${kindVolthaChange} != '' ] ; then
121 cd $WORKSPACE/kind-voltha;
122 git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD
123 fi
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700124 """)
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700125 }
126 }
127 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700128 stage('Deploy common infrastructure') {
Matteo Scandoloa8afe122020-05-11 10:45:56 -0700129 // includes monitoring, kafka, etcd
Matteo Scandolo0430f672020-05-07 11:50:26 -0700130 steps {
131 sh '''
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700132 helm install -n kafka incubator/kafka --version 0.13.3 --set replicas=3 --set persistence.enabled=false --set zookeeper.replicaCount=3 --set zookeeper.persistence.enabled=false --version=0.15.3
Matteo Scandolo0430f672020-05-07 11:50:26 -0700133
Matteo Scandolo683b1442020-05-21 15:30:57 -0700134 helm install --set clusterName=etcd-cluster --set autoCompactionRetention=1 --set clusterSize=3 --set defaults.log_level=WARN --namespace default -n etcd-cluster onf/voltha-etcd-cluster ${extraHelmFlags}
Matteo Scandoloa8afe122020-05-11 10:45:56 -0700135
Matteo Scandolo0430f672020-05-07 11:50:26 -0700136 if [ ${withMonitoring} = true ] ; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700137 helm install -n nem-monitoring cord/nem-monitoring \
138 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
139 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
Matteo Scandolo0430f672020-05-07 11:50:26 -0700140 fi
141
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700142 # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh
Matteo Scandolo0430f672020-05-07 11:50:26 -0700143 bash /home/cord/voltha-scale/wait_for_pods.sh
144 '''
145 }
146 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700147 stage('Deploy Voltha') {
148 steps {
149 script {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700150 // TODO install etcd outside kind-voltha (no need to redeploy the operator everytime)
151 sh returnStdout: false, script: """
Matteo Scandolo0430f672020-05-07 11:50:26 -0700152 export EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
153
154 # BBSim custom image handling
155 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700156 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700157
158 # VOLTHA and ofAgent custom image handling
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700159 IFS=: read -r rwCoreRepo rwCoreTag <<< ${rwCoreImg}
Matteo Scandolo0430f672020-05-07 11:50:26 -0700160 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700161 EXTRA_HELM_FLAGS+="--set images.rw_core.repository=\$rwCoreRepo,images.rw_core.tag=\$rwCoreTag,images.ofagent_go.repository=\$ofAgentRepo,images.ofagent_go.tag=\$ofAgentTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700162
163 # OpenOLT custom image handling
164 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700165 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=\$openoltAdapterRepo,images.adapter_open_olt.tag=\$openoltAdapterTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700166
167 # OpenONU custom image handling
168 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700169 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=\$openonuAdapterRepo,images.adapter_open_onu.tag=\$openonuAdapterTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700170
171 # ONOS custom image handling
172 IFS=: read -r onosRepo onosTag <<< ${onosImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700173 EXTRA_HELM_FLAGS+="--set images.onos.repository=\$onosRepo,images.onos.tag=\$onosTag "
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700174
175
176 cd $WORKSPACE/kind-voltha/
177
178 ./voltha up
179 """
180 }
Matteo Scandoloac946522020-05-27 15:20:59 -0700181 // bbsim-sadis server takes a while to cache the subscriber entries
182 // wait for that before starting the tests
183 sleep(120)
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700184 }
185 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700186 stage('Configuration') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700187 steps {
188 sh '''
Matteo Scandolo0430f672020-05-07 11:50:26 -0700189 # Always deactivate org.opencord.kafka
190 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.kafka
191
192 #Setting link discovery
193 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}
194
195 #Setting LOG level to ${logLevel}
196 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set ${logLevel}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700197 kubectl exec $(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print $1}') -- bbsimctl log ${logLevel} false
Matteo Scandolo0430f672020-05-07 11:50:26 -0700198
Matteo Scandolo3136cca2020-05-15 14:14:27 -0700199 # Set Flows/Ports/Meters poll frequency
200 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}
201 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}
202
Matteo Scandolo0430f672020-05-07 11:50:26 -0700203 if [ ${withEapol} = false ] || [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700204 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.aaa
Matteo Scandolo0430f672020-05-07 11:50:26 -0700205 fi
206
207 if [ ${withDhcp} = false ] || [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700208 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.dhcpl2relay
Matteo Scandolo0430f672020-05-07 11:50:26 -0700209 fi
210
211 if [ ${withIgmp} = false ] || [ ${withFlows} = false ]; then
212 # FIXME will actually affected the tests only after VOL-3054 is addressed
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700213 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.igmpproxy
214 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.mcast
Matteo Scandolo0430f672020-05-07 11:50:26 -0700215 fi
216
217 if [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700218 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt
Matteo Scandolo0430f672020-05-07 11:50:26 -0700219 fi
220
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700221 if [ ${withMibTemplate} = true ] ; then
222 rm -f BBSM-12345123451234512345-00000000000001-v1.json
223 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
224 cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it $(kubectl get pods | grep etcd-cluster | awk 'NR==1{print $1}') etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001
225 fi
226 '''
227 }
228 }
229 stage('Run Test') {
230 steps {
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700231 sh '''
232 mkdir -p $WORKSPACE/RobotLogs
233 cd $WORKSPACE/voltha-system-tests
234 make vst_venv
235 '''
236 sh '''
237 if [ ${withProfiling} = true ] ; then
238 mkdir -p $WORKSPACE/logs/pprof
239 echo $PATH
240 #Creating Python script for ONU Detection
241 cat << EOF > $WORKSPACE/pprof.sh
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700242timestamp() {
243 date +"%T"
244}
245
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700246i=0
247while [[ true ]]; do
248 ((i++))
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700249 ts=$(timestamp)
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700250 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $WORKSPACE/logs/pprof/rw-core-heap-\\$i-\\$ts.png
251 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $WORKSPACE/logs/pprof/rw-core-goroutine-\\$i-\\$ts.png
252 curl -o $WORKSPACE/logs/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
253 go tool pprof -png $WORKSPACE/logs/pprof/rw-core-profile-\\$i-\\$ts.pprof > $WORKSPACE/logs/pprof/rw-core-profile-\\$i-\\$ts.png
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700254
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700255 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $WORKSPACE/logs/pprof/openolt-heap-\\$i-\\$ts.png
256 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $WORKSPACE/logs/pprof/openolt-goroutine-\\$i-\\$ts.png
257 curl -o $WORKSPACE/logs/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
258 go tool pprof -png $WORKSPACE/logs/pprof/openolt-profile-\\$i-\\$ts.pprof > $WORKSPACE/logs/pprof/openolt-profile-\\$i-\\$ts.png
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700259
Matteo Scandolo731d12c2020-05-13 14:33:26 -0700260 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $WORKSPACE/logs/pprof/ofagent-heap-\\$i-\\$ts.png
261 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $WORKSPACE/logs/pprof/ofagent-goroutine-\\$i-\\$ts.png
262 curl -o $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
263 go tool pprof -png $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof > $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.png
264
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700265 sleep 10
266done
267EOF
268
269 _TAG="pprof"
270 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
271 fi
272 '''
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700273 timeout(time: 11, unit: 'MINUTES') {
274 sh '''
275 ROBOT_PARAMS="-v olt:${olts} \
276 -v pon:${pons} \
277 -v onu:${onus} \
278 -v workflow:${workflow} \
279 -v withEapol:${withEapol} \
280 -v withDhcp:${withDhcp} \
281 -v withIgmp:${withIgmp} \
282 --noncritical non-critical \
283 -e teardown "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700284
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700285 if [ ${withEapol} = false ] ; then
286 ROBOT_PARAMS+="-e authentication "
287 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700288
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700289 if [ ${withDhcp} = false ] ; then
290 ROBOT_PARAMS+="-e dhcp "
291 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700292
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700293 if [ ${provisionSubscribers} = false ] ; then
Matteo Scandolocd59fd02020-05-12 15:00:35 -0700294 # if we're not considering subscribers then we don't care about authentication and dhcp
Matteo Scandolo111c8932020-05-12 18:28:05 -0700295 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700296 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700297
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700298 if [ ${withFlows} = false ] ; then
299 ROBOT_PARAMS+="-i setup -i activation "
300 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700301
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700302 cd $WORKSPACE/voltha-system-tests
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700303 source ./vst_venv/bin/activate
304 robot -d $WORKSPACE/RobotLogs \
305 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
306 '''
307 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700308 }
309 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700310 }
311 post {
312 always {
Matteo Scandolo157f66c2020-05-12 09:26:19 -0700313 // collect result, done in the "post" step so it's executed even in the
314 // event of a timeout in the tests
315 sh '''
316 cd voltha-system-tests
317 source ./vst_venv/bin/activate
318 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
319 cat $WORKSPACE/execution-time.txt
320 '''
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700321 sh '''
322 if [ ${withProfiling} = true ] ; then
323 _TAG="pprof"
324 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
325 if [ -n "$P_IDS" ]; then
326 echo $P_IDS
327 for P_ID in $P_IDS; do
328 kill -9 $P_ID
329 done
330 fi
331 fi
332 '''
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700333 plot([
334 csvFileName: 'scale-test.csv',
335 csvSeries: [
Matteo Scandolo272aed42020-05-08 15:05:57 -0700336 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
337 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
338 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700339 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700340 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
341 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
342 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700343 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700344 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
345 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700346 ],
347 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
348 ])
349 step([$class: 'RobotPublisher',
350 disableArchiveOutput: false,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700351 logFileName: 'RobotLogs/log.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700352 otherFiles: '',
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700353 outputFileName: 'RobotLogs/output.xml',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700354 outputPath: '.',
355 passThreshold: 100,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700356 reportFileName: 'RobotLogs/report.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700357 unstableThreshold: 0]);
Matteo Scandolo502644b2020-05-18 08:56:18 -0700358 // get all the logs from kubernetes PODs
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700359 sh returnStdout: false, script: '''
360 LOG_FOLDER=$WORKSPACE/logs
361 mkdir -p $LOG_FOLDER
362
363 # store information on the running pods
364 kubectl get pods -o wide > $LOG_FOLDER/pods.txt
365 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt
366 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt
367
368 # log in individual files for all the container that match the selector app=$APP_TO_LOG
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700369 APPS_TO_LOG=(etcd kafka onos adapter-open-onu adapter-open-olt rw-core ofagent bbsim)
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700370 for app in "${APPS_TO_LOG[@]}"
371 do
372 echo "Getting logs for: ${app}"
373 kubectl get pods -l app=${app} -o=jsonpath=\"{.items[*]['metadata.name']}\"
Andrea Campanella743f52e2020-05-27 10:07:33 +0200374 printf '%s\n' $(kubectl get pods -l app=$app -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I@ bash -c "kubectl logs @ > $LOG_FOLDER/@.log"
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700375
376 # Get the logs from the previous POD if any (useful in case of restarts)
Matteo Scandolof4de4962020-05-29 13:34:20 -0700377 printf '%s\n' $(kubectl get pods -l app=$app -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I@ bash -c "kubectl logs -p @ > $LOG_FOLDER/@-previous.log" || true
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700378 done
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700379
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700380 # copy the ONOS logs directly from the container to avoid the color codes
381 printf '%s\n' $(kubectl get pods -l app=onos-onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I@ bash -c "kubectl cp @:apache-karaf-4.2.8/data/log/karaf.log $LOG_FOLDER/@.log"
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700382 '''
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700383 // dump all the BBSim(s) ONU informations
384 sh '''
385 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
386 IDS=($BBSIM_IDS)
387
388 for bbsim in "${IDS[@]}"
389 do
390 kubectl exec -t $bbsim bbsimctl onu list > $WORKSPACE/logs/$bbsim-device-list.txt
391 done
392 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700393 // get ONOS debug infos
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700394 sh '''
395 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 ports > $WORKSPACE/logs/onos-ports-list.txt
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700396
397 if [ ${withFlows} = true ] ; then
398 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 flows -s > $WORKSPACE/logs/onos-flows-list.txt
399 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 meters > $WORKSPACE/logs/onos-meters-list.txt
400 fi
401
Matteo Scandolo0bf7e9e2020-05-29 18:17:50 -0700402 if [ ${provisionSubscribers} = true ]; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700403 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-subscribers > $WORKSPACE/logs/onos-programmed-subscribers.txt
404 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-meters > $WORKSPACE/logs/onos-programmed-meters.txt
405 fi
406
Matteo Scandolo172c9ca2020-06-10 12:23:48 -0700407 if [ ${withEapol} = true ] ; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700408 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 aaa-users > $WORKSPACE/logs/onos-aaa-users.txt
409 fi
410
Matteo Scandolo172c9ca2020-06-10 12:23:48 -0700411 if [ ${withDhcp} = true ] ; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700412 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 dhcpl2relay-allocations > $WORKSPACE/logs/onos-dhcp-allocations.txt
413 fi
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700414 '''
Shrey Baidcf652c82020-05-21 13:35:04 +0530415 // get cpu usage by container
416 sh '''
417 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=avg(rate(container_cpu_usage_seconds_total[10m])*100) by (pod_name)' | jq . > $WORKSPACE/cpu-usage.json
418 '''
419 // collect etcd metrics
420 sh '''
421 mkdir $WORKSPACE/etcd-metrics
422 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_debugging_mvcc_keys_total' | jq '.data.result[0].value[1]' > $WORKSPACE/etcd-metrics/etcd-key-count.json
423 curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=grpc_server_handled_total{grpc_code="OK",grpc_service="etcdserverpb.KV"}' | jq . > $WORKSPACE/etcd-metrics/etcd-rpc-count.json
424 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.result[0].value[1]' > $WORKSPACE/etcd-metrics/etcd-db-size.json
425 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700426 // get VOLTHA debug infos
Matteo Scandolo502644b2020-05-18 08:56:18 -0700427 script {
428 try {
429 sh '''
430 voltctl device list -o json > $WORKSPACE/logs/device-list.json
431 python -m json.tool $WORKSPACE/logs/device-list.json > $WORKSPACE/logs/voltha-devices-list.json
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700432
433 printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device flows @ > $WORKSPACE/logs/voltha-device-flows-@.txt"
434 printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' @ > $WORKSPACE/logs/voltha-device-ports-@.txt"
435
436 printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice flows @ > $WORKSPACE/logs/voltha-logicaldevice-flows-@.txt"
437 printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice port list @ > $WORKSPACE/logs/voltha-logicaldevice-ports-@.txt"
Matteo Scandolo502644b2020-05-18 08:56:18 -0700438 '''
439 } catch(e) {
440 sh '''
441 echo "Can't get device list from voltclt"
442 '''
443 }
444 }
Matteo Scandolo0dc72af2020-05-12 10:14:57 -0700445 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*.txt'
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700446 }
447 }
448}