Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -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 | pipeline { |
| 18 | |
| 19 | /* no label, executor is determined by JJB */ |
| 20 | agent { |
| 21 | label "${params.buildNode}" |
| 22 | } |
| 23 | options { |
Matteo Scandolo | f7ca631 | 2020-11-16 15:57:15 -0800 | [diff] [blame] | 24 | timeout(time: 120, unit: 'MINUTES') |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 25 | } |
| 26 | environment { |
| 27 | JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done |
| 28 | KUBECONFIG="$HOME/.kube/config" |
| 29 | SSHPASS="karaf" |
| 30 | PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 31 | SCHEDULE_ON_CONTROL_NODES="yes" |
| 32 | FANCY=0 |
| 33 | WAIT_ON_DOWN="yes" |
| 34 | WITH_SIM_ADAPTERS="no" |
| 35 | WITH_RADIUS="${withRadius}" |
| 36 | WITH_BBSIM="yes" |
| 37 | LEGACY_BBSIM_INDEX="no" |
| 38 | DEPLOY_K8S="no" |
| 39 | CONFIG_SADIS="external" |
| 40 | WITH_KAFKA="yes" |
| 41 | WITH_ETCD="yes" |
| 42 | VOLTHA_ETCD_PORT=9999 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 43 | INFRA_NS="infra" |
| 44 | |
| 45 | // configurable options |
| 46 | WITH_EAPOL="${withEapol}" |
| 47 | WITH_DHCP="${withDhcp}" |
| 48 | WITH_IGMP="${withIgmp}" |
| 49 | VOLTHA_LOG_LEVEL="${logLevel}" |
| 50 | NUM_OF_BBSIM="${olts}" |
| 51 | NUM_OF_OPENONU="${openonuAdapterReplicas}" |
| 52 | NUM_OF_ONOS="${onosReplicas}" |
| 53 | NUM_OF_ATOMIX="${atomixReplicas}" |
| 54 | NUM_OF_KAFKA="${kafkaReplicas}" |
| 55 | NUM_OF_ETCD="${etcdReplicas}" |
| 56 | WITH_PPROF="${withProfiling}" |
| 57 | EXTRA_HELM_FLAGS="${extraHelmFlags} " // note that the trailing space is required to separate the parameters from appends done later |
| 58 | VOLTHA_CHART="${volthaChart}" |
| 59 | VOLTHA_BBSIM_CHART="${bbsimChart}" |
| 60 | VOLTHA_ADAPTER_OPEN_OLT_CHART="${openoltAdapterChart}" |
| 61 | VOLTHA_ADAPTER_OPEN_ONU_CHART="${openonuAdapterChart}" |
| 62 | ONOS_CLASSIC_CHART="${onosChart}" |
| 63 | RADIUS_CHART="${radiusChart}" |
| 64 | |
Matteo Scandolo | 7c803cb | 2020-12-15 11:33:32 -1000 | [diff] [blame] | 65 | APPS_TO_LOG="etcd kafka onos-onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server" |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 66 | LOG_FOLDER="$WORKSPACE/logs" |
| 67 | |
| 68 | GERRIT_PROJECT="${GERRIT_PROJECT}" |
| 69 | } |
| 70 | |
| 71 | stages { |
| 72 | stage ('Cleanup') { |
| 73 | steps { |
| 74 | timeout(time: 11, unit: 'MINUTES') { |
| 75 | sh returnStdout: false, script: """ |
Matteo Scandolo | be82324 | 2020-11-20 13:48:13 -0800 | [diff] [blame] | 76 | helm repo add stable https://charts.helm.sh/stable |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 77 | helm repo add onf https://charts.opencord.org |
| 78 | helm repo add cord https://charts.opencord.org |
| 79 | helm repo add onos https://charts.onosproject.org |
| 80 | helm repo add atomix https://charts.atomix.io |
| 81 | helm repo add bbsim-sadis https://ciena.github.io/bbsim-sadis-server/charts |
| 82 | helm repo update |
| 83 | |
| 84 | # removing ETCD port forward |
| 85 | P_ID="\$(ps e -ww -A | grep "_TAG=etcd-port-forward" | grep -v grep | awk '{print \$1}')" |
| 86 | if [ -n "\$P_ID" ]; then |
| 87 | kill -9 \$P_ID |
| 88 | fi |
| 89 | |
Matteo Scandolo | 9fe8cad | 2020-11-13 12:54:19 -0800 | [diff] [blame] | 90 | NAMESPACES="voltha1 voltha2 infra default" |
| 91 | for NS in \$NAMESPACES |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 92 | do |
Matteo Scandolo | 9fe8cad | 2020-11-13 12:54:19 -0800 | [diff] [blame] | 93 | for hchart in \$(helm list -n \$NS -q | grep -E -v 'docker-registry|kafkacat'); |
| 94 | do |
| 95 | echo "Purging chart: \${hchart}" |
| 96 | helm delete -n \$NS "\${hchart}" |
| 97 | done |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 98 | done |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 99 | |
| 100 | test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down |
| 101 | |
| 102 | cd $WORKSPACE |
| 103 | rm -rf $WORKSPACE/* |
Matteo Scandolo | 557cd8b | 2021-02-25 10:42:45 -0800 | [diff] [blame] | 104 | |
| 105 | # remove orphaned port-forward from different namespaces |
| 106 | ps aux | grep port-forw | grep -v grep | awk '{print \$2}' | xargs --no-run-if-empty kill -9 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 107 | """ |
| 108 | } |
| 109 | } |
| 110 | } |
| 111 | stage('Clone kind-voltha') { |
| 112 | steps { |
| 113 | checkout([ |
| 114 | $class: 'GitSCM', |
| 115 | userRemoteConfigs: [[ |
| 116 | url: "https://gerrit.opencord.org/kind-voltha", |
| 117 | refspec: "${kindVolthaChange}" |
| 118 | ]], |
| 119 | branches: [[ name: "master", ]], |
| 120 | extensions: [ |
| 121 | [$class: 'WipeWorkspace'], |
| 122 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 123 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 124 | ], |
| 125 | ]) |
| 126 | script { |
| 127 | sh(script:""" |
| 128 | if [ '${kindVolthaChange}' != '' ] ; then |
| 129 | cd $WORKSPACE/kind-voltha; |
| 130 | git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD |
| 131 | fi |
| 132 | """) |
| 133 | } |
| 134 | } |
| 135 | } |
| 136 | stage('Clone voltha-system-tests') { |
| 137 | steps { |
| 138 | checkout([ |
| 139 | $class: 'GitSCM', |
| 140 | userRemoteConfigs: [[ |
| 141 | url: "https://gerrit.opencord.org/voltha-system-tests", |
| 142 | refspec: "${volthaSystemTestsChange}" |
| 143 | ]], |
| 144 | branches: [[ name: "${release}", ]], |
| 145 | extensions: [ |
| 146 | [$class: 'WipeWorkspace'], |
| 147 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 148 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 149 | ], |
| 150 | ]) |
| 151 | script { |
| 152 | sh(script:""" |
| 153 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 154 | cd $WORKSPACE/voltha-system-tests; |
| 155 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 156 | fi |
| 157 | """) |
| 158 | } |
| 159 | } |
| 160 | } |
| 161 | stage('Build patch') { |
| 162 | when { |
| 163 | expression { |
| 164 | return params.GERRIT_PROJECT |
| 165 | } |
| 166 | } |
| 167 | steps { |
| 168 | sh """ |
| 169 | git clone https://\$GERRIT_HOST/\$GERRIT_PROJECT |
| 170 | cd \$GERRIT_PROJECT |
| 171 | git fetch https://\$GERRIT_HOST/\$GERRIT_PROJECT \$GERRIT_REFSPEC && git checkout FETCH_HEAD |
| 172 | |
| 173 | DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-build |
| 174 | DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-push |
| 175 | """ |
| 176 | } |
| 177 | } |
| 178 | stage('Deploy common infrastructure') { |
| 179 | // includes monitoring, kafka, etcd |
| 180 | steps { |
| 181 | sh ''' |
| 182 | if [ ${withMonitoring} = true ] ; then |
Matteo Scandolo | d4d55b7 | 2020-11-25 12:29:07 -0800 | [diff] [blame] | 183 | helm install -n $INFRA_NS nem-monitoring cord/nem-monitoring \ |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 184 | -f $HOME/voltha-scale/grafana.yaml \ |
| 185 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 186 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 187 | fi |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 188 | ''' |
| 189 | } |
| 190 | } |
| 191 | stage('Deploy VOLTHA infrastructure') { |
| 192 | steps { |
| 193 | sh returnStdout: false, script: ''' |
Matteo Scandolo | 128ee7a | 2020-12-03 14:16:54 -0800 | [diff] [blame] | 194 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 195 | cd $WORKSPACE/kind-voltha/ |
| 196 | |
Matteo Scandolo | f665656 | 2020-11-16 14:45:44 -0800 | [diff] [blame] | 197 | export ETCD_CHART=$HOME/teone/helm-charts/etcd |
| 198 | export KAFKA_CHART=$HOME/teone/helm-charts/kafka |
Matteo Scandolo | b28a97b | 2020-11-13 10:58:32 -0800 | [diff] [blame] | 199 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 200 | # KAFKA config |
Matteo Scandolo | f665656 | 2020-11-16 14:45:44 -0800 | [diff] [blame] | 201 | export NUM_OF_KAFKA=${kafkaReplicas} |
| 202 | export EXTRA_HELM_FLAGS+=' --set prometheus.kafka.enabled=true,prometheus.operator.enabled=true,prometheus.jmx.enabled=true,prometheus.operator.serviceMonitor.namespace=default ' |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 203 | |
| 204 | # ETCD config |
Matteo Scandolo | f665656 | 2020-11-16 14:45:44 -0800 | [diff] [blame] | 205 | export EXTRA_HELM_FLAGS+=" --set memoryMode=${inMemoryEtcdStorage} " |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 206 | |
| 207 | NAME=infra JUST_INFRA=y ./voltha up |
| 208 | |
| 209 | # Forward the ETCD port onto $VOLTHA_ETCD_PORT |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 210 | _TAG=etcd-port-forward kubectl -n \$INFRA_NS port-forward --address 0.0.0.0 -n default service/etcd $VOLTHA_ETCD_PORT:2379& |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 211 | ''' |
| 212 | } |
| 213 | } |
| 214 | stage('Deploy Voltha') { |
| 215 | steps { |
| 216 | deploy_voltha_stacks(params.volthaStacks) |
| 217 | } |
| 218 | } |
| 219 | stage('Start logging') { |
| 220 | steps { |
| 221 | sh returnStdout: false, script: ''' |
| 222 | # start logging with kail |
| 223 | |
| 224 | mkdir -p $LOG_FOLDER |
| 225 | |
| 226 | list=($APPS_TO_LOG) |
| 227 | for app in "${list[@]}" |
| 228 | do |
| 229 | echo "Starting logs for: ${app}" |
| 230 | _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log& |
| 231 | done |
| 232 | ''' |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 233 | } |
| 234 | } |
| 235 | stage('Configuration') { |
| 236 | steps { |
| 237 | script { |
| 238 | sh returnStdout: false, script: """ |
Matteo Scandolo | 6897875 | 2020-12-02 12:23:42 -0800 | [diff] [blame] | 239 | |
Matteo Scandolo | ffe19c9 | 2020-11-24 15:25:25 -0800 | [diff] [blame] | 240 | # TODO this needs to be repeated per stack |
| 241 | # kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false |
| 242 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 243 | #Setting link discovery |
| 244 | 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} |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 245 | 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 |
| 246 | 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 | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 247 | 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 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 248 | 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 |
| 249 | |
Matteo Scandolo | ffe19c9 | 2020-11-24 15:25:25 -0800 | [diff] [blame] | 250 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.onosproject |
| 251 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 cfg log:set ${logLevel} org.opencord |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 252 | |
| 253 | # Set Flows/Ports/Meters poll frequency |
| 254 | 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} |
| 255 | 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} |
| 256 | |
| 257 | if [ ${withFlows} = false ]; then |
| 258 | sshpass -e ssh -q -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 8101 karaf@127.0.0.1 app deactivate org.opencord.olt |
| 259 | fi |
| 260 | |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 261 | if [ ${withPcap} = true ] && [ ${volthaStacks} -eq 1 ] ; then |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 262 | # Start the tcp-dump in ofagent |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 263 | export OF_AGENT=\$(kubectl -n \$INFRA_NS get pods -l app=ofagent -o name) |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 264 | kubectl exec \$OF_AGENT -- apk update |
| 265 | kubectl exec \$OF_AGENT -- apk add tcpdump |
| 266 | kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 267 | _TAG=ofagent-tcpdump kubectl -n \$INFRA_NS exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap& |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 268 | |
| 269 | # Start the tcp-dump in radius |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 270 | export RADIUS=\$(kubectl -n \$INFRA_NS get pods -l app=radius -o name) |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 271 | kubectl exec \$RADIUS -- apt-get update |
| 272 | kubectl exec \$RADIUS -- apt-get install -y tcpdump |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 273 | _TAG=radius-tcpdump kubectl -n \$INFRA_NS exec \$RADIUS -- tcpdump -w out.pcap& |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 274 | |
| 275 | # Start the tcp-dump in ONOS |
| 276 | for i in \$(seq 0 \$ONOSES); do |
| 277 | INSTANCE="onos-onos-classic-\$i" |
| 278 | kubectl exec \$INSTANCE -- apt-get update |
| 279 | kubectl exec \$INSTANCE -- apt-get install -y tcpdump |
| 280 | kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 281 | _TAG=\$INSTANCE kubectl -n \$INFRA_NS exec \$INSTANCE -- /usr/bin/tcpdump -nei eth0 port 1812 -w out.pcap& |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 282 | done |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 283 | else |
| 284 | echo "PCAP not supported for multiple VOLTHA stacks" |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 285 | fi |
| 286 | """ |
| 287 | } |
| 288 | } |
| 289 | } |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 290 | stage('Setup Test') { |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 291 | steps { |
| 292 | sh ''' |
| 293 | mkdir -p $WORKSPACE/RobotLogs |
| 294 | cd $WORKSPACE/voltha-system-tests |
| 295 | make vst_venv |
| 296 | ''' |
| 297 | sh ''' |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 298 | if [ ${withProfiling} = true ] && [ ${volthaStacks} -eq 1 ]; then |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 299 | mkdir -p $LOG_FOLDER/pprof |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 300 | cat << EOF > $WORKSPACE/pprof.sh |
| 301 | timestamp() { |
| 302 | date +"%T" |
| 303 | } |
| 304 | |
| 305 | i=0 |
| 306 | while [[ true ]]; do |
| 307 | ((i++)) |
| 308 | ts=$(timestamp) |
| 309 | go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png |
| 310 | go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png |
| 311 | curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10 |
| 312 | go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png |
| 313 | |
| 314 | go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png |
| 315 | go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png |
| 316 | curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10 |
| 317 | go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png |
| 318 | |
| 319 | go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png |
| 320 | go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png |
| 321 | curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10 |
| 322 | go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png |
| 323 | |
| 324 | sleep 10 |
| 325 | done |
| 326 | EOF |
| 327 | |
| 328 | _TAG="pprof" |
| 329 | _TAG=$_TAG bash $WORKSPACE/pprof.sh & |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 330 | else |
| 331 | echo "Profiling not supported for multiple VOLTHA stacks" |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 332 | fi |
| 333 | ''' |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 334 | } |
| 335 | } |
| 336 | stage('Run Test') { |
| 337 | steps { |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 338 | test_voltha_stacks(params.volthaStacks) |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 339 | } |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 340 | } |
| 341 | } |
| 342 | post { |
| 343 | always { |
| 344 | // collect result, done in the "post" step so it's executed even in the |
| 345 | // event of a timeout in the tests |
| 346 | sh ''' |
| 347 | |
| 348 | # stop the kail processes |
| 349 | list=($APPS_TO_LOG) |
| 350 | for app in "${list[@]}" |
| 351 | do |
| 352 | echo "Stopping logs for: ${app}" |
| 353 | _TAG="kail-$app" |
| 354 | P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')" |
| 355 | if [ -n "$P_IDS" ]; then |
| 356 | echo $P_IDS |
| 357 | for P_ID in $P_IDS; do |
| 358 | kill -9 $P_ID |
| 359 | done |
| 360 | fi |
| 361 | done |
Matteo Scandolo | b3d2727b | 2021-03-03 11:17:46 -0800 | [diff] [blame] | 362 | ''' |
| 363 | // compressing the logs to save space on Jenkins |
| 364 | sh ''' |
| 365 | cd $LOG_FOLDER |
| 366 | tar -czf logs.tar.gz *.log |
| 367 | rm *.log |
| 368 | ''' |
| 369 | sh ''' |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 370 | |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 371 | if [ ${withPcap} = true ] && [ ${volthaStacks} -eq 1 ]; then |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 372 | # stop ofAgent tcpdump |
| 373 | P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')" |
| 374 | if [ -n "\$P_ID" ]; then |
| 375 | kill -9 \$P_ID |
| 376 | fi |
| 377 | |
| 378 | # stop radius tcpdump |
| 379 | P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')" |
| 380 | if [ -n "\$P_ID" ]; then |
| 381 | kill -9 \$P_ID |
| 382 | fi |
| 383 | |
| 384 | # stop onos tcpdump |
| 385 | LIMIT=$(($NUM_OF_ONOS - 1)) |
| 386 | for i in $(seq 0 $LIMIT); do |
| 387 | INSTANCE="onos-onos-classic-$i" |
| 388 | P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')" |
| 389 | if [ -n "\$P_ID" ]; then |
| 390 | kill -9 \$P_ID |
| 391 | fi |
| 392 | done |
| 393 | |
| 394 | # copy the file |
| 395 | export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true |
| 396 | kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true |
| 397 | |
| 398 | export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true |
| 399 | kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true |
| 400 | |
| 401 | LIMIT=$(($NUM_OF_ONOS - 1)) |
| 402 | for i in $(seq 0 $LIMIT); do |
| 403 | INSTANCE="onos-onos-classic-$i" |
| 404 | kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true |
| 405 | done |
| 406 | fi |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 407 | ''' |
| 408 | sh ''' |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 409 | if [ ${withProfiling} = true ] && [ ${volthaStacks} -eq 1 ]; then |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 410 | _TAG="pprof" |
| 411 | P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')" |
| 412 | if [ -n "$P_IDS" ]; then |
| 413 | echo $P_IDS |
| 414 | for P_ID in $P_IDS; do |
| 415 | kill -9 $P_ID |
| 416 | done |
| 417 | fi |
| 418 | fi |
| 419 | ''' |
| 420 | plot([ |
| 421 | csvFileName: 'scale-test.csv', |
| 422 | csvSeries: [ |
| 423 | [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 424 | [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 425 | [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 426 | [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 427 | [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 428 | [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 429 | [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 430 | [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 431 | [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 432 | [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 433 | ], |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 434 | 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 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 435 | ]) |
| 436 | step([$class: 'RobotPublisher', |
| 437 | disableArchiveOutput: false, |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 438 | logFileName: 'RobotLogs/**/log.html', |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 439 | otherFiles: '', |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 440 | outputFileName: 'RobotLogs/**/output.xml', |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 441 | outputPath: '.', |
| 442 | passThreshold: 100, |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 443 | reportFileName: 'RobotLogs/**/report.html', |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 444 | unstableThreshold: 0]); |
| 445 | // get all the logs from kubernetes PODs |
| 446 | sh returnStdout: false, script: ''' |
| 447 | |
| 448 | # store information on running charts |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 449 | helm ls --all-namespaces > $LOG_FOLDER/helm-list.txt || true |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 450 | |
| 451 | # store information on the running pods |
Matteo Scandolo | d4d55b7 | 2020-11-25 12:29:07 -0800 | [diff] [blame] | 452 | kubectl get pods --all-namespaces -o wide > $LOG_FOLDER/pods.txt || true |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 453 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true |
| 454 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true |
| 455 | |
| 456 | # copy the ONOS logs directly from the container to avoid the color codes |
Matteo Scandolo | be82324 | 2020-11-20 13:48:13 -0800 | [diff] [blame] | 457 | 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 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 458 | |
| 459 | # get radius logs out of the container |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 460 | 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 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 461 | ''' |
| 462 | // dump all the BBSim(s) ONU information |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 463 | script { |
| 464 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 465 | stack_ns="voltha"+i |
| 466 | sh """ |
| 467 | BBSIM_IDS=\$(kubectl -n ${stack_ns} get pods | grep bbsim | grep -v server | awk '{print \$1}') |
| 468 | IDS=(\$BBSIM_IDS) |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 469 | |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 470 | for bbsim in "\${IDS[@]}" |
| 471 | do |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 472 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl onu list > $LOG_FOLDER/${stack_ns}/\$bbsim-device-list.txt || true |
| 473 | kubectl -n ${stack_ns} exec -t \$bbsim -- bbsimctl service list > $LOG_FOLDER/${stack_ns}/\$bbsim-service-list.txt || true |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 474 | done |
| 475 | """ |
| 476 | } |
| 477 | } |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 478 | // get ONOS debug infos |
| 479 | sh ''' |
| 480 | |
| 481 | 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 |
| 482 | 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 |
| 483 | 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 |
| 484 | 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 |
| 485 | |
| 486 | 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 |
| 487 | 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 |
| 488 | |
| 489 | if [ ${withFlows} = true ] ; then |
| 490 | 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 |
| 491 | 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 |
| 492 | 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 |
| 493 | fi |
| 494 | |
| 495 | if [ ${provisionSubscribers} = true ]; then |
| 496 | 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 |
| 497 | 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 |
| 498 | 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 |
| 499 | 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 |
| 500 | fi |
| 501 | |
| 502 | if [ ${withEapol} = true ] ; then |
| 503 | 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 |
| 504 | 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 |
| 505 | fi |
| 506 | |
| 507 | if [ ${withDhcp} = true ] ; then |
| 508 | 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 |
| 509 | fi |
| 510 | ''' |
| 511 | // collect etcd metrics |
| 512 | sh ''' |
| 513 | mkdir -p $WORKSPACE/etcd-metrics |
| 514 | 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 |
| 515 | 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 |
| 516 | 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 |
| 517 | 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 |
| 518 | ''' |
| 519 | // get VOLTHA debug infos |
| 520 | script { |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 521 | for (int i = 1; i <= params.volthaStacks.toInteger(); i++) { |
| 522 | stack_ns="voltha"+i |
| 523 | voltcfg="~/.volt/config-voltha"+i |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 524 | try { |
| 525 | sh """ |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 526 | voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB device list -o json > $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 527 | python -m json.tool $LOG_FOLDER/${stack_ns}/device-list.json > $LOG_FOLDER/${stack_ns}/voltha-devices-list.json || true |
| 528 | rm $LOG_FOLDER/${stack_ns}/device-list.json || true |
| 529 | voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB device list > $LOG_FOLDER/${stack_ns}/voltha-devices-list.txt || true |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 530 | |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 531 | DEVICE_LIST= |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 532 | printf '%s\n' \$(voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -c $HOME/.volt/config-${stack_ns}-m 8MB device flows # > $LOG_FOLDER/${stack_ns}/voltha-device-flows-#.txt" || true |
| 533 | printf '%s\n' \$(voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB device list | grep olt | awk '{print \$1}') | xargs --no-run-if-empty -I# bash -c "voltctl -c $HOME/.volt/config-${stack_ns} -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 |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 534 | |
Matteo Scandolo | d1430a7 | 2020-12-04 15:14:44 -0800 | [diff] [blame] | 535 | printf '%s\n' \$(voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB logicaldevice flows # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-flows-#.txt" || true |
| 536 | printf '%s\n' \$(voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -c $HOME/.volt/config-${stack_ns} -m 8MB logicaldevice port list # > $LOG_FOLDER/${stack_ns}/voltha-logicaldevice-ports-#.txt" || true |
Matteo Scandolo | d406449 | 2020-11-13 10:48:30 -0800 | [diff] [blame] | 537 | """ |
| 538 | } catch(e) { |
| 539 | sh ''' |
| 540 | echo "Can't get device list from voltclt" |
| 541 | ''' |
| 542 | } |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 543 | } |
| 544 | } |
| 545 | // get cpu usage by container |
| 546 | sh ''' |
| 547 | if [ ${withMonitoring} = true ] ; then |
| 548 | cd $WORKSPACE/voltha-system-tests |
| 549 | source ./vst_venv/bin/activate |
| 550 | sleep 60 # we have to wait for prometheus to collect all the information |
| 551 | python tests/scale/sizing.py -o $WORKSPACE/plots || true |
| 552 | fi |
| 553 | ''' |
Matteo Scandolo | b3d2727b | 2021-03-03 11:17:46 -0800 | [diff] [blame] | 554 | archiveArtifacts artifacts: 'kind-voltha/install-*.log,execution-time-*.txt,logs/**/*.txt,logs/**/*.tar.gz,RobotLogs/**/*,plots/*,etcd-metrics/*' |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 555 | } |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | def deploy_voltha_stacks(numberOfStacks) { |
| 560 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 561 | stage("Deploy VOLTHA stack " + i) { |
| 562 | sh returnStdout: false, script: """ |
Matteo Scandolo | 77501cc | 2020-12-11 09:49:07 -0800 | [diff] [blame] | 563 | |
| 564 | # unset voltha-api port so that the port is forwarded on a new one |
| 565 | unset VOLTHA_API_PORT |
| 566 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 567 | cd $WORKSPACE/kind-voltha/ |
| 568 | |
| 569 | export NAME=voltha${i} |
| 570 | export VOLTHA_NS=voltha${i} |
| 571 | export ADAPTER_NS=voltha${i} |
| 572 | export BBSIM_NS=voltha${i} |
| 573 | export BBSIM_BASE_INDEX=${i} |
| 574 | export WITH_ETCD=etcd.\$INFRA_NS.svc:2379 |
| 575 | export WITH_KAFKA=kafka.\$INFRA_NS.svc:9092 |
| 576 | export WITH_ONOS=onos-onos-classic-hs.\$INFRA_NS.svc:6653 |
| 577 | |
| 578 | export EXTRA_HELM_FLAGS+=' ' |
| 579 | |
| 580 | # Load the release defaults |
| 581 | if [ '${release.trim()}' != 'master' ]; then |
| 582 | source $WORKSPACE/kind-voltha/releases/${release} |
| 583 | EXTRA_HELM_FLAGS+=" ${extraHelmFlags} " |
| 584 | fi |
| 585 | |
| 586 | # BBSim custom image handling |
| 587 | if [ '${bbsimImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'bbsim' ]; then |
| 588 | IFS=: read -r bbsimRepo bbsimTag <<< '${bbsimImg.trim()}' |
| 589 | EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag " |
| 590 | fi |
| 591 | |
| 592 | # VOLTHA and ofAgent custom image handling |
| 593 | # NOTE to override the rw-core image in a released version you must set the ofAgent image too |
| 594 | # TODO split ofAgent and voltha-go |
| 595 | if [ '${rwCoreImg.trim()}' != '' ] && [ '${ofAgentImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-go' ]; then |
| 596 | IFS=: read -r rwCoreRepo rwCoreTag <<< '${rwCoreImg.trim()}' |
| 597 | IFS=: read -r ofAgentRepo ofAgentTag <<< '${ofAgentImg.trim()}' |
| 598 | EXTRA_HELM_FLAGS+="--set images.rw_core.repository=\$rwCoreRepo,images.rw_core.tag=\$rwCoreTag,images.ofagent.repository=\$ofAgentRepo,images.ofagent.tag=\$ofAgentTag " |
| 599 | fi |
| 600 | |
| 601 | # OpenOLT custom image handling |
| 602 | if [ '${openoltAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openolt-adapter' ]; then |
| 603 | IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< '${openoltAdapterImg.trim()}' |
| 604 | EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=\$openoltAdapterRepo,images.adapter_open_olt.tag=\$openoltAdapterTag " |
| 605 | fi |
| 606 | |
| 607 | # OpenONU custom image handling |
| 608 | if [ '${openonuAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter' ]; then |
| 609 | IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< '${openonuAdapterImg.trim()}' |
| 610 | EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=\$openonuAdapterRepo,images.adapter_open_onu.tag=\$openonuAdapterTag " |
| 611 | fi |
| 612 | |
Andrea Campanella | 2876308 | 2020-11-18 10:55:31 +0100 | [diff] [blame] | 613 | # OpenONU Go custom image handling |
| 614 | if [ '${openonuAdapterGoImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter-go' ]; then |
| 615 | IFS=: read -r openonuAdapterGoRepo openonuAdapterGoTag <<< '${openonuAdapterGoImg.trim()}' |
Andrea Campanella | ed02698 | 2020-11-20 10:06:42 +0100 | [diff] [blame] | 616 | EXTRA_HELM_FLAGS+="--set images.adapter_open_onu_go.repository=\$openonuAdapterGoRepo,images.adapter_open_onu_go.tag=\$openonuAdapterGoTag " |
Andrea Campanella | 2876308 | 2020-11-18 10:55:31 +0100 | [diff] [blame] | 617 | fi |
| 618 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 619 | # ONOS custom image handling |
| 620 | if [ '${onosImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-onos' ]; then |
| 621 | IFS=: read -r onosRepo onosTag <<< '${onosImg.trim()}' |
| 622 | EXTRA_HELM_FLAGS+="--set images.onos.repository=\$onosRepo,images.onos.tag=\$onosTag " |
| 623 | fi |
| 624 | |
| 625 | # set BBSim parameters |
| 626 | EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} ' |
| 627 | |
| 628 | # disable the securityContext, this is a development cluster |
| 629 | EXTRA_HELM_FLAGS+='--set securityContext.enabled=false ' |
| 630 | |
| 631 | # No persistent-volume-claims in Atomix |
| 632 | EXTRA_HELM_FLAGS+="--set atomix.persistence.enabled=false " |
| 633 | |
| 634 | echo "Installing with the following extra arguments:" |
| 635 | echo $EXTRA_HELM_FLAGS |
| 636 | |
| 637 | # if it's newer than voltha-2.4 set the correct BBSIM_CFG |
| 638 | if [ '${release.trim()}' != 'voltha-2.4' ]; then |
| 639 | export BBSIM_CFG="$WORKSPACE/kind-voltha/configs/bbsim-sadis-${workflow}.yaml" |
| 640 | fi |
| 641 | |
| 642 | # Use custom built images |
| 643 | |
| 644 | if [ '\$GERRIT_PROJECT' == 'voltha-go' ]; then |
| 645 | EXTRA_HELM_FLAGS+="--set images.rw_core.repository=${dockerRegistry}/voltha/voltha-rw-core,images.rw_core.tag=voltha-scale " |
| 646 | fi |
| 647 | |
| 648 | if [ '\$GERRIT_PROJECT' == 'voltha-openolt-adapter' ]; then |
| 649 | EXTRA_HELM_FLAGS+="--set images.adapter_open_olt.repository=${dockerRegistry}/voltha/voltha-openolt-adapter,images.adapter_open_olt.tag=voltha-scale " |
| 650 | fi |
| 651 | |
| 652 | if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter' ]; then |
| 653 | EXTRA_HELM_FLAGS+="--set images.adapter_open_onu.repository=${dockerRegistry}/voltha/voltha-openonu-adapter,images.adapter_open_onu.tag=voltha-scale " |
| 654 | fi |
| 655 | |
Andrea Campanella | ed02698 | 2020-11-20 10:06:42 +0100 | [diff] [blame] | 656 | if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter-go' ]; then |
| 657 | EXTRA_HELM_FLAGS+="--set images.adapter_open_onu_go.repository=${dockerRegistry}/voltha/voltha-openonu-adapter-go,images.adapter_open_onu_go.tag=voltha-scale " |
| 658 | fi |
| 659 | |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 660 | if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then |
| 661 | EXTRA_HELM_FLAGS+="--set images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,images.ofagent.tag=voltha-scale " |
| 662 | fi |
| 663 | |
| 664 | if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then |
| 665 | EXTRA_HELM_FLAGS+="--set images.onos.repository=${dockerRegistry}/voltha/voltha-onos,images.onos.tag=voltha-scale " |
| 666 | fi |
| 667 | |
| 668 | if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then |
| 669 | EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale " |
| 670 | fi |
| 671 | |
| 672 | ./voltha up |
| 673 | """ |
| 674 | } |
| 675 | } |
| 676 | } |
| 677 | |
| 678 | def test_voltha_stacks(numberOfStacks) { |
| 679 | for (int i = 1; i <= numberOfStacks.toInteger(); i++) { |
| 680 | stage("Test VOLTHA stack " + i) { |
| 681 | timeout(time: 15, unit: 'MINUTES') { |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 682 | sh """ |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 683 | export VOLTCONFIG="$HOME/.volt/config-voltha${i}" |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 684 | ROBOT_PARAMS="-v stackId:${i} \ |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 685 | -v olt:${olts} \ |
| 686 | -v pon:${pons} \ |
| 687 | -v onu:${onus} \ |
| 688 | -v workflow:${workflow} \ |
| 689 | -v withEapol:${withEapol} \ |
| 690 | -v withDhcp:${withDhcp} \ |
| 691 | -v withIgmp:${withIgmp} \ |
| 692 | --noncritical non-critical \ |
| 693 | -e teardown " |
| 694 | |
| 695 | if [ ${withEapol} = false ] ; then |
| 696 | ROBOT_PARAMS+="-e authentication " |
| 697 | fi |
| 698 | |
| 699 | if [ ${withDhcp} = false ] ; then |
| 700 | ROBOT_PARAMS+="-e dhcp " |
| 701 | fi |
| 702 | |
| 703 | if [ ${provisionSubscribers} = false ] ; then |
| 704 | # if we're not considering subscribers then we don't care about authentication and dhcp |
| 705 | ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp " |
| 706 | fi |
| 707 | |
| 708 | if [ ${withFlows} = false ] ; then |
| 709 | ROBOT_PARAMS+="-i setup -i activation " |
| 710 | fi |
| 711 | |
| 712 | cd $WORKSPACE/voltha-system-tests |
| 713 | source ./vst_venv/bin/activate |
Matteo Scandolo | 5f6c549 | 2020-11-12 17:37:25 -0800 | [diff] [blame] | 714 | robot -d $WORKSPACE/RobotLogs/voltha${i} \ |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 715 | \$ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
Matteo Scandolo | f7ca631 | 2020-11-16 15:57:15 -0800 | [diff] [blame] | 716 | |
| 717 | # collect results |
| 718 | python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/voltha${i}/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time-voltha${i}.txt || true |
| 719 | cat $WORKSPACE/execution-time-voltha${i}.txt |
Matteo Scandolo | dc4608c | 2020-11-12 16:48:16 -0800 | [diff] [blame] | 720 | """ |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 721 | } |
| 722 | } |
Matteo Scandolo | 4b006ae | 2020-11-09 16:14:40 -0800 | [diff] [blame] | 723 | } |
| 724 | } |