Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [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 and performs a scale test |
| 16 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 17 | library identifier: 'cord-jenkins-libraries@master', |
| 18 | retriever: modernSCM([ |
| 19 | $class: 'GitSCMSource', |
| 20 | remote: 'https://gerrit.opencord.org/ci-management.git' |
| 21 | ]) |
| 22 | |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 23 | // this function generates the correct parameters for ofAgent |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 24 | // to connect to multiple ONOS instances |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 25 | def ofAgentConnections(numOfOnos, releaseName, namespace) { |
| 26 | def params = " " |
| 27 | numOfOnos.times { |
| 28 | params += "--set voltha.services.controller[${it}].address=${releaseName}-onos-classic-${it}.${releaseName}-onos-classic-hs.${namespace}.svc:6653 " |
| 29 | } |
| 30 | return params |
| 31 | } |
| 32 | |
| 33 | pipeline { |
| 34 | |
| 35 | /* no label, executor is determined by JJB */ |
| 36 | agent { |
| 37 | label "${params.buildNode}" |
| 38 | } |
| 39 | options { |
| 40 | timeout(time: 60, unit: 'MINUTES') |
| 41 | } |
| 42 | environment { |
| 43 | JENKINS_NODE_COOKIE="dontKillMe" // do not kill processes after the build is done |
| 44 | KUBECONFIG="$HOME/.kube/config" |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 45 | VOLTCONFIG="$HOME/.volt/config" |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 46 | SSHPASS="karaf" |
| 47 | VOLTHA_LOG_LEVEL="${logLevel}" |
| 48 | NUM_OF_BBSIM="${olts}" |
| 49 | NUM_OF_OPENONU="${openonuAdapterReplicas}" |
| 50 | NUM_OF_ONOS="${onosReplicas}" |
| 51 | NUM_OF_ATOMIX="${atomixReplicas}" |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 52 | EXTRA_HELM_FLAGS=" " |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 53 | |
| 54 | APPS_TO_LOG="etcd kafka onos-classic adapter-open-onu adapter-open-olt rw-core ofagent bbsim radius bbsim-sadis-server onos-config-loader" |
| 55 | LOG_FOLDER="$WORKSPACE/logs" |
| 56 | |
| 57 | GERRIT_PROJECT="${GERRIT_PROJECT}" |
| 58 | } |
| 59 | |
| 60 | stages { |
| 61 | stage ('Cleanup') { |
| 62 | steps { |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 63 | script { |
| 64 | try { |
Matteo Scandolo | ce8fd78 | 2021-10-12 07:32:06 -0700 | [diff] [blame] | 65 | timeout(time: 5, unit: 'MINUTES') { |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 66 | sh returnStdout: false, script: ''' |
| 67 | cd $WORKSPACE |
| 68 | rm -rf $WORKSPACE/* |
| 69 | ''' |
| 70 | // removing the voltha-infra chart first |
| 71 | // if we don't ONOS might get stuck because of all the events when BBSim goes down |
| 72 | sh returnStdout: false, script: ''' |
| 73 | set +x |
| 74 | helm del voltha-infra || true |
| 75 | echo -ne "\nWaiting for ONOS to be removed..." |
| 76 | onos=$(kubectl get pod -n default -l app=onos-classic --no-headers | wc -l) |
| 77 | while [[ $onos != 0 ]]; do |
| 78 | onos=$(kubectl get pod -n default -l app=onos-classic --no-headers | wc -l) |
| 79 | sleep 5 |
| 80 | echo -ne "." |
| 81 | done |
| 82 | ''' |
| 83 | } |
| 84 | } catch(org.jenkinsci.plugins.workflow.steps.FlowInterruptedException e) { |
| 85 | // if we have a timeout in the Cleanup fase most likely ONOS got stuck somewhere, thuse force remove the pods |
| 86 | sh ''' |
| 87 | kubectl get pods | grep Terminating | awk '{print $1}' | xargs kubectl delete pod --force --grace-period=0 |
| 88 | ''' |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 89 | } |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 90 | timeout(time: 10, unit: 'MINUTES') { |
| 91 | script { |
| 92 | helmTeardown(["default"]) |
| 93 | } |
| 94 | sh returnStdout: false, script: ''' |
| 95 | helm repo add onf https://charts.opencord.org |
| 96 | helm repo update |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 97 | |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 98 | # remove all persistent volume claims |
| 99 | kubectl delete pvc --all-namespaces --all |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 100 | PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l) |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 101 | while [[ \$PVCS != 0 ]]; do |
| 102 | sleep 5 |
| 103 | PVCS=\$(kubectl get pvc --all-namespaces --no-headers | wc -l) |
| 104 | done |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 105 | |
Matteo Scandolo | dc329dc | 2021-10-11 16:00:23 -0700 | [diff] [blame] | 106 | # remove orphaned port-forward from different namespaces |
| 107 | ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true |
| 108 | ''' |
| 109 | } |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 110 | } |
| 111 | } |
| 112 | } |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 113 | stage('Download Code') { |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 114 | steps { |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 115 | getVolthaCode([ |
| 116 | branch: "${release}", |
| 117 | volthaSystemTestsChange: "${volthaSystemTestsChange}", |
| 118 | volthaHelmChartsChange: "${volthaHelmChartsChange}", |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 119 | ]) |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 120 | } |
| 121 | } |
| 122 | stage('Build patch') { |
| 123 | when { |
| 124 | expression { |
| 125 | return params.GERRIT_PROJECT |
| 126 | } |
| 127 | } |
| 128 | steps { |
| 129 | sh """ |
| 130 | git clone https://\$GERRIT_HOST/\$GERRIT_PROJECT |
| 131 | cd \$GERRIT_PROJECT |
| 132 | git fetch https://\$GERRIT_HOST/\$GERRIT_PROJECT \$GERRIT_REFSPEC && git checkout FETCH_HEAD |
| 133 | |
| 134 | DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-build |
| 135 | DOCKER_REGISTRY=${dockerRegistry}/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=voltha-scale make docker-push |
| 136 | """ |
| 137 | } |
| 138 | } |
| 139 | stage('Deploy common infrastructure') { |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 140 | steps { |
| 141 | sh ''' |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 142 | if [ ${withMonitoring} = true ] ; then |
| 143 | helm install nem-monitoring onf/nem-monitoring \ |
| 144 | -f $HOME/voltha-scale/grafana.yaml \ |
| 145 | --set prometheus.alertmanager.enabled=false,prometheus.pushgateway.enabled=false \ |
| 146 | --set kpi_exporter.enabled=false,dashboards.xos=false,dashboards.onos=false,dashboards.aaa=false,dashboards.voltha=false |
| 147 | fi |
| 148 | ''' |
| 149 | } |
| 150 | } |
| 151 | stage('Deploy Voltha') { |
| 152 | steps { |
| 153 | timeout(time: 10, unit: 'MINUTES') { |
| 154 | script { |
| 155 | sh returnStdout: false, script: ''' |
| 156 | # start logging with kail |
| 157 | |
| 158 | mkdir -p $LOG_FOLDER |
| 159 | |
| 160 | list=($APPS_TO_LOG) |
| 161 | for app in "${list[@]}" |
| 162 | do |
| 163 | echo "Starting logs for: ${app}" |
| 164 | _TAG=kail-$app kail -l app=$app --since 1h > $LOG_FOLDER/$app.log& |
| 165 | done |
| 166 | ''' |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 167 | def returned_flags = sh (returnStdout: true, script: """ |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 168 | |
| 169 | export EXTRA_HELM_FLAGS+=' ' |
| 170 | |
| 171 | # BBSim custom image handling |
| 172 | if [ '${bbsimImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'bbsim' ]; then |
| 173 | IFS=: read -r bbsimRepo bbsimTag <<< '${bbsimImg.trim()}' |
| 174 | EXTRA_HELM_FLAGS+="--set images.bbsim.repository=\$bbsimRepo,images.bbsim.tag=\$bbsimTag " |
| 175 | fi |
| 176 | |
| 177 | # VOLTHA custom image handling |
| 178 | if [ '${rwCoreImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-go' ]; then |
| 179 | IFS=: read -r rwCoreRepo rwCoreTag <<< '${rwCoreImg.trim()}' |
| 180 | EXTRA_HELM_FLAGS+="--set voltha.images.rw_core.repository=\$rwCoreRepo,voltha.images.rw_core.tag=\$rwCoreTag " |
| 181 | fi |
| 182 | |
| 183 | # ofAgent custom image handling |
| 184 | if [ '${ofAgentImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'of-agent' ]; then |
| 185 | IFS=: read -r ofAgentRepo ofAgentTag <<< '${ofAgentImg.trim()}' |
| 186 | EXTRA_HELM_FLAGS+="--set voltha.images.ofagent.repository=\$ofAgentRepo,voltha.images.ofagent.tag=\$ofAgentTag " |
| 187 | fi |
| 188 | |
| 189 | # OpenOLT custom image handling |
| 190 | if [ '${openoltAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openolt-adapter' ]; then |
| 191 | IFS=: read -r openoltAdapterRepo openoltAdapterTag <<< '${openoltAdapterImg.trim()}' |
| 192 | EXTRA_HELM_FLAGS+="--set voltha-adapter-openolt.images.adapter_open_olt.repository=\$openoltAdapterRepo,voltha-adapter-openolt.images.adapter_open_olt.tag=\$openoltAdapterTag " |
| 193 | fi |
| 194 | |
| 195 | # OpenONU custom image handling |
| 196 | if [ '${openonuAdapterImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter' ]; then |
| 197 | IFS=: read -r openonuAdapterRepo openonuAdapterTag <<< '${openonuAdapterImg.trim()}' |
| 198 | EXTRA_HELM_FLAGS+="--set voltha-adapter-openonu.images.adapter_open_onu.repository=\$openonuAdapterRepo,voltha-adapter-openonu.images.adapter_open_onu.tag=\$openonuAdapterTag " |
| 199 | fi |
| 200 | |
| 201 | # OpenONU GO custom image handling |
| 202 | if [ '${openonuAdapterGoImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-openonu-adapter-go' ]; then |
| 203 | IFS=: read -r openonuAdapterGoRepo openonuAdapterGoTag <<< '${openonuAdapterGoImg.trim()}' |
| 204 | EXTRA_HELM_FLAGS+="--set voltha-adapter-openonu.images.adapter_open_onu_go.repository=\$openonuAdapterGoRepo,voltha-adapter-openonu.images.adapter_open_onu_go.tag=\$openonuAdapterGoTag " |
| 205 | fi |
| 206 | |
| 207 | # ONOS custom image handling |
| 208 | if [ '${onosImg.trim()}' != '' ] && [ '\$GERRIT_PROJECT' != 'voltha-onos' ]; then |
| 209 | IFS=: read -r onosRepo onosTag <<< '${onosImg.trim()}' |
| 210 | EXTRA_HELM_FLAGS+="--set onos-classic.image.repository=\$onosRepo,onos-classic.image.tag=\$onosTag " |
| 211 | fi |
| 212 | |
| 213 | # set BBSim parameters |
| 214 | EXTRA_HELM_FLAGS+='--set enablePerf=true,pon=${pons},onu=${onus} ' |
| 215 | |
| 216 | # disable the securityContext, this is a development cluster |
| 217 | EXTRA_HELM_FLAGS+='--set securityContext.enabled=false ' |
| 218 | |
| 219 | # No persistent-volume-claims in Atomix |
| 220 | EXTRA_HELM_FLAGS+="--set onos-classic.atomix.persistence.enabled=false " |
| 221 | |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 222 | # Use custom built images |
| 223 | |
| 224 | if [ '\$GERRIT_PROJECT' == 'voltha-go' ]; then |
| 225 | EXTRA_HELM_FLAGS+="--set voltha.images.rw_core.repository=${dockerRegistry}/voltha/voltha-rw-core,voltha.images.rw_core.tag=voltha-scale " |
| 226 | fi |
| 227 | |
| 228 | if [ '\$GERRIT_PROJECT' == 'voltha-openolt-adapter' ]; then |
| 229 | EXTRA_HELM_FLAGS+="--set voltha-openolt-adapter.images.adapter_open_olt.repository=${dockerRegistry}/voltha/voltha-openolt-adapter,voltha-openolt-adapter.images.adapter_open_olt.tag=voltha-scale " |
| 230 | fi |
| 231 | |
| 232 | if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter' ]; then |
| 233 | EXTRA_HELM_FLAGS+="--set voltha-openonu-adapter.images.adapter_open_onu.repository=${dockerRegistry}/voltha/voltha-openonu-adapter,voltha-openonu-adapter.images.adapter_open_onu.tag=voltha-scale " |
| 234 | fi |
| 235 | |
| 236 | if [ '\$GERRIT_PROJECT' == 'voltha-openonu-adapter-go' ]; then |
| 237 | EXTRA_HELM_FLAGS+="--set voltha-openonu-adapter-go.images.adapter_open_onu_go.repository=${dockerRegistry}/voltha/voltha-openonu-adapter-go,voltha-openonu-adapter-go.images.adapter_open_onu_go.tag=voltha-scale " |
| 238 | fi |
| 239 | |
| 240 | if [ '\$GERRIT_PROJECT' == 'ofagent-go' ]; then |
| 241 | EXTRA_HELM_FLAGS+="--set voltha.images.ofagent.repository=${dockerRegistry}/voltha/voltha-ofagent-go,ofagent-go.images.ofagent.tag=voltha-scale " |
| 242 | fi |
| 243 | |
| 244 | if [ '\$GERRIT_PROJECT' == 'voltha-onos' ]; then |
| 245 | EXTRA_HELM_FLAGS+="--set onos-classic.image.repository=${dockerRegistry}/voltha/voltha-onos,onos-classic.image.tag=voltha-scale " |
| 246 | fi |
| 247 | |
| 248 | if [ '\$GERRIT_PROJECT' == 'bbsim' ]; then |
| 249 | EXTRA_HELM_FLAGS+="--set images.bbsim.repository=${dockerRegistry}/voltha/bbsim,images.bbsim.tag=voltha-scale " |
| 250 | fi |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 251 | echo \$EXTRA_HELM_FLAGS |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 252 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 253 | """).trim() |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 254 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 255 | def extraHelmFlags = returned_flags |
| 256 | // The added space before params.extraHelmFlags is required due to the .trim() above |
| 257 | def infraHelmFlags = |
Matteo Scandolo | 529e882 | 2021-07-21 10:20:18 -0700 | [diff] [blame] | 258 | "--set global.log_level=${logLevel} " + |
| 259 | "--set radius.enabled=${withEapol} " + |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 260 | "--set onos-classic.onosSshPort=30115 " + |
| 261 | "--set onos-classic.onosApiPort=30120 " + |
| 262 | extraHelmFlags + " " + params.extraHelmFlags |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 263 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 264 | println "Passing the following parameters to the VOLTHA infra deploy: ${infraHelmFlags}." |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 265 | |
Matteo Scandolo | c11b0ad | 2021-07-13 10:55:08 -0700 | [diff] [blame] | 266 | // in a released version we always want to use the local version of the helm-charts |
| 267 | def localCharts = true |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 268 | |
| 269 | volthaInfraDeploy([ |
| 270 | workflow: workflow, |
| 271 | infraNamespace: "default", |
| 272 | extraHelmFlags: infraHelmFlags, |
| 273 | localCharts: localCharts, |
| 274 | onosReplica: onosReplicas, |
| 275 | atomixReplica: atomixReplicas, |
| 276 | kafkaReplica: kafkaReplicas, |
| 277 | etcdReplica: etcdReplicas, |
| 278 | ]) |
| 279 | |
| 280 | stackHelmFlags = " --set onu=${onus},pon=${pons} --set global.log_level=${logLevel.toLowerCase()} " |
| 281 | stackHelmFlags += " --set voltha.ingress.enabled=true --set voltha.ingress.enableVirtualHosts=true --set voltha.fullHostnameOverride=voltha.scale1.dev " |
| 282 | stackHelmFlags += extraHelmFlags + " " + params.extraHelmFlags |
| 283 | |
| 284 | volthaStackDeploy([ |
| 285 | bbsimReplica: olts.toInteger(), |
| 286 | infraNamespace: "default", |
| 287 | volthaNamespace: "default", |
| 288 | stackName: "voltha1", // TODO support custom charts |
| 289 | workflow: workflow, |
| 290 | extraHelmFlags: stackHelmFlags, |
| 291 | localCharts: localCharts, |
Matteo Scandolo | ce8fd78 | 2021-10-12 07:32:06 -0700 | [diff] [blame] | 292 | adaptersToWait: 0, // no need to wait for adapters, 2.8 is kafka based |
Andrea Campanella | 8977b4d | 2021-12-29 15:41:39 +0100 | [diff] [blame] | 293 | onosReplica: onosReplicas, |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 294 | ]) |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 295 | sh """ |
| 296 | set +x |
| 297 | |
| 298 | echo -ne "\nWaiting for VOLTHA and ONOS to start..." |
| 299 | voltha=\$(kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l) |
| 300 | onos=\$(kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l) |
| 301 | while [[ \$voltha != 0 || \$onos != 0 ]]; do |
| 302 | sleep 5 |
| 303 | echo -ne "." |
| 304 | voltha=\$(kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l) |
| 305 | onos=\$(kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l) |
| 306 | done |
| 307 | echo -ne "\nVOLTHA and ONOS pods ready\n" |
| 308 | kubectl get pods --all-namespaces -l app.kubernetes.io/part-of=voltha --no-headers | grep "0/" | wc -l |
| 309 | kubectl get pods --all-namespaces -l app=onos-classic --no-headers | grep "0/" | wc -l |
| 310 | """ |
| 311 | start_port_forward(olts) |
| 312 | } |
| 313 | } |
| 314 | } |
| 315 | } |
| 316 | stage('Configuration') { |
| 317 | steps { |
| 318 | script { |
| 319 | def tech_prof_directory = "XGS-PON" |
| 320 | sh returnStdout: false, script: """ |
| 321 | #Setting link discovery |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 322 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.lldp.impl.LldpLinkProvider enabled ${withLLDP} |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 323 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 324 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager allowExtraneousRules true |
| 325 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flow.impl.FlowRuleManager importExtraneousRules true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 326 | |
| 327 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 328 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxBatchMillis 900 |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 329 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 330 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager accumulatorMaxIdleMillis 500 |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 331 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 332 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.opencord.olt.impl.Olt provisionDelay 1000 |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 333 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 334 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set ${logLevel} org.onosproject |
| 335 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set ${logLevel} org.opencord |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 336 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 337 | # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.cordmcast |
| 338 | # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.onosproject.mcast |
| 339 | # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.igmpproxy |
| 340 | # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.opencord.olt |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 341 | # sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 log:set DEBUG org.onosproject.net.flowobjective.impl.FlowObjectiveManager |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 342 | |
| 343 | kubectl exec \$(kubectl get pods | grep -E "bbsim[0-9]" | awk 'NR==1{print \$1}') -- bbsimctl log ${logLevel.toLowerCase()} false |
| 344 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 345 | # Set Flows/Ports/Meters/Groups poll frequency |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 346 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.flow.impl.OpenFlowRuleProvider flowPollFrequency ${onosStatInterval} |
| 347 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.device.impl.OpenFlowDeviceProvider portStatsPollFrequency ${onosStatInterval} |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 348 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.provider.of.group.impl.OpenFlowGroupProvider groupPollInterval ${onosGroupInterval} |
| 349 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.FlowObjectiveManager numThreads ${flowObjWorkerThreads} |
| 350 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg set org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager objectiveTimeoutMs 300000 |
| 351 | |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 352 | if [ ${withFlows} = false ]; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 353 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 app deactivate org.opencord.olt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 354 | fi |
| 355 | |
| 356 | if [ '${workflow}' = 'tt' ]; then |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 357 | etcd_container=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$2}') |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 358 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-HSIA.json \$etcd_container:/tmp/hsia.json |
| 359 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/hsia.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/64') |
| 360 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-VoIP.json \$etcd_container:/tmp/voip.json |
| 361 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/voip.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/65') |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 362 | kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-TT-MCAST-AdditionalBW-NA.json \$etcd_container:/tmp/mcast.json |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 363 | put_result=\$(kubectl exec -it \$etcd_container -- /bin/sh -c 'cat /tmp/mcast.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/${tech_prof_directory}/66') |
| 364 | fi |
| 365 | |
| 366 | if [ ${withPcap} = true ] ; then |
| 367 | # Start the tcp-dump in ofagent |
| 368 | export OF_AGENT=\$(kubectl get pods -l app=ofagent -o name) |
| 369 | kubectl exec \$OF_AGENT -- apk update |
| 370 | kubectl exec \$OF_AGENT -- apk add tcpdump |
| 371 | kubectl exec \$OF_AGENT -- mv /usr/sbin/tcpdump /usr/bin/tcpdump |
| 372 | _TAG=ofagent-tcpdump kubectl exec \$OF_AGENT -- tcpdump -nei eth0 -w out.pcap& |
| 373 | |
| 374 | # Start the tcp-dump in radius |
| 375 | export RADIUS=\$(kubectl get pods -l app=radius -o name) |
| 376 | kubectl exec \$RADIUS -- apt-get update |
| 377 | kubectl exec \$RADIUS -- apt-get install -y tcpdump |
| 378 | _TAG=radius-tcpdump kubectl exec \$RADIUS -- tcpdump -w out.pcap& |
| 379 | |
| 380 | # Start the tcp-dump in ONOS |
| 381 | for i in \$(seq 0 \$ONOSES); do |
| 382 | INSTANCE="onos-onos-classic-\$i" |
| 383 | kubectl exec \$INSTANCE -- apt-get update |
| 384 | kubectl exec \$INSTANCE -- apt-get install -y tcpdump |
| 385 | kubectl exec \$INSTANCE -- mv /usr/sbin/tcpdump /usr/bin/tcpdump |
| 386 | _TAG=\$INSTANCE kubectl exec \$INSTANCE -- /usr/bin/tcpdump -nei eth0 port 1812 -w out.pcap& |
| 387 | done |
| 388 | fi |
| 389 | """ |
| 390 | } |
| 391 | } |
| 392 | } |
Matteo Scandolo | fcb7563 | 2021-04-06 16:25:19 -0700 | [diff] [blame] | 393 | stage('Load MIB Template') { |
| 394 | when { |
| 395 | expression { |
| 396 | return params.withMibTemplate |
| 397 | } |
| 398 | } |
| 399 | steps { |
| 400 | sh """ |
| 401 | # load MIB template |
| 402 | wget https://raw.githubusercontent.com/opencord/voltha-openonu-adapter-go/master/templates/BBSM-12345123451234512345-00000000000001-v1.json |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 403 | cat BBSM-12345123451234512345-00000000000001-v1.json | kubectl exec -it \$(kubectl get pods |grep etcd-0 | awk 'NR==1{print \$1}') -- etcdctl put service/voltha/omci_mibs/go_templates/BBSM/12345123451234512345/00000000000001 |
Matteo Scandolo | fcb7563 | 2021-04-06 16:25:19 -0700 | [diff] [blame] | 404 | """ |
| 405 | } |
| 406 | } |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 407 | stage('Run Test') { |
| 408 | steps { |
| 409 | sh ''' |
| 410 | mkdir -p $WORKSPACE/RobotLogs |
| 411 | cd $WORKSPACE/voltha-system-tests |
| 412 | make vst_venv |
| 413 | ''' |
| 414 | sh ''' |
| 415 | if [ ${withProfiling} = true ] ; then |
| 416 | mkdir -p $LOG_FOLDER/pprof |
| 417 | echo $PATH |
| 418 | #Creating Python script for ONU Detection |
| 419 | cat << EOF > $WORKSPACE/pprof.sh |
| 420 | timestamp() { |
| 421 | date +"%T" |
| 422 | } |
| 423 | |
| 424 | i=0 |
| 425 | while [[ true ]]; do |
| 426 | ((i++)) |
| 427 | ts=$(timestamp) |
| 428 | go tool pprof -png http://127.0.0.1:6060/debug/pprof/heap > $LOG_FOLDER/pprof/rw-core-heap-\\$i-\\$ts.png |
| 429 | go tool pprof -png http://127.0.0.1:6060/debug/pprof/goroutine > $LOG_FOLDER/pprof/rw-core-goroutine-\\$i-\\$ts.png |
| 430 | curl -o $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof http://127.0.0.1:6060/debug/pprof/profile?seconds=10 |
| 431 | go tool pprof -png $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/rw-core-profile-\\$i-\\$ts.png |
| 432 | |
| 433 | go tool pprof -png http://127.0.0.1:6061/debug/pprof/heap > $LOG_FOLDER/pprof/openolt-heap-\\$i-\\$ts.png |
| 434 | go tool pprof -png http://127.0.0.1:6061/debug/pprof/goroutine > $LOG_FOLDER/pprof/openolt-goroutine-\\$i-\\$ts.png |
| 435 | curl -o $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof http://127.0.0.1:6061/debug/pprof/profile?seconds=10 |
| 436 | go tool pprof -png $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/openolt-profile-\\$i-\\$ts.png |
| 437 | |
| 438 | go tool pprof -png http://127.0.0.1:6062/debug/pprof/heap > $LOG_FOLDER/pprof/ofagent-heap-\\$i-\\$ts.png |
| 439 | go tool pprof -png http://127.0.0.1:6062/debug/pprof/goroutine > $LOG_FOLDER/pprof/ofagent-goroutine-\\$i-\\$ts.png |
| 440 | curl -o $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof http://127.0.0.1:6062/debug/pprof/profile?seconds=10 |
| 441 | go tool pprof -png $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.pprof > $LOG_FOLDER/pprof/ofagent-profile-\\$i-\\$ts.png |
| 442 | |
| 443 | sleep 10 |
| 444 | done |
| 445 | EOF |
| 446 | |
| 447 | _TAG="pprof" |
| 448 | _TAG=$_TAG bash $WORKSPACE/pprof.sh & |
| 449 | fi |
| 450 | ''' |
| 451 | timeout(time: 15, unit: 'MINUTES') { |
| 452 | sh ''' |
| 453 | ROBOT_PARAMS="--exitonfailure \ |
| 454 | -v olt:${olts} \ |
| 455 | -v pon:${pons} \ |
| 456 | -v onu:${onus} \ |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 457 | -v ONOS_SSH_PORT:30115 \ |
| 458 | -v ONOS_REST_PORT:30120 \ |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 459 | -v workflow:${workflow} \ |
| 460 | -v withEapol:${withEapol} \ |
| 461 | -v withDhcp:${withDhcp} \ |
| 462 | -v withIgmp:${withIgmp} \ |
| 463 | --noncritical non-critical \ |
| 464 | -e igmp -e teardown " |
| 465 | |
| 466 | if [ ${withEapol} = false ] ; then |
| 467 | ROBOT_PARAMS+="-e authentication " |
| 468 | fi |
| 469 | |
| 470 | if [ ${withDhcp} = false ] ; then |
| 471 | ROBOT_PARAMS+="-e dhcp " |
| 472 | fi |
| 473 | |
| 474 | if [ ${provisionSubscribers} = false ] ; then |
| 475 | # if we're not considering subscribers then we don't care about authentication and dhcp |
| 476 | ROBOT_PARAMS+="-e authentication -e provision -e flow-after -e dhcp " |
| 477 | fi |
| 478 | |
| 479 | if [ ${withFlows} = false ] ; then |
| 480 | ROBOT_PARAMS+="-i setup -i activation " |
| 481 | fi |
| 482 | |
| 483 | cd $WORKSPACE/voltha-system-tests |
| 484 | source ./vst_venv/bin/activate |
| 485 | robot -d $WORKSPACE/RobotLogs \ |
| 486 | $ROBOT_PARAMS tests/scale/Voltha_Scale_Tests.robot |
| 487 | ''' |
| 488 | } |
| 489 | } |
| 490 | } |
Matteo Scandolo | 36d897c | 2021-07-14 10:26:55 -0700 | [diff] [blame] | 491 | } |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 492 | post { |
| 493 | always { |
| 494 | // collect result, done in the "post" step so it's executed even in the |
| 495 | // event of a timeout in the tests |
| 496 | sh ''' |
| 497 | |
| 498 | # stop the kail processes |
| 499 | list=($APPS_TO_LOG) |
| 500 | for app in "${list[@]}" |
| 501 | do |
| 502 | echo "Stopping logs for: ${app}" |
| 503 | _TAG="kail-$app" |
| 504 | P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')" |
| 505 | if [ -n "$P_IDS" ]; then |
| 506 | echo $P_IDS |
| 507 | for P_ID in $P_IDS; do |
| 508 | kill -9 $P_ID |
| 509 | done |
| 510 | fi |
| 511 | done |
| 512 | |
| 513 | if [ ${withPcap} = true ] ; then |
| 514 | # stop ofAgent tcpdump |
| 515 | P_ID="\$(ps e -ww -A | grep "_TAG=ofagent-tcpdump" | grep -v grep | awk '{print \$1}')" |
| 516 | if [ -n "\$P_ID" ]; then |
| 517 | kill -9 \$P_ID |
| 518 | fi |
| 519 | |
| 520 | # stop radius tcpdump |
| 521 | P_ID="\$(ps e -ww -A | grep "_TAG=radius-tcpdump" | grep -v grep | awk '{print \$1}')" |
| 522 | if [ -n "\$P_ID" ]; then |
| 523 | kill -9 \$P_ID |
| 524 | fi |
| 525 | |
| 526 | # stop onos tcpdump |
| 527 | LIMIT=$(($NUM_OF_ONOS - 1)) |
| 528 | for i in $(seq 0 $LIMIT); do |
| 529 | INSTANCE="onos-onos-classic-$i" |
| 530 | P_ID="\$(ps e -ww -A | grep "_TAG=$INSTANCE" | grep -v grep | awk '{print \$1}')" |
| 531 | if [ -n "\$P_ID" ]; then |
| 532 | kill -9 \$P_ID |
| 533 | fi |
| 534 | done |
| 535 | |
| 536 | # copy the file |
| 537 | export OF_AGENT=$(kubectl get pods -l app=ofagent | awk 'NR==2{print $1}') || true |
| 538 | kubectl cp $OF_AGENT:out.pcap $LOG_FOLDER/ofagent.pcap || true |
| 539 | |
| 540 | export RADIUS=$(kubectl get pods -l app=radius | awk 'NR==2{print $1}') || true |
| 541 | kubectl cp $RADIUS:out.pcap $LOG_FOLDER/radius.pcap || true |
| 542 | |
| 543 | LIMIT=$(($NUM_OF_ONOS - 1)) |
| 544 | for i in $(seq 0 $LIMIT); do |
| 545 | INSTANCE="onos-onos-classic-$i" |
| 546 | kubectl cp $INSTANCE:out.pcap $LOG_FOLDER/$INSTANCE.pcap || true |
| 547 | done |
| 548 | fi |
| 549 | |
| 550 | cd voltha-system-tests |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 551 | source ./vst_venv/bin/activate || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 552 | python tests/scale/collect-result.py -r $WORKSPACE/RobotLogs/output.xml -p $WORKSPACE/plots > $WORKSPACE/execution-time.txt || true |
| 553 | cat $WORKSPACE/execution-time.txt |
| 554 | ''' |
| 555 | sh ''' |
| 556 | if [ ${withProfiling} = true ] ; then |
| 557 | _TAG="pprof" |
| 558 | P_IDS="$(ps e -ww -A | grep "_TAG=$_TAG" | grep -v grep | awk '{print $1}')" |
| 559 | if [ -n "$P_IDS" ]; then |
| 560 | echo $P_IDS |
| 561 | for P_ID in $P_IDS; do |
| 562 | kill -9 $P_ID |
| 563 | done |
| 564 | fi |
| 565 | fi |
| 566 | ''' |
| 567 | plot([ |
| 568 | csvFileName: 'scale-test.csv', |
| 569 | csvSeries: [ |
| 570 | [file: 'plots/plot-voltha-onus.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 571 | [file: 'plots/plot-onos-ports.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 572 | [file: 'plots/plot-voltha-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 573 | [file: 'plots/plot-voltha-openolt-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 574 | [file: 'plots/plot-onos-flows-before.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 575 | [file: 'plots/plot-onos-auth.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 576 | [file: 'plots/plot-voltha-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 577 | [file: 'plots/plot-voltha-openolt-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 578 | [file: 'plots/plot-onos-flows-after.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 579 | [file: 'plots/plot-onos-dhcp.txt', displayTableFlag: false, exclusionValues: '', inclusionFlag: 'OFF', url: ''], |
| 580 | ], |
| 581 | group: 'Voltha-Scale-Numbers', numBuilds: '20', style: 'line', title: "Scale Test (OLTs: ${olts}, PONs: ${pons}, ONUs: ${onus})", yaxis: 'Time (s)', useDescr: true |
| 582 | ]) |
| 583 | step([$class: 'RobotPublisher', |
| 584 | disableArchiveOutput: false, |
| 585 | logFileName: '**/log*.html', |
| 586 | otherFiles: '', |
| 587 | outputFileName: '**/output*.xml', |
| 588 | outputPath: 'RobotLogs', |
| 589 | passThreshold: 100, |
| 590 | reportFileName: '**/report*.html', |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 591 | onlyCritical: true, |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 592 | unstableThreshold: 0]); |
| 593 | // get all the logs from kubernetes PODs |
| 594 | sh returnStdout: false, script: ''' |
| 595 | |
| 596 | # store information on running charts |
| 597 | helm ls > $LOG_FOLDER/helm-list.txt || true |
| 598 | |
| 599 | # store information on the running pods |
| 600 | kubectl get pods -o wide > $LOG_FOLDER/pods.txt || true |
| 601 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-images.txt || true |
| 602 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $LOG_FOLDER/pod-imagesId.txt || true |
| 603 | |
| 604 | # copy the ONOS logs directly from the container to avoid the color codes |
| 605 | printf '%s\n' $(kubectl get pods -l app=onos-classic -o=jsonpath="{.items[*]['metadata.name']}") | xargs --no-run-if-empty -I# bash -c "kubectl cp #:${karafHome}/data/log/karaf.log $LOG_FOLDER/#.log" || true |
| 606 | |
| 607 | # get ONOS cfg from the 3 nodes |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 608 | # kubectl exec -t voltha-infra-onos-classic-0 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-0-cfg.txt || true |
| 609 | # kubectl exec -t voltha-infra-onos-classic-1 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-1-cfg.txt || true |
| 610 | # kubectl exec -t voltha-infra-onos-classic-2 -- sh /root/onos/apache-karaf-4.2.9/bin/client cfg get > ~/voltha-infra-onos-classic-2-cfg.txt || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 611 | |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 612 | # kubectl exec -t voltha-infra-onos-classic-0 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-0-next-objs.txt || true |
| 613 | # kubectl exec -t voltha-infra-onos-classic-1 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-1-next-objs.txt || true |
| 614 | # kubectl exec -t voltha-infra-onos-classic-2 -- sh /root/onos/apache-karaf-4.2.9/bin/client obj-next-ids > ~/voltha-infra-onos-classic-2-next-objs.txt || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 615 | |
| 616 | # get radius logs out of the container |
| 617 | kubectl cp $(kubectl get pods -l app=radius --no-headers | awk '{print $1}'):/var/log/freeradius/radius.log $LOG_FOLDER/radius.log || true |
| 618 | ''' |
| 619 | // dump all the BBSim(s) ONU information |
| 620 | sh ''' |
| 621 | BBSIM_IDS=$(kubectl get pods | grep bbsim | grep -v server | awk '{print $1}') |
| 622 | IDS=($BBSIM_IDS) |
| 623 | |
| 624 | for bbsim in "${IDS[@]}" |
| 625 | do |
| 626 | kubectl exec -t $bbsim -- bbsimctl onu list > $LOG_FOLDER/$bbsim-device-list.txt || true |
| 627 | kubectl exec -t $bbsim -- bbsimctl service list > $LOG_FOLDER/$bbsim-service-list.txt || true |
| 628 | kubectl exec -t $bbsim -- bbsimctl olt resources GEM_PORT > $LOG_FOLDER/$bbsim-flows-gem-ports.txt || true |
| 629 | kubectl exec -t $bbsim -- bbsimctl olt resources ALLOC_ID > $LOG_FOLDER/$bbsim-flows-alloc-ids.txt || true |
| 630 | kubectl exec -t $bbsim -- bbsimctl olt pons > $LOG_FOLDER/$bbsim-pon-resources.txt || true |
| 631 | done |
| 632 | ''' |
| 633 | script { |
| 634 | // first make sure the port-forward is still running, |
| 635 | // sometimes Jenkins kills it relardless of the JENKINS_NODE_COOKIE=dontKillMe |
| 636 | def running = sh ( |
| 637 | script: 'ps aux | grep port-forw | grep -E "onos|voltha" | grep -v grep | wc -l', |
| 638 | returnStdout: true |
| 639 | ).trim() |
| 640 | // if any of the voltha-api, onos-rest, onos-ssh port-forwards are not there |
| 641 | // kill all and restart |
| 642 | if (running != "3") { |
| 643 | start_port_forward(olts) |
| 644 | } |
| 645 | } |
| 646 | // get ONOS debug infos |
| 647 | sh ''' |
| 648 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 649 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 apps -a -s > $LOG_FOLDER/onos-apps.txt |
| 650 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 nodes > $LOG_FOLDER/onos-nodes.txt |
| 651 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 masters > $LOG_FOLDER/onos-masters.txt |
| 652 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 roles > $LOG_FOLDER/onos-roles.txt |
| 653 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 cfg get > $LOG_FOLDER/onos-cfg.txt |
| 654 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 netcfg > $LOG_FOLDER/onos-netcfg.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 655 | |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 656 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 ports > $LOG_FOLDER/onos-ports-list.txt |
| 657 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 hosts > $LOG_FOLDER/onos-hosts-list.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 658 | |
| 659 | if [ ${withFlows} = true ] ; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 660 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-olts > $LOG_FOLDER/onos-olt-list.txt |
| 661 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 flows -s > $LOG_FOLDER/onos-flows-list.txt |
| 662 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 meters > $LOG_FOLDER/onos-meters-list.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 663 | fi |
| 664 | |
| 665 | if [ ${provisionSubscribers} = true ]; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 666 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-programmed-subscribers > $LOG_FOLDER/onos-programmed-subscribers.txt |
| 667 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-programmed-meters > $LOG_FOLDER/onos-programmed-meters.txt |
| 668 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-bpmeter-mappings > $LOG_FOLDER/onos-bpmeter-mappings.txt |
| 669 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 volt-failed-subscribers > $LOG_FOLDER/onos-failed-subscribers.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 670 | fi |
| 671 | |
| 672 | if [ ${withEapol} = true ] ; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 673 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 aaa-users > $LOG_FOLDER/onos-aaa-users.txt |
| 674 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 aaa-statistics > $LOG_FOLDER/onos-aaa-statistics.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 675 | fi |
| 676 | |
| 677 | if [ ${withDhcp} = true ] ; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 678 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 dhcpl2relay-allocations > $LOG_FOLDER/onos-dhcp-allocations.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 679 | fi |
| 680 | |
| 681 | if [ ${withIgmp} = true ] ; then |
Matteo Scandolo | 8731a1f | 2021-04-09 13:05:06 -0700 | [diff] [blame] | 682 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 mcast-host-routes > $LOG_FOLDER/onos-mcast-host-routes.txt |
| 683 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 mcast-host-show > $LOG_FOLDER/onos-mcast-host-show.txt |
| 684 | sshpass -e ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 30115 karaf@127.0.0.1 groups > $LOG_FOLDER/onos-groups.txt |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 685 | fi |
| 686 | ''' |
| 687 | // collect etcd metrics |
| 688 | sh ''' |
| 689 | mkdir -p $WORKSPACE/etcd-metrics |
| 690 | 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 |
| 691 | 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 |
| 692 | 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 |
| 693 | 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 |
| 694 | 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-sum.json || true |
| 695 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_backend_commit_duration_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-backend-write-time-bucket.json || true |
| 696 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_disk_wal_fsync_duration_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-wal-fsync-time-bucket.json || true |
| 697 | curl -s -X GET -G http://10.90.0.101:31301/api/v1/query --data-urlencode 'query=etcd_network_peer_round_trip_time_seconds_bucket' | jq '.data' > $WORKSPACE/etcd-metrics/etcd-network-peer-round-trip-time-seconds.json || true |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 698 | etcd_namespace=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$1}') |
| 699 | etcd_container=\$(kubectl get pods --all-namespaces | grep etcd-0 | awk 'NR==1{print \$2}') |
| 700 | kubectl exec -it -n \$etcd_namespace \$etcd_container -- etcdctl defrag --cluster || true |
| 701 | kubectl exec -it -n \$etcd_namespace \$etcd_container -- etcdctl endpoint status -w table > $WORKSPACE/etcd-metrics/etcd-status-table.txt || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 702 | |
| 703 | ''' |
| 704 | // get VOLTHA debug infos |
| 705 | script { |
| 706 | try { |
| 707 | sh ''' |
| 708 | voltctl -m 8MB device list -o json > $LOG_FOLDER/device-list.json || true |
| 709 | python -m json.tool $LOG_FOLDER/device-list.json > $LOG_FOLDER/voltha-devices-list.json || true |
| 710 | rm $LOG_FOLDER/device-list.json || true |
| 711 | voltctl -m 8MB device list > $LOG_FOLDER/voltha-devices-list.txt || true |
| 712 | |
| 713 | 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/voltha-device-flows-#.txt" || true |
| 714 | 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/voltha-device-ports-#.txt" || true |
| 715 | |
| 716 | printf '%s\n' $(voltctl -m 8MB logicaldevice list -q) | xargs --no-run-if-empty -I# bash -c "voltctl -m 8MB logicaldevice flows # > $LOG_FOLDER/voltha-logicaldevice-flows-#.txt" || true |
| 717 | 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/voltha-logicaldevice-ports-#.txt" || true |
| 718 | ''' |
| 719 | } catch(e) { |
| 720 | sh ''' |
| 721 | echo "Can't get device list from voltclt" |
| 722 | ''' |
| 723 | } |
| 724 | } |
| 725 | // get cpu usage by container |
| 726 | sh ''' |
| 727 | if [ ${withMonitoring} = true ] ; then |
| 728 | cd $WORKSPACE/voltha-system-tests |
Hardik Windlass | 6d9a82e | 2021-07-08 16:23:21 +0000 | [diff] [blame] | 729 | source ./vst_venv/bin/activate || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 730 | sleep 60 # we have to wait for prometheus to collect all the information |
Hardik Windlass | 5cfb29a | 2021-08-10 09:39:29 +0000 | [diff] [blame] | 731 | python scripts/sizing.py -o $WORKSPACE/plots || true |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 732 | fi |
| 733 | ''' |
| 734 | archiveArtifacts artifacts: 'execution-time.txt,logs/*,logs/pprof/*,RobotLogs/**/*,plots/*,etcd-metrics/*' |
| 735 | } |
| 736 | } |
| 737 | } |
| 738 | |
| 739 | def start_port_forward(olts) { |
| 740 | sh """ |
Matteo Scandolo | fed6bab | 2021-03-31 14:19:57 -0700 | [diff] [blame] | 741 | bbsimRestPortFwd=50071 |
| 742 | for i in {0..${olts.toInteger() - 1}}; do |
| 743 | daemonize -E JENKINS_NODE_COOKIE="dontKillMe" /usr/local/bin/kubectl port-forward --address 0.0.0.0 -n default svc/bbsim\${i} \${bbsimRestPortFwd}:50071 |
| 744 | ((bbsimRestPortFwd++)) |
| 745 | done |
| 746 | """ |
| 747 | } |