blob: dad278e294415f267fd8ba74249733e5d24ecdfb [file] [log] [blame]
Matteo Scandolo51b76302020-02-05 12:07:23 -08001/* voltha-scale-measurements pipeline */
2pipeline {
Matteo Scandolo51b76302020-02-05 12:07:23 -08003 /* no label, executor is determined by JJB */
4 agent {
5 label "${params.buildNode}"
6 }
Shrey Baid00ff5c42020-02-07 15:14:08 -08007 environment {
Shrey Baidb001c712020-02-11 11:12:46 -08008 SSHPASS="karaf"
Shrey Baid00ff5c42020-02-07 15:14:08 -08009 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080010 stages {
Matteo Scandolod1a15082020-04-22 10:57:49 -070011 stage('Set build description') {
Shrey Baide7614d02020-02-25 10:26:42 -080012 steps {
13 script {
Shrey Baid943e2072020-03-04 10:31:32 -080014 currentBuild.description = "$BUILD_TIMESTAMP"
Shrey Baide7614d02020-02-25 10:26:42 -080015 }
16 }
17 }
Matteo Scandolod1a15082020-04-22 10:57:49 -070018 stage('Cleanup') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080019 steps {
Shrey Baidb0447182020-02-27 16:39:35 -080020 sh '''
Matteo Scandolod1a15082020-04-22 10:57:49 -070021 rm -rf *.txt
Matteo Scandolodd5bbe92020-03-27 11:43:08 -070022 for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat|etcd-operator');
Matteo Scandolo151e35c2020-02-28 15:45:15 -080023 do
24 echo "Purging chart: \${hchart}"
25 helm delete --purge "\${hchart}"
26 done
Shrey Baidb0447182020-02-27 16:39:35 -080027 bash /home/cord/voltha-scale/wait_for_pods.sh
28 bash /home/cord/voltha-scale/stop_port_forward.sh
29 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080030 }
31 }
Matteo Scandolod1a15082020-04-22 10:57:49 -070032 stage('Start') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080033 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080034 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080035 #!/usr/bin/env bash
36 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080037 '''
38 }
39 }
Matteo Scandolod1a15082020-04-22 10:57:49 -070040 stage('Deploy voltha') {
Matteo Scandolo2fc1dac2020-03-09 08:39:53 -070041 options {
42 timeout(time:10)
43 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080044 steps {
45 sh '''
Matteo Scandoloa3470b72020-03-17 12:26:47 -070046 helm repo update
Matteo Scandolof87e1da2020-04-16 16:13:31 -070047 helm install -n cord-kafka incubator/kafka -f /home/cord/voltha-scale/voltha-values.yaml --version 0.13.3 --set replicas=${numOfKafka} --set persistence.enabled=false --set zookeeper.replicaCount=${numOfKafka} --set zookeeper.persistence.enabled=false
Matteo Scandoloe1c200f2020-03-24 10:33:58 -070048 helm install -n nem-monitoring cord/nem-monitoring --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false
Shrey Baidb06b55a2020-03-12 15:04:58 -070049
Matteo Scandolof87e1da2020-04-16 16:13:31 -070050 helm install -n radius onf/freeradius ${extraHelmFlags}
51
Matteo Scandolod1a15082020-04-22 10:57:49 -070052 # Multi BBSim sadis server (to be migrated in ONF and included in the helm-chart)
53 # kubectl create -f https://raw.githubusercontent.com/ciena/bbsim-sadis-server/master/bbsim-sadis-server.yaml
54
Matteo Scandolof87e1da2020-04-16 16:13:31 -070055 # NOTE wait for the infrastructure to be running before installing VOLTHA
56 bash /home/cord/voltha-scale/wait_for_pods.sh
57
Matteo Scandoloe69614f2020-03-10 11:35:35 -070058 IFS=: read -r onosRepo onosTag <<< ${onosImg}
59 helm install -n onos onf/onos --set images.onos.repository=${onosRepo} --set images.onos.tag=${onosTag} ${extraHelmFlags}
Shrey Baidb0447182020-02-27 16:39:35 -080060
Matteo Scandoloa2928e72020-03-02 16:38:22 -080061 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070062 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
Matteo Scandolofddcb002020-03-24 09:14:57 -070063 helm install -n voltha ${volthaChart} -f /home/cord/voltha-scale/voltha-values.yaml --set defaults.log_level=${logLevel},images.rw_core.repository=${volthaRepo},images.rw_core.tag=${volthaTag},images.ofagent_go.repository=${ofAgentRepo},images.ofagent_go.tag=${ofAgentTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080064
65 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
Matteo Scandolo330f7522020-03-17 17:15:53 -070066 helm install -n openolt ${openoltAdapterChart} -f /home/cord/voltha-scale/voltha-values.yaml --set defaults.log_level=${logLevel},images.adapter_open_olt.repository=${openoltAdapterRepo},images.adapter_open_olt.tag=${openoltAdapterTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080067
68 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
Matteo Scandolo330f7522020-03-17 17:15:53 -070069 helm install -n openonu ${openonuAdapterChart} -f /home/cord/voltha-scale/voltha-values.yaml --set defaults.log_level=${logLevel},images.adapter_open_onu.repository=${openonuAdapterRepo},images.adapter_open_onu.tag=${openonuAdapterTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080070
71 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
Matteo Scandolo7059b082020-03-17 09:05:03 -070072
Matteo Scandolof87e1da2020-04-16 16:13:31 -070073 for i in $(seq 1 $((${numOfBbsim}))); do
74 helm install -n bbsim-$i ${bbsimChart} --set olt_id=$i,enablePerf=true,pon=${ponPorts},onu=${onuPerPon},auth=${bbsimAuth},dhcp=${bbsimDhcp},delay=${BBSIMdelay},images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag} ${extraHelmFlags}
75 done
Shrey Baidb0447182020-02-27 16:39:35 -080076
Shrey Baidb0447182020-02-27 16:39:35 -080077 bash /home/cord/voltha-scale/wait_for_pods.sh
78 bash /home/cord/voltha-scale/start_port_forward.sh
Shrey Baid00ff5c42020-02-07 15:14:08 -080079 '''
80 }
81 }
Matteo Scandolod1a15082020-04-22 10:57:49 -070082 stage('Wait for Adapters to be registered in VOLTHA') {
Matteo Scandolo2fc1dac2020-03-09 08:39:53 -070083 options {
84 timeout(time:5)
85 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080086 steps{
87 waitUntil {
88 script {
89 openolt_res = sh returnStdout: true, script: """
90 voltctl adapter list | grep openolt | wc -l
91 """
92
93 openonu_res = sh returnStdout: true, script: """
94 voltctl adapter list | grep brcm_openomci_onu | wc -l
95 """
96
Matteo Scandolo89f1cea2020-04-10 10:20:20 -070097 return openolt_res.toInteger() >= 1 && openonu_res.toInteger() >= 1
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080098 }
99 }
100 }
101 }
Matteo Scandolod1a15082020-04-22 10:57:49 -0700102 stage('Push MIB template to ETCD') {
Shrey Baide7614d02020-02-25 10:26:42 -0800103 steps {
104 sh '''
105 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800106 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -0800107 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -0800108 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
Shrey Baide7614d02020-02-25 10:26:42 -0800109 fi
110 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800111 }
Shrey Baide7614d02020-02-25 10:26:42 -0800112 }
Matteo Scandolod1a15082020-04-22 10:57:49 -0700113 stage('Configure ONOS and VOLTHA') {
Shrey Baide7614d02020-02-25 10:26:42 -0800114 steps {
115 sh '''
Matteo Scandolo330f7522020-03-17 17:15:53 -0700116 #Setting LOG level to ${logLevel}
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700117 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set ${logLevel}
Shrey Baidb0447182020-02-27 16:39:35 -0800118 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Matteo Scandolod1a15082020-04-22 10:57:49 -0700119
Shrey Baide7614d02020-02-25 10:26:42 -0800120 #Setting link discovery
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700121 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery}
Matteo Scandolod1a15082020-04-22 10:57:49 -0700122
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800123 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800124 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Matteo Scandolod1a15082020-04-22 10:57:49 -0700125
126 #Setting the flow and ports stats collection interval
127 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval}
128 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval}
129
Matteo Scandoloc9812232020-04-22 14:18:07 -0700130 # Always deactivate org.opencord.kafka
131 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.kafka
132
Matteo Scandolod1a15082020-04-22 10:57:49 -0700133 #Check withOnosApps and disable apps accordingly
134 if [ ${withOnosApps} = false ] ; then
135 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.olt
136 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.aaa
137 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.dhcpl2relay
138 else
139 curl --fail -sSL --user karaf:karaf -X POST -H Content-Type:application/json "http://127.0.0.1:30120/onos/v1/network/configuration/apps/org.opencord.sadis" --data '{
140 "sadis": {
141 "integration": {
142 "url": "http://bbsim-sadis-server.default.svc:58080/subscribers/%s",
143 "cache": {
144 "enabled": true,
145 "maxsize": 50,
146 "ttl": "PT1m"
147 }
148 }
149 },
150 "bandwidthprofile": {
151 "integration": {
152 "url": "http://bbsim-sadis-server.default.svc:58080/profiles/%s",
153 "cache": {
154 "enabled": true,
155 "maxsize": 50,
156 "ttl": "PT1m"
157 }
158 }
159 }
160 }'
161 fi
Shrey Baide7614d02020-02-25 10:26:42 -0800162 '''
163 }
164 }
Matteo Scandolod1a15082020-04-22 10:57:49 -0700165 stage('Set timeout at 10 minutes') {
Shrey Baide7614d02020-02-25 10:26:42 -0800166 options {
167 timeout(time:10)
168 }
169 stages {
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700170 stage('Activate OLTs') {
171 steps {
172 sh '''
173 for i in $(seq 1 $((${numOfBbsim}))); do
174 voltctl device create -t openolt -H bbsim-$i:50060 -m 0f:f1:ce:c$i:ff:ee
175 done
176 voltctl device list --filter Type~openolt -q | xargs voltctl device enable
177 '''
178 }
179 }
Matteo Scandolod1a15082020-04-22 10:57:49 -0700180 stage('Wait for ONUs to be enabled') {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800181 steps {
182 sh '''
183 if [ -z ${expectedOnus} ]
184 then
185 echo -e "You need to set the target ONU number\n"
186 exit 1
187 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800188
Shrey Baida3b8aa62020-02-13 11:22:51 -0800189 # check ONUs reached Active State in VOLTHA
190 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
191 until [ $i -eq ${expectedOnus} ]
192 do
193 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
194 sleep ${pollInterval}
195 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
196 done
197 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolod1a15082020-04-22 10:57:49 -0700198
Shrey Baid49bf8f62020-03-09 17:52:01 -0700199 echo $SECONDS > voltha-devices-time-num.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700200
201 echo "VOLTHA Duration(s)" > voltha-devices-time.txt
202 cat voltha-devices-time-num.txt >> voltha-devices-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800203 '''
204 }
205 }
Matteo Scandolod1a15082020-04-22 10:57:49 -0700206 stage('Wait for ports to be discovered in ONOS') {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800207 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800208 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800209 # Check ports showed up in ONOS
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700210 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800211 until [ $z -eq ${expectedOnus} ]
212 do
213 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
214 sleep ${pollInterval}
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700215 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800216 done
217 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolod1a15082020-04-22 10:57:49 -0700218
Shrey Baid49bf8f62020-03-09 17:52:01 -0700219 echo $SECONDS > temp.txt
220 paste voltha-devices-time-num.txt temp.txt | awk '{print ($1 + $2)}' > onos-ports-time-num.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700221
222 echo "PORTs Duration(s)" > onos-ports-time.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700223 cat onos-ports-time-num.txt >> onos-ports-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800224 '''
225 }
226 }
Matteo Scandoloc9812232020-04-22 14:18:07 -0700227 stage('Wait for flows to be programmed in VOLTHA') {
228 steps {
229 sh '''
230 if [ ${withOnosApps} = false ] ; then
231 echo "ONOS Apps are not enabled, nothing to check"
232 else
233 function get_flows() {
234 local TOTAL
235 TOTAL=0
236
237 arr=("$@")
238 for id in "${arr[@]}"
239 do
240 TOTAL=$((TOTAL + $(voltctl logicaldevice flows $id | grep -v ID | wc -l)))
241 done
242 echo $TOTAL
243 }
244
245 LOGICAL_DEVICE_IDS=$(voltctl logicaldevice list | grep BBSIM | awk '{print $1}')
246 IDS=($LOGICAL_DEVICE_IDS)
247
248 FLOWS=$(get_flows "${IDS[@]}")
249
250 until [ $FLOWS -eq ${expectedFlows} ]
251 do
252 echo "${FLOWS} of ${expectedFlows} flows programmed in VOLTHA (time: $SECONDS)"
253 sleep ${pollInterval}
254 FLOWS=$(get_flows "${IDS[@]}")
255 done
256 echo "${expectedFlows} flows correctly programmed (time: $SECONDS)"
257 echo $SECONDS > temp.txt
258 paste onos-ports-time-num.txt temp.txt | awk '{print ($1 + $2)}' > voltha-flows-time-num.txt
259
260 echo "VOLTHA FLOWs Duration(s)" > voltha-flows-time.txt
261 cat voltha-flows-time-num.txt >> voltha-flows-time.txt
262 fi
263 '''
264 }
265 }
266 stage('Wait for flows to be acknowledged in ONOS') {
Matteo Scandolod1a15082020-04-22 10:57:49 -0700267 steps {
268 sh '''
269 if [ ${withOnosApps} = false ] ; then
270 echo "ONOS Apps are not enabled, nothing to check"
271 else
272 # wait until all flows are in added state
Matteo Scandoloc9812232020-04-22 14:18:07 -0700273 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s | grep ADDED | wc -l)
274 until [ $z -eq ${expectedFlows} ]
Matteo Scandolod1a15082020-04-22 10:57:49 -0700275 do
Matteo Scandoloc9812232020-04-22 14:18:07 -0700276 echo "${z} of ${expectedFlows} flows in ADDED state (time: $SECONDS)"
Matteo Scandolod1a15082020-04-22 10:57:49 -0700277 sleep ${pollInterval}
Matteo Scandoloc9812232020-04-22 14:18:07 -0700278 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s | grep ADDED | wc -l)
Matteo Scandolod1a15082020-04-22 10:57:49 -0700279 done
Matteo Scandoloc9812232020-04-22 14:18:07 -0700280 echo "${expectedFlows} flows correctly acknowledged (time: $SECONDS)"
Matteo Scandolod1a15082020-04-22 10:57:49 -0700281
282 echo $SECONDS > temp.txt
Matteo Scandoloc9812232020-04-22 14:18:07 -0700283 paste voltha-flows-time-num.txt temp.txt | awk '{print ($1 + $2)}' > onos-flows-time-num.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700284
Matteo Scandoloc9812232020-04-22 14:18:07 -0700285 echo "ONOS FLOWs Duration(s)" > onos-flows-time.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700286 cat onos-flows-time-num.txt >> onos-flows-time.txt
287 fi
288 '''
289 }
290 }
Shrey Baidb001c712020-02-11 11:12:46 -0800291 }
292 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800293 }
294 post {
Shrey Baid4da57a62020-03-05 15:49:50 -0800295 success {
Shrey Baide7614d02020-02-25 10:26:42 -0800296 plot([
297 csvFileName: 'plot-onu-activation.csv',
Matteo Scandolod1a15082020-04-22 10:57:49 -0700298 csvSeries: [
299 [displayTableFlag: false, exclusionValues: '', file: 'voltha-devices-time.txt', inclusionFlag: 'OFF', url: ''],
300 [displayTableFlag: false, exclusionValues: '', file: 'onos-ports-time.txt', inclusionFlag: 'OFF', url: ''],
Matteo Scandoloc9812232020-04-22 14:18:07 -0700301 [displayTableFlag: false, exclusionValues: '', file: 'voltha-flows-time.txt', inclusionFlag: 'OFF', url: ''],
Matteo Scandolod1a15082020-04-22 10:57:49 -0700302 [displayTableFlag: false, exclusionValues: '', file: 'onos-flows-time.txt', inclusionFlag: 'OFF', url: '']
303 ],
304 group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Time (${BBSIMdelay}s Delay)", yaxis: 'Time (s)', useDescr: true
Shrey Baide7614d02020-02-25 10:26:42 -0800305 ])
Shrey Baid4da57a62020-03-05 15:49:50 -0800306 }
307 always {
Matteo Scandolod1a15082020-04-22 10:57:49 -0700308 // count how many ONUs have been activated
Shrey Baid4da57a62020-03-05 15:49:50 -0800309 sh '''
Shrey Baid49bf8f62020-03-09 17:52:01 -0700310 echo "#-of-ONUs" > voltha-devices-count.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700311 echo $(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) >> voltha-devices-count.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700312 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700313 // count how many ports have been discovered
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700314 sh '''
Shrey Baid49bf8f62020-03-09 17:52:01 -0700315 echo "#-of-ports" > onos-ports-count.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700316 echo $(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports -e | grep BBSM | wc -l) >> onos-ports-count.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700317 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700318 // count how many flows have been provisioned
319 sh '''
320 echo "#-of-flows" > onos-flows-count.txt
321 echo $(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s | grep ADDED | wc -l) >> onos-flows-count.txt
322 '''
323 // check which containers were used in this build
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700324 sh '''
Matteo Scandolo24044fc2020-04-14 10:07:14 -0700325 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
326 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700327 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700328 // dump all the VOLTHA devices informations
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700329 sh '''
Shrey Baid4da57a62020-03-05 15:49:50 -0800330 voltctl device list -o json > device-list.json
Shrey Baid49bf8f62020-03-09 17:52:01 -0700331 python -m json.tool device-list.json > voltha-devices-list.json
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700332 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700333 // get ports and flows from ONOS
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700334 sh '''
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700335 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports > onos-ports-list.txt
Matteo Scandolod1a15082020-04-22 10:57:49 -0700336 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s > onos-flows-list.txt
337 '''
338 // collect the CPU usage
339 sh '''
Shrey Baidce9ed552020-03-13 13:40:13 -0700340 curl -s -X GET -G http://127.0.0.1:31301/api/v1/query --data-urlencode 'query=avg(rate(container_cpu_usage_seconds_total[10m])*100) by (pod_name)' | jq . > cpu-usage.json
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700341 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700342 // get all the logs from kubernetes PODs
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700343 sh '''
Matteo Scandolo3d31ebc2020-04-16 14:39:40 -0700344 kubectl get pods -o wide
Matteo Scandolo89f1cea2020-04-10 10:20:20 -0700345 kubectl logs -l app=adapter-open-olt > open-olt-logs.txt
346 kubectl logs -l app=adapter-open-onu > open-onu-logs.txt
347 kubectl logs -l app=rw-core > voltha-rw-core-logs.txt
348 kubectl logs -l app=ofagent > voltha-ofagent-logs.txt
349 kubectl logs -l app=bbsim > bbsim-logs.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700350 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700351 // cleanup of things we don't want to archive
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700352 sh '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700353 rm -rf BBSM-12345123451234512345-00000000000001-v1.json device-list.json temp.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700354 '''
Matteo Scandolod1a15082020-04-22 10:57:49 -0700355 // compile a plot of the activate informations
Shrey Baid4da57a62020-03-05 15:49:50 -0800356 plot([
357 csvFileName: 'plot-numbers.csv',
Matteo Scandolod1a15082020-04-22 10:57:49 -0700358 csvSeries: [
359 [displayTableFlag: false, exclusionValues: '', file: 'voltha-devices-count.txt', inclusionFlag: 'OFF', url: ''],
360 [displayTableFlag: false, exclusionValues: '', file: 'onos-ports-count.txt', inclusionFlag: 'OFF', url: '']
361 ],
Shrey Baid4da57a62020-03-05 15:49:50 -0800362 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Activated ONUs and Recognized Ports", yaxis: 'Number of Ports/ONUs', useDescr: true
363 ])
364
365 archiveArtifacts artifacts: '*.log,*.json,*txt'
366
Matteo Scandolo51b76302020-02-05 12:07:23 -0800367 }
368 }
Matteo Scandoloe69614f2020-03-10 11:35:35 -0700369}