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 | ''' |
| 213 | plot([ |
| 214 | csvFileName: 'scale-test.csv', |
| 215 | csvSeries: [ |
| 216 | [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 217 | [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 218 | [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 219 | [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 220 | [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 221 | [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 222 | [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 223 | [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 224 | [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 225 | [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 226 | ], |
| 227 | 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 |
| 228 | ]) |
| 229 | step([$class: 'RobotPublisher', |
| 230 | disableArchiveOutput: false, |
| 231 | logFileName: 'RobotLogs/**/log.html', |
| 232 | otherFiles: '', |
| 233 | outputFileName: 'RobotLogs/**/output.xml', |
| 234 | outputPath: '.', |
| 235 | passThreshold: 100, |
| 236 | reportFileName: 'RobotLogs/**/report.html', |
| 237 | unstableThreshold: 0]); |
| 238 | // get all the logs from kubernetes PODs |
| 239 | sh returnStdout: false, script: ''' |
| 240 | |
| 241 | # store information on running charts |
| 242 | helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true |
| 243 | |
| 244 | # store information on the running pods |
| 245 | kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true |
| 246 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true |
| 247 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true |
| 248 | |
| 249 | # copy the ONOS logs directly from the container to avoid the color codes |
| 250 | 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 |
| 251 | |
| 252 | # get radius logs out of the container |
| 253 | 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 |
| 254 | ''' |
| 255 | // dump all the BBSim(s) ONU information |
| 256 | script { |
| 257 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 258 | stack_ns="voltha"+i |
| 259 | sh """ |
| 260 | BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}') |
| 261 | IDS=(\$BBSIM_IDS) |
| 262 | |
| 263 | for bbsim in "\${IDS[@]}" |
| 264 | do |
| 265 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > $LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true |
| 266 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > $LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true |
| 267 | done |
| 268 | """ |
| 269 | } |
| 270 | } |
| 271 | // get ONOS debug infos |
| 272 | sh ''' |
| 273 | |
| 274 | 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 |
| 275 | 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 |
| 276 | 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 |
| 277 | 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 |
| 278 | |
| 279 | 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 |
| 280 | 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 |
| 281 | |
| 282 | if [ ${withFlows} = true ] ; then |
| 283 | 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 |
| 284 | 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 |
| 285 | 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 |
| 286 | fi |
| 287 | |
| 288 | if [ ${provisionSubscribers} = true ]; then |
| 289 | 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 |
| 290 | 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 |
| 291 | 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 |
| 292 | 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 |
| 293 | fi |
| 294 | |
| 295 | if [ ${withEapol} = true ] ; then |
| 296 | 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 |
| 297 | 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 |
| 298 | fi |
| 299 | |
| 300 | if [ ${withDhcp} = true ] ; then |
| 301 | 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 |
| 302 | fi |
| 303 | ''' |
| 304 | // collect etcd metrics |
| 305 | sh ''' |
| 306 | mkdir -p $WORKSPACE/etcd-metrics |
| 307 | 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 |
| 308 | 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 |
| 309 | 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 |
| 310 | 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 |
| 311 | ''' |
| 312 | // get VOLTHA debug infos |
| 313 | script { |
| 314 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 315 | stack_ns="voltha"+i |
| 316 | voltcfg="~/.volt/config-voltha"+i |
| 317 | try { |
| 318 | sh """ |
| 319 | |
| 320 | _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 |
| 321 | |
| 322 | voltctl -m 8MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 323 | python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true |
| 324 | rm $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 325 | voltctl -m 8MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true |
| 326 | |
| 327 | DEVICE_LIST= |
| 328 | 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 |
| 329 | 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 |
| 330 | |
| 331 | 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 |
| 332 | 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 |
| 333 | |
| 334 | # remove VOLTHA port-forward |
| 335 | ps aux | grep port-forw | grep voltha-api | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 |
| 336 | """ |
| 337 | } catch(e) { |
| 338 | sh ''' |
| 339 | echo "Can't get device list from voltclt" |
| 340 | ''' |
| 341 | } |
| 342 | } |
| 343 | } |
| 344 | // get cpu usage by container |
| 345 | sh ''' |
| 346 | if [ ${withMonitoring} = true ] ; then |
| 347 | cd $WORKSPACE/voltha-system-tests |
| 348 | source ./vst_venv/bin/activate |
| 349 | sleep 60 # we have to wait for prometheus to collect all the information |
| 350 | python tests/scale/sizing.py -o $WORKSPACE/plots || true |
| 351 | fi |
| 352 | ''' |
| 353 | archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*,RobotLogs/**/*,plots/*,etcd-metrics/*' |
| 354 | } |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | def deploy_voltha_stacks(numberOfStacks) { |
| 359 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 360 | stage("Deploy VOLTHA stack " + i) { |
| 361 | // ${logLevel} |
Matteo Scandolo | 8877ab8 | 2021-02-24 15:54:23 -0800 | [diff] [blame] | 362 | 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] | 363 | extraHelmFlags += " --set securityContext.enabled=false,atomix.persistence.enabled=false " |
| 364 | // FIXME having to set all of these values is annoying, is there a better solution? |
| 365 | def controllerFlags = " " |
| 366 | onosReplicas.toInteger().times { |
| 367 | controllerFlags += " --set services.controller[${it}].address=onos-onos-classic-${it}.onos-onos-classic-hs.infra.svc:6653" |
| 368 | } |
| 369 | |
| 370 | def volthaHelmFlags = "${controllerFlags} " + extraHelmFlags + |
| 371 | "--set voltha.services.kafka.adapter.address=kafka.infra.svc:9092 " + |
| 372 | "--set voltha.services.kafka.cluster.address=kafka.infra.svc:9092 " + |
| 373 | "--set voltha.services.etcd.address=etcd.infra.svc:2379 " + |
| 374 | "--set voltha-adapter-openolt.services.kafka.adapter.address=kafka.infra.svc:9092 " + |
| 375 | "--set voltha-adapter-openolt.services.kafka.cluster.address=kafka.infra.svc:9092 " + |
| 376 | "--set voltha-adapter-openolt.services.etcd.address=etcd.infra.svc:2379 " + |
| 377 | "--set voltha-adapter-openonu.services.kafka.adapter.address=kafka.infra.svc:9092 " + |
| 378 | "--set voltha-adapter-openonu.services.kafka.cluster.address=kafka.infra.svc:9092 " + |
| 379 | "--set voltha-adapter-openonu.services.etcd.address=etcd.infra.svc:2379" |
| 380 | volthaStackDeploy([ |
| 381 | bbsimReplica: olts.toInteger(), |
| 382 | infraNamespace: "infra", |
| 383 | volthaNamespace: "voltha${i}", |
| 384 | stackName: "voltha${i}", |
| 385 | stackId: i, |
| 386 | workflow: workflow, |
| 387 | extraHelmFlags: volthaHelmFlags |
| 388 | ]) |
| 389 | } |
| 390 | } |
| 391 | } |
| 392 | |
| 393 | def test_voltha_stacks(numberOfStacks) { |
| 394 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 395 | stage("Test VOLTHA stack " + i) { |
| 396 | timeout(time: 15, unit: 'MINUTES') { |
| 397 | sh """ |
| 398 | |
| 399 | # we are restarting the voltha-api port-forward for each stack, no need to have a different voltconfig file |
| 400 | voltctl -s 127.0.0.1:55555 config > $HOME/.volt/config |
| 401 | export VOLTCONFIG=$HOME/.volt/config |
| 402 | |
| 403 | _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 |
| 404 | |
| 405 | ROBOT_PARAMS="-v stackId:${i} \ |
| 406 | -v olt:${olts} \ |
| 407 | -v pon:${pons} \ |
| 408 | -v onu:${onus} \ |
| 409 | -v workflow:${workflow} \ |
| 410 | -v withEapol:${withEapol} \ |
| 411 | -v withDhcp:${withDhcp} \ |
| 412 | -v withIgmp:${withIgmp} \ |
| 413 | --noncritical non-critical \ |
| 414 | -e igmp \ |
| 415 | -e teardown " |
| 416 | |
| 417 | if [ ${withEapol} = false ] ; then |
| 418 | ROBOT_PARAMS+="-e authentication " |
| 419 | fi |
| 420 | |
| 421 | if [ ${withDhcp} = false ] ; then |
| 422 | ROBOT_PARAMS+="-e dhcp " |
| 423 | fi |
| 424 | |
| 425 | if [ ${provisionSubscribers} = false ] ; then |
| 426 | # if we're not considering subscribers then we don't care about authentication and dhcp |
| 427 | ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp " |
| 428 | fi |
| 429 | |
| 430 | if [ ${withFlows} = false ] ; then |
| 431 | ROBOT_PARAMS+="-i setup -i activation " |
| 432 | fi |
| 433 | |
| 434 | cd $WORKSPACE/voltha-system-tests |
| 435 | source ./vst_venv/bin/activate |
| 436 | robot -d $WORKSPACE/RobotLogs/voltha${i} \ |
| 437 | \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
| 438 | |
| 439 | # collect results |
| 440 | python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true |
| 441 | cat $WORKSPACE/execution-time-voltha${i}.txt |
| 442 | """ |
| 443 | sh """ |
| 444 | # remove VOLTHA port-forward |
| 445 | 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 |
| 446 | """ |
| 447 | } |
| 448 | } |
| 449 | } |
| 450 | } |