blob: f0b67873a92f4df27a853dea5f453930a2f1866e [file] [log] [blame]
Andy Bavier61c5b2a2019-11-12 12:08:19 -07001// 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 built from patchset on a physical pod and run e2e test
16// uses kind-voltha to deploy voltha-2.X
17
Matteo Scandolo7a330022021-03-29 14:03:48 -070018// NOTE we are importing the library even if it's global so that it's
19// easier to change the keywords during a replay
20library identifier: 'cord-jenkins-libraries@master',
21 retriever: modernSCM([
22 $class: 'GitSCMSource',
23 remote: 'https://gerrit.opencord.org/ci-management.git'
24])
25
Andy Baviere06dcff2020-02-06 11:36:40 -070026// Need this so that deployment_config has global scope when it's read later
27deployment_config = null
28localDeploymentConfigFile = null
29localKindVolthaValuesFile = null
30localSadisConfigFile = null
31
32// The pipeline assumes these variables are always defined
Zack Williams03ebb272020-03-27 09:42:33 -070033if ( params.manualBranch != "" ) {
Andy Baviere06dcff2020-02-06 11:36:40 -070034 GERRIT_EVENT_COMMENT_TEXT = ""
35 GERRIT_PROJECT = ""
Zack Williams03ebb272020-03-27 09:42:33 -070036 GERRIT_BRANCH = "${params.manualBranch}"
Andy Baviere06dcff2020-02-06 11:36:40 -070037 GERRIT_CHANGE_NUMBER = ""
38 GERRIT_PATCHSET_NUMBER = ""
Andy Bavier61c5b2a2019-11-12 12:08:19 -070039}
40
41pipeline {
42
43 /* no label, executor is determined by JJB */
44 agent {
45 label "${params.buildNode}"
46 }
47 options {
Andy Bavier880d8862020-06-28 12:03:35 -070048 timeout(time: 120, unit: 'MINUTES')
Andy Bavier61c5b2a2019-11-12 12:08:19 -070049 }
50
51 environment {
52 KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal"
53 VOLTCONFIG="$HOME/.volt/config-minimal"
Matteo Scandolo7a330022021-03-29 14:03:48 -070054 PATH="$WORKSPACE/bin:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Matteo Scandolo4d1a12f2020-12-07 16:17:12 -080055 NAME="minimal"
Andy Bavier61c5b2a2019-11-12 12:08:19 -070056 FANCY=0
57 //VOL-2194 ONOS SSH and REST ports hardcoded to 30115/30120 in tests
58 ONOS_SSH_PORT=30115
59 ONOS_API_PORT=30120
60 }
61
62 stages {
63 stage ('Initialize') {
64 steps {
hwchiu1f0b0fe2019-12-06 11:45:23 -080065 sh returnStdout: false, script: """
Andrea Campanella57735a82021-05-18 13:22:49 +020066 if [ "${branch}" != "master" ]; then
67 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
68 source "$WORKSPACE/kind-voltha/releases/${branch}"
69 else
70 echo "on master, using default settings for kind-voltha"
71 fi
Matteo Scandolo7a330022021-03-29 14:03:48 -070072 test -e $WORKSPACE/kind-voltha/voltha && cd $WORKSPACE/kind-voltha && ./voltha down
Andy Bavier61c5b2a2019-11-12 12:08:19 -070073 cd $WORKSPACE
74 rm -rf $WORKSPACE/*
75 """
76 script {
77 if (env.configRepo && ! env.localConfigDir) {
78 env.localConfigDir = "$WORKSPACE"
hwchiu1f0b0fe2019-12-06 11:45:23 -080079 sh returnStdout: false, script: "git clone -b master ${cordRepoUrl}/${configRepo}"
Andy Bavier61c5b2a2019-11-12 12:08:19 -070080 }
81 localDeploymentConfigFile = "${env.localConfigDir}/${params.deploymentConfigFile}"
82 localKindVolthaValuesFile = "${env.localConfigDir}/${params.kindVolthaValuesFile}"
83 localSadisConfigFile = "${env.localConfigDir}/${params.sadisConfigFile}"
Andy Bavier61c5b2a2019-11-12 12:08:19 -070084 }
85 }
86 }
87
Matteo Scandolo7a330022021-03-29 14:03:48 -070088 stage('Download Code') {
Andy Bavier06d816c2019-11-19 11:40:48 -070089 steps {
Matteo Scandolo7a330022021-03-29 14:03:48 -070090 checkout([
91 $class: 'GitSCM',
92 userRemoteConfigs: [[
93 url: "https://gerrit.opencord.org/kind-voltha",
94 ]],
95 branches: [[ name: "master", ]],
96 extensions: [
97 [$class: 'WipeWorkspace'],
98 [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"],
99 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
100 ],
101 ])
102 getVolthaCode([
103 branch: "${branch}",
104 gerritProject: "${gerritProject}",
Matteo Scandolo7a330022021-03-29 14:03:48 -0700105 gerritRefspec: "${gerritRefspec}",
Matteo Scandolo9b644ba2021-04-19 11:21:07 -0700106 volthaSystemTestsChange: "${volthaSystemTestsChange}",
107 volthaHelmChartsChange: "${volthaHelmChartsChange}",
Matteo Scandolo7a330022021-03-29 14:03:48 -0700108 ])
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700109 }
110 }
111
Andy Bavier9a376602019-11-13 11:53:37 -0700112 stage('Check config files') {
113 steps {
Andy Bavier85ab0942019-11-13 14:43:25 -0700114 script {
115 try {
116 deployment_config = readYaml file: "${localDeploymentConfigFile}"
117 } catch (err) {
118 echo "Error reading ${localDeploymentConfigFile}"
119 throw err
120 }
121 sh returnStdout: false, script: """
122 if [ ! -e ${localKindVolthaValuesFile} ]; then echo "${localKindVolthaValuesFile} not found"; exit 1; fi
123 if [ ! -e ${localSadisConfigFile} ]; then echo "${localSadisConfigFile} not found"; exit 1; fi
124 """
Andy Bavier9a376602019-11-13 11:53:37 -0700125 }
Andy Bavier9a376602019-11-13 11:53:37 -0700126 }
127 }
128
Matteo Scandolo7a330022021-03-29 14:03:48 -0700129 stage('Build patch') {
130 steps {
131 // NOTE that the correct patch has already been checked out
132 // during the getVolthaCode step
133 buildVolthaComponent("${gerritProject}")
134 }
135 }
136
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700137 stage('Create KinD Cluster') {
138 steps {
139 sh returnStdout: false, script: """
Zack Williams03ebb272020-03-27 09:42:33 -0700140 if [ "${branch}" != "master" ]; then
141 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo7a330022021-03-29 14:03:48 -0700142 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700143 else
144 echo "on master, using default settings for kind-voltha"
145 fi
Matteo Scandolo7a330022021-03-29 14:03:48 -0700146 cd $WORKSPACE/kind-voltha/
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700147 JUST_K8S=y ./voltha up
148 """
149 }
150 }
151
Matteo Scandolo7a330022021-03-29 14:03:48 -0700152 stage('Load image in kind nodes') {
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700153 when {
Andy Bavierfc3ca142020-03-27 13:44:25 -0700154 expression { params.manualBranch == "" }
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700155 }
156 steps {
157 sh returnStdout: false, script: """
Zack Williams03ebb272020-03-27 09:42:33 -0700158 if [ "${branch}" != "master" ]; then
159 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo7a330022021-03-29 14:03:48 -0700160 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700161 else
162 echo "on master, using default settings for kind-voltha"
163 fi
Andy Bavierc1cb94b2020-06-04 16:39:32 -0700164 if ! [[ "${gerritProject}" =~ ^(voltha-system-tests|kind-voltha|voltha-helm-charts)\$ ]]; then
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700165 docker images | grep citest
166 for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}")
167 do
168 echo "Pushing \$image to nodes"
Matteo Scandolo6fede0e2020-12-09 17:19:09 -0800169 kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700170 docker rmi \$image:citest \$image:latest || true
171 done
172 fi
173 """
174 }
175 }
176
177 stage('Deploy Voltha') {
178 environment {
Andy Bavier1f530f52020-04-14 15:57:33 -0700179 WITH_SIM_ADAPTERS="no"
180 WITH_RADIUS="yes"
181 DEPLOY_K8S="no"
182 VOLTHA_LOG_LEVEL="DEBUG"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700183 }
184 steps {
185 script {
Andy Baviere06dcff2020-02-06 11:36:40 -0700186 sh returnStdout: false, script: """
Zack Williams03ebb272020-03-27 09:42:33 -0700187 if [ "${branch}" != "master" ]; then
188 echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}"
Matteo Scandolo7a330022021-03-29 14:03:48 -0700189 source "$WORKSPACE/kind-voltha/releases/${branch}"
Zack Williams03ebb272020-03-27 09:42:33 -0700190 else
191 echo "on master, using default settings for kind-voltha"
192 fi
193
194 export EXTRA_HELM_FLAGS+='--set log_agent.enabled=False -f ${localKindVolthaValuesFile} '
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700195
Andy Baviere06dcff2020-02-06 11:36:40 -0700196 IMAGES=""
197 if [ "${gerritProject}" = "voltha-go" ]; then
198 IMAGES="rw_core ro_core "
199 elif [ "${gerritProject}" = "ofagent-py" ]; then
200 IMAGES="ofagent "
201 elif [ "${gerritProject}" = "voltha-onos" ]; then
202 IMAGES="onos "
203 elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then
204 IMAGES="adapter_open_olt "
205 elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then
206 IMAGES="adapter_open_onu "
Girish Gowdra7beebea2021-01-31 18:56:45 -0800207 elif [ "${gerritProject}" = "voltha-openonu-adapter-go" ]; then
208 IMAGES="adapter_open_onu_go "
Andy Baviere06dcff2020-02-06 11:36:40 -0700209 elif [ "${gerritProject}" = "voltha-api-server" ]; then
210 IMAGES="afrouter afrouterd "
211 else
212 echo "No images to push"
213 fi
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700214
Andy Baviere06dcff2020-02-06 11:36:40 -0700215 for I in \$IMAGES
216 do
217 EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never "
218 done
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700219
Andy Bavierc1cb94b2020-06-04 16:39:32 -0700220 if [ "${gerritProject}" = "voltha-helm-charts" ]; then
Matteo Scandolo7a330022021-03-29 14:03:48 -0700221 export CHART_PATH=$WORKSPACE/voltha-helm-charts
Andy Bavierc1cb94b2020-06-04 16:39:32 -0700222 export VOLTHA_CHART=\$CHART_PATH/voltha
223 export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt
224 export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu
225 helm dep update \$VOLTHA_CHART
226 helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART
227 helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART
228 fi
229
Matteo Scandolo7a330022021-03-29 14:03:48 -0700230 cd $WORKSPACE/kind-voltha/
Andy Baviere06dcff2020-02-06 11:36:40 -0700231 echo \$EXTRA_HELM_FLAGS
232 kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log &
233 ./voltha up
Andy Bavier1f530f52020-04-14 15:57:33 -0700234
Andy Baviercf7a5812020-04-24 15:06:30 -0700235 set +e
236
Andy Bavier1f530f52020-04-14 15:57:33 -0700237 # Remove noise from voltha-core logs
Andy Baviercf7a5812020-04-24 15:06:30 -0700238 voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model
239 voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Andy Bavier1f530f52020-04-14 15:57:33 -0700240 # Remove noise from openolt logs
Andy Baviercf7a5812020-04-24 15:06:30 -0700241 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
242 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
243 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Andy Baviere06dcff2020-02-06 11:36:40 -0700244 """
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700245 }
246 }
247 }
248
Scott Bakerfb0284c2019-12-12 17:22:38 -0800249 stage('Deploy Kafka Dump Chart') {
250 steps {
251 script {
252 sh returnStdout: false, script: """
253 helm repo add cord https://charts.opencord.org
254 helm repo update
Andy Bavierb0f4e002020-07-23 09:37:23 -0700255 if helm version -c --short|grep v2 -q; then
256 helm install -n voltha-kafka-dump cord/voltha-kafka-dump
257 else
258 helm install voltha-kafka-dump cord/voltha-kafka-dump
259 fi
Scott Bakerfb0284c2019-12-12 17:22:38 -0800260 """
261 }
262 }
263 }
264
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700265 stage('Push Tech-Profile') {
266 when {
267 expression { params.profile != "Default" }
268 }
269 steps {
270 sh returnStdout: false, script: """
271 etcd_container=\$(kubectl get pods -n voltha | grep voltha-etcd-cluster | awk 'NR==1{print \$1}')
Matteo Scandolo7a330022021-03-29 14:03:48 -0700272 kubectl cp $WORKSPACE/voltha-system-tests/tests/data/TechProfile-${profile}.json voltha/\$etcd_container:/tmp/flexpod.json
Andy Bavier6ebf3182019-11-21 13:47:21 -0700273 kubectl exec -it \$etcd_container -n voltha -- /bin/sh -c 'cat /tmp/flexpod.json | ETCDCTL_API=3 etcdctl put service/voltha/technology_profiles/XGS-PON/64'
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700274 """
275 }
276 }
277
278 stage('Push Sadis-config') {
279 steps {
280 sh returnStdout: false, script: """
Suchitra Vemuri63b71742020-08-11 16:54:57 -0700281 ssh-keygen -R [${deployment_config.nodes[0].ip}]:30115
282 ssh-keyscan -p 30115 -H ${deployment_config.nodes[0].ip} >> ~/.ssh/known_hosts
283 sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.dhcpl2relay"
284 sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.aaa"
285 sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set TRACE org.opencord.olt"
286 sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.FlowObjectiveManager"
287 sshpass -p karaf ssh -p 30115 karaf@${deployment_config.nodes[0].ip} "log:set DEBUG org.onosproject.net.flowobjective.impl.InOrderFlowObjectiveManager"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700288 curl -sSL --user karaf:karaf -X POST -H Content-Type:application/json http://${deployment_config.nodes[0].ip}:$ONOS_API_PORT/onos/v1/network/configuration --data @${localSadisConfigFile}
289 """
290 }
291 }
292
293 stage('Reinstall OLT software') {
294 when {
295 expression { params.reinstallOlt }
296 }
297 steps {
298 script {
299 deployment_config.olts.each { olt ->
hwchiu1f0b0fe2019-12-06 11:45:23 -0800300 sh returnStdout: false, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --remove asfvolt16 && dpkg --purge asfvolt16'"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700301 waitUntil {
302 olt_sw_present = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --list | grep asfvolt16 | wc -l'"
303 return olt_sw_present.toInteger() == 0
304 }
Andy Bavier893d2442020-05-21 12:41:17 -0700305 if ( params.branch == 'voltha-2.3' ) {
306 oltDebVersion = oltDebVersionVoltha23
307 } else {
308 oltDebVersion = oltDebVersionMaster
309 }
hwchiu1f0b0fe2019-12-06 11:45:23 -0800310 sh returnStdout: false, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --install ${oltDebVersion}'"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700311 waitUntil {
312 olt_sw_present = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'dpkg --list | grep asfvolt16 | wc -l'"
313 return olt_sw_present.toInteger() == 1
314 }
315 if ( olt.fortygig ) {
316 // If the OLT is connected to a 40G switch interface, set the NNI port to be downgraded
hwchiu1f0b0fe2019-12-06 11:45:23 -0800317 sh returnStdout: false, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'echo port ce128 sp=40000 >> /broadcom/qax.soc ; /opt/bcm68620/svk_init.sh'"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700318 }
319 }
320 }
321 }
322 }
323
324 stage('Restart OLT processes') {
325 steps {
326 script {
327 deployment_config.olts.each { olt ->
hwchiu1f0b0fe2019-12-06 11:45:23 -0800328 sh returnStdout: false, script: """
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700329 ssh-keyscan -H ${olt.ip} >> ~/.ssh/known_hosts
Andy Bavier5bb88bc2020-06-18 14:51:21 -0700330 sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'rm -f /var/log/openolt.log; rm -f /var/log/dev_mgmt_daemon.log; reboot'
331 sleep 120
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700332 """
333 waitUntil {
334 onu_discovered = sh returnStdout: true, script: "sshpass -p ${olt.pass} ssh -l ${olt.user} ${olt.ip} 'grep \"onu discover indication\" /var/log/openolt.log | wc -l'"
335 return onu_discovered.toInteger() > 0
336 }
337 }
338 }
339 }
340 }
341
342 stage('Run E2E Tests') {
343 environment {
Andy Bavierbda4c6b2019-11-12 17:06:22 -0700344 ROBOT_CONFIG_FILE="${localDeploymentConfigFile}"
Andy Bavierd3be2bf2020-02-07 17:02:21 -0700345 ROBOT_MISC_ARGS="${params.extraRobotArgs} --removekeywords wuks -d $WORKSPACE/RobotLogs -v container_log_dir:$WORKSPACE "
Andy Bavierbda4c6b2019-11-12 17:06:22 -0700346 ROBOT_FILE="Voltha_PODTests.robot"
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700347 }
348 steps {
349 sh returnStdout: false, script: """
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700350 mkdir -p $WORKSPACE/RobotLogs
Andy Baviere06dcff2020-02-06 11:36:40 -0700351
352 # If the Gerrit comment contains a line with "functional tests" then run the full
353 # functional test suite. This covers tests tagged either 'sanity' or 'functional'.
354 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
355 REGEX="functional tests"
356 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
357 ROBOT_MISC_ARGS+="-i functional"
358 fi
Andy Bavierc8ee4322020-08-18 16:37:38 -0700359 # Likewise for dataplane tests
360 REGEX="dataplane tests"
361 if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then
362 ROBOT_MISC_ARGS+="-i dataplane"
363 fi
Andy Baviere06dcff2020-02-06 11:36:40 -0700364
Matteo Scandolo7a330022021-03-29 14:03:48 -0700365 make -C $WORKSPACE/voltha-system-tests voltha-test || true
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700366 """
367 }
368 }
Scott Bakerda31d7b2020-01-08 16:35:52 -0800369
370 stage('After-Test Delay') {
Andy Bavier4af02722020-01-15 10:24:24 -0700371 when {
Andy Bavierfc3ca142020-03-27 13:44:25 -0700372 expression { params.manualBranch == "" }
Andy Bavier4af02722020-01-15 10:24:24 -0700373 }
Scott Bakerda31d7b2020-01-08 16:35:52 -0800374 steps {
375 sh returnStdout: false, script: """
376 # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line
377 REGEX="hardware test with delay\$"
378 [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]] && sleep 10m || true
379 """
380 }
381 }
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700382 }
383
384 post {
385 always {
Andy Bavier4af02722020-01-15 10:24:24 -0700386 sh returnStdout: false, script: '''
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700387 set +e
Matteo Scandolo7a330022021-03-29 14:03:48 -0700388 cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/
Matteo Scandolo97b12572020-04-13 12:44:46 -0700389 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq
390 kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700391 kubectl get nodes -o wide
392 kubectl get pods -o wide
393 kubectl get pods -n voltha -o wide
Andy Bavier4af02722020-01-15 10:24:24 -0700394
395 sync
396 pkill kail || true
397
398 ## Pull out errors from log files
399 extract_errors_go() {
400 echo
401 echo "Error summary for $1:"
402 grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg'
403 echo
404 }
405
406 extract_errors_python() {
407 echo
408 echo "Error summary for $1:"
409 grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2-
410 echo
411 }
412
413 extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log
414 extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log
415 extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log
416 extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log
417
Andy Bavier2178d102020-02-06 16:22:11 -0700418 gzip $WORKSPACE/onos-voltha-combined.log
419
Scott Bakerfb0284c2019-12-12 17:22:38 -0800420 ## collect events, the chart should be running by now
421 kubectl get pods | grep -i voltha-kafka-dump | grep -i running
Andy Bavier4af02722020-01-15 10:24:24 -0700422 if [[ $? == 0 ]]; then
Scott Bakerfb0284c2019-12-12 17:22:38 -0800423 kubectl exec -it `kubectl get pods | grep -i voltha-kafka-dump | grep -i running | cut -f1 -d " "` ./voltha-dump-events.sh > $WORKSPACE/voltha-events.log
424 fi
Andy Bavier4af02722020-01-15 10:24:24 -0700425 '''
Andy Bavier6ebf3182019-11-21 13:47:21 -0700426 script {
427 deployment_config.olts.each { olt ->
hwchiu1f0b0fe2019-12-06 11:45:23 -0800428 sh returnStdout: false, script: """
Andy Bavier827560b2020-06-05 09:49:32 -0700429 until sshpass -p ${olt.pass} scp ${olt.user}@${olt.ip}:/var/log/openolt.log $WORKSPACE/openolt-${olt.ip}.log
430 do
431 echo "Fetching openolt.log log failed, retrying..."
432 sleep 10
433 done
Andy Bavier6ebf3182019-11-21 13:47:21 -0700434 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.ip}.log # Remove escape sequences
Andy Bavier827560b2020-06-05 09:49:32 -0700435 until sshpass -p ${olt.pass} scp ${olt.user}@${olt.ip}:/var/log/dev_mgmt_daemon.log $WORKSPACE/dev_mgmt_daemon-${olt.ip}.log
436 do
437 echo "Fetching dev_mgmt_daemon.log failed, retrying..."
438 sleep 10
439 done
Andy Bavierbecaa8e2020-01-08 11:49:57 -0700440 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/dev_mgmt_daemon-${olt.ip}.log # Remove escape sequences
Andy Bavier6ebf3182019-11-21 13:47:21 -0700441 """
442 }
443 }
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700444 step([$class: 'RobotPublisher',
445 disableArchiveOutput: false,
446 logFileName: 'RobotLogs/log*.html',
447 otherFiles: '',
448 outputFileName: 'RobotLogs/output*.xml',
449 outputPath: '.',
Andy Baviere19b67b2020-02-14 11:29:50 -0700450 passThreshold: 100,
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700451 reportFileName: 'RobotLogs/report*.html',
452 unstableThreshold: 0]);
Andy Bavier2178d102020-02-06 16:22:11 -0700453 archiveArtifacts artifacts: '*.log,*.gz'
Andy Bavier61c5b2a2019-11-12 12:08:19 -0700454 }
455 }
456}