Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 1 | /* voltha-scale-measurements pipeline */ |
| 2 | pipeline { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 3 | /* no label, executor is determined by JJB */ |
| 4 | agent { |
| 5 | label "${params.buildNode}" |
| 6 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 7 | 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 Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 13 | SECONDS=0 |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 14 | WITH_SIM_ADAPTERS="n" |
| 15 | WITH_RADIUS="y" |
| 16 | WITH_BBSIM="y" |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 17 | VOLTHA_LOG_LEVEL="WARN" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 18 | CONFIG_SADIS="n" |
| 19 | ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs -v teardown_device:False" |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 20 | SSHPASS="karaf" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 21 | DEPLOY_K8S="n" |
Shrey Baid | 6748658 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 22 | EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimAuth},dhcp=${bbsimDhcp}" |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 23 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 24 | stages { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 25 | stage('set-description') { |
| 26 | steps { |
| 27 | script { |
Shrey Baid | 943e207 | 2020-03-04 10:31:32 -0800 | [diff] [blame] | 28 | currentBuild.description = "$BUILD_TIMESTAMP" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 29 | } |
| 30 | } |
| 31 | } |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 32 | stage('cleanup') { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 33 | steps { |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 34 | sh ''' |
Matteo Scandolo | e57af74 | 2020-03-04 16:39:56 -0800 | [diff] [blame] | 35 | rm -rf voltha-devices.txt onos-ports.txt total-time.txt onu-activation.txt |
Matteo Scandolo | 151e35c | 2020-02-28 15:45:15 -0800 | [diff] [blame] | 36 | 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 Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 41 | bash /home/cord/voltha-scale/wait_for_pods.sh |
| 42 | bash /home/cord/voltha-scale/stop_port_forward.sh |
| 43 | ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 44 | } |
| 45 | } |
| 46 | stage('start') { |
| 47 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 48 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 49 | #!/usr/bin/env bash |
| 50 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 51 | ''' |
| 52 | } |
| 53 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 54 | stage('deploy-voltha') { |
| 55 | steps { |
| 56 | sh ''' |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 57 | helm install -n onos onf/onos --set images.onos.repository=voltha/voltha-onos --set images.onos.tag=4.0.1 |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 58 | |
Matteo Scandolo | a2928e7 | 2020-03-02 16:38:22 -0800 | [diff] [blame] | 59 | 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 Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 70 | helm install -n radius onf/freeradius |
| 71 | |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 72 | 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 Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 82 | bash /home/cord/voltha-scale/wait_for_pods.sh |
| 83 | bash /home/cord/voltha-scale/start_port_forward.sh |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 84 | ''' |
| 85 | } |
| 86 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 87 | stage('MIB-template') { |
| 88 | steps { |
| 89 | sh ''' |
| 90 | if [ ${withMibTemplate} = true ] ; then |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 91 | rm -f BBSM-12345123451234512345-00000000000001-v1.json |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 92 | wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 93 | 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 Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 94 | fi |
| 95 | ''' |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 96 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 97 | } |
| 98 | stage('disable-ONOS-apps') { |
| 99 | steps { |
| 100 | sh ''' |
| 101 | #Check withOnosApps and disable apps accordingly |
| 102 | if [ ${withOnosApps} = false ] ; then |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 103 | 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 Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 106 | fi |
| 107 | ''' |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 108 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 109 | } |
| 110 | stage('configuration') { |
| 111 | steps { |
| 112 | sh ''' |
| 113 | #Setting LOG level to WARN |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 114 | 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 Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 116 | #Setting link discovery |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 117 | 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 Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 118 | #Setting the flow stats collection interval |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 119 | 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 Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 120 | #Setting the ports stats collection interval |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 121 | 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 Scandolo | 7b3fde9 | 2020-02-26 16:17:16 -0800 | [diff] [blame] | 122 | # extending voltctl timeout |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 123 | sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 124 | ''' |
| 125 | } |
| 126 | } |
| 127 | stage('execute') { |
| 128 | options { |
| 129 | timeout(time:10) |
| 130 | } |
| 131 | stages { |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 132 | 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 Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 140 | |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 141 | 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 Scandolo | 3c3fe2c | 2020-03-03 17:53:34 -0800 | [diff] [blame] | 152 | echo $SECONDS > voltha-devices.txt |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 153 | ''' |
| 154 | } |
| 155 | } |
| 156 | stage('ONOS-ports') { |
| 157 | steps { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 158 | sh ''' |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 159 | # Check ports showed up in ONOS |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 160 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l) |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 161 | until [ $z -eq ${expectedOnus} ] |
| 162 | do |
| 163 | echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)" |
| 164 | sleep ${pollInterval} |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 165 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports -e | grep BBSM | wc -l) |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 166 | done |
| 167 | echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)" |
Matteo Scandolo | 3c3fe2c | 2020-03-03 17:53:34 -0800 | [diff] [blame] | 168 | echo $SECONDS > onos-ports.txt |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 169 | echo "ONOS-Duration(s)" > total-time.txt |
| 170 | echo "VOLTHA-Duration(s)" > onu-activation.txt |
Matteo Scandolo | 3c3fe2c | 2020-03-03 17:53:34 -0800 | [diff] [blame] | 171 | cat voltha-devices.txt >> onu-activation.txt |
| 172 | paste voltha-devices.txt onos-ports.txt | awk '{print ($1 + $2)}' >> total-time.txt |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 173 | ''' |
| 174 | } |
| 175 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 176 | } |
| 177 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 178 | } |
| 179 | post { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 180 | always { |
| 181 | plot([ |
| 182 | csvFileName: 'plot-onu-activation.csv', |
Shrey Baid | b044718 | 2020-02-27 16:39:35 -0800 | [diff] [blame] | 183 | csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: ''], [displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']], |
Shrey Baid | 943e207 | 2020-03-04 10:31:32 -0800 | [diff] [blame] | 184 | group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: "Time (${BBSIMdelay}s Delay)", yaxis: 'Time (s)', useDescr: true |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 185 | ]) |
Shrey Baid | 18165a3 | 2020-02-27 11:01:13 -0800 | [diff] [blame] | 186 | script { |
| 187 | sh ''' |
| 188 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
Shrey Baid | 704373e | 2020-03-03 14:08:02 -0800 | [diff] [blame] | 189 | 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 Scandolo | 10581c5 | 2020-03-03 19:39:27 -0800 | [diff] [blame] | 192 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@localhost ports > onos-ports-list.txt |
Shrey Baid | 18165a3 | 2020-02-27 11:01:13 -0800 | [diff] [blame] | 193 | ''' |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 194 | } |
Shrey Baid | 704373e | 2020-03-03 14:08:02 -0800 | [diff] [blame] | 195 | archiveArtifacts artifacts: '*.log,*.json,*txt' |
Shrey Baid | 18165a3 | 2020-02-27 11:01:13 -0800 | [diff] [blame] | 196 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 197 | success { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 198 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 199 | #!/usr/bin/env bash |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 200 | set +e |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 201 | ''' |
| 202 | } |
| 203 | } |
Shrey Baid | 943e207 | 2020-03-04 10:31:32 -0800 | [diff] [blame] | 204 | } |