blob: 2222803e2c5eb50aeccf4e8f0f66ff8132659d53 [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
Matteo Scandolo679ced22020-05-19 15:15:58 -0700226
Matteo Scandolo7332d632020-05-28 15:04:44 -0700227 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 log:set DEBUG org.opencord.olt
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700228 '''
229 }
230 }
231 stage('Run Test') {
232 steps {
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700233 sh '''
234 mkdir -p $WORKSPACE/RobotLogs
235 cd $WORKSPACE/voltha-system-tests
236 make vst_venv
237 '''
238 sh '''
239 if [ ${withProfiling} = true ] ; then
240 mkdir -p $WORKSPACE/logs/pprof
241 echo $PATH
242 #Creating Python script for ONU Detection
243 cat << EOF > $WORKSPACE/pprof.sh
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700244timestamp() {
245 date +"%T"
246}
247
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700248i=0
249while [[ true ]]; do
250 ((i++))
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700251 ts=$(timestamp)
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700252 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $WORKSPACE/logs/pprof/rw-core-heap-\\$i-\\$ts.png
253 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $WORKSPACE/logs/pprof/rw-core-goroutine-\\$i-\\$ts.png
254 curl -o $WORKSPACE/logs/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
255 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 -0700256
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700257 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $WORKSPACE/logs/pprof/openolt-heap-\\$i-\\$ts.png
258 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $WORKSPACE/logs/pprof/openolt-goroutine-\\$i-\\$ts.png
259 curl -o $WORKSPACE/logs/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
260 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 -0700261
Matteo Scandolo731d12c2020-05-13 14:33:26 -0700262 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $WORKSPACE/logs/pprof/ofagent-heap-\\$i-\\$ts.png
263 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $WORKSPACE/logs/pprof/ofagent-goroutine-\\$i-\\$ts.png
264 curl -o $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
265 go tool pprof -png $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof > $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.png
266
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700267 sleep 10
268done
269EOF
270
271 _TAG="pprof"
272 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
273 fi
274 '''
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700275 timeout(time: 11, unit: 'MINUTES') {
276 sh '''
277 ROBOT_PARAMS="-v olt:${olts} \
278 -v pon:${pons} \
279 -v onu:${onus} \
280 -v workflow:${workflow} \
281 -v withEapol:${withEapol} \
282 -v withDhcp:${withDhcp} \
283 -v withIgmp:${withIgmp} \
284 --noncritical non-critical \
285 -e teardown "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700286
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700287 if [ ${withEapol} = false ] ; then
288 ROBOT_PARAMS+="-e authentication "
289 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700290
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700291 if [ ${withDhcp} = false ] ; then
292 ROBOT_PARAMS+="-e dhcp "
293 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700294
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700295 if [ ${provisionSubscribers} = false ] ; then
Matteo Scandolocd59fd02020-05-12 15:00:35 -0700296 # if we're not considering subscribers then we don't care about authentication and dhcp
Matteo Scandolo111c8932020-05-12 18:28:05 -0700297 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700298 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700299
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700300 if [ ${withFlows} = false ] ; then
301 ROBOT_PARAMS+="-i setup -i activation "
302 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700303
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700304 cd $WORKSPACE/voltha-system-tests
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700305 source ./vst_venv/bin/activate
306 robot -d $WORKSPACE/RobotLogs \
307 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
308 '''
309 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700310 }
311 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700312 }
313 post {
314 always {
Matteo Scandolo157f66c2020-05-12 09:26:19 -0700315 // collect result, done in the "post" step so it's executed even in the
316 // event of a timeout in the tests
317 sh '''
318 cd voltha-system-tests
319 source ./vst_venv/bin/activate
320 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
321 cat $WORKSPACE/execution-time.txt
322 '''
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700323 sh '''
324 if [ ${withProfiling} = true ] ; then
325 _TAG="pprof"
326 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
327 if [ -n "$P_IDS" ]; then
328 echo $P_IDS
329 for P_ID in $P_IDS; do
330 kill -9 $P_ID
331 done
332 fi
333 fi
334 '''
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700335 plot([
336 csvFileName: 'scale-test.csv',
337 csvSeries: [
Matteo Scandolo272aed42020-05-08 15:05:57 -0700338 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
339 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
340 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700341 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700342 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
343 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
344 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700345 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700346 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
347 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700348 ],
349 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
350 ])
351 step([$class: 'RobotPublisher',
352 disableArchiveOutput: false,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700353 logFileName: 'RobotLogs/log.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700354 otherFiles: '',
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700355 outputFileName: 'RobotLogs/output.xml',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700356 outputPath: '.',
357 passThreshold: 100,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700358 reportFileName: 'RobotLogs/report.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700359 unstableThreshold: 0]);
Matteo Scandolo502644b2020-05-18 08:56:18 -0700360 // get all the logs from kubernetes PODs
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700361 sh returnStdout: false, script: '''
362 LOG_FOLDER=$WORKSPACE/logs
363 mkdir -p $LOG_FOLDER
364
365 # store information on the running pods
366 kubectl get pods -o wide > $LOG_FOLDER/pods.txt
367 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt
368 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt
369
370 # log in individual files for all the container that match the selector app=$APP_TO_LOG
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700371 APPS_TO_LOG=(etcd kafka onos adapter-open-onu adapter-open-olt rw-core ofagent bbsim)
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700372 for app in "${APPS_TO_LOG[@]}"
373 do
374 echo "Getting logs for: ${app}"
375 kubectl get pods -l app=${app} -o=jsonpath=\"{.items[*]['metadata.name']}\"
Andrea Campanella743f52e2020-05-27 10:07:33 +0200376 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 -0700377
378 # Get the logs from the previous POD if any (useful in case of restarts)
Matteo Scandolof4de4962020-05-29 13:34:20 -0700379 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 -0700380 done
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700381
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700382 # copy the ONOS logs directly from the container to avoid the color codes
383 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 -0700384 '''
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700385 // dump all the BBSim(s) ONU informations
386 sh '''
387 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
388 IDS=($BBSIM_IDS)
389
390 for bbsim in "${IDS[@]}"
391 do
392 kubectl exec -t $bbsim bbsimctl onu list > $WORKSPACE/logs/$bbsim-device-list.txt
393 done
394 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700395 // get ONOS debug infos
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700396 sh '''
397 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 -0700398
399 if [ ${withFlows} = true ] ; then
400 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
401 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
402 fi
403
Matteo Scandolo0bf7e9e2020-05-29 18:17:50 -0700404 if [ ${provisionSubscribers} = true ]; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700405 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
406 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
407 fi
408
Matteo Scandolo9bb3ffb2020-06-05 13:17:00 -0700409 if [ ${withOnosApps} = true ] && [ ${withEapol} = true ] ; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700410 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
411 fi
412
Matteo Scandolo9bb3ffb2020-06-05 13:17:00 -0700413 if [ ${withOnosApps} = true ] && [ ${withDhcp} = true ] ; then
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700414 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
415 fi
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700416 '''
Shrey Baidcf652c82020-05-21 13:35:04 +0530417 // get cpu usage by container
418 sh '''
419 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
420 '''
421 // collect etcd metrics
422 sh '''
423 mkdir $WORKSPACE/etcd-metrics
424 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
425 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
426 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
427 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700428 // get VOLTHA debug infos
Matteo Scandolo502644b2020-05-18 08:56:18 -0700429 script {
430 try {
431 sh '''
432 voltctl device list -o json > $WORKSPACE/logs/device-list.json
433 python -m json.tool $WORKSPACE/logs/device-list.json > $WORKSPACE/logs/voltha-devices-list.json
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700434
435 printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device flows @ > $WORKSPACE/logs/voltha-device-flows-@.txt"
436 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"
437
438 printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice flows @ > $WORKSPACE/logs/voltha-logicaldevice-flows-@.txt"
439 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 -0700440 '''
441 } catch(e) {
442 sh '''
443 echo "Can't get device list from voltclt"
444 '''
445 }
446 }
Matteo Scandolo0dc72af2020-05-12 10:14:57 -0700447 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*.txt'
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700448 }
449 }
450}