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 { |
Matteo Scandolo | 7b3fde9 | 2020-02-26 16:17:16 -0800 | [diff] [blame^] | 28 | currentBuild.description = "${onuPerPon} ONU x ${ponPorts} PON - BBSIM Delay ${BBSIMdelay}" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 29 | } |
| 30 | } |
| 31 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 32 | stage('checkout') { |
| 33 | steps { |
| 34 | checkout([ |
| 35 | $class: 'GitSCM', |
| 36 | userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]], |
| 37 | branches: [[ name: "master", ]], |
| 38 | extensions: [ |
| 39 | [$class: 'WipeWorkspace'], |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 40 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 41 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 42 | ], |
| 43 | ]) |
| 44 | script { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 45 | git_tags = sh(script:"cd kind-voltha; git tag -l --points-at HEAD", returnStdout: true).trim() |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 46 | } |
| 47 | } |
| 48 | } |
| 49 | stage('start') { |
| 50 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 51 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 52 | #!/usr/bin/env bash |
| 53 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 54 | ''' |
| 55 | } |
| 56 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 57 | stage('deploy-voltha') { |
| 58 | steps { |
| 59 | sh ''' |
| 60 | cd kind-voltha |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 61 | if [ ! -z ${bbsimImg} ]; |
| 62 | then |
| 63 | IFS=: read -r bbsimRepo bbsimTag <<< ${bbsimImg} |
| 64 | EXTRA_HELM_FLAGS+=",images.bbsim.repository=${bbsimRepo},images.bbsim.tag=${bbsimTag}" |
| 65 | fi |
| 66 | if [ ! -z ${volthaImg} ]; |
| 67 | then |
| 68 | IFS=: read -r volthaRepo volthaTag <<< ${volthaImg} |
| 69 | EXTRA_HELM_FLAGS+=",images.voltha.repository=${volthaRepo},images.voltha.tag=${volthaTag}" |
| 70 | fi |
| 71 | ./voltha up |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 72 | ''' |
| 73 | } |
| 74 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 75 | stage('MIB-template') { |
| 76 | steps { |
| 77 | sh ''' |
| 78 | if [ ${withMibTemplate} = true ] ; then |
| 79 | wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter/master/templates/BBSM-12345123451234512345-00000000000001-v1.json |
| 80 | cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it -n voltha $(kubectl get pods -n voltha | grep etcd-cluster | awk 'NR==1{print $1}') etcdctl put service/voltha/omci_mibs/templates/BBSM/12345123451234512345/00000000000001 |
| 81 | fi |
| 82 | ''' |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 83 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 84 | } |
| 85 | stage('disable-ONOS-apps') { |
| 86 | steps { |
| 87 | sh ''' |
| 88 | #Check withOnosApps and disable apps accordingly |
| 89 | if [ ${withOnosApps} = false ] ; then |
Shrey Baid | 6748658 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 90 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deativate org.opencord.olt |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 91 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.aaa |
| 92 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app deactivate org.opencord.dhcpl2relay |
| 93 | fi |
| 94 | ''' |
Shrey Baid | 0d4e31d | 2020-02-11 13:28:47 -0800 | [diff] [blame] | 95 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 96 | } |
| 97 | stage('configuration') { |
| 98 | steps { |
| 99 | sh ''' |
| 100 | #Setting LOG level to WARN |
| 101 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost log:set WARN |
| 102 | kubectl exec -n voltha $(kubectl get pods -n voltha | grep bbsim | awk 'NR==1{print $1}') bbsimctl log warn false |
| 103 | #Setting link discovery |
| 104 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${setLinkDiscovery} |
| 105 | #Setting the flow stats collection interval |
| 106 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${flowStatInterval} |
| 107 | #Setting the ports stats collection interval |
| 108 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 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^] | 109 | # extending voltctl timeout |
| 110 | sed -i 's/timeout: 10s/timeout: 5m/g' /home/cord/.volt/config-minimal |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 111 | ''' |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 112 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 113 | } |
| 114 | stage('cpu-usage') { |
| 115 | steps { |
| 116 | sh ''' |
| 117 | psrecord $(ps aux | grep -v "grep" | grep rw_core | awk 'NR==1{print $2}') --log rwcore-activity.txt --interval 1 & |
| 118 | ''' |
| 119 | } |
| 120 | } |
| 121 | stage('execute') { |
| 122 | options { |
| 123 | timeout(time:10) |
| 124 | } |
| 125 | stages { |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 126 | stage('ONUs-enabled') { |
| 127 | steps { |
| 128 | sh ''' |
| 129 | if [ -z ${expectedOnus} ] |
| 130 | then |
| 131 | echo -e "You need to set the target ONU number\n" |
| 132 | exit 1 |
| 133 | fi |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 134 | |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 135 | voltctl device create -t openolt -H bbsim:50060 |
| 136 | voltctl device enable $(voltctl device list --filter Type~openolt -q) |
| 137 | # check ONUs reached Active State in VOLTHA |
| 138 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 139 | until [ $i -eq ${expectedOnus} ] |
| 140 | do |
| 141 | echo "$i ONUs ACTIVE of ${expectedOnus} expected (time: $SECONDS)" |
| 142 | sleep ${pollInterval} |
| 143 | i=$(voltctl device list | grep -v OLT | grep ACTIVE | wc -l) |
| 144 | done |
| 145 | echo "${expectedOnus} ONUs Activated in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 146 | echo $SECONDS > activation-time.txt |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 147 | ''' |
| 148 | } |
| 149 | } |
| 150 | stage('ONOS-ports') { |
| 151 | steps { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 152 | sh ''' |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 153 | # Check ports showed up in ONOS |
| 154 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 155 | until [ $z -eq ${expectedOnus} ] |
| 156 | do |
| 157 | echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)" |
| 158 | sleep ${pollInterval} |
| 159 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 160 | done |
| 161 | echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 162 | echo $SECONDS > port-recognition.txt |
| 163 | echo "Duration(s)" > total-time.txt |
| 164 | echo "Duration(s)" > onu-activation.txt |
| 165 | cat activation-time.txt >> onu-activation.txt |
| 166 | paste activation-time.txt port-recognition.txt | awk '{print ($1 + $2)}' >> total-time.txt |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 167 | ''' |
| 168 | } |
| 169 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 170 | } |
| 171 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 172 | } |
| 173 | post { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 174 | always { |
| 175 | plot([ |
| 176 | csvFileName: 'plot-onu-activation.csv', |
| 177 | csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: '']], |
| 178 | group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'ONU Activation Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)' |
| 179 | ]) |
| 180 | |
| 181 | plot([ |
| 182 | csvFileName: 'plot-total-time.csv', |
| 183 | csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']], |
| 184 | group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Port Recognition Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)' |
| 185 | ]) |
| 186 | archiveArtifacts artifacts: '*.log,*.txt' |
| 187 | } |
| 188 | success { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 189 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 190 | #!/usr/bin/env bash |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame] | 191 | set +e |
| 192 | rm onu-activation.txt |
| 193 | rm total-time.txt |
| 194 | rm port-recognition.txt |
| 195 | rm activation-time.txt |
| 196 | cp kind-voltha/install-minimal.log $WORKSPACE/ |
| 197 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
| 198 | ''' |
| 199 | } |
| 200 | cleanup { |
| 201 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 202 | set -euo pipefail |
| 203 | cd $WORKSPACE/kind-voltha |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 204 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 205 | cd $WORKSPACE/ |
| 206 | rm -rf kind-voltha/ || true |
| 207 | ''' |
| 208 | } |
| 209 | } |
Matteo Scandolo | 7b3fde9 | 2020-02-26 16:17:16 -0800 | [diff] [blame^] | 210 | } |