Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 1 | // Copyright 2019-present Open Networking Foundation |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | pipeline { |
| 16 | |
| 17 | agent { |
| 18 | label "${params.buildNode}" |
| 19 | } |
| 20 | options { |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 21 | timeout(time: 120, unit: 'MINUTES') |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 22 | } |
| 23 | environment { |
Matteo Scandolo | 52749cb | 2020-08-27 16:33:13 -0700 | [diff] [blame] | 24 | JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done |
| 25 | KUBECONFIG="$HOME/.kube/config" |
| 26 | VOLTCONFIG="$HOME/.volt/config" |
Matteo Scandolo | 154df53 | 2020-11-08 12:20:08 -0800 | [diff] [blame] | 27 | SSHPASS="karaf" |
Matteo Scandolo | 52749cb | 2020-08-27 16:33:13 -0700 | [diff] [blame] | 28 | SCHEDULE_ON_CONTROL_NODES="yes" |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 29 | FANCY=0 |
| 30 | NAME="minimal" |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 31 | |
Matteo Scandolo | 52749cb | 2020-08-27 16:33:13 -0700 | [diff] [blame] | 32 | WITH_SIM_ADAPTERS="no" |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 33 | WITH_RADIUS="no" |
Matteo Scandolo | 52749cb | 2020-08-27 16:33:13 -0700 | [diff] [blame] | 34 | WITH_BBSIM="yes" |
| 35 | LEGACY_BBSIM_INDEX="no" |
| 36 | DEPLOY_K8S="no" |
| 37 | CONFIG_SADIS="external" |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 38 | VOLTHA_LOG_LEVEL="WARN" |
| 39 | |
| 40 | // install everything in the default namespace |
| 41 | VOLTHA_NS="default" |
| 42 | ADAPTER_NS="default" |
| 43 | INFRA_NS="default" |
| 44 | BBSIM_NS="default" |
| 45 | |
| 46 | // workflow |
| 47 | WITH_EAPOL="no" |
| 48 | WITH_DHCP="no" |
| 49 | WITH_IGMP="no" |
| 50 | |
| 51 | // infrastructure size |
Matteo Scandolo | e5d41f6 | 2020-11-04 15:43:50 -0800 | [diff] [blame] | 52 | NUM_OF_OPENONU="${openonuAdapterReplicas}" |
Matteo Scandolo | f6e8658 | 2020-11-03 17:53:01 -0800 | [diff] [blame] | 53 | NUM_OF_ONOS="${onosReplicas}" |
| 54 | NUM_OF_ATOMIX="${atomixReplicas}" |
| 55 | NUM_OF_KAFKA="${kafkaReplicas}" |
| 56 | NUM_OF_ETCD="${etcdReplicas}" |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 57 | } |
| 58 | |
| 59 | stages { |
Matteo Scandolo | ffc7f84 | 2020-11-04 13:43:21 -0800 | [diff] [blame] | 60 | stage ('Parse parameters') { |
| 61 | steps { |
| 62 | script { |
| 63 | format = "format is 'olt-pon-onu' separated bya comma, eg: '1-16-16, 1-16-32, 2-16-32'" |
| 64 | source = params.topologies |
| 65 | |
| 66 | if (source == null || source == "") { |
| 67 | throw new Exception("You need to specify some deployment topologies, " + format) |
| 68 | } |
| 69 | |
| 70 | topologies = [] |
| 71 | |
| 72 | for(topo in source.split(",")) { |
| 73 | t = topo.split("-") |
| 74 | topologies.add(['olt': t[0].trim(), 'pon': t[1].trim(), 'onu': t[2].trim()]) |
| 75 | } |
| 76 | |
| 77 | if (topologies.size() == 0) { |
| 78 | throw new Exception("Not enough topologies defined, " + format) |
| 79 | } |
| 80 | println "Deploying topologies:" |
| 81 | println topologies |
| 82 | } |
| 83 | } |
| 84 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 85 | stage ('Cleanup') { |
| 86 | steps { |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 87 | timeout(time: 10, unit: 'MINUTES') { |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 88 | sh returnStdout: false, script: """ |
| 89 | helm repo add incubator https://kubernetes-charts-incubator.storage.googleapis.com |
| 90 | helm repo add stable https://kubernetes-charts.storage.googleapis.com |
| 91 | helm repo add onf https://charts.opencord.org |
| 92 | helm repo add cord https://charts.opencord.org |
| 93 | helm repo add onos https://charts.onosproject.org |
| 94 | helm repo add atomix https://charts.atomix.io |
| 95 | helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts |
| 96 | helm repo update |
| 97 | |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 98 | for hchart in \$(helm list -q | grep -E -v 'docker-registry|kafkacat'); |
| 99 | do |
| 100 | echo "Purging chart: \${hchart}" |
| 101 | helm delete "\${hchart}" |
| 102 | done |
| 103 | bash /home/cord/voltha-scale/wait_for_pods.sh |
| 104 | |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 105 | cd $WORKSPACE |
| 106 | rm -rf $WORKSPACE/* |
| 107 | """ |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | stage('Clone kind-voltha') { |
| 112 | steps { |
| 113 | checkout([ |
| 114 | $class: 'GitSCM', |
| 115 | userRemoteConfigs: [[ url: "https://gerrit.opencord.org/kind-voltha", ]], |
| 116 | branches: [[ name: "master", ]], |
| 117 | extensions: [ |
| 118 | [$class: 'WipeWorkspace'], |
| 119 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 120 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 121 | ], |
| 122 | ]) |
| 123 | script { |
| 124 | sh(script:""" |
| 125 | if [ '${kindVolthaChange}' != '' ] ; then |
| 126 | cd $WORKSPACE/kind-voltha; |
| 127 | git fetch https://gerrit.opencord.org/kind-voltha ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 128 | fi |
| 129 | """) |
| 130 | } |
| 131 | } |
| 132 | } |
| 133 | stage('Clone voltha-system-tests') { |
| 134 | steps { |
| 135 | checkout([ |
| 136 | $class: 'GitSCM', |
| 137 | userRemoteConfigs: [[ url: "https://gerrit.opencord.org/voltha-system-tests", ]], |
| 138 | branches: [[ name: "${release}", ]], |
| 139 | extensions: [ |
| 140 | [$class: 'WipeWorkspace'], |
| 141 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 142 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 143 | ], |
| 144 | ]) |
| 145 | script { |
| 146 | sh(script:""" |
| 147 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 148 | cd $WORKSPACE/voltha-system-tests; |
| 149 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 150 | fi |
| 151 | """) |
| 152 | } |
| 153 | } |
| 154 | } |
| 155 | stage('Deploy and test') { |
Matteo Scandolo | 52749cb | 2020-08-27 16:33:13 -0700 | [diff] [blame] | 156 | steps { |
| 157 | repeat_deploy_and_test(topologies) |
| 158 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 159 | } |
Matteo Scandolo | e5d41f6 | 2020-11-04 15:43:50 -0800 | [diff] [blame] | 160 | stage('Aggregate stats') { |
| 161 | steps { |
| 162 | sh returnStdout: false, script: """ |
| 163 | export IN_FOLDER=$WORKSPACE/stats/ |
| 164 | export OUT_FOLDER=$WORKSPACE/plots/ |
| 165 | mkdir -p \$OUT_FOLDER |
| 166 | cd $WORKSPACE/voltha-system-tests |
| 167 | make vst_venv |
| 168 | source ./vst_venv/bin/activate |
| 169 | |
| 170 | sleep 60 # we have to wait for prometheus to collect all the information |
| 171 | |
Matteo Scandolo | b7d60ba | 2020-11-06 09:46:11 -0800 | [diff] [blame] | 172 | python tests/scale/stats-aggregation.py -s \$IN_FOLDER -o \$OUT_FOLDER |
Matteo Scandolo | e5d41f6 | 2020-11-04 15:43:50 -0800 | [diff] [blame] | 173 | """ |
| 174 | } |
| 175 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 176 | } |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 177 | post { |
| 178 | always { |
Matteo Scandolo | b7d60ba | 2020-11-06 09:46:11 -0800 | [diff] [blame] | 179 | archiveArtifacts artifacts: '*-install-minimal.log,*-minimal-env.sh,RobotLogs/**/*,stats/**/*,logs/**/*' |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 180 | } |
| 181 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 182 | } |
| 183 | |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 184 | def repeat_deploy_and_test(list) { |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 185 | for (int i = 0; i < list.size(); i++) { |
Matteo Scandolo | f6e8658 | 2020-11-03 17:53:01 -0800 | [diff] [blame] | 186 | stage('Cleanup') { |
| 187 | sh returnStdout: false, script: """ |
| 188 | for hchart in \$(helm list -q | grep -E -v 'bbsim-sadis-server|onos|radius'); |
| 189 | do |
| 190 | echo "Purging chart: \${hchart}" |
| 191 | helm delete "\${hchart}" |
| 192 | done |
| 193 | bash /home/cord/voltha-scale/wait_for_pods.sh |
| 194 | """ |
| 195 | } |
| 196 | stage('Deploy monitoring infrastructure') { |
| 197 | sh returnStdout: false, script: ''' |
| 198 | helm install nem-monitoring cord/nem-monitoring \ |
| 199 | -f $HOME/voltha-scale/grafana.yaml \ |
| 200 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 201 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 202 | |
| 203 | # TODO download this file from https://github.com/opencord/helm-charts/blob/master/scripts/wait_for_pods.sh |
| 204 | bash /home/cord/voltha-scale/wait_for_pods.sh |
| 205 | ''' |
| 206 | } |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 207 | stage('Deploy topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) { |
| 208 | timeout(time: 10, unit: 'MINUTES') { |
| 209 | script { |
| 210 | now = new Date(); |
| 211 | currentRunStart = now.getTime() / 1000; |
| 212 | println("Start: " + currentRunStart) |
| 213 | } |
| 214 | sh returnStdout: false, script: """ |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 215 | cd $WORKSPACE/kind-voltha/ |
| 216 | |
| 217 | if [ '${release.trim()}' != 'master' ]; then |
| 218 | source $WORKSPACE/kind-voltha/releases/${release} |
| 219 | fi |
| 220 | |
| 221 | # if it's newer than voltha-2.4 set the correct BBSIM_CFG |
| 222 | if [ '${release.trim()}' != 'voltha-2.4' ]; then |
| 223 | export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-dt.yaml" |
| 224 | fi |
| 225 | |
| 226 | export NUM_OF_BBSIM=${list[i]['olt']} |
| 227 | export EXTRA_HELM_FLAGS+="--set enablePerf=true,pon=${list[i]['pon']},onu=${list[i]['onu']} " |
Matteo Scandolo | f6e8658 | 2020-11-03 17:53:01 -0800 | [diff] [blame] | 228 | export EXTRA_HELM_FLAGS+="--set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default" |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 229 | ./voltha up |
| 230 | |
Matteo Scandolo | 8d61e10 | 2020-11-06 15:46:19 -0800 | [diff] [blame] | 231 | # disable LLDP |
| 232 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled false |
| 233 | |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 234 | cp minimal-env.sh ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-minimal-env.sh |
| 235 | cp install-minimal.log ../${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']}-install-minimal.log |
| 236 | """ |
Matteo Scandolo | b7d60ba | 2020-11-06 09:46:11 -0800 | [diff] [blame] | 237 | sleep(120) // TODO can we improve and check once the bbsim-sadis-server is actually done loading subscribers?? |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 238 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 239 | } |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 240 | stage('Test topology: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) { |
Matteo Scandolo | b7d60ba | 2020-11-06 09:46:11 -0800 | [diff] [blame] | 241 | timeout(time: 15, unit: 'MINUTES') { |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 242 | sh returnStdout: false, script: """ |
| 243 | mkdir -p $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} |
| 244 | cd $WORKSPACE/voltha-system-tests |
| 245 | make vst_venv |
| 246 | |
| 247 | export ROBOT_PARAMS=" \ |
| 248 | -v olt:${list[i]['olt']} \ |
| 249 | -v pon:${list[i]['pon']} \ |
| 250 | -v onu:${list[i]['onu']} \ |
| 251 | -v workflow:dt \ |
| 252 | -v withEapol:false \ |
| 253 | -v withDhcp:false \ |
| 254 | -v withIgmp:false \ |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 255 | -e authentication \ |
| 256 | -e dhcp" |
| 257 | |
| 258 | cd $WORKSPACE/voltha-system-tests |
| 259 | source ./vst_venv/bin/activate |
| 260 | robot -d $WORKSPACE/RobotLogs/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} \ |
| 261 | \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
| 262 | """ |
| 263 | } |
| 264 | } |
| 265 | stage('Collect metrics: ' + list[i]['olt'] + "-" + list[i]['pon'] + "-" + list[i]['onu']) { |
| 266 | script { |
| 267 | now = new Date(); |
| 268 | currentRunEnd = now.getTime() / 1000; |
| 269 | println("End: " + currentRunEnd) |
| 270 | delta = currentRunEnd - currentRunStart |
| 271 | println("Delta: " + delta) |
| 272 | minutesDelta = Math.ceil(delta / 60).toInteger() |
| 273 | println("Delta in minutes: " + minutesDelta) |
| 274 | } |
| 275 | sh returnStdout: false, script: """ |
| 276 | export LOG_FOLDER=$WORKSPACE/stats/${list[i]['olt']}-${list[i]['pon']}-${list[i]['onu']} |
| 277 | mkdir -p \$LOG_FOLDER |
| 278 | cd $WORKSPACE/voltha-system-tests |
| 279 | make vst_venv |
| 280 | source ./vst_venv/bin/activate |
| 281 | |
Matteo Scandolo | f6e8658 | 2020-11-03 17:53:01 -0800 | [diff] [blame] | 282 | sleep 60 # we have to wait for prometheus to collect all the information |
| 283 | |
Matteo Scandolo | b7d60ba | 2020-11-06 09:46:11 -0800 | [diff] [blame] | 284 | python tests/scale/sizing.py -o \$LOG_FOLDER -s ${minutesDelta} |
Matteo Scandolo | 5fec802 | 2020-08-27 17:29:35 -0700 | [diff] [blame] | 285 | """ |
| 286 | } |
| 287 | } |
Matteo Scandolo | c88d313 | 2020-08-27 15:24:34 -0700 | [diff] [blame] | 288 | } |