blob: dcb8059668ae9cd0704a85c0a1864078a0bcefda [file] [log] [blame]
Joey Armstrong16bd8e82023-01-12 15:20:06 -05001#!/usr/bin/env groovy
2// -----------------------------------------------------------------------
Joey Armstrong518f3572024-02-11 07:56:25 -05003// Copyright 2017-2024 Open Networking Foundation (ONF) and the ONF Contributors
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -07004//
5// Licensed under the Apache License, Version 2.0 (the "License");
6// you may not use this file except in compliance with the License.
7// You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing, software
12// distributed under the License is distributed on an "AS IS" BASIS,
13// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14// See the License for the specific language governing permissions and
15// limitations under the License.
Joey Armstrong16bd8e82023-01-12 15:20:06 -050016// -----------------------------------------------------------------------
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070017
Matteo Scandolo0d0f2902021-07-15 16:16:33 -070018library identifier: 'cord-jenkins-libraries@master',
19 retriever: modernSCM([
20 $class: 'GitSCMSource',
21 remote: 'https://gerrit.opencord.org/ci-management.git'
22])
23
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070024node {
25 // Need this so that deployment_config has global scope when it's read later
26 deployment_config = null
27}
28
Hardik Windlass7e4e3152021-09-29 06:42:05 +000029def infraNamespace = "infra"
30def volthaNamespace = "voltha"
31
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070032pipeline {
33 /* no label, executor is determined by JJB */
34 agent {
35 label "${params.buildNode}"
36 }
37 options {
Hardik Windlassd0f01662021-09-03 08:07:15 +000038 timeout(time: "${timeout}", unit: 'MINUTES')
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070039 }
40
41 environment {
42 KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf"
Jan Klarece1bc812023-09-28 13:15:52 +020043 VOLTCONFIG="$HOME/.volt/config"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -070044 PATH="$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
45 }
46
47 stages {
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070048 stage('Clone voltha-system-tests') {
49 steps {
Matteo Scandolo67842812021-07-13 16:52:13 -070050 step([$class: 'WsCleanup'])
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070051 checkout([
52 $class: 'GitSCM',
53 userRemoteConfigs: [[
54 url: "https://gerrit.opencord.org/voltha-system-tests",
Matteo Scandoloa42c6f52020-09-19 01:35:12 +000055 refspec: "${volthaSystemTestsChange}"
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070056 ]],
Suchitra Vemuri1143ae32021-03-26 01:08:37 +000057 branches: [[ name: "${branch}", ]],
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070058 extensions: [
59 [$class: 'WipeWorkspace'],
60 [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"],
61 [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false],
62 ],
63 ])
Suchitra Vemuria38e5412021-02-23 15:28:28 -080064 script {
65 sh(script:"""
66 if [ '${volthaSystemTestsChange}' != '' ] ; then
67 cd $WORKSPACE/voltha-system-tests;
68 git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD
69 fi
70 """)
71 }
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070072 }
73 }
Matteo Scandolo92a5cb62020-09-15 16:02:08 -070074 // This checkout allows us to show changes in Jenkins
75 // we only do this on master as we don't branch all the repos for all the releases
76 // (we should compute the difference by tracking the container version, not the code)
77 stage('Download All the VOLTHA repos') {
78 when {
79 expression {
80 return "${branch}" == 'master';
81 }
82 }
83 steps {
84 checkout(changelog: true,
85 poll: false,
86 scm: [$class: 'RepoScm',
87 manifestRepositoryUrl: "${params.manifestUrl}",
88 manifestBranch: "${params.branch}",
89 currentBranch: true,
90 destinationDir: 'voltha',
91 forceSync: true,
92 resetFirst: true,
93 quiet: true,
94 jobs: 4,
95 showAllChanges: true]
96 )
97 }
98 }
Matteo Scandolo3dce2a12020-09-15 14:21:14 -070099 stage ('Initialize') {
100 steps {
Hardik Windlass6f854a12021-07-12 13:20:21 +0000101 sh returnStdout: false, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700102 script {
103 deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
104 }
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800105 sh """
106 ps -ef | grep port-forward
107 """
108
109 sh returnStdout: false, script: '''
110 # remove orphaned port-forward from different namespaces
111 ps aux | grep port-forw | grep -v grep | awk '{print $2}' | xargs --no-run-if-empty kill -9 || true
112 '''
113 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800114 JENKINS_NODE_COOKIE="dontKillMe" _TAG="kafka" bash -c "while true; do kubectl port-forward --address 0.0.0.0 -n ${infraNamespace} svc/voltha-infra-kafka 9092:9092; done"&
115 ps aux | grep port-forward
116 """
Joey Armstrong16bd8e82023-01-12 15:20:06 -0500117
118 sh("""ps -ef | grep port-forward""")
119
120 sh(returnStdout: false, script: """
121 mkdir -p "$WORKSPACE/bin"
122
123 # install kail
124 make -C "$WORKSPACE/voltha-system-tests" KAIL_PATH="$WORKSPACE/bin" kail
Matteo Scandolo3fbb0652020-07-22 08:50:02 -0700125
Andrea Campanella9b234332020-04-24 12:22:18 +0200126 # Default kind-voltha config doesn't work on ONF demo pod for accessing kvstore.
127 # The issue is that the mgmt node is also one of the k8s nodes and so port forwarding doesn't work.
128 # We should change this. In the meantime here is a workaround.
Suchitra Vemuri13421432020-06-05 17:34:33 -0700129 set +e
Andrea Campanella9b234332020-04-24 12:22:18 +0200130
Roger Luethi3dd65a72023-09-20 13:10:29 +0200131 # Have voltctl exit with error status 1 and warning if etcd is unavailable.
132 voltctl log level list
133
Andrea Campanella9b234332020-04-24 12:22:18 +0200134 # Remove noise from voltha-core logs
Suchitra Vemuria2a7f2c2020-06-08 14:05:06 -0700135 voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model
136 voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Andrea Campanella9b234332020-04-24 12:22:18 +0200137 # Remove noise from openolt logs
Suchitra Vemuria2a7f2c2020-06-08 14:05:06 -0700138 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db
139 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe
140 voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka
Joey Armstrong16bd8e82023-01-12 15:20:06 -0500141 """)
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700142 }
143 }
144
145 stage('Functional Tests') {
146 environment {
Suchitra Vemurie4a5bcc2020-03-16 12:43:03 -0700147 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700148 ROBOT_FILE="Voltha_DT_PODTests.robot"
Andrea Campanellad924ce22020-04-20 16:40:41 +0200149 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FunctionalTests"
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700150 }
151 steps {
152 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800153 ps -ef | grep port-forward
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700154 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530155 if [ ${params.withFttb} = false ]; then
156 if ( ${powerSwitch} ); then
157 export ROBOT_MISC_ARGS="--removekeywords wuks -i PowerSwitch -i sanityDt -i functionalDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
158 if ( ${powerCycleOlt} ); then
159 ROBOT_MISC_ARGS+=" -v power_cycle_olt:True"
160 fi
161 else
162 export ROBOT_MISC_ARGS="--removekeywords wuks -e PowerSwitch -i sanityDt -i functionalDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
163 fi
164 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100165 if [[ ${configFileName} == *"zyxel"* ]]; then
166 make -C $WORKSPACE/voltha-system-tests voltha-dt-test
167 else
168 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
169 fi
Suchitra Vemuri627786a2020-06-18 16:52:05 -0700170 fi
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530171 """
172 }
173 }
174
175 stage('FTTB Functional Tests') {
176 environment {
177 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
178 ROBOT_FILE="Voltha_DT_FTTB_Tests.robot"
179 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FunctionalTests"
180 }
181 steps {
182 sh """
183 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlass6f7e30b2022-05-16 17:13:41 +0530184 if [ ${params.withFttb} = true ]; then
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530185 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i sanityDtFttb -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE"
186 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace} -v has_dataplane:False"
Amaiaa96f7ab2025-01-16 10:58:16 +0100187 if [[ ${configFileName} == *"zyxel"* ]]; then
188 make -C $WORKSPACE/voltha-system-tests voltha-dt-test
189 else
190 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
191 fi
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530192 fi
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700193 """
194 }
195 }
Andrea Campanellad924ce22020-04-20 16:40:41 +0200196
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200197 stage('Failure/Recovery Tests') {
198 environment {
199 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
200 ROBOT_FILE="Voltha_DT_FailureScenarios.robot"
201 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FailureScenarios"
202 }
203 steps {
204 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800205 ps -ef | grep port-forward
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200206 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530207 if [ ${params.withFttb} = false ]; then
208 if ( ${powerSwitch} ); then
209 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -i PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
210 else
211 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -e PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
212 fi
213 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100214 if [[ ${configFileName} == *"zyxel"* ]]; then
215 make -C $WORKSPACE/voltha-system-tests voltha-dt-test
216 else
217 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
218 fi
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200219 fi
Andrea Campanellaf47a1982020-04-21 11:53:31 +0200220 """
221 }
222 }
223
Andy Bavier5ad87c92020-05-11 16:31:35 -0700224 stage('Dataplane Tests') {
225 environment {
Andy Bavier1541da82020-05-15 09:41:38 -0700226 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
Andy Bavier5ad87c92020-05-11 16:31:35 -0700227 ROBOT_FILE="Voltha_DT_PODTests.robot"
228 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/DataplaneTests"
229 }
230 steps {
231 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800232 ps -ef | grep port-forward
Andy Bavier5ad87c92020-05-11 16:31:35 -0700233 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530234 if [ ${params.withFttb} = false ]; then
235 export ROBOT_MISC_ARGS="--removekeywords wuks -i dataplaneDt -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
236 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100237 if [[ ${configFileName} == *"zyxel"* ]]; then
238 make -C $WORKSPACE/voltha-system-tests voltha-dt-test
239 else
240 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
241 fi
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530242 fi
Andy Bavier5ad87c92020-05-11 16:31:35 -0700243 """
244 }
245 }
Suchitra Vemuri5e8e7892020-09-14 16:04:12 -0700246 stage('HA Tests') {
247 environment {
248 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
249 ROBOT_FILE="Voltha_ONOSHATests.robot"
250 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ONOSHAScenarios"
251 }
252 steps {
Matteo Scandolo67842812021-07-13 16:52:13 -0700253 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800254 ps -ef | grep port-forward
Matteo Scandolo67842812021-07-13 16:52:13 -0700255 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530256 if [ ${params.withFttb} = false ]; then
257 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v workflow:${params.workFlow} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
258 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100259 if [[ ${configFileName} == *"zyxel"* ]]; then
260 make -C $WORKSPACE/voltha-system-tests voltha-test
261 else
262 make -C $WORKSPACE/voltha-system-tests voltha-test || true
263 fi
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530264 fi
Matteo Scandolo67842812021-07-13 16:52:13 -0700265 """
Suchitra Vemuri5e8e7892020-09-14 16:04:12 -0700266 }
267 }
Andy Bavier5ad87c92020-05-11 16:31:35 -0700268
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800269 stage('Multiple OLT Tests') {
270 environment {
271 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
272 ROBOT_FILE="Voltha_DT_MultiOLT_Tests.robot"
273 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/MultipleOLTScenarios"
274 }
275 steps {
276 sh """
Andrea Campanella9274f7d2021-11-18 15:42:06 -0800277 ps -ef | grep port-forward
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800278 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530279 if [ ${params.withFttb} = false ]; then
280 if ( ${powerSwitch} ); then
281 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -i PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
282 else
283 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functionalDt -e PowerSwitch -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
284 fi
285 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100286 if [[ ${configFileName} == *"zyxel"* ]]; then
287 make -C $WORKSPACE/voltha-system-tests voltha-dt-test
288 else
289 make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true
290 fi
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800291 fi
Suchitra Vemuri0a9c8c62020-12-07 18:24:31 -0800292 """
293 }
294 }
295
296
Andrea Campanellad924ce22020-04-20 16:40:41 +0200297 stage('Error Scenario Tests') {
298 environment {
299 ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml"
300 ROBOT_FILE="Voltha_ErrorScenarios.robot"
301 ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/ErrorScenarios"
302 }
303 steps {
304 sh """
305 mkdir -p $ROBOT_LOGS_DIR
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530306 if [ ${params.withFttb} = false ]; then
307 export ROBOT_MISC_ARGS="--removekeywords wuks -L TRACE -i functional -e bbsim -e notready -d $ROBOT_LOGS_DIR -v POD_NAME:${configFileName} -v workflow:${params.workFlow} -v KUBERNETES_CONFIGS_DIR:$WORKSPACE/${configBaseDir}/${configKubernetesDir} -v container_log_dir:$WORKSPACE -v OLT_ADAPTER_APP_LABEL:${oltAdapterAppLabel}"
308 ROBOT_MISC_ARGS+=" -v NAMESPACE:${volthaNamespace} -v INFRA_NAMESPACE:${infraNamespace}"
Amaiaa96f7ab2025-01-16 10:58:16 +0100309 if [[ ${configFileName} == *"zyxel"* ]]; then
310 make -C $WORKSPACE/voltha-system-tests voltha-test
311 else
312 make -C $WORKSPACE/voltha-system-tests voltha-test || true
313 fi
Hardik Windlassc97ceae2022-05-13 10:12:55 +0530314 fi
Andrea Campanellad924ce22020-04-20 16:40:41 +0200315 """
316 }
Andrea Campanella71666372020-04-21 10:56:17 +0200317 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700318 }
319 post {
320 always {
Matteo Scandolo5e7bd1d2021-07-16 13:29:42 -0700321 getPodsInfo("$WORKSPACE/pods")
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700322 sh returnStdout: false, script: '''
323 set +e
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700324
Matteo Scandolo5e7bd1d2021-07-16 13:29:42 -0700325 # collect logs collected in the Robot Framework StartLogging keyword
326 cd $WORKSPACE
327 gzip *-combined.log || true
328 rm *-combined.log || true
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700329 '''
330 script {
331 deployment_config.olts.each { olt ->
Andrea Campanella0d3110c2021-01-20 12:25:45 +0100332 if (olt.type == null || olt.type == "" || olt.type == "openolt") {
333 sh returnStdout: false, script: """
334 sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/openolt.log $WORKSPACE/openolt-${olt.sship}.log || true
335 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.sship}.log # Remove escape sequences
336 sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/dev_mgmt_daemon.log $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log || true
337 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log # Remove escape sequences
338 sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/startup.log $WORKSPACE/startup-${olt.sship}.log || true
339 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/startup-${olt.sship}.log || true # Remove escape sequences
340 sshpass -p ${olt.pass} scp -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no ${olt.user}@${olt.sship}:/var/log/openolt_process_watchdog.log $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true
341 sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true # Remove escape sequences
342 """
343 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700344 }
345 }
346 step([$class: 'RobotPublisher',
347 disableArchiveOutput: false,
348 logFileName: '**/log*.html',
349 otherFiles: '',
350 outputFileName: '**/output*.xml',
351 outputPath: 'RobotLogs',
352 passThreshold: 100,
353 reportFileName: '**/report*.html',
Andrea Campanellaabc09772021-06-16 12:08:57 +0200354 unstableThreshold: 0,
355 onlyCritical: true
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700356 ]);
Matteo Scandolo5e7bd1d2021-07-16 13:29:42 -0700357 archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.tgz,*.txt,pods/*.txt'
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700358 }
Suchitra Vemuri8d180ab2020-03-12 17:38:24 -0700359 }
360}