blob: 97b902113c533660f011a0b7de0a6ddb5625dbba [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 {
27 KUBECONFIG="$HOME/.kube/config"
28 VOLTCONFIG="$HOME/.volt/config"
Matteo Scandolob70b3e02020-05-07 11:50:26 -070029 SSHPASS="karaf"
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070030 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 -070031 TYPE="minimal"
32 FANCY=0
33 WITH_SIM_ADAPTERS="no"
34 WITH_RADIUS="yes"
35 WITH_BBSIM="yes"
36 LEGACY_BBSIM_INDEX="no"
37 DEPLOY_K8S="no"
38 CONFIG_SADIS="external"
Matteo Scandolo0430f672020-05-07 11:50:26 -070039 WITH_KAFKA="kafka.default.svc.cluster.local"
Matteo Scandoloa8afe122020-05-11 10:45:56 -070040 WITH_ETCD="etcd-cluster-client.default.svc.cluster.local"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070041
42 // install everything in the default namespace
43 VOLTHA_NS="default"
44 ADAPTER_NS="default"
45 INFRA_NS="default"
46 BBSIM_NS="default"
47
Matteo Scandolo0430f672020-05-07 11:50:26 -070048 // configurable options
49 WITH_EAPOL="${withEapol}"
50 WITH_DHCP="${withDhcp}"
51 WITH_IGMP="${withIgmp}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070052 VOLTHA_LOG_LEVEL="${logLevel}"
53 NUM_OF_BBSIM="${olts}"
Matteo Scandolo0430f672020-05-07 11:50:26 -070054 NUM_OF_OPENONU="${openonuAdapterReplicas}"
55 NUM_OF_ONOS="${onosReplicas}"
56 NUM_OF_ATOMIX="${atomixReplicas}"
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070057 WITH_PPROF="${withProfiling}"
Matteo Scandolo3136cca2020-05-15 14:14:27 -070058 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 -070059
Matteo Scandolo0430f672020-05-07 11:50:26 -070060 VOLTHA_CHART="${volthaChart}"
61 VOLTHA_BBSIM_CHART="${bbsimChart}"
62 VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}"
63 VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}"
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070064 }
65
66 stages {
67 stage ('Cleanup') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070068 steps {
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070069 timeout(time: 11, unit: 'MINUTES') {
70 sh returnStdout: false, script: """
71 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
Matteo Scandolob70b3e02020-05-07 11:50:26 -070072
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070073 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat|etcd-operator');
74 do
75 echo "Purging chart: \${hchart}"
76 helm delete --purge "\${hchart}"
77 done
78 bash /home/cord/voltha-scale/wait_for_pods.sh
Matteo Scandolob70b3e02020-05-07 11:50:26 -070079
Matteo Scandoloa731f8f2020-05-11 10:27:26 -070080 cd $WORKSPACE
81 rm -rf $WORKSPACE/*
82 """
83 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -070084 }
85 }
86 stage('Clone kind-voltha') {
87 steps {
88 checkout([
89 $class: 'GitSCM',
90 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]],
91 branches: [[ name: "master", ]],
92 extensions: [
93 [$class: 'WipeWorkspace'],
94 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
95 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
96 ],
97 ])
98 }
99 }
100 stage('Clone voltha-system-tests') {
101 steps {
102 checkout([
103 $class: 'GitSCM',
104 userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]],
105 branches: [[ name: "master", ]],
106 extensions: [
107 [$class: 'WipeWorkspace'],
108 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
109 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
110 ],
111 ])
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700112 script {
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700113 sh(script:"""
114 if [ ${volthaSystemTestsChange} != '' ] ; then
115 cd voltha-system-tests;
116 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
117 fi
118 """)
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700119 }
120 }
121 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700122 stage('Deploy common infrastructure') {
Matteo Scandoloa8afe122020-05-11 10:45:56 -0700123 // includes monitoring, kafka, etcd
Matteo Scandolo0430f672020-05-07 11:50:26 -0700124 steps {
125 sh '''
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700126 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 -0700127
Matteo Scandolo683b1442020-05-21 15:30:57 -0700128 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 -0700129
Matteo Scandolo0430f672020-05-07 11:50:26 -0700130 if [ ${withMonitoring} = true ] ; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700131 helm install -n nem-monitoring cord/nem-monitoring \
132 --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \
133 --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
Matteo Scandolo0430f672020-05-07 11:50:26 -0700134 fi
135
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700136 # 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 -0700137 bash /home/cord/voltha-scale/wait_for_pods.sh
138 '''
139 }
140 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700141 stage('Deploy Voltha') {
142 steps {
143 script {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700144 // TODO install etcd outside kind-voltha (no need to redeploy the operator everytime)
145 sh returnStdout: false, script: """
Matteo Scandolo0430f672020-05-07 11:50:26 -0700146 export EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} '
147
148 # BBSim custom image handling
149 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700150 EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700151
152 # VOLTHA and ofAgent custom image handling
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700153 IFS=: read -r rwCoreRepo rwCoreTag <<< ${rwCoreImg}
Matteo Scandolo0430f672020-05-07 11:50:26 -0700154 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700155 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 -0700156
157 # OpenOLT custom image handling
158 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700159 EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=\$openoltAdapterRepo,images.adapter_open_olt.tag=\$openoltAdapterTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700160
161 # OpenONU custom image handling
162 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700163 EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=\$openonuAdapterRepo,images.adapter_open_onu.tag=\$openonuAdapterTag "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700164
165 # ONOS custom image handling
166 IFS=: read -r onosRepo onosTag <<< ${onosImg}
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700167 EXTRA_HELM_FLAGS+="--set images.onos.repository=\$onosRepo,images.onos.tag=\$onosTag "
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700168
169
170 cd $WORKSPACE/kind-voltha/
171
172 ./voltha up
173 """
174 }
Matteo Scandoloac946522020-05-27 15:20:59 -0700175 // bbsim-sadis server takes a while to cache the subscriber entries
176 // wait for that before starting the tests
177 sleep(120)
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700178 }
179 }
Matteo Scandolo0430f672020-05-07 11:50:26 -0700180 stage('Configuration') {
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700181 steps {
182 sh '''
Matteo Scandolo0430f672020-05-07 11:50:26 -0700183 # Always deactivate org.opencord.kafka
184 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.kafka
185
186 #Setting link discovery
187 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}
188
189 #Setting LOG level to ${logLevel}
190 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 -0700191 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 -0700192
Matteo Scandolo3136cca2020-05-15 14:14:27 -0700193 # Set Flows/Ports/Meters poll frequency
194 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}
195 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}
196
Matteo Scandolo0430f672020-05-07 11:50:26 -0700197 if [ ${withEapol} = false ] || [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700198 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 -0700199 fi
200
201 if [ ${withDhcp} = false ] || [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700202 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 -0700203 fi
204
205 if [ ${withIgmp} = false ] || [ ${withFlows} = false ]; then
206 # FIXME will actually affected the tests only after VOL-3054 is addressed
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700207 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.igmpproxy
208 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 -0700209 fi
210
211 if [ ${withFlows} = false ]; then
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700212 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 -0700213 fi
214
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700215 if [ ${withMibTemplate} = true ] ; then
216 rm -f BBSM-12345123451234512345-00000000000001-v1.json
217 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
218 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
219 fi
Matteo Scandolo679ced22020-05-19 15:15:58 -0700220
Matteo Scandolo7332d632020-05-28 15:04:44 -0700221 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 -0700222 '''
223 }
224 }
225 stage('Run Test') {
226 steps {
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700227 sh '''
228 mkdir -p $WORKSPACE/RobotLogs
229 cd $WORKSPACE/voltha-system-tests
230 make vst_venv
231 '''
232 sh '''
233 if [ ${withProfiling} = true ] ; then
234 mkdir -p $WORKSPACE/logs/pprof
235 echo $PATH
236 #Creating Python script for ONU Detection
237 cat << EOF > $WORKSPACE/pprof.sh
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700238timestamp() {
239 date +"%T"
240}
241
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700242i=0
243while [[ true ]]; do
244 ((i++))
Matteo Scandolo3ddd3fb2020-05-12 14:31:14 -0700245 ts=$(timestamp)
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700246 go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $WORKSPACE/logs/pprof/rw-core-heap-\\$i-\\$ts.png
247 go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $WORKSPACE/logs/pprof/rw-core-goroutine-\\$i-\\$ts.png
248 curl -o $WORKSPACE/logs/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10
249 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 -0700250
Matteo Scandolo41cbc542020-05-12 13:59:12 -0700251 go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $WORKSPACE/logs/pprof/openolt-heap-\\$i-\\$ts.png
252 go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $WORKSPACE/logs/pprof/openolt-goroutine-\\$i-\\$ts.png
253 curl -o $WORKSPACE/logs/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10
254 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 -0700255
Matteo Scandolo731d12c2020-05-13 14:33:26 -0700256 go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $WORKSPACE/logs/pprof/ofagent-heap-\\$i-\\$ts.png
257 go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $WORKSPACE/logs/pprof/ofagent-goroutine-\\$i-\\$ts.png
258 curl -o $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10
259 go tool pprof -png $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.pprof > $WORKSPACE/logs/pprof/ofagent-profile-\\$i-\\$ts.png
260
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700261 sleep 10
262done
263EOF
264
265 _TAG="pprof"
266 _TAG=$_TAG bash $WORKSPACE/pprof.sh &
267 fi
268 '''
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700269 timeout(time: 11, unit: 'MINUTES') {
270 sh '''
271 ROBOT_PARAMS="-v olt:${olts} \
272 -v pon:${pons} \
273 -v onu:${onus} \
274 -v workflow:${workflow} \
275 -v withEapol:${withEapol} \
276 -v withDhcp:${withDhcp} \
277 -v withIgmp:${withIgmp} \
278 --noncritical non-critical \
279 -e teardown "
Matteo Scandolo0430f672020-05-07 11:50:26 -0700280
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700281 if [ ${withEapol} = false ] ; then
282 ROBOT_PARAMS+="-e authentication "
283 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700284
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700285 if [ ${withDhcp} = false ] ; then
286 ROBOT_PARAMS+="-e dhcp "
287 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700288
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700289 if [ ${provisionSubscribers} = false ] ; then
Matteo Scandolocd59fd02020-05-12 15:00:35 -0700290 # if we're not considering subscribers then we don't care about authentication and dhcp
Matteo Scandolo111c8932020-05-12 18:28:05 -0700291 ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp "
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700292 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700293
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700294 if [ ${withFlows} = false ] ; then
295 ROBOT_PARAMS+="-i setup -i activation "
296 fi
Matteo Scandolo0430f672020-05-07 11:50:26 -0700297
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700298 cd $WORKSPACE/voltha-system-tests
Matteo Scandolo9b0728b2020-05-11 08:25:57 -0700299 source ./vst_venv/bin/activate
300 robot -d $WORKSPACE/RobotLogs \
301 $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot
302 '''
303 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700304 }
305 }
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700306 }
307 post {
308 always {
Matteo Scandolo157f66c2020-05-12 09:26:19 -0700309 // collect result, done in the "post" step so it's executed even in the
310 // event of a timeout in the tests
311 sh '''
312 cd voltha-system-tests
313 source ./vst_venv/bin/activate
314 python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt
315 cat $WORKSPACE/execution-time.txt
316 '''
Matteo Scandoloa731f8f2020-05-11 10:27:26 -0700317 sh '''
318 if [ ${withProfiling} = true ] ; then
319 _TAG="pprof"
320 P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')"
321 if [ -n "$P_IDS" ]; then
322 echo $P_IDS
323 for P_ID in $P_IDS; do
324 kill -9 $P_ID
325 done
326 fi
327 fi
328 '''
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700329 plot([
330 csvFileName: 'scale-test.csv',
331 csvSeries: [
Matteo Scandolo272aed42020-05-08 15:05:57 -0700332 [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
333 [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
334 [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700335 [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700336 [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
337 [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
338 [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo64966762020-05-13 11:51:38 -0700339 [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolo272aed42020-05-08 15:05:57 -0700340 [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
341 [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''],
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700342 ],
343 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true
344 ])
345 step([$class: 'RobotPublisher',
346 disableArchiveOutput: false,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700347 logFileName: 'RobotLogs/log.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700348 otherFiles: '',
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700349 outputFileName: 'RobotLogs/output.xml',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700350 outputPath: '.',
351 passThreshold: 100,
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700352 reportFileName: 'RobotLogs/report.html',
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700353 unstableThreshold: 0]);
Matteo Scandolo502644b2020-05-18 08:56:18 -0700354 // get all the logs from kubernetes PODs
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700355 sh returnStdout: false, script: '''
356 LOG_FOLDER=$WORKSPACE/logs
357 mkdir -p $LOG_FOLDER
358
359 # store information on the running pods
360 kubectl get pods -o wide > $LOG_FOLDER/pods.txt
361 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt
362 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt
363
364 # log in individual files for all the container that match the selector app=$APP_TO_LOG
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700365 APPS_TO_LOG=(etcd kafka onos adapter-open-onu adapter-open-olt rw-core ofagent bbsim)
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700366 for app in "${APPS_TO_LOG[@]}"
367 do
368 echo "Getting logs for: ${app}"
369 kubectl get pods -l app=${app} -o=jsonpath=\"{.items[*]['metadata.name']}\"
Andrea Campanella743f52e2020-05-27 10:07:33 +0200370 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 -0700371
372 # Get the logs from the previous POD if any (useful in case of restarts)
373 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"
Matteo Scandoloede5abd2020-05-22 10:57:10 -0700374 done
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700375
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700376 # copy the ONOS logs directly from the container to avoid the color codes
377 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 -0700378 '''
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700379 // dump all the BBSim(s) ONU informations
380 sh '''
381 BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}')
382 IDS=($BBSIM_IDS)
383
384 for bbsim in "${IDS[@]}"
385 do
386 kubectl exec -t $bbsim bbsimctl onu list > $WORKSPACE/logs/$bbsim-device-list.txt
387 done
388 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700389 // get ONOS debug infos
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700390 sh '''
391 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 -0700392
393 if [ ${withFlows} = true ] ; then
394 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
395 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
396 fi
397
398 if [ ${provisionSubscribers} = true ]
399 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
400 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
401 fi
402
403 if [ ${withOnosApps} = true ] && [ ${withEapol} ] ; then
404 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
405 fi
406
407 if [ ${withOnosApps} = true ] && [ ${withDhcp} ] ; then
408 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
409 fi
Matteo Scandolob70b3e02020-05-07 11:50:26 -0700410 '''
Shrey Baidcf652c82020-05-21 13:35:04 +0530411 // get cpu usage by container
412 sh '''
413 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
414 '''
415 // collect etcd metrics
416 sh '''
417 mkdir $WORKSPACE/etcd-metrics
418 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
419 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
420 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
421 '''
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700422 // get VOLTHA debug infos
Matteo Scandolo502644b2020-05-18 08:56:18 -0700423 script {
424 try {
425 sh '''
426 voltctl device list -o json > $WORKSPACE/logs/device-list.json
427 python -m json.tool $WORKSPACE/logs/device-list.json > $WORKSPACE/logs/voltha-devices-list.json
Matteo Scandolo32da27d2020-05-29 10:38:31 -0700428
429 printf '%s\n' $(voltctl device list | grep olt | awk '{print $1}') | xargs -I@ bash -c "voltctl device flows @ > $WORKSPACE/logs/voltha-device-flows-@.txt"
430 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"
431
432 printf '%s\n' $(voltctl logicaldevice list -q) | xargs -I@ bash -c "voltctl logicaldevice flows @ > $WORKSPACE/logs/voltha-logicaldevice-flows-@.txt"
433 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 -0700434 '''
435 } catch(e) {
436 sh '''
437 echo "Can't get device list from voltclt"
438 '''
439 }
440 }
Matteo Scandolo0dc72af2020-05-12 10:14:57 -0700441 archiveArtifacts artifacts: 'kind-voltha/install-minimal.log,execution-time.txt,logs/*,logs/pprof/*,RobotLogs/*,plots/*.txt'
Matteo Scandolofbcbdb82020-05-06 15:41:32 -0700442 }
443 }
444}