Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 1 | // Copyright 2017-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 | node { |
| 16 | // Need this so that deployment_config has global scope when it's read later |
| 17 | deployment_config = null |
| 18 | } |
| 19 | |
| 20 | pipeline { |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
| 23 | label "${params.buildNode}" |
| 24 | } |
| 25 | options { |
Suchitra Vemuri | 6ec0757 | 2021-02-22 10:47:05 -0800 | [diff] [blame] | 26 | timeout(time: 640, unit: 'MINUTES') |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 27 | } |
| 28 | |
| 29 | environment { |
| 30 | KUBECONFIG="$WORKSPACE/${configBaseDir}/${configKubernetesDir}/${configFileName}.conf" |
| 31 | VOLTCONFIG="$HOME/.volt/config-minimal" |
| 32 | PATH="$WORKSPACE/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
| 33 | } |
| 34 | |
| 35 | stages { |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 36 | stage('Clone kind-voltha') { |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 37 | steps { |
| 38 | step([$class: 'WsCleanup']) |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 39 | checkout([ |
| 40 | $class: 'GitSCM', |
| 41 | userRemoteConfigs: [[ |
| 42 | url: "https://gerrit.opencord.org/kind-voltha", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 43 | refspec: "${kindVolthaChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 44 | ]], |
| 45 | branches: [[ name: "master", ]], |
| 46 | extensions: [ |
| 47 | [$class: 'WipeWorkspace'], |
| 48 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 49 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 50 | ], |
| 51 | ]) |
| 52 | } |
| 53 | } |
| 54 | stage('Clone voltha-system-tests') { |
| 55 | steps { |
| 56 | checkout([ |
| 57 | $class: 'GitSCM', |
| 58 | userRemoteConfigs: [[ |
| 59 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 60 | refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 61 | ]], |
Suchitra Vemuri | 1143ae3 | 2021-03-26 01:08:37 +0000 | [diff] [blame] | 62 | branches: [[ name: "${branch}", ]], |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 63 | extensions: [ |
| 64 | [$class: 'WipeWorkspace'], |
| 65 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 66 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 67 | ], |
| 68 | ]) |
Suchitra Vemuri | a38e541 | 2021-02-23 15:28:28 -0800 | [diff] [blame] | 69 | script { |
| 70 | sh(script:""" |
| 71 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 72 | cd $WORKSPACE/voltha-system-tests; |
| 73 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 74 | fi |
| 75 | """) |
| 76 | } |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 77 | } |
| 78 | } |
| 79 | stage('Clone cord-tester') { |
| 80 | steps { |
| 81 | checkout([ |
| 82 | $class: 'GitSCM', |
| 83 | userRemoteConfigs: [[ |
| 84 | url: "https://gerrit.opencord.org/cord-tester", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 85 | refspec: "${cordTesterChange}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 86 | ]], |
| 87 | branches: [[ name: "master", ]], |
| 88 | extensions: [ |
| 89 | [$class: 'WipeWorkspace'], |
| 90 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "cord-tester"], |
| 91 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 92 | ], |
| 93 | ]) |
| 94 | } |
| 95 | } |
Matteo Scandolo | 92a5cb6 | 2020-09-15 16:02:08 -0700 | [diff] [blame] | 96 | // This checkout allows us to show changes in Jenkins |
| 97 | // we only do this on master as we don't branch all the repos for all the releases |
| 98 | // (we should compute the difference by tracking the container version, not the code) |
| 99 | stage('Download All the VOLTHA repos') { |
| 100 | when { |
| 101 | expression { |
| 102 | return "${branch}" == 'master'; |
| 103 | } |
| 104 | } |
| 105 | steps { |
| 106 | checkout(changelog: true, |
| 107 | poll: false, |
| 108 | scm: [$class: 'RepoScm', |
| 109 | manifestRepositoryUrl: "${params.manifestUrl}", |
| 110 | manifestBranch: "${params.branch}", |
| 111 | currentBranch: true, |
| 112 | destinationDir: 'voltha', |
| 113 | forceSync: true, |
| 114 | resetFirst: true, |
| 115 | quiet: true, |
| 116 | jobs: 4, |
| 117 | showAllChanges: true] |
| 118 | ) |
| 119 | } |
| 120 | } |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 121 | stage ('Initialize') { |
| 122 | steps { |
Hardik Windlass | 6f854a1 | 2021-07-12 13:20:21 +0000 | [diff] [blame] | 123 | sh returnStdout: false, script: "git clone -b ${branch} ${cordRepoUrl}/${configBaseDir}" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 124 | script { |
| 125 | deployment_config = readYaml file: "${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 126 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 127 | sh returnStdout: false, script: """ |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 128 | mkdir -p $WORKSPACE/bin |
| 129 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/bin" |
| 130 | cd $WORKSPACE |
Hardik Windlass | 6f854a1 | 2021-07-12 13:20:21 +0000 | [diff] [blame] | 131 | if [ "${params.branch}" == "voltha-2.8" ]; then |
| 132 | VOLTCTL_VERSION=1.6.10 |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 133 | else |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 134 | VOLTCTL_VERSION=\$(curl -sSL https://api.github.com/repos/opencord/voltctl/releases/latest | jq -r .tag_name | sed -e 's/^v//g') |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 135 | fi |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 136 | |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 137 | HOSTOS=\$(uname -s | tr "[:upper:]" "[:lower:"]) |
| 138 | HOSTARCH=\$(uname -m | tr "[:upper:]" "[:lower:"]) |
| 139 | if [ \$HOSTARCH == "x86_64" ]; then |
| 140 | HOSTARCH="amd64" |
| 141 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 142 | curl -o $WORKSPACE/bin/voltctl -sSL https://github.com/opencord/voltctl/releases/download/v\${VOLTCTL_VERSION}/voltctl-\${VOLTCTL_VERSION}-\${HOSTOS}-\${HOSTARCH} |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 143 | chmod 755 $WORKSPACE/bin/voltctl |
| 144 | voltctl version --clientonly |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 145 | |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 146 | |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 147 | # Default kind-voltha config doesn't work on ONF demo pod for accessing kvstore. |
| 148 | # The issue is that the mgmt node is also one of the k8s nodes and so port forwarding doesn't work. |
| 149 | # We should change this. In the meantime here is a workaround. |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 150 | if [ "${params.branch}" == "master" ]; then |
| 151 | set +e |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 152 | |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 153 | |
| 154 | # Remove noise from voltha-core logs |
Suchitra Vemuri | a2a7f2c | 2020-06-08 14:05:06 -0700 | [diff] [blame] | 155 | voltctl log level set WARN read-write-core#github.com/opencord/voltha-go/db/model |
| 156 | voltctl log level set WARN read-write-core#github.com/opencord/voltha-lib-go/v3/pkg/kafka |
Andrea Campanella | 9b23433 | 2020-04-24 12:22:18 +0200 | [diff] [blame] | 157 | # Remove noise from openolt logs |
Suchitra Vemuri | a2a7f2c | 2020-06-08 14:05:06 -0700 | [diff] [blame] | 158 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/db |
| 159 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/probe |
| 160 | voltctl log level set WARN adapter-open-olt#github.com/opencord/voltha-lib-go/v3/pkg/kafka |
Suchitra Vemuri | 1342143 | 2020-06-05 17:34:33 -0700 | [diff] [blame] | 161 | fi |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 162 | """ |
| 163 | } |
| 164 | } |
| 165 | |
| 166 | stage('Functional Tests') { |
| 167 | environment { |
Suchitra Vemuri | e4a5bcc | 2020-03-16 12:43:03 -0700 | [diff] [blame] | 168 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 169 | ROBOT_FILE="Voltha_DT_PODTests.robot" |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 170 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FunctionalTests" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 171 | } |
| 172 | steps { |
| 173 | sh """ |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 174 | cd $WORKSPACE/kind-voltha/scripts |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 175 | ./log-collector.sh > /dev/null & |
| 176 | ./log-combine.sh > /dev/null & |
| 177 | |
| 178 | mkdir -p $ROBOT_LOGS_DIR |
Suchitra Vemuri | 627786a | 2020-06-18 16:52:05 -0700 | [diff] [blame] | 179 | if ( ${powerSwitch} ); then |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 180 | 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}" |
Suchitra Vemuri | 627786a | 2020-06-18 16:52:05 -0700 | [diff] [blame] | 181 | else |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 182 | 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}" |
Suchitra Vemuri | 627786a | 2020-06-18 16:52:05 -0700 | [diff] [blame] | 183 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 184 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 185 | """ |
| 186 | } |
| 187 | } |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 188 | |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 189 | stage('Failure/Recovery Tests') { |
| 190 | environment { |
| 191 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 192 | ROBOT_FILE="Voltha_DT_FailureScenarios.robot" |
| 193 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/FailureScenarios" |
| 194 | } |
| 195 | steps { |
| 196 | sh """ |
| 197 | mkdir -p $ROBOT_LOGS_DIR |
| 198 | if ( ${powerSwitch} ); then |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 199 | 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}" |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 200 | else |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 201 | 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}" |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 202 | fi |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 203 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Andrea Campanella | f47a198 | 2020-04-21 11:53:31 +0200 | [diff] [blame] | 204 | """ |
| 205 | } |
| 206 | } |
| 207 | |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 208 | stage('Dataplane Tests') { |
| 209 | environment { |
Andy Bavier | 1541da8 | 2020-05-15 09:41:38 -0700 | [diff] [blame] | 210 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 211 | ROBOT_FILE="Voltha_DT_PODTests.robot" |
| 212 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/DataplaneTests" |
| 213 | } |
| 214 | steps { |
| 215 | sh """ |
| 216 | mkdir -p $ROBOT_LOGS_DIR |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 217 | 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}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 218 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 219 | """ |
| 220 | } |
| 221 | } |
Suchitra Vemuri | 5e8e789 | 2020-09-14 16:04:12 -0700 | [diff] [blame] | 222 | stage('HA Tests') { |
| 223 | environment { |
| 224 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 225 | ROBOT_FILE="Voltha_ONOSHATests.robot" |
| 226 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ONOSHAScenarios" |
| 227 | } |
| 228 | steps { |
| 229 | sh """ |
| 230 | mkdir -p $ROBOT_LOGS_DIR |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 231 | 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}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 232 | make -C $WORKSPACE/voltha-system-tests voltha-test || true |
Suchitra Vemuri | 5e8e789 | 2020-09-14 16:04:12 -0700 | [diff] [blame] | 233 | """ |
| 234 | } |
| 235 | } |
Andy Bavier | 5ad87c9 | 2020-05-11 16:31:35 -0700 | [diff] [blame] | 236 | |
Suchitra Vemuri | 0a9c8c6 | 2020-12-07 18:24:31 -0800 | [diff] [blame] | 237 | stage('Multiple OLT Tests') { |
| 238 | environment { |
| 239 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 240 | ROBOT_FILE="Voltha_DT_MultiOLT_Tests.robot" |
| 241 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/MultipleOLTScenarios" |
| 242 | } |
| 243 | steps { |
| 244 | sh """ |
| 245 | mkdir -p $ROBOT_LOGS_DIR |
| 246 | if ( ${powerSwitch} ); then |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 247 | 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}" |
Suchitra Vemuri | 0a9c8c6 | 2020-12-07 18:24:31 -0800 | [diff] [blame] | 248 | else |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 249 | 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}" |
Suchitra Vemuri | 0a9c8c6 | 2020-12-07 18:24:31 -0800 | [diff] [blame] | 250 | fi |
| 251 | make -C $WORKSPACE/voltha-system-tests voltha-dt-test || true |
| 252 | """ |
| 253 | } |
| 254 | } |
| 255 | |
| 256 | |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 257 | stage('Error Scenario Tests') { |
| 258 | environment { |
| 259 | ROBOT_CONFIG_FILE="$WORKSPACE/${configBaseDir}/${configDeploymentDir}/${configFileName}-DT.yaml" |
| 260 | ROBOT_FILE="Voltha_ErrorScenarios.robot" |
| 261 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/dt-workflow/ErrorScenarios" |
| 262 | } |
| 263 | steps { |
| 264 | sh """ |
| 265 | mkdir -p $ROBOT_LOGS_DIR |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 266 | 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}" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 267 | make -C $WORKSPACE/voltha-system-tests voltha-test || true |
Andrea Campanella | d924ce2 | 2020-04-20 16:40:41 +0200 | [diff] [blame] | 268 | """ |
| 269 | } |
Andrea Campanella | 7166637 | 2020-04-21 10:56:17 +0200 | [diff] [blame] | 270 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 271 | } |
| 272 | post { |
| 273 | always { |
| 274 | sh returnStdout: false, script: ''' |
| 275 | set +e |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 276 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 277 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 278 | kubectl get nodes -o wide |
| 279 | kubectl get pods -n voltha -o wide |
Suchitra Vemuri | 179643b | 2020-11-02 10:06:20 -0800 | [diff] [blame] | 280 | kubectl get pods -o wide |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 281 | |
| 282 | sleep 60 # Wait for log-collector and log-combine to complete |
| 283 | |
| 284 | # Clean up "announcer" pod used by the tests if present |
| 285 | kubectl delete pod announcer || true |
| 286 | |
| 287 | ## Pull out errors from log files |
| 288 | extract_errors_go() { |
| 289 | echo |
| 290 | echo "Error summary for $1:" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 291 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 292 | echo |
| 293 | } |
| 294 | |
| 295 | extract_errors_python() { |
| 296 | echo |
| 297 | echo "Error summary for $1:" |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 298 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 299 | echo |
| 300 | } |
| 301 | |
| 302 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 303 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 304 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 305 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 306 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 307 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 308 | gzip error-report.log || true |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 309 | rm error-report.log || true |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 310 | |
Matteo Scandolo | 3dce2a1 | 2020-09-15 14:21:14 -0700 | [diff] [blame] | 311 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 312 | tar czf $WORKSPACE/container-logs.tgz * |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 313 | rm * || true |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 314 | |
| 315 | cd $WORKSPACE |
| 316 | gzip *-combined.log || true |
Andrea Campanella | c9c8068 | 2020-09-30 12:02:01 +0200 | [diff] [blame] | 317 | rm *-combined.log || true |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 318 | |
Andrea Campanella | a20a933 | 2021-03-09 09:18:42 +0100 | [diff] [blame] | 319 | # store information on running charts |
| 320 | helm ls > $WORKSPACE/helm-list.txt || true |
| 321 | |
| 322 | # store information on the running pods |
Andrea Campanella | e0c839f | 2021-03-16 17:53:40 +0100 | [diff] [blame] | 323 | kubectl get pods --all-namespaces -o wide > $WORKSPACE/pods.txt || true |
Andrea Campanella | a20a933 | 2021-03-09 09:18:42 +0100 | [diff] [blame] | 324 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq | tee $WORKSPACE/pod-images.txt || true |
| 325 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq | tee $WORKSPACE/pod-imagesId.txt || true |
| 326 | |
Matteo Scandolo | 3fbb065 | 2020-07-22 08:50:02 -0700 | [diff] [blame] | 327 | # collect ETCD cluster logs |
| 328 | mkdir -p $WORKSPACE/etcd |
Girish Gowdra | 3eb96f6 | 2020-10-15 12:48:34 -0700 | [diff] [blame] | 329 | printf '%s\n' $(kubectl get pods -l app=etcd -o=jsonpath="{.items[*]['metadata.name']}") | xargs -I% bash -c "kubectl logs % > $WORKSPACE/etcd/%.log" |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 330 | ''' |
| 331 | script { |
| 332 | deployment_config.olts.each { olt -> |
Andrea Campanella | 0d3110c | 2021-01-20 12:25:45 +0100 | [diff] [blame] | 333 | if (olt.type == null || olt.type == "" || olt.type == "openolt") { |
| 334 | sh returnStdout: false, script: """ |
| 335 | 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 |
| 336 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt-${olt.sship}.log # Remove escape sequences |
| 337 | 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 |
| 338 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/dev_mgmt_daemon-${olt.sship}.log # Remove escape sequences |
| 339 | 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 |
| 340 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/startup-${olt.sship}.log || true # Remove escape sequences |
| 341 | 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 |
| 342 | sed -i 's/\\x1b\\[[0-9;]*[a-zA-Z]//g' $WORKSPACE/openolt_process_watchdog-${olt.sship}.log || true # Remove escape sequences |
| 343 | """ |
| 344 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 345 | } |
| 346 | } |
| 347 | step([$class: 'RobotPublisher', |
| 348 | disableArchiveOutput: false, |
| 349 | logFileName: '**/log*.html', |
| 350 | otherFiles: '', |
| 351 | outputFileName: '**/output*.xml', |
| 352 | outputPath: 'RobotLogs', |
| 353 | passThreshold: 100, |
| 354 | reportFileName: '**/report*.html', |
Andrea Campanella | abc0977 | 2021-06-16 12:08:57 +0200 | [diff] [blame] | 355 | unstableThreshold: 0, |
| 356 | onlyCritical: true |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 357 | ]); |
Andrea Campanella | 82bed26 | 2021-03-10 10:06:26 +0100 | [diff] [blame] | 358 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz,etcd/*.log,*.txt' |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 359 | } |
Suchitra Vemuri | 8d180ab | 2020-03-12 17:38:24 -0700 | [diff] [blame] | 360 | } |
| 361 | } |