blob: f935bdebe4bb174ff859d857a5400b476524127c [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 {
Shrey Baide7614d02020-02-25 10:26:42 -080011 stage('set-description') {
12 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 }
Shrey Baidb0447182020-02-27 16:39:35 -080018 stage('cleanup') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080019 steps {
Shrey Baidb0447182020-02-27 16:39:35 -080020 sh '''
Shrey Baid49bf8f62020-03-09 17:52:01 -070021 rm -rf voltha-devices-count.txt voltha-devices-time.txt onos-ports-count.txt onos-ports-time.txt onos-ports-list.txt voltha-devices-list.json onos-ports-time-num.txt voltha-devices-time-num.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 }
32 stage('start') {
33 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 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080040 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
52 # NOTE wait for the infrastructure to be running before installing VOLTHA
53 bash /home/cord/voltha-scale/wait_for_pods.sh
54
Matteo Scandoloe69614f2020-03-10 11:35:35 -070055 IFS=: read -r onosRepo onosTag <<< ${onosImg}
56 helm install -n onos onf/onos --set images.onos.repository=${onosRepo} --set images.onos.tag=${onosTag} ${extraHelmFlags}
Shrey Baidb0447182020-02-27 16:39:35 -080057
Matteo Scandoloa2928e72020-03-02 16:38:22 -080058 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070059 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
Matteo Scandolofddcb002020-03-24 09:14:57 -070060 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 -080061
62 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
Matteo Scandolo330f7522020-03-17 17:15:53 -070063 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 -080064
65 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
Matteo Scandolo330f7522020-03-17 17:15:53 -070066 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 -080067
68 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
Matteo Scandolo7059b082020-03-17 09:05:03 -070069
Matteo Scandolof87e1da2020-04-16 16:13:31 -070070 for i in $(seq 1 $((${numOfBbsim}))); do
71 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}
72 done
Shrey Baidb0447182020-02-27 16:39:35 -080073
Shrey Baidb0447182020-02-27 16:39:35 -080074 bash /home/cord/voltha-scale/wait_for_pods.sh
75 bash /home/cord/voltha-scale/start_port_forward.sh
Shrey Baid00ff5c42020-02-07 15:14:08 -080076 '''
77 }
78 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080079 stage('wait for adapters to be registered') {
Matteo Scandolo2fc1dac2020-03-09 08:39:53 -070080 options {
81 timeout(time:5)
82 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080083 steps{
84 waitUntil {
85 script {
86 openolt_res = sh returnStdout: true, script: """
87 voltctl adapter list | grep openolt | wc -l
88 """
89
90 openonu_res = sh returnStdout: true, script: """
91 voltctl adapter list | grep brcm_openomci_onu | wc -l
92 """
93
Matteo Scandolo89f1cea2020-04-10 10:20:20 -070094 return openolt_res.toInteger() >= 1 && openonu_res.toInteger() >= 1
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080095 }
96 }
97 }
98 }
Shrey Baide7614d02020-02-25 10:26:42 -080099 stage('MIB-template') {
100 steps {
101 sh '''
102 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800103 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -0800104 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -0800105 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 -0800106 fi
107 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800108 }
Shrey Baide7614d02020-02-25 10:26:42 -0800109 }
110 stage('disable-ONOS-apps') {
111 steps {
112 sh '''
113 #Check withOnosApps and disable apps accordingly
114 if [ ${withOnosApps} = false ] ; then
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700115 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.olt
116 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.aaa
117 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.dhcpl2relay
Shrey Baide7614d02020-02-25 10:26:42 -0800118 fi
119 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800120 }
Shrey Baide7614d02020-02-25 10:26:42 -0800121 }
122 stage('configuration') {
123 steps {
124 sh '''
Matteo Scandolo330f7522020-03-17 17:15:53 -0700125 #Setting LOG level to ${logLevel}
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700126 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 -0800127 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800128 #Setting link discovery
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700129 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}
Shrey Baide7614d02020-02-25 10:26:42 -0800130 #Setting the flow stats collection interval
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700131 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}
Shrey Baide7614d02020-02-25 10:26:42 -0800132 #Setting the ports stats collection interval
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700133 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}
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800134 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800135 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800136 '''
137 }
138 }
139 stage('execute') {
140 options {
141 timeout(time:10)
142 }
143 stages {
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700144 stage('Activate OLTs') {
145 steps {
146 sh '''
147 for i in $(seq 1 $((${numOfBbsim}))); do
148 voltctl device create -t openolt -H bbsim-$i:50060 -m 0f:f1:ce:c$i:ff:ee
149 done
150 voltctl device list --filter Type~openolt -q | xargs voltctl device enable
151 '''
152 }
153 }
Shrey Baida3b8aa62020-02-13 11:22:51 -0800154 stage('ONUs-enabled') {
155 steps {
156 sh '''
157 if [ -z ${expectedOnus} ]
158 then
159 echo -e "You need to set the target ONU number\n"
160 exit 1
161 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800162
Shrey Baida3b8aa62020-02-13 11:22:51 -0800163 # check ONUs reached Active State in VOLTHA
164 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
165 until [ $i -eq ${expectedOnus} ]
166 do
167 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
168 sleep ${pollInterval}
169 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
170 done
171 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baid49bf8f62020-03-09 17:52:01 -0700172 echo $SECONDS > voltha-devices-time-num.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800173 '''
174 }
175 }
176 stage('ONOS-ports') {
177 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800178 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800179 # Check ports showed up in ONOS
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700180 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 -0800181 until [ $z -eq ${expectedOnus} ]
182 do
183 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
184 sleep ${pollInterval}
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700185 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 -0800186 done
187 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baid49bf8f62020-03-09 17:52:01 -0700188 echo $SECONDS > temp.txt
189 paste voltha-devices-time-num.txt temp.txt | awk '{print ($1 + $2)}' > onos-ports-time-num.txt
190 echo "ONOS-Duration(s)" > onos-ports-time.txt
191 echo "VOLTHA-Duration(s)" > voltha-devices-time.txt
192 cat voltha-devices-time-num.txt >> voltha-devices-time.txt
193 cat onos-ports-time-num.txt >> onos-ports-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800194 '''
195 }
196 }
Shrey Baidb001c712020-02-11 11:12:46 -0800197 }
198 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800199 }
200 post {
Shrey Baid4da57a62020-03-05 15:49:50 -0800201 success {
Shrey Baide7614d02020-02-25 10:26:42 -0800202 plot([
203 csvFileName: 'plot-onu-activation.csv',
Shrey Baid49bf8f62020-03-09 17:52:01 -0700204 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'voltha-devices-time.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'onos-ports-time.txt', inclusionFlag: 'OFF', url: '']],
Shrey Baid943e2072020-03-04 10:31:32 -0800205 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Time (${BBSIMdelay}s Delay)", yaxis: 'Time (s)', useDescr: true
Shrey Baide7614d02020-02-25 10:26:42 -0800206 ])
Shrey Baid4da57a62020-03-05 15:49:50 -0800207 }
208 always {
209 sh '''
210 echo $(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) > onus.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700211 echo "#-of-ONUs" > voltha-devices-count.txt
212 cat onus.txt >> voltha-devices-count.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700213 '''
214 sh '''
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700215 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) > ports.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700216 echo "#-of-ports" > onos-ports-count.txt
217 cat ports.txt >> onos-ports-count.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700218 '''
219 sh '''
Matteo Scandolo24044fc2020-04-14 10:07:14 -0700220 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
221 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700222 '''
223 sh '''
Shrey Baid4da57a62020-03-05 15:49:50 -0800224 voltctl device list -o json > device-list.json
Shrey Baid49bf8f62020-03-09 17:52:01 -0700225 python -m json.tool device-list.json > voltha-devices-list.json
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700226 '''
227 sh '''
Matteo Scandolof87e1da2020-04-16 16:13:31 -0700228 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports > onos-ports-list.txt
Shrey Baidce9ed552020-03-13 13:40:13 -0700229 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 -0700230 '''
231 sh '''
Matteo Scandolo3d31ebc2020-04-16 14:39:40 -0700232 kubectl get pods -o wide
Matteo Scandolo89f1cea2020-04-10 10:20:20 -0700233 kubectl logs -l app=adapter-open-olt > open-olt-logs.txt
234 kubectl logs -l app=adapter-open-onu > open-onu-logs.txt
235 kubectl logs -l app=rw-core > voltha-rw-core-logs.txt
236 kubectl logs -l app=ofagent > voltha-ofagent-logs.txt
237 kubectl logs -l app=bbsim > bbsim-logs.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700238 '''
239 sh '''
Shrey Baid49bf8f62020-03-09 17:52:01 -0700240 rm -rf BBSM-12345123451234512345-00000000000001-v1.json device-list.json onus.txt ports.txt temp.txt
Matteo Scandoloe1c200f2020-03-24 10:33:58 -0700241 '''
Shrey Baid4da57a62020-03-05 15:49:50 -0800242 plot([
243 csvFileName: 'plot-numbers.csv',
Shrey Baid49bf8f62020-03-09 17:52:01 -0700244 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'voltha-devices-count.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'onos-ports-count.txt', inclusionFlag: 'OFF', url: '']],
Shrey Baid4da57a62020-03-05 15:49:50 -0800245 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Activated ONUs and Recognized Ports", yaxis: 'Number of Ports/ONUs', useDescr: true
246 ])
247
248 archiveArtifacts artifacts: '*.log,*.json,*txt'
249
Matteo Scandolo51b76302020-02-05 12:07:23 -0800250 }
251 }
Matteo Scandoloe69614f2020-03-10 11:35:35 -0700252}