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 | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 22 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 23 | stages { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 24 | stage('set-description') { |
| 25 | steps { |
| 26 | script { |
| 27 | currentBuild.description = "${onuPerPon} ONU x ${ponPorts} PON" |
| 28 | } |
| 29 | } |
| 30 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 31 | stage('checkout') { |
| 32 | steps { |
| 33 | checkout([ |
| 34 | $class: 'GitSCM', |
| 35 | userRemoteConfigs: [[ url: "https://github.com/ciena/kind-voltha.git", ]], |
| 36 | branches: [[ name: "master", ]], |
| 37 | extensions: [ |
| 38 | [$class: 'WipeWorkspace'], |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 39 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 40 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 41 | ], |
| 42 | ]) |
| 43 | script { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 44 | 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] | 45 | } |
| 46 | } |
| 47 | } |
| 48 | stage('start') { |
| 49 | steps { |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 50 | sh ''' |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 51 | #!/usr/bin/env bash |
| 52 | set -euo pipefail |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 53 | ''' |
| 54 | } |
| 55 | } |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 56 | stage('deploy-voltha') { |
| 57 | steps { |
| 58 | sh ''' |
| 59 | cd kind-voltha |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 60 | EXTRA_HELM_FLAGS="--set onu=${onuPerPon},pon=${ponPorts},delay=${BBSIMdelay},auth=${bbsimAuth},dhcp=${bbsimDhcp}" |
| 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 |
| 90 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost app dfctivate org.opencord.olt |
| 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} |
| 109 | ''' |
Shrey Baid | 7cbb06e | 2020-02-11 17:45:07 -0800 | [diff] [blame] | 110 | } |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 111 | } |
| 112 | stage('cpu-usage') { |
| 113 | steps { |
| 114 | sh ''' |
| 115 | psrecord $(ps aux | grep -v "grep" | grep rw_core | awk 'NR==1{print $2}') --log rwcore-activity.txt --interval 1 & |
| 116 | ''' |
| 117 | } |
| 118 | } |
| 119 | stage('execute') { |
| 120 | options { |
| 121 | timeout(time:10) |
| 122 | } |
| 123 | stages { |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 124 | 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 Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 132 | |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 133 | 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)" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 144 | echo $SECONDS > activation-time.txt |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 145 | ''' |
| 146 | } |
| 147 | } |
| 148 | stage('ONOS-ports') { |
| 149 | steps { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 150 | sh ''' |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 151 | # Check ports showed up in ONOS |
| 152 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 153 | until [ $z -eq ${expectedOnus} ] |
| 154 | do |
| 155 | echo "${z} enabled ports of ${expectedOnus} expected (time: $SECONDS)" |
| 156 | sleep ${pollInterval} |
| 157 | z=$(sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@localhost ports -e | grep BBSM | wc -l) |
| 158 | done |
| 159 | echo "${expectedOnus} ports enabled in $SECONDS seconds (time: $SECONDS)" |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 160 | echo $SECONDS > port-recognition.txt |
| 161 | echo "Duration(s)" > total-time.txt |
| 162 | echo "Duration(s)" > onu-activation.txt |
| 163 | cat activation-time.txt >> onu-activation.txt |
| 164 | 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] | 165 | ''' |
| 166 | } |
| 167 | } |
Shrey Baid | b001c71 | 2020-02-11 11:12:46 -0800 | [diff] [blame] | 168 | } |
| 169 | } |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 170 | } |
| 171 | post { |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 172 | always { |
| 173 | plot([ |
| 174 | csvFileName: 'plot-onu-activation.csv', |
| 175 | csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'onu-activation.txt', inclusionFlag: 'OFF', url: '']], |
| 176 | group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'ONU Activation Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)' |
| 177 | ]) |
| 178 | |
| 179 | plot([ |
| 180 | csvFileName: 'plot-total-time.csv', |
| 181 | csvSeries: [[displayTableFlag: false, exclusionValues: '', file: 'total-time.txt', inclusionFlag: 'OFF', url: '']], |
| 182 | group: 'Voltha-Scale-Numbers', numBuilds: '100', style: 'line', title: 'Port Recognition Time (200ms Delay)', useDescr: true, yaxis: 'Time (s)' |
| 183 | ]) |
| 184 | archiveArtifacts artifacts: '*.log,*.txt' |
| 185 | } |
| 186 | success { |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 187 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 188 | #!/usr/bin/env bash |
Shrey Baid | e7614d0 | 2020-02-25 10:26:42 -0800 | [diff] [blame^] | 189 | set +e |
| 190 | rm onu-activation.txt |
| 191 | rm total-time.txt |
| 192 | rm port-recognition.txt |
| 193 | rm activation-time.txt |
| 194 | cp kind-voltha/install-minimal.log $WORKSPACE/ |
| 195 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
| 196 | ''' |
| 197 | } |
| 198 | cleanup { |
| 199 | sh ''' |
Shrey Baid | 00ff5c4 | 2020-02-07 15:14:08 -0800 | [diff] [blame] | 200 | set -euo pipefail |
| 201 | cd $WORKSPACE/kind-voltha |
Shrey Baid | a3b8aa6 | 2020-02-13 11:22:51 -0800 | [diff] [blame] | 202 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Matteo Scandolo | 51b7630 | 2020-02-05 12:07:23 -0800 | [diff] [blame] | 203 | cd $WORKSPACE/ |
| 204 | rm -rf kind-voltha/ || true |
| 205 | ''' |
| 206 | } |
| 207 | } |
Shrey Baid | ba6e985 | 2020-02-12 11:19:33 -0800 | [diff] [blame] | 208 | } |