blob: ae01f94cac29fbffcb36cc739e6bf3ed96ed251d [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 }
Shrey Baide7614d02020-02-25 10:26:42 -080087 stage('MIB-template') {
88 steps {
89 sh '''
90 if [ ${withMibTemplate} = true ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -080091 rm -f BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baide7614d02020-02-25 10:26:42 -080092 wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json
Shrey Baidb0447182020-02-27 16:39:35 -080093 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 -080094 fi
95 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -080096 }
Shrey Baide7614d02020-02-25 10:26:42 -080097 }
98 stage('disable-ONOS-apps') {
99 steps {
100 sh '''
101 #Check withOnosApps and disable apps accordingly
102 if [ ${withOnosApps} = false ] ; then
Shrey Baidb0447182020-02-27 16:39:35 -0800103 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.olt
104 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost app deactivate org.opencord.aaa
105 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 -0800106 fi
107 '''
Shrey Baid0d4e31d2020-02-11 13:28:47 -0800108 }
Shrey Baide7614d02020-02-25 10:26:42 -0800109 }
110 stage('configuration') {
111 steps {
112 sh '''
113 #Setting LOG level to WARN
Shrey Baidb0447182020-02-27 16:39:35 -0800114 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost log:set WARN
115 kubectl exec $(kubectl get pods | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false
Shrey Baide7614d02020-02-25 10:26:42 -0800116 #Setting link discovery
Shrey Baidb0447182020-02-27 16:39:35 -0800117 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 -0800118 #Setting the flow stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800119 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 -0800120 #Setting the ports stats collection interval
Shrey Baidb0447182020-02-27 16:39:35 -0800121 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 -0800122 # extending voltctl timeout
Shrey Baidb0447182020-02-27 16:39:35 -0800123 sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config
Shrey Baide7614d02020-02-25 10:26:42 -0800124 '''
125 }
126 }
127 stage('execute') {
128 options {
129 timeout(time:10)
130 }
131 stages {
Shrey Baida3b8aa62020-02-13 11:22:51 -0800132 stage('ONUs-enabled') {
133 steps {
134 sh '''
135 if [ -z ${expectedOnus} ]
136 then
137 echo -e "You need to set the target ONU number\n"
138 exit 1
139 fi
Shrey Baid00ff5c42020-02-07 15:14:08 -0800140
Shrey Baida3b8aa62020-02-13 11:22:51 -0800141 voltctl device create -t openolt -H bbsim:50060
142 voltctl device enable $(voltctl device list --filter Type~openolt -q)
143 # check ONUs reached Active State in VOLTHA
144 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
145 until [ $i -eq ${expectedOnus} ]
146 do
147 echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)"
148 sleep ${pollInterval}
149 i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l)
150 done
151 echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800152 echo $SECONDS > voltha-devices.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800153 '''
154 }
155 }
156 stage('ONOS-ports') {
157 steps {
Shrey Baide7614d02020-02-25 10:26:42 -0800158 sh '''
Shrey Baida3b8aa62020-02-13 11:22:51 -0800159 # Check ports showed up in ONOS
Shrey Baidb0447182020-02-27 16:39:35 -0800160 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 -0800161 until [ $z -eq ${expectedOnus} ]
162 do
163 echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)"
164 sleep ${pollInterval}
Shrey Baidb0447182020-02-27 16:39:35 -0800165 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 -0800166 done
167 echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)"
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800168 echo $SECONDS > onos-ports.txt
Shrey Baidb0447182020-02-27 16:39:35 -0800169 echo "ONOS-Duration(s)" > total-time.txt
170 echo "VOLTHA-Duration(s)" > onu-activation.txt
Matteo Scandolo3c3fe2c2020-03-03 17:53:34 -0800171 cat voltha-devices.txt >> onu-activation.txt
172 paste voltha-devices.txt onos-ports.txt | awk '{print ($1 + $2)}' >> total-time.txt
Shrey Baida3b8aa62020-02-13 11:22:51 -0800173 '''
174 }
175 }
Shrey Baidb001c712020-02-11 11:12:46 -0800176 }
177 }
Matteo Scandolo51b76302020-02-05 12:07:23 -0800178 }
179 post {
Shrey Baide7614d02020-02-25 10:26:42 -0800180 always {
181 plot([
182 csvFileName: 'plot-onu-activation.csv',
Shrey Baidb0447182020-02-27 16:39:35 -0800183 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 -0800184 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 -0800185 ])
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
Shrey Baid704373e2020-03-03 14:08:02 -0800189 voltctl device list -o json > device-list.json
190 python -m json.tool device-list.json > volt-device-list.json
191 rm device-list.json
Matteo Scandolo10581c52020-03-03 19:39:27 -0800192 sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports > onos-ports-list.txt
Shrey Baid18165a32020-02-27 11:01:13 -0800193 '''
Shrey Baide7614d02020-02-25 10:26:42 -0800194 }
Shrey Baid704373e2020-03-03 14:08:02 -0800195 archiveArtifacts artifacts: '*.log,*.json,*txt'
Shrey Baid18165a32020-02-27 11:01:13 -0800196 }
Shrey Baide7614d02020-02-25 10:26:42 -0800197 success {
Matteo Scandolo51b76302020-02-05 12:07:23 -0800198 sh '''
Shrey Baid00ff5c42020-02-07 15:14:08 -0800199 #!/usr/bin/env bash
Shrey Baide7614d02020-02-25 10:26:42 -0800200 set +e
Matteo Scandolo51b76302020-02-05 12:07:23 -0800201 '''
202 }
203 }
Shrey Baid943e2072020-03-04 10:31:32 -0800204}