Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [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 | // deploy VOLTHA using kind-voltha and performs a scale test |
| 16 | |
| 17 | // NOTE we are importing the library even if it's global so that it's |
| 18 | // easier to change the keywords during a replay |
| 19 | library identifier: 'cord-jenkins-libraries@master', |
| 20 | retriever: modernSCM([ |
| 21 | $class: 'GitSCMSource', |
| 22 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 23 | ]) |
| 24 | |
Matteo Scandolo | 433f60d | 2021-03-26 12:04:34 -0700 | [diff] [blame] | 25 | def ofAgentConnections(numOfOnos, releaseName, namespace) { |
| 26 | def params = " " |
| 27 | numOfOnos.times { |
| 28 | params += "--set voltha.services.controller[${it}].address=${releaseName}-onos-classic-${it}.${releaseName}-onos-classic-hs.${namespace}.svc:6653 " |
| 29 | } |
| 30 | return params |
| 31 | } |
| 32 | |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 33 | pipeline { |
| 34 | |
| 35 | /* no label, executor is determined by JJB */ |
| 36 | agent { |
| 37 | label "${params.buildNode}" |
| 38 | } |
| 39 | options { |
| 40 | timeout(time: 120, unit: 'MINUTES') |
| 41 | } |
| 42 | environment { |
| 43 | JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done |
| 44 | KUBECONFIG="$HOME/.kube/config" |
| 45 | SSHPASS="karaf" |
| 46 | PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" |
| 47 | |
| 48 | APPS_TO_LOG="etcd kafka onos-onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server" |
| 49 | LOG_FOLDER="$WORKSPACE/logs" |
| 50 | } |
| 51 | |
| 52 | stages { |
| 53 | stage ('Cleanup') { |
| 54 | steps { |
| 55 | timeout(time: 11, unit: 'MINUTES') { |
Matteo Scandolo | 557cd8b | 2021-02-25 10:42:45 -0800 | [diff] [blame] | 56 | sh """ |
| 57 | # remove orphaned port-forward from different namespaces |
Andrea Campanella | 4c8af94 | 2021-05-12 10:12:13 +0200 | [diff] [blame] | 58 | ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true |
Matteo Scandolo | 557cd8b | 2021-02-25 10:42:45 -0800 | [diff] [blame] | 59 | """ |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 60 | script { |
| 61 | def namespaces = ["infra"] |
| 62 | // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks) |
| 63 | volthaStacks.toInteger().times { |
| 64 | namespaces += "voltha${it + 1}" |
| 65 | } |
| 66 | helmTeardown(namespaces) |
| 67 | } |
| 68 | sh returnStdout: false, script: """ |
| 69 | helm repo add onf https://charts.opencord.org |
| 70 | helm repo add cord https://charts.opencord.org |
| 71 | helm repo update |
| 72 | |
| 73 | # remove all port-forward from different namespaces |
Andrea Campanella | 4c8af94 | 2021-05-12 10:12:13 +0200 | [diff] [blame] | 74 | ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 75 | """ |
| 76 | } |
| 77 | } |
| 78 | } |
| 79 | stage('Download Code') { |
| 80 | steps { |
| 81 | getVolthaCode([ |
| 82 | branch: "${release}", |
| 83 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
Girish Gowdra | a5b1de2 | 2021-06-07 14:20:27 -0700 | [diff] [blame] | 84 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 85 | ]) |
| 86 | } |
| 87 | } |
| 88 | stage('Deploy common infrastructure') { |
| 89 | // includes monitoring |
| 90 | steps { |
| 91 | sh ''' |
| 92 | if [ ${withMonitoring} = true ] ; then |
| 93 | helm install -n infra nem-monitoring cord/nem-monitoring \ |
| 94 | -f $HOME/voltha-scale/grafana.yaml \ |
| 95 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 96 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 97 | fi |
| 98 | ''' |
| 99 | } |
| 100 | } |
| 101 | stage('Deploy VOLTHA infrastructure') { |
| 102 | steps { |
| 103 | sh returnStdout: false, script: ''' |
| 104 | |
Andrea Campanella | 4c75f16 | 2021-06-30 14:27:36 +0200 | [diff] [blame^] | 105 | kubectl create configmap -n infra kube-config "--from-file=kube_config=\$KUBECONFIG" || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 106 | |
Andrea Campanella | 4c75f16 | 2021-06-30 14:27:36 +0200 | [diff] [blame^] | 107 | export EXTRA_HELM_FLAGS+=' ' |
| 108 | |
| 109 | # No persistent-volume-claims in Atomix |
| 110 | EXTRA_HELM_FLAGS+="--set onos-classic.atomix.persistence.enabled=false " |
| 111 | # disable the securityContext, this is a development cluster |
| 112 | EXTRA_HELM_FLAGS+='--set securityContext.enabled=false ' |
| 113 | |
| 114 | echo \$EXTRA_HELM_FLAGS |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 115 | |
| 116 | helm upgrade --install -n infra voltha-infra onf/voltha-infra \ |
| 117 | -f $WORKSPACE/voltha-helm-charts/examples/${workflow}-values.yaml \ |
| 118 | --set onos-classic.replicas=${onosReplicas},onos-classic.atomix.replicas=${atomixReplicas} \ |
| 119 | --set radius.enabled=${withEapol} \ |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 120 | --set global.log_level=${logLevel} \ |
| 121 | --set onos-classic.onosSshPort=30115 \ |
Andrea Campanella | 4c75f16 | 2021-06-30 14:27:36 +0200 | [diff] [blame^] | 122 | --set onos-classic.onosApiPort=30120 \ |
| 123 | --set kafka.replicaCount=3,kafka.zookeeper.replicaCount=3 \ |
| 124 | --set etcd.statefulset.replicaCount=3 \$EXTRA_HELM_FLAGS |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 125 | ''' |
| 126 | } |
| 127 | } |
| 128 | stage('Deploy Voltha') { |
| 129 | steps { |
| 130 | deploy_voltha_stacks(params.volthaStacks) |
| 131 | } |
| 132 | } |
| 133 | stage('Start logging') { |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 134 | //FIXME this collects the logs all in one file for all the 10 stacks |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 135 | steps { |
| 136 | sh returnStdout: false, script: ''' |
| 137 | # start logging with kail |
| 138 | |
| 139 | mkdir -p $LOG_FOLDER |
| 140 | |
| 141 | list=($APPS_TO_LOG) |
| 142 | for app in "${list[@]}" |
| 143 | do |
| 144 | echo "Starting logs for: ${app}" |
| 145 | _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log& |
| 146 | done |
| 147 | ''' |
| 148 | } |
| 149 | } |
| 150 | stage('Configuration') { |
| 151 | steps { |
| 152 | script { |
| 153 | sh returnStdout: false, script: """ |
| 154 | |
| 155 | # forward ETCD port |
Matteo Scandolo | 89f5833 | 2021-03-26 15:40:00 -0700 | [diff] [blame] | 156 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=etcd-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/etcd 9999:2379; done 2>&1 " & |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 157 | |
| 158 | # forward ONOS ports |
Matteo Scandolo | 89f5833 | 2021-03-26 15:40:00 -0700 | [diff] [blame] | 159 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8101:8101; done 2>&1 " & |
| 160 | JENKINS_NODE_COOKIE="dontKillMe" _TAG=onos-port-forward /bin/bash -c "while true; do kubectl -n infra port-forward --address 0.0.0.0 service/voltha-infra-onos-classic-hs 8181:8181; done 2>&1 " & |
Matteo Scandolo | 2d30c7d | 2021-02-25 15:39:51 -0800 | [diff] [blame] | 161 | |
| 162 | # make sure the the port-forward has started before moving forward |
| 163 | sleep 5 |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 164 | """ |
| 165 | sh returnStdout: false, script: """ |
| 166 | # TODO this needs to be repeated per stack |
| 167 | # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false |
| 168 | |
| 169 | #Setting link discovery |
| 170 | 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 ${withLLDP} |
| 171 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager allowExtraneousRules true |
| 172 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager importExtraneousRules true |
Matteo Scandolo | 433f60d | 2021-03-26 12:04:34 -0700 | [diff] [blame] | 173 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 900 |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 174 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxIdleMillis 500 |
Matteo Scandolo | 433f60d | 2021-03-26 12:04:34 -0700 | [diff] [blame] | 175 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.opencord.olt.impl.Olt provisionDelay 1000 |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 176 | |
| 177 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject |
| 178 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord |
| 179 | |
| 180 | # Set Flows/Ports/Meters poll frequency |
| 181 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${onosStatInterval} |
| 182 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${onosStatInterval} |
| 183 | |
| 184 | if [ ${withFlows} = false ]; then |
| 185 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt |
| 186 | fi |
| 187 | """ |
| 188 | } |
| 189 | } |
| 190 | } |
| 191 | stage('Setup Test') { |
| 192 | steps { |
| 193 | sh ''' |
| 194 | mkdir -p $WORKSPACE/RobotLogs |
| 195 | cd $WORKSPACE/voltha-system-tests |
| 196 | make vst_venv |
| 197 | ''' |
| 198 | } |
| 199 | } |
| 200 | stage('Run Test') { |
| 201 | steps { |
| 202 | test_voltha_stacks(params.volthaStacks) |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | post { |
| 207 | always { |
| 208 | // collect result, done in the "post" step so it's executed even in the |
| 209 | // event of a timeout in the tests |
| 210 | sh ''' |
| 211 | |
| 212 | # stop the kail processes |
| 213 | list=($APPS_TO_LOG) |
| 214 | for app in "${list[@]}" |
| 215 | do |
| 216 | echo "Stopping logs for: ${app}" |
| 217 | _TAG="kail-$app" |
| 218 | P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')" |
| 219 | if [ -n "$P_IDS" ]; then |
| 220 | echo $P_IDS |
| 221 | for P_ID in $P_IDS; do |
| 222 | kill -9 $P_ID |
| 223 | done |
| 224 | fi |
| 225 | done |
| 226 | ''' |
Matteo Scandolo | b3d2727b | 2021-03-03 11:17:46 -0800 | [diff] [blame] | 227 | // compressing the logs to save space on Jenkins |
| 228 | sh ''' |
| 229 | cd $LOG_FOLDER |
| 230 | tar -czf logs.tar.gz *.log |
| 231 | rm *.log |
| 232 | ''' |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 233 | plot([ |
| 234 | csvFileName: 'scale-test.csv', |
| 235 | csvSeries: [ |
| 236 | [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 237 | [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 238 | [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 239 | [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 240 | [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 241 | [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 242 | [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 243 | [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 244 | [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 245 | [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 246 | ], |
| 247 | group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (Stacks: ${params.volthaStacks}, OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true |
| 248 | ]) |
| 249 | step([$class: 'RobotPublisher', |
| 250 | disableArchiveOutput: false, |
| 251 | logFileName: 'RobotLogs/**/log.html', |
| 252 | otherFiles: '', |
| 253 | outputFileName: 'RobotLogs/**/output.xml', |
| 254 | outputPath: '.', |
| 255 | passThreshold: 100, |
| 256 | reportFileName: 'RobotLogs/**/report.html', |
Andrea Campanella | 98b6e2b | 2021-06-22 09:34:48 +0200 | [diff] [blame] | 257 | unstableThreshold: 0]); |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 258 | // get all the logs from kubernetes PODs |
| 259 | sh returnStdout: false, script: ''' |
| 260 | |
| 261 | # store information on running charts |
| 262 | helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true |
| 263 | |
| 264 | # store information on the running pods |
| 265 | kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true |
| 266 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true |
| 267 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true |
| 268 | |
| 269 | # copy the ONOS logs directly from the container to avoid the color codes |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 270 | printf '%s\n' $(kubectl get pods -n infra -l app=onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs --no-run-if-empty -I# bash -c "kubectl cp #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 271 | |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 272 | ''' |
| 273 | // dump all the BBSim(s) ONU information |
| 274 | script { |
| 275 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 276 | stack_ns="voltha"+i |
| 277 | sh """ |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 278 | mkdir -p \$LOG_FOLDER/${stack_ns} |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 279 | BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}') |
| 280 | IDS=(\$BBSIM_IDS) |
| 281 | |
| 282 | for bbsim in "\${IDS[@]}" |
| 283 | do |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 284 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > \$LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true |
| 285 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > \$LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true |
| 286 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true |
| 287 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true |
| 288 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt pons > \$LOG_FOLDER/${stack_ns}/\$bbsim-pon-resources.txt || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 289 | done |
| 290 | """ |
| 291 | } |
| 292 | } |
| 293 | // get ONOS debug infos |
| 294 | sh ''' |
| 295 | |
| 296 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 apps -a -s > $LOG_FOLDER/onos-apps.txt || true |
| 297 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 nodes > $LOG_FOLDER/onos-nodes.txt || true |
| 298 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 masters > $LOG_FOLDER/onos-masters.txt || true |
| 299 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 roles > $LOG_FOLDER/onos-roles.txt || true |
| 300 | |
| 301 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 ports > $LOG_FOLDER/onos-ports-list.txt || true |
| 302 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 hosts > $LOG_FOLDER/onos-hosts-list.txt || true |
| 303 | |
| 304 | if [ ${withFlows} = true ] ; then |
| 305 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-olts > $LOG_FOLDER/onos-olt-list.txt || true |
| 306 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 flows -s > $LOG_FOLDER/onos-flows-list.txt || true |
| 307 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 meters > $LOG_FOLDER/onos-meters-list.txt || true |
| 308 | fi |
| 309 | |
| 310 | if [ ${provisionSubscribers} = true ]; then |
| 311 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-subscribers > $LOG_FOLDER/onos-programmed-subscribers.txt || true |
| 312 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-programmed-meters > $LOG_FOLDER/onos-programmed-meters.txt || true |
| 313 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-bpmeter-mappings > $LOG_FOLDER/onos-bpmeter-mappings.txt || true |
| 314 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 volt-failed-subscribers > $LOG_FOLDER/onos-failed-subscribers.txt || true |
| 315 | fi |
| 316 | |
| 317 | if [ ${withEapol} = true ] ; then |
| 318 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 aaa-users > $LOG_FOLDER/onos-aaa-users.txt || true |
| 319 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 aaa-statistics > $LOG_FOLDER/onos-aaa-statistics.txt || true |
| 320 | fi |
| 321 | |
| 322 | if [ ${withDhcp} = true ] ; then |
| 323 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 dhcpl2relay-allocations > $LOG_FOLDER/onos-dhcp-allocations.txt || true |
| 324 | fi |
| 325 | ''' |
| 326 | // collect etcd metrics |
| 327 | sh ''' |
| 328 | mkdir -p $WORKSPACE/etcd-metrics |
| 329 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_debugging_mvcc_keys_total' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-key-count.json || true |
| 330 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=grpc_server_handled_total{grpc_service="etcdserverpb.KV"}' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-rpc-count.json || true |
| 331 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_debugging_mvcc_db_total_size_in_bytes' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-db-size.json || true |
| 332 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_backend_commit_duration_seconds_sum' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-backend-write-time.json || true |
| 333 | ''' |
| 334 | // get VOLTHA debug infos |
| 335 | script { |
| 336 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 337 | stack_ns="voltha"+i |
| 338 | voltcfg="~/.volt/config-voltha"+i |
| 339 | try { |
| 340 | sh """ |
| 341 | |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 342 | # _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555& > /dev/null 2>&1 |
| 343 | _TAG="voltha-port-forward" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555 > /dev/null 2>&1; done"& |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 344 | |
| 345 | voltctl -m 8MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 346 | python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true |
| 347 | rm $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 348 | voltctl -m 8MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true |
| 349 | |
| 350 | DEVICE_LIST= |
| 351 | printf '%s\n' \$(voltctl -m 8MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl-m 8MB device flows # > $LOG_FOLDER/${stack_ns}/voltha-device-flows-#.txt" || true |
| 352 | printf '%s\n' \$(voltctl -m 8MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' # > $LOG_FOLDER/${stack_ns}/voltha-device-ports-#.txt" || true |
| 353 | |
| 354 | printf '%s\n' \$(voltctl -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB logicaldevice flows # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-flows-#.txt" || true |
| 355 | printf '%s\n' \$(voltctl -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB logicaldevice port list # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-ports-#.txt" || true |
| 356 | |
| 357 | # remove VOLTHA port-forward |
Andrea Campanella | 4c8af94 | 2021-05-12 10:12:13 +0200 | [diff] [blame] | 358 | ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 359 | """ |
| 360 | } catch(e) { |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 361 | println e |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 362 | sh ''' |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 363 | echo "Can't get device list from voltctl" |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 364 | ''' |
| 365 | } |
| 366 | } |
| 367 | } |
| 368 | // get cpu usage by container |
| 369 | sh ''' |
| 370 | if [ ${withMonitoring} = true ] ; then |
| 371 | cd $WORKSPACE/voltha-system-tests |
| 372 | source ./vst_venv/bin/activate |
| 373 | sleep 60 # we have to wait for prometheus to collect all the information |
| 374 | python tests/scale/sizing.py -o $WORKSPACE/plots || true |
| 375 | fi |
| 376 | ''' |
Matteo Scandolo | b3d2727b | 2021-03-03 11:17:46 -0800 | [diff] [blame] | 377 | archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*.txt,logs/**/*.tar.gz,RobotLogs/**/*,plots/*,etcd-metrics/*' |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 378 | } |
| 379 | } |
| 380 | } |
| 381 | |
| 382 | def deploy_voltha_stacks(numberOfStacks) { |
| 383 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 384 | stage("Deploy VOLTHA stack " + i) { |
| 385 | // ${logLevel} |
Matteo Scandolo | 8877ab8 | 2021-02-24 15:54:23 -0800 | [diff] [blame] | 386 | def extraHelmFlags = "${extraHelmFlags} --set global.log_level=${logLevel},enablePerf=true,onu=${onus},pon=${pons} " |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 387 | extraHelmFlags += " --set securityContext.enabled=false,atomix.persistence.enabled=false " |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 388 | |
Matteo Scandolo | 433f60d | 2021-03-26 12:04:34 -0700 | [diff] [blame] | 389 | // FIXME having to set all of these values is annoying, is there a better solution? |
| 390 | def volthaHelmFlags = extraHelmFlags + |
Matteo Scandolo | 433f60d | 2021-03-26 12:04:34 -0700 | [diff] [blame] | 391 | ofAgentConnections(onosReplicas.toInteger(), "voltha-infra", "infra") |
| 392 | |
Girish Gowdra | a5b1de2 | 2021-06-07 14:20:27 -0700 | [diff] [blame] | 393 | def localCharts = false |
| 394 | if (volthaHelmChartsChange != "") { |
| 395 | localCharts = true |
| 396 | } |
| 397 | |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 398 | volthaStackDeploy([ |
| 399 | bbsimReplica: olts.toInteger(), |
| 400 | infraNamespace: "infra", |
| 401 | volthaNamespace: "voltha${i}", |
| 402 | stackName: "voltha${i}", |
| 403 | stackId: i, |
| 404 | workflow: workflow, |
Girish Gowdra | a5b1de2 | 2021-06-07 14:20:27 -0700 | [diff] [blame] | 405 | extraHelmFlags: volthaHelmFlags, |
| 406 | localCharts: localCharts |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 407 | ]) |
| 408 | } |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | def test_voltha_stacks(numberOfStacks) { |
| 413 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 414 | stage("Test VOLTHA stack " + i) { |
| 415 | timeout(time: 15, unit: 'MINUTES') { |
| 416 | sh """ |
| 417 | |
| 418 | # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file |
| 419 | voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config |
| 420 | export VOLTCONFIG=$HOME/.volt/config |
| 421 | |
Andrea Campanella | 06ca362 | 2021-05-26 12:14:44 +0200 | [diff] [blame] | 422 | # _TAG=voltha-port-forward kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555& > /dev/null 2>&1 |
| 423 | _TAG="voltha-port-forward" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n voltha${i} svc/voltha${i}-voltha-api 55555:55555 > /dev/null 2>&1; done"& |
| 424 | |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 425 | |
| 426 | ROBOT_PARAMS="-v stackId:${i} \ |
| 427 | -v olt:${olts} \ |
| 428 | -v pon:${pons} \ |
| 429 | -v onu:${onus} \ |
| 430 | -v workflow:${workflow} \ |
| 431 | -v withEapol:${withEapol} \ |
| 432 | -v withDhcp:${withDhcp} \ |
| 433 | -v withIgmp:${withIgmp} \ |
| 434 | --noncritical non-critical \ |
| 435 | -e igmp \ |
| 436 | -e teardown " |
| 437 | |
| 438 | if [ ${withEapol} = false ] ; then |
| 439 | ROBOT_PARAMS+="-e authentication " |
| 440 | fi |
| 441 | |
| 442 | if [ ${withDhcp} = false ] ; then |
| 443 | ROBOT_PARAMS+="-e dhcp " |
| 444 | fi |
| 445 | |
| 446 | if [ ${provisionSubscribers} = false ] ; then |
| 447 | # if we're not considering subscribers then we don't care about authentication and dhcp |
| 448 | ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp " |
| 449 | fi |
| 450 | |
| 451 | if [ ${withFlows} = false ] ; then |
| 452 | ROBOT_PARAMS+="-i setup -i activation " |
| 453 | fi |
| 454 | |
| 455 | cd $WORKSPACE/voltha-system-tests |
| 456 | source ./vst_venv/bin/activate |
| 457 | robot -d $WORKSPACE/RobotLogs/voltha${i} \ |
| 458 | \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
| 459 | |
| 460 | # collect results |
| 461 | python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true |
| 462 | cat $WORKSPACE/execution-time-voltha${i}.txt |
| 463 | """ |
| 464 | sh """ |
| 465 | # remove VOLTHA port-forward |
Andrea Campanella | 4c8af94 | 2021-05-12 10:12:13 +0200 | [diff] [blame] | 466 | ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 2>&1 > /dev/null || true |
Matteo Scandolo | 2bc660a | 2021-02-12 10:52:25 -0800 | [diff] [blame] | 467 | """ |
| 468 | } |
| 469 | } |
| 470 | } |
| 471 | } |