blob: 7fa9a881d565affdfb5b28f8ded1df2e2131cf30 [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 {
8 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
9 VOLTCONFIG="$HOME/.volt/config-minimal"
10 PATH="$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
11 TYPE="minimal"
12 FANCY=0
Shrey Baid7cbb06e2020-02-11 17:45:07 -080013 SECONDS=0
Shrey Baid00ff5c42020-02-07 15:14:08 -080014 WITH_SIM_ADAPTERS="n"
15 WITH_RADIUS="y"
16 WITH_BBSIM="y"
Shrey Baid7cbb06e2020-02-11 17:45:07 -080017 VOLTHA_LOG_LEVEL="WARN"
Shrey Baid00ff5c42020-02-07 15:14:08 -080018 CONFIG_SADIS="n"
19 ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False"
Shrey Baidb001c712020-02-11 11:12:46 -080020 SSHPASS="karaf"
Shrey Baide7614d02020-02-25 10:26:42 -080021 DEPLOY_K8S="n"
Shrey Baid00ff5c42020-02-07 15:14:08 -080022 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080023 stages {
Shrey Baide7614d02020-02-25 10:26:42 -080024 stage('set-description') {
25 steps {
26 script {
Shrey Baid943e2072020-03-04 10:31:32 -080027 currentBuild.description = "$BUILD_TIMESTAMP"
Shrey Baide7614d02020-02-25 10:26:42 -080028 }
29 }
30 }
Shrey Baidb0447182020-02-27 16:39:35 -080031 stage('cleanup') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080032 steps {
Shrey Baidb0447182020-02-27 16:39:35 -080033 sh '''
Shrey Baid49bf8f62020-03-09 17:52:01 -070034 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 Scandolo151e35c2020-02-28 15:45:15 -080035 for hchart in \$(helm list -q | grep -E -v 'docker-registry|cord-kafka|etcd-operator');
36 do
37 echo "Purging chart: \${hchart}"
38 helm delete --purge "\${hchart}"
39 done
Shrey Baidb0447182020-02-27 16:39:35 -080040 bash /home/cord/voltha-scale/wait_for_pods.sh
41 bash /home/cord/voltha-scale/stop_port_forward.sh
42 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080043 }
44 }
45 stage('start') {
46 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080047 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080048 #!/usr/bin/env bash
49 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080050 '''
51 }
52 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080053 stage('deploy-voltha') {
Matteo Scandolo2fc1dac2020-03-09 08:39:53 -070054 options {
55 timeout(time:10)
56 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080057 steps {
58 sh '''
Shrey Baidb06b55a2020-03-12 15:04:58 -070059 helm install -n nem-monitoring cord/nem-monitoring
60
Matteo Scandoloe69614f2020-03-10 11:35:35 -070061 IFS=: read -r onosRepo onosTag <<< ${onosImg}
62 helm install -n onos onf/onos --set images.onos.repository=${onosRepo} --set images.onos.tag=${onosTag} ${extraHelmFlags}
Shrey Baidb0447182020-02-27 16:39:35 -080063
Matteo Scandoloa2928e72020-03-02 16:38:22 -080064 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070065 IFS=: read -r ofAgentRepo ofAgentTag <<< ${ofAgentImg}
66 helm install -n voltha onf/voltha -f /home/cord/voltha-scale/voltha-values.yaml --set images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag},images.ofagent.repository=${ofAgentRepo},images.ofagent.tag=${ofAgentTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080067
68 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070069 helm install -n openolt onf/voltha-adapter-openolt -f /home/cord/voltha-scale/voltha-values.yaml --set images.adapter_open_olt.repository=${openoltAdapterRepo},images.adapter_open_olt.tag=${openoltAdapterTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080070
71 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070072 helm install -n openonu onf/voltha-adapter-openonu -f /home/cord/voltha-scale/voltha-values.yaml --set images.adapter_open_olt.repository=${openonuAdapterRepo},images.adapter_open_olt.tag=${openonuAdapterTag} ${extraHelmFlags}
Matteo Scandoloa2928e72020-03-02 16:38:22 -080073
74 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
Matteo Scandoloe69614f2020-03-10 11:35:35 -070075 helm install -n bbsim onf/bbsim --set pon=${ponPorts},onu=${onuPerPon},auth=${bbsimAuth},dhcp=${bbsimDhcp},delay=${BBSIMdelay},images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag} ${extraHelmFlags}
76 helm install -n radius onf/freeradius ${extraHelmFlags}
Shrey Baidb0447182020-02-27 16:39:35 -080077
Shrey Baidb0447182020-02-27 16:39:35 -080078 bash /home/cord/voltha-scale/wait_for_pods.sh
79 bash /home/cord/voltha-scale/start_port_forward.sh
Shrey Baid00ff5c42020-02-07 15:14:08 -080080 '''
81 }
82 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080083 stage('wait for adapters to be registered') {
Matteo Scandolo2fc1dac2020-03-09 08:39:53 -070084 options {
85 timeout(time:5)
86 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080087 steps{
88 waitUntil {
89 script {
90 openolt_res = sh returnStdout: true, script: """
91 voltctl adapter list | grep openolt | wc -l
92 """
93
94 openonu_res = sh returnStdout: true, script: """
95 voltctl adapter list | grep brcm_openomci_onu | wc -l
96 """
97
98 return openolt_res.toInteger() == 1 && openonu_res.toInteger() == 1
99 }
100 }
101 }
102 }
Shrey Baide7614d02020-02-25 10:26:42 -0800103 stage('MIB-template') {
104 steps {
105 sh '''
106 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800107 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -0800108 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -0800109 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 -0800110 fi
111 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800112 }
Shrey Baide7614d02020-02-25 10:26:42 -0800113 }
114 stage('disable-ONOS-apps') {
115 steps {
116 sh '''
117 #Check withOnosApps and disable apps accordingly
118 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800119 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
120 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
121 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.dhcpl2relay
Shrey Baide7614d02020-02-25 10:26:42 -0800122 fi
123 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800124 }
Shrey Baide7614d02020-02-25 10:26:42 -0800125 }
126 stage('configuration') {
127 steps {
128 sh '''
129 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800130 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
131 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800132 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800133 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery}
Shrey Baide7614d02020-02-25 10:26:42 -0800134 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800135 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval}
Shrey Baide7614d02020-02-25 10:26:42 -0800136 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800137 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${portsStatInterval}
Matteo Scandolo7b3fde92020-02-26 16:17:16 -0800138 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800139 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800140 '''
141 }
142 }
143 stage('execute') {
144 options {
145 timeout(time:10)
146 }
147 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800148 stage('ONUs-enabled') {
149 steps {
150 sh '''
151 if [ -z ${expectedOnus} ]
152 then
153 echo -e "You need to set the target ONU number\n"
154 exit 1
155 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800156
Shrey Baida3b8aa62020-02-13 11:22:51 -0800157 voltctl device create -t openolt -H bbsim:50060
158 voltctl device enable $(voltctl device list --filter Type~openolt -q)
159 # check ONUs reached Active State in VOLTHA
160 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
161 until [ $i -eq ${expectedOnus} ]
162 do
163 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
164 sleep ${pollInterval}
165 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
166 done
167 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baid49bf8f62020-03-09 17:52:01 -0700168 echo $SECONDS > voltha-devices-time-num.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800169 '''
170 }
171 }
172 stage('ONOS-ports') {
173 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800174 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800175 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800176 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800177 until [ $z -eq ${expectedOnus} ]
178 do
179 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
180 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800181 z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l)
Shrey Baida3b8aa62020-02-13 11:22:51 -0800182 done
183 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baid49bf8f62020-03-09 17:52:01 -0700184 echo $SECONDS > temp.txt
185 paste voltha-devices-time-num.txt temp.txt | awk '{print ($1 + $2)}' > onos-ports-time-num.txt
186 echo "ONOS-Duration(s)" > onos-ports-time.txt
187 echo "VOLTHA-Duration(s)" > voltha-devices-time.txt
188 cat voltha-devices-time-num.txt >> voltha-devices-time.txt
189 cat onos-ports-time-num.txt >> onos-ports-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800190 '''
191 }
192 }
Shrey Baidb001c712020-02-11 11:12:46 -0800193 }
194 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800195 }
196 post {
Shrey Baid4da57a62020-03-05 15:49:50 -0800197 success {
Shrey Baide7614d02020-02-25 10:26:42 -0800198 plot([
199 csvFileName: 'plot-onu-activation.csv',
Shrey Baid49bf8f62020-03-09 17:52:01 -0700200 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 -0800201 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 -0800202 ])
Shrey Baid4da57a62020-03-05 15:49:50 -0800203 }
204 always {
205 sh '''
206 echo $(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) > onus.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700207 echo "#-of-ONUs" > voltha-devices-count.txt
208 cat onus.txt >> voltha-devices-count.txt
Shrey Baid4da57a62020-03-05 15:49:50 -0800209
210 echo $(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l) > ports.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700211 echo "#-of-ports" > onos-ports-count.txt
212 cat ports.txt >> onos-ports-count.txt
Shrey Baid4da57a62020-03-05 15:49:50 -0800213
214 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
215 voltctl device list -o json > device-list.json
Shrey Baid49bf8f62020-03-09 17:52:01 -0700216 python -m json.tool device-list.json > voltha-devices-list.json
217 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports > onos-ports-list.txt
Shrey Baidce9ed552020-03-13 13:40:13 -0700218 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
Shrey Baid36b76f82020-03-12 15:04:58 -0700219 kubectl logs $(kubectl get pods --all-namespaces | grep "adapter-open-olt" | awk '{ print $2 }') > open-olt-logs.txt
220 kubectl logs $(kubectl get pods --all-namespaces | grep "adapter-open-onu" | awk '{ print $2 }') > open-onu-logs.txt
221 kubectl logs $(kubectl get pods --all-namespaces | grep "voltha-rw" | awk '{ print $2 }') > voltha-rw-core-logs.txt
Shrey Baid49bf8f62020-03-09 17:52:01 -0700222 rm -rf BBSM-12345123451234512345-00000000000001-v1.json device-list.json onus.txt ports.txt temp.txt
Shrey Baid4da57a62020-03-05 15:49:50 -0800223 '''
224 plot([
225 csvFileName: 'plot-numbers.csv',
Shrey Baid49bf8f62020-03-09 17:52:01 -0700226 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 -0800227 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Activated ONUs and Recognized Ports", yaxis: 'Number of Ports/ONUs', useDescr: true
228 ])
229
230 archiveArtifacts artifacts: '*.log,*.json,*txt'
231
Matteo Scandolo51b76302020-02-05 12:07:23 -0800232 }
233 }
Matteo Scandoloe69614f2020-03-10 11:35:35 -0700234}