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