Joey Armstrong | 7adbfb0 | 2023-01-24 17:02:37 -0500 | [diff] [blame] | 1 | // Copyright 2019-2023 Open Networking Foundation (ONF) and the ONF Contributors// |
| 2 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 3 | // you may not use this file except in compliance with the License. |
| 4 | // You may obtain a copy of the License at |
| 5 | // |
| 6 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 7 | // |
| 8 | // Unless required by applicable law or agreed to in writing, software |
| 9 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 10 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 11 | // See the License for the specific language governing permissions and |
| 12 | // limitations under the License. |
| 13 | |
| 14 | // deploy VOLTHA using kind-voltha and performs a scale test |
| 15 | |
| 16 | // NOTE we are importing the library even if it's global so that it's |
| 17 | // easier to change the keywords during a replay |
| 18 | library identifier: 'cord-jenkins-libraries@master', |
| 19 | retriever: modernSCM([ |
| 20 | $class: 'GitSCMSource', |
| 21 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 22 | ]) |
| 23 | |
| 24 | pipeline { |
| 25 | |
| 26 | /* no label, executor is determined by JJB */ |
| 27 | agent { |
| 28 | label "${params.buildNode}" |
| 29 | } |
| 30 | options { |
| 31 | timeout(time: 120, unit: 'MINUTES') |
| 32 | } |
| 33 | environment { |
| 34 | JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done |
| 35 | KUBECONFIG="$HOME/.kube/config" |
| 36 | SSHPASS="karaf" |
| 37 | PATH="$PATH:$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin" |
| 38 | |
| 39 | LOG_FOLDER="$WORKSPACE/logs" |
| 40 | } |
| 41 | |
| 42 | stages { |
| 43 | stage ('Cleanup') { |
| 44 | steps { |
| 45 | timeout(time: 11, unit: 'MINUTES') { |
| 46 | script { |
| 47 | def namespaces = ["infra"] |
| 48 | // FIXME we may have leftovers from more VOLTHA stacks (eg: run1 had 10 stacks, run2 had 2 stacks) |
| 49 | volthaStacks.toInteger().times { |
| 50 | namespaces += "voltha${it + 1}" |
| 51 | } |
| 52 | helmTeardown(namespaces) |
| 53 | } |
| 54 | sh returnStdout: false, script: ''' |
| 55 | helm repo add onf https://charts.opencord.org |
| 56 | helm repo update |
| 57 | |
| 58 | # remove all persistent volume claims |
| 59 | kubectl delete pvc --all-namespaces --all |
| 60 | PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l) |
| 61 | while [[ \$PVCS != 0 ]]; do |
| 62 | sleep 5 |
| 63 | PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l) |
| 64 | done |
| 65 | |
| 66 | # remove orphaned port-forward from different namespaces |
| 67 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true |
| 68 | |
| 69 | cd $WORKSPACE |
| 70 | rm -rf $WORKSPACE/* |
| 71 | ''' |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | stage('Download Code') { |
| 76 | steps { |
| 77 | getVolthaCode([ |
| 78 | branch: "${release}", |
| 79 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 80 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
| 81 | ]) |
| 82 | } |
| 83 | } |
| 84 | stage('Deploy common infrastructure') { |
| 85 | // includes monitoring |
| 86 | steps { |
| 87 | sh ''' |
| 88 | if [ ${withMonitoring} = true ] ; then |
| 89 | helm install -n infra nem-monitoring cord/nem-monitoring \ |
| 90 | -f $HOME/voltha-scale/grafana.yaml \ |
| 91 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 92 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 93 | fi |
| 94 | ''' |
| 95 | } |
| 96 | } |
| 97 | stage('Start logging') { |
| 98 | steps { |
| 99 | script { |
| 100 | startComponentsLogs([ |
| 101 | appsToLog: [ |
| 102 | 'app.kubernetes.io/name=etcd', |
| 103 | 'app.kubernetes.io/name=kafka', |
| 104 | 'app=onos-classic', |
| 105 | 'app=adapter-open-onu', |
| 106 | 'app=adapter-open-olt', |
| 107 | 'app=rw-core', |
| 108 | 'app=ofagent', |
| 109 | 'app=bbsim', |
| 110 | 'app=radius', |
| 111 | 'app=bbsim-sadis-server', |
| 112 | 'app=onos-config-loader', |
| 113 | ] |
| 114 | ]) |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | stage('Deploy VOLTHA infrastructure') { |
| 119 | steps { |
| 120 | timeout(time: 5, unit: 'MINUTES') { |
| 121 | script { |
| 122 | def localCharts = false |
| 123 | if (volthaHelmChartsChange != "" || release != "master") { |
| 124 | localCharts = true |
| 125 | } |
| 126 | |
| 127 | def infraHelmFlags = |
| 128 | "--set global.log_level=${logLevel} " + |
| 129 | "--set radius.enabled=${withEapol} " + |
| 130 | "--set onos-classic.onosSshPort=30115 " + |
| 131 | "--set onos-classic.onosApiPort=30120 " + |
| 132 | params.extraHelmFlags |
| 133 | |
| 134 | volthaInfraDeploy([ |
| 135 | workflow: workflow, |
| 136 | infraNamespace: "infra", |
| 137 | extraHelmFlags: infraHelmFlags, |
| 138 | localCharts: localCharts, |
| 139 | onosReplica: onosReplicas, |
| 140 | atomixReplica: atomixReplicas, |
| 141 | kafkaReplica: kafkaReplicas, |
| 142 | etcdReplica: etcdReplicas, |
| 143 | ]) |
| 144 | } |
| 145 | } |
| 146 | } |
| 147 | } |
| 148 | stage('Deploy Voltha') { |
| 149 | steps { |
| 150 | installVoltctl("${release}") |
| 151 | deploy_voltha_stacks(params.volthaStacks) |
| 152 | } |
| 153 | } |
| 154 | stage('Configuration') { |
| 155 | steps { |
| 156 | script { |
| 157 | sh returnStdout: false, script: """ |
| 158 | |
| 159 | # forward ETCD port |
| 160 | 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 " & |
| 161 | |
| 162 | # forward ONOS ports |
| 163 | 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 " & |
| 164 | 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 " & |
| 165 | |
| 166 | # make sure the the port-forward has started before moving forward |
| 167 | sleep 5 |
| 168 | """ |
| 169 | sh returnStdout: false, script: """ |
| 170 | # TODO this needs to be repeated per stack |
| 171 | # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false |
| 172 | |
| 173 | #Setting link discovery |
| 174 | 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} |
| 175 | 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 |
| 176 | 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 |
| 177 | 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 |
| 178 | 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 |
| 179 | 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 |
| 180 | |
| 181 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject |
| 182 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord |
| 183 | |
| 184 | # Set Flows/Ports/Meters poll frequency |
| 185 | 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} |
| 186 | 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} |
| 187 | |
| 188 | #SR is not needed in scale tests and not currently used by operators in production, can be disabled. |
| 189 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.onosproject.segmentrouting |
| 190 | |
| 191 | |
| 192 | if [ ${withFlows} = false ]; then |
| 193 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt |
| 194 | fi |
| 195 | """ |
| 196 | } |
| 197 | } |
| 198 | } |
| 199 | stage('Setup Test') { |
| 200 | steps { |
| 201 | sh ''' |
| 202 | mkdir -p $WORKSPACE/RobotLogs |
| 203 | cd $WORKSPACE/voltha-system-tests |
| 204 | make vst_venv |
| 205 | ''' |
| 206 | } |
| 207 | } |
| 208 | stage('Run Test') { |
| 209 | steps { |
| 210 | test_voltha_stacks(params.volthaStacks) |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | post { |
| 215 | always { |
| 216 | stopComponentsLogs([compress: true]) |
| 217 | // collect result, done in the "post" step so it's executed even in the |
| 218 | // event of a timeout in the tests |
| 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 | onlyCritical: true, |
| 244 | unstableThreshold: 0]); |
| 245 | // get all the logs from kubernetes PODs |
| 246 | sh returnStdout: false, script: ''' |
| 247 | |
| 248 | # store information on running charts |
| 249 | helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true |
| 250 | |
| 251 | # store information on the running pods |
| 252 | kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true |
| 253 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true |
| 254 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true |
| 255 | |
| 256 | # copy the ONOS logs directly from the container to avoid the color codes |
| 257 | 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 -n infra #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true |
| 258 | |
| 259 | ''' |
| 260 | // dump all the BBSim(s) ONU information |
| 261 | script { |
| 262 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 263 | stack_ns="voltha"+i |
| 264 | sh """ |
| 265 | mkdir -p \$LOG_FOLDER/${stack_ns} |
| 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 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources GEM_PORT > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-gem-ports.txt || true |
| 274 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt resources ALLOC_ID > \$LOG_FOLDER/${stack_ns}/\$bbsim-flows-alloc-ids.txt || true |
| 275 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl olt pons > \$LOG_FOLDER/${stack_ns}/\$bbsim-pon-resources.txt || true |
| 276 | done |
| 277 | """ |
| 278 | } |
| 279 | } |
| 280 | // get ONOS debug infos |
| 281 | sh ''' |
| 282 | |
| 283 | 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 |
| 284 | 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 |
| 285 | 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 |
| 286 | 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 |
| 287 | |
| 288 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt || true |
| 289 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg get > $LOG_FOLDER/onos-cfg.txt || true |
| 290 | |
| 291 | 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 |
| 292 | 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 |
| 293 | |
| 294 | if [ ${withFlows} = true ] ; then |
| 295 | 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 |
| 296 | 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 |
| 297 | 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 |
| 298 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-port-status > $LOG_FOLDER/onos-volt-port-status.txt || true |
| 299 | fi |
| 300 | |
| 301 | if [ ${provisionSubscribers} = true ]; then |
| 302 | 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 |
| 303 | 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 |
| 304 | 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 |
| 305 | 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 |
| 306 | fi |
| 307 | |
| 308 | if [ ${withEapol} = true ] ; then |
| 309 | 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 |
| 310 | 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 |
| 311 | fi |
| 312 | |
| 313 | if [ ${withDhcp} = true ] ; then |
| 314 | 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 |
| 315 | fi |
| 316 | ''' |
| 317 | // collect etcd metrics |
| 318 | sh ''' |
| 319 | mkdir -p $WORKSPACE/etcd-metrics |
| 320 | 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 |
| 321 | 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 |
| 322 | 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 |
| 323 | 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 |
| 324 | ''' |
| 325 | // get VOLTHA debug infos |
| 326 | script { |
| 327 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 328 | stack_ns="voltha"+i |
| 329 | voltcfg="~/.volt/config-voltha"+i |
| 330 | try { |
| 331 | sh """ |
| 332 | |
| 333 | # _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 |
| 334 | _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"& |
| 335 | |
| 336 | voltctl -m 32MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 337 | python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true |
| 338 | rm $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 339 | voltctl -m 32MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true |
| 340 | |
| 341 | DEVICE_LIST= |
| 342 | printf '%s\n' \$(voltctl -m 32MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB device flows # > $LOG_FOLDER/${stack_ns}/voltha-device-flows-#.txt" || true |
| 343 | printf '%s\n' \$(voltctl -m 32MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB device port list --format 'table{{.PortNo}}\t{{.Label}}\t{{.Type}}\t{{.AdminState}}\t{{.OperStatus}}' # > $LOG_FOLDER/${stack_ns}/voltha-device-ports-#.txt" || true |
| 344 | |
| 345 | printf '%s\n' \$(voltctl -m 32MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB logicaldevice flows # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-flows-#.txt" || true |
| 346 | printf '%s\n' \$(voltctl -m 32MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 32MB logicaldevice port list # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-ports-#.txt" || true |
| 347 | |
| 348 | # remove VOLTHA port-forward |
| 349 | ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 || true |
| 350 | """ |
| 351 | } catch(e) { |
| 352 | println e |
| 353 | sh ''' |
| 354 | echo "Can't get device list from voltctl" |
| 355 | ''' |
| 356 | } |
| 357 | } |
| 358 | } |
| 359 | // get cpu usage by container |
| 360 | sh ''' |
| 361 | if [ ${withMonitoring} = true ] ; then |
| 362 | cd $WORKSPACE/voltha-system-tests |
| 363 | source ./vst_venv/bin/activate |
| 364 | sleep 60 # we have to wait for prometheus to collect all the information |
| 365 | python scripts/sizing.py -o $WORKSPACE/plots || true |
| 366 | fi |
| 367 | ''' |
| 368 | archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*.txt,logs/**/*.tar.gz,logs/**/*.tgz,RobotLogs/**/*,plots/*,etcd-metrics/*' |
| 369 | } |
| 370 | } |
| 371 | } |
| 372 | |
| 373 | def deploy_voltha_stacks(numberOfStacks) { |
| 374 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 375 | timeout(time: 5, unit: 'MINUTES') { |
| 376 | stage("Deploy VOLTHA stack " + i) { |
| 377 | |
| 378 | def localCharts = false |
| 379 | if (volthaHelmChartsChange != "" || release != "master") { |
| 380 | localCharts = true |
| 381 | } |
| 382 | |
| 383 | def volthaHelmFlags = |
| 384 | "--set global.log_level=${logLevel} " + |
| 385 | "--set enablePerf=true,onu=${onus},pon=${pons} " + |
| 386 | "--set securityContext.enabled=false " + |
| 387 | params.extraHelmFlags |
| 388 | |
| 389 | volthaStackDeploy([ |
| 390 | bbsimReplica: olts.toInteger(), |
| 391 | infraNamespace: "infra", |
| 392 | volthaNamespace: "voltha${i}", |
| 393 | stackName: "voltha${i}", |
| 394 | stackId: i, |
| 395 | workflow: workflow, |
| 396 | extraHelmFlags: volthaHelmFlags, |
| 397 | localCharts: localCharts, |
| 398 | onosReplica: onosReplicas, |
| 399 | ]) |
| 400 | } |
| 401 | } |
| 402 | } |
| 403 | } |
| 404 | |
| 405 | def test_voltha_stacks(numberOfStacks) { |
| 406 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 407 | stage("Test VOLTHA stack " + i) { |
| 408 | timeout(time: 15, unit: 'MINUTES') { |
| 409 | sh """ |
| 410 | |
| 411 | # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file |
| 412 | voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config |
| 413 | export VOLTCONFIG=$HOME/.volt/config |
| 414 | |
| 415 | # _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 |
| 416 | _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"& |
| 417 | |
| 418 | # wait a bit to make sure the port-forwarding has started |
| 419 | sleep 5 |
| 420 | |
| 421 | |
| 422 | ROBOT_PARAMS="-v stackId:${i} \ |
| 423 | -v olt:${olts} \ |
| 424 | -v pon:${pons} \ |
| 425 | -v onu:${onus} \ |
| 426 | -v workflow:${workflow} \ |
| 427 | -v withEapol:${withEapol} \ |
| 428 | -v withDhcp:${withDhcp} \ |
| 429 | -v withIgmp:${withIgmp} \ |
| 430 | --noncritical non-critical \ |
| 431 | -e igmp \ |
| 432 | -e onu-upgrade \ |
| 433 | -e teardown " |
| 434 | |
| 435 | if [ ${withEapol} = false ] ; then |
| 436 | ROBOT_PARAMS+="-e authentication " |
| 437 | fi |
| 438 | |
| 439 | if [ ${withDhcp} = false ] ; then |
| 440 | ROBOT_PARAMS+="-e dhcp " |
| 441 | fi |
| 442 | |
| 443 | if [ ${provisionSubscribers} = false ] ; then |
| 444 | # if we're not considering subscribers then we don't care about authentication and dhcp |
| 445 | ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp " |
| 446 | fi |
| 447 | |
| 448 | if [ ${withFlows} = false ] ; then |
| 449 | ROBOT_PARAMS+="-i setup -i activation " |
| 450 | fi |
| 451 | |
| 452 | cd $WORKSPACE/voltha-system-tests |
| 453 | source ./vst_venv/bin/activate |
| 454 | robot -d $WORKSPACE/RobotLogs/voltha${i} \ |
| 455 | \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
| 456 | |
| 457 | # collect results |
| 458 | python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true |
| 459 | cat $WORKSPACE/execution-time-voltha${i}.txt |
| 460 | """ |
| 461 | sh """ |
| 462 | # remove VOLTHA port-forward |
| 463 | 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 |
| 464 | """ |
| 465 | } |
| 466 | } |
| 467 | } |
| 468 | } |