blob: ab81eeda1b7d9db44de4ef4f0b643590510c6b0f [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 Baid67486582020-02-25 10:26:42 -080022 EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimAuth},dhcp=${bbsimDhcp}"
Shrey Baid00ff5c42020-02-07 15:14:08 -080023 }
Matteo Scandolo51b76302020-02-05 12:07:23 -080024 stages {
Shrey Baide7614d02020-02-25 10:26:42 -080025 stage('set-description') {
26 steps {
27 script {
Shrey Baid943e2072020-03-04 10:31:32 -080028 currentBuild.description = "$BUILD_TIMESTAMP"
Shrey Baide7614d02020-02-25 10:26:42 -080029 }
30 }
31 }
Shrey Baidb0447182020-02-27 16:39:35 -080032 stage('cleanup') {
Matteo Scandolo51b76302020-02-05 12:07:23 -080033 steps {
Shrey Baidb0447182020-02-27 16:39:35 -080034 sh '''
Matteo Scandoloe57af742020-03-04 16:39:56 -080035 rm -rf voltha-devices.txt onos-ports.txt total-time.txt onu-activation.txt
Matteo Scandolo151e35c2020-02-28 15:45:15 -080036 for hchart in \$(helm list -q | grep -E -v 'docker-registry|cord-kafka|etcd-operator');
37 do
38 echo "Purging chart: \${hchart}"
39 helm delete --purge "\${hchart}"
40 done
Shrey Baidb0447182020-02-27 16:39:35 -080041 bash /home/cord/voltha-scale/wait_for_pods.sh
42 bash /home/cord/voltha-scale/stop_port_forward.sh
43 '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080044 }
45 }
46 stage('start') {
47 steps {
Shrey Baid00ff5c42020-02-07 15:14:08 -080048 sh '''
Matteo Scandolo51b76302020-02-05 12:07:23 -080049 #!/usr/bin/env bash
50 set -euo pipefail
Shrey Baid00ff5c42020-02-07 15:14:08 -080051 '''
52 }
53 }
Shrey Baid00ff5c42020-02-07 15:14:08 -080054 stage('deploy-voltha') {
55 steps {
56 sh '''
Shrey Baidb0447182020-02-27 16:39:35 -080057 helm install -n onos onf/onos --set images.onos.repository=voltha/voltha-onos --set images.onos.tag=4.0.1
Shrey Baidb0447182020-02-27 16:39:35 -080058
Matteo Scandoloa2928e72020-03-02 16:38:22 -080059 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
60 helm install -n voltha onf/voltha -f /home/cord/voltha-scale/voltha-values.yaml --set images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}
61
62 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
63 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}
64
65 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
66 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}
67
68 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
69 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}
Shrey Baidb0447182020-02-27 16:39:35 -080070 helm install -n radius onf/freeradius
71
Shrey Baide7614d02020-02-25 10:26:42 -080072 if [ ! -z ${bbsimImg} ];
73 then
74 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
75 EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}"
76 fi
77 if [ ! -z ${volthaImg} ];
78 then
79 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
80 EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}"
81 fi
Shrey Baidb0447182020-02-27 16:39:35 -080082 bash /home/cord/voltha-scale/wait_for_pods.sh
83 bash /home/cord/voltha-scale/start_port_forward.sh
Shrey Baid00ff5c42020-02-07 15:14:08 -080084 '''
85 }
86 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -080087 stage('wait for adapters to be registered') {
88 steps{
89 waitUntil {
90 script {
91 openolt_res = sh returnStdout: true, script: """
92 voltctl adapter list | grep openolt | wc -l
93 """
94
95 openonu_res = sh returnStdout: true, script: """
96 voltctl adapter list | grep brcm_openomci_onu | wc -l
97 """
98
99 return openolt_res.toInteger() == 1 && openonu_res.toInteger() == 1
100 }
101 }
102 }
103 }
Shrey Baide7614d02020-02-25 10:26:42 -0800104 stage('MIB-template') {
105 steps {
106 sh '''
107 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800108 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -0800109 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -0800110 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 -0800111 fi
112 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800113 }
Shrey Baide7614d02020-02-25 10:26:42 -0800114 }
115 stage('disable-ONOS-apps') {
116 steps {
117 sh '''
118 #Check withOnosApps and disable apps accordingly
119 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800120 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
121 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
122 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 -0800123 fi
124 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800125 }
Shrey Baide7614d02020-02-25 10:26:42 -0800126 }
127 stage('configuration') {
128 steps {
129 sh '''
130 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800131 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
132 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800133 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800134 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 -0800135 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800136 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 -0800137 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800138 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 -0800139 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800140 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800141 '''
142 }
143 }
144 stage('execute') {
145 options {
146 timeout(time:10)
147 }
148 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800149 stage('ONUs-enabled') {
150 steps {
151 sh '''
152 if [ -z ${expectedOnus} ]
153 then
154 echo -e "You need to set the target ONU number\n"
155 exit 1
156 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800157
Shrey Baida3b8aa62020-02-13 11:22:51 -0800158 voltctl device create -t openolt -H bbsim:50060
159 voltctl device enable $(voltctl device list --filter Type~openolt -q)
160 # check ONUs reached Active State in VOLTHA
161 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
162 until [ $i -eq ${expectedOnus} ]
163 do
164 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
165 sleep ${pollInterval}
166 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
167 done
168 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800169 echo $SECONDS > voltha-devices.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800170 '''
171 }
172 }
173 stage('ONOS-ports') {
174 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800175 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800176 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800177 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 -0800178 until [ $z -eq ${expectedOnus} ]
179 do
180 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
181 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800182 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 -0800183 done
184 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800185 echo $SECONDS > onos-ports.txt
Shrey Baidb0447182020-02-27 16:39:35 -0800186 echo "ONOS-Duration(s)" > total-time.txt
187 echo "VOLTHA-Duration(s)" > onu-activation.txt
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800188 cat voltha-devices.txt >> onu-activation.txt
189 paste voltha-devices.txt onos-ports.txt | awk '{print ($1 + $2)}' >> total-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 Baidb0447182020-02-27 16:39:35 -0800200 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'total-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
207 echo "#-of-ONUs" > no_onus.txt
208 cat onus.txt >> no_onus.txt
209
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
211 echo "#-of-ports" > no_ports.txt
212 cat ports.txt >> no_ports.txt
213
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
216 python -m json.tool device-list.json > volt-device-list.json
217 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports > onos-ports.txt
218 '''
219 plot([
220 csvFileName: 'plot-numbers.csv',
221 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'no_onus.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'no_ports.txt', inclusionFlag: 'OFF', url: '']],
222 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Activated ONUs and Recognized Ports", yaxis: 'Number of Ports/ONUs', useDescr: true
223 ])
224
225 archiveArtifacts artifacts: '*.log,*.json,*txt'
226
Shrey Baid18165a32020-02-27 11:01:13 -0800227 script {
228 sh '''
Shrey Baid4da57a62020-03-05 15:49:50 -0800229 rm -rf onus.txt ports.txt voltha-devices.txt onos-ports.txt total-time.txt onu-activation.txt device-list.json
Shrey Baid18165a32020-02-27 11:01:13 -0800230 '''
Shrey Baide7614d02020-02-25 10:26:42 -0800231 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800232 }
233 }
Matteo Scandoloa711ddf2020-03-06 16:41:34 -0800234}