blob: 4db505b818b126157f5770a12f48b951f468ff90 [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
Shrey Baidb0447182020-02-27 16:39:35 -080057
Matteo Scandoloa2928e72020-03-02 16:38:22 -080058 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
59 helm install -n voltha onf/voltha -f /home/cord/voltha-scale/voltha-values.yaml --set images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}
60
61 IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< ${openoltAdapterImg}
62 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}
63
64 IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< ${openonuAdapterImg}
65 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}
66
67 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
68 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 -080069 helm install -n radius onf/freeradius
70
Shrey Baide7614d02020-02-25 10:26:42 -080071 if [ ! -z ${bbsimImg} ];
72 then
73 IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg}
74 EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}"
75 fi
76 if [ ! -z ${volthaImg} ];
77 then
78 IFS=: read -r volthaRepo volthaTag <<< ${volthaImg}
79 EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}"
80 fi
Shrey Baidb0447182020-02-27 16:39:35 -080081 bash /home/cord/voltha-scale/wait_for_pods.sh
82 bash /home/cord/voltha-scale/start_port_forward.sh
Shrey Baid00ff5c42020-02-07 15:14:08 -080083 '''
84 }
85 }
Shrey Baide7614d02020-02-25 10:26:42 -080086 stage('MIB-template') {
87 steps {
88 sh '''
89 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -080090 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -080091 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -080092 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 -080093 fi
94 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080095 }
Shrey Baide7614d02020-02-25 10:26:42 -080096 }
97 stage('disable-ONOS-apps') {
98 steps {
99 sh '''
100 #Check withOnosApps and disable apps accordingly
101 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800102 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
103 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
104 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 -0800105 fi
106 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800107 }
Shrey Baide7614d02020-02-25 10:26:42 -0800108 }
109 stage('configuration') {
110 steps {
111 sh '''
112 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800113 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
114 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800115 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800116 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 -0800117 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800118 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 -0800119 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800120 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 -0800121 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800122 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800123 '''
124 }
125 }
126 stage('execute') {
127 options {
128 timeout(time:10)
129 }
130 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800131 stage('ONUs-enabled') {
132 steps {
133 sh '''
134 if [ -z ${expectedOnus} ]
135 then
136 echo -e "You need to set the target ONU number\n"
137 exit 1
138 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800139
Shrey Baida3b8aa62020-02-13 11:22:51 -0800140 voltctl device create -t openolt -H bbsim:50060
141 voltctl device enable $(voltctl device list --filter Type~openolt -q)
142 # check ONUs reached Active State in VOLTHA
143 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
144 until [ $i -eq ${expectedOnus} ]
145 do
146 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
147 sleep ${pollInterval}
148 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
149 done
150 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800151 echo $SECONDS > activation-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800152 '''
153 }
154 }
155 stage('ONOS-ports') {
156 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800157 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800158 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800159 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 -0800160 until [ $z -eq ${expectedOnus} ]
161 do
162 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
163 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800164 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 -0800165 done
166 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Shrey Baide7614d02020-02-25 10:26:42 -0800167 echo $SECONDS > port-recognition.txt
Shrey Baidb0447182020-02-27 16:39:35 -0800168 echo "ONOS-Duration(s)" > total-time.txt
169 echo "VOLTHA-Duration(s)" > onu-activation.txt
Shrey Baide7614d02020-02-25 10:26:42 -0800170 cat activation-time.txt >> onu-activation.txt
171 paste activation-time.txt port-recognition.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800172 '''
173 }
174 }
Shrey Baidb001c712020-02-11 11:12:46 -0800175 }
176 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800177 }
178 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800179 always {
180 plot([
181 csvFileName: 'plot-onu-activation.csv',
Shrey Baidb0447182020-02-27 16:39:35 -0800182 csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']],
183 group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)'
Shrey Baide7614d02020-02-25 10:26:42 -0800184 ])
185 archiveArtifacts artifacts: '*.log,*.txt'
Shrey Baid18165a32020-02-27 11:01:13 -0800186 script {
187 sh '''
188 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c
189 '''
Shrey Baide7614d02020-02-25 10:26:42 -0800190 }
Shrey Baid18165a32020-02-27 11:01:13 -0800191 }
Shrey Baide7614d02020-02-25 10:26:42 -0800192 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800193 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800194 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800195 set +e
196 rm onu-activation.txt
197 rm total-time.txt
198 rm port-recognition.txt
199 rm activation-time.txt
Matteo Scandolo51b76302020-02-05 12:07:23 -0800200 '''
201 }
202 }
Matteo Scandolo151e35c2020-02-28 15:45:15 -0800203}