blob: 755c919ee3b064eead18310d625b0c35361a8e6c [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 {
Matteo Scandolo7b3fde92020-02-26 16:17:16 -080028 currentBuild.description = "${onuPerPon} ONU x ${ponPorts} PON - BBSIM Delay ${BBSIMdelay}"
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 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') {
54 steps {
55 sh '''
Shrey Baidb0447182020-02-27 16:39:35 -080056 helm install -n onos onf/onos --set images.onos.repository=voltha/voltha-onos --set images.onos.tag=4.0.1
57 helm install -n voltha onf/voltha -f /home/cord/voltha-scale/voltha-values.yaml
58 helm install -n openolt onf/voltha-adapter-openolt -f /home/cord/voltha-scale/voltha-values.yaml
59 helm install -n openonu onf/voltha-adapter-openonu -f /home/cord/voltha-scale/voltha-values.yaml
60
61 helm install -n bbsim onf/bbsim --set pon=${ponPorts},onu=${onuPerPon},auth=${bbsimAuth},dhcp=${bbsimDhcp},delay=${BBSIMdelay}
62 helm install -n radius onf/freeradius
63
Shrey Baide7614d02020-02-25 10:26:42 -080064 if [ ! -z ${bbsimImg} ];
65 then
66 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
67 EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}"
68 fi
69 if [ ! -z ${volthaImg} ];
70 then
71 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
72 EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}"
73 fi
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 }
Shrey Baide7614d02020-02-25 10:26:42 -080079 stage('MIB-template') {
80 steps {
81 sh '''
82 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -080083 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -080084 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -080085 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 -080086 fi
87 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080088 }
Shrey Baide7614d02020-02-25 10:26:42 -080089 }
90 stage('disable-ONOS-apps') {
91 steps {
92 sh '''
93 #Check withOnosApps and disable apps accordingly
94 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -080095 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
96 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
97 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 -080098 fi
99 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800100 }
Shrey Baide7614d02020-02-25 10:26:42 -0800101 }
102 stage('configuration') {
103 steps {
104 sh '''
105 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800106 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
107 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800108 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800109 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 -0800110 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800111 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 -0800112 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800113 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 -0800114 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800115 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800116 '''
117 }
118 }
119 stage('execute') {
120 options {
121 timeout(time:10)
122 }
123 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800124 stage('ONUs-enabled') {
125 steps {
126 sh '''
127 if [ -z ${expectedOnus} ]
128 then
129 echo -e "You need to set the target ONU number\n"
130 exit 1
131 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800132
Shrey Baida3b8aa62020-02-13 11:22:51 -0800133 voltctl device create -t openolt -H bbsim:50060
134 voltctl device enable $(voltctl device list --filter Type~openolt -q)
135 # check ONUs reached Active State in VOLTHA
136 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
137 until [ $i -eq ${expectedOnus} ]
138 do
139 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
140 sleep ${pollInterval}
141 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
142 done
143 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800144 echo $SECONDS > voltha-devices.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800145 '''
146 }
147 }
148 stage('ONOS-ports') {
149 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800150 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800151 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800152 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 -0800153 until [ $z -eq ${expectedOnus} ]
154 do
155 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
156 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800157 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 -0800158 done
159 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800160 echo $SECONDS > onos-ports.txt
Shrey Baidb0447182020-02-27 16:39:35 -0800161 echo "ONOS-Duration(s)" > total-time.txt
162 echo "VOLTHA-Duration(s)" > onu-activation.txt
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800163 cat voltha-devices.txt >> onu-activation.txt
164 paste voltha-devices.txt onos-ports.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800165 '''
166 }
167 }
Shrey Baidb001c712020-02-11 11:12:46 -0800168 }
169 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800170 }
171 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800172 always {
173 plot([
174 csvFileName: 'plot-onu-activation.csv',
Shrey Baidb0447182020-02-27 16:39:35 -0800175 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']],
176 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
Shrey Baide7614d02020-02-25 10:26:42 -0800177 ])
Shrey Baid18165a32020-02-27 11:01:13 -0800178 script {
179 sh '''
180 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
Shrey Baid704373e2020-03-03 14:08:02 -0800181 voltctl device list -o json > device-list.json
182 python -m json.tool device-list.json > volt-device-list.json
183 rm device-list.json
Shrey Baid704373e2020-03-03 14:08:02 -0800184 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports > onos-ports.txt
Shrey Baid18165a32020-02-27 11:01:13 -0800185 '''
Shrey Baide7614d02020-02-25 10:26:42 -0800186 }
Shrey Baid704373e2020-03-03 14:08:02 -0800187 archiveArtifacts artifacts: '*.log,*.json,*txt'
Shrey Baid18165a32020-02-27 11:01:13 -0800188 }
Shrey Baide7614d02020-02-25 10:26:42 -0800189 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800190 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800191 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800192 set +e
Matteo Scandolo51b76302020-02-05 12:07:23 -0800193 '''
194 }
195 }
Matteo Scandolo151e35c2020-02-28 15:45:15 -0800196}