Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -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 | // voltha-2.x e2e tests |
| 16 | // uses kind-voltha to deploy voltha-2.X |
| 17 | // uses bbsim to simulate OLT/ONUs |
| 18 | |
| 19 | pipeline { |
| 20 | |
| 21 | /* no label, executor is determined by JJB */ |
| 22 | agent { |
| 23 | label "${params.buildNode}" |
| 24 | } |
| 25 | options { |
Hardik Windlass | fcb8627 | 2021-02-15 17:01:24 +0530 | [diff] [blame] | 26 | timeout(time: 300, unit: 'MINUTES') |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 27 | } |
| 28 | environment { |
| 29 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 30 | VOLTCONFIG="$HOME/.volt/config-minimal" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 31 | PATH="$PATH:$WORKSPACE/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Matteo Scandolo | 4d1a12f | 2020-12-07 16:17:12 -0800 | [diff] [blame] | 32 | NAME="minimal" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 33 | FANCY=0 |
| 34 | WITH_SIM_ADAPTERS="no" |
| 35 | WITH_RADIUS="yes" |
| 36 | WITH_BBSIM="yes" |
| 37 | DEPLOY_K8S="yes" |
| 38 | VOLTHA_LOG_LEVEL="DEBUG" |
Andrea Campanella | 2a01b5a | 2020-09-09 11:38:18 +0200 | [diff] [blame] | 39 | CONFIG_SADIS="external" |
| 40 | BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 4be3706 | 2020-06-29 15:17:26 -0700 | [diff] [blame] | 41 | ROBOT_MISC_ARGS="-e PowerSwitch ${params.extraRobotArgs}" |
pierventre | f48ebc1 | 2020-07-17 16:01:32 +0200 | [diff] [blame] | 42 | KARAF_HOME="${params.karafHome}" |
| 43 | DIAGS_PROFILE="VOLTHA_PROFILE" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 44 | NUM_OF_BBSIM="${olts}" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 45 | } |
| 46 | stages { |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 47 | stage('Clone kind-voltha') { |
| 48 | steps { |
| 49 | checkout([ |
| 50 | $class: 'GitSCM', |
| 51 | userRemoteConfigs: [[ |
| 52 | url: "https://gerrit.opencord.org/kind-voltha", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 53 | // refspec: "${kindVolthaChange}" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 54 | ]], |
| 55 | branches: [[ name: "master", ]], |
| 56 | extensions: [ |
| 57 | [$class: 'WipeWorkspace'], |
| 58 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 59 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 60 | ], |
| 61 | ]) |
| 62 | } |
| 63 | } |
Matteo Scandolo | fa90bb1 | 2020-09-18 11:00:50 -0700 | [diff] [blame] | 64 | stage('Cleanup') { |
| 65 | steps { |
| 66 | sh """ |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame^] | 67 | if [ "${branch}" != "master" ]; then |
| 68 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 69 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 70 | else |
| 71 | echo "on master, using default settings for kind-voltha" |
| 72 | fi |
Matteo Scandolo | fa90bb1 | 2020-09-18 11:00:50 -0700 | [diff] [blame] | 73 | cd $WORKSPACE/kind-voltha/ |
| 74 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
| 75 | """ |
| 76 | } |
| 77 | } |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 78 | stage('Clone voltha-system-tests') { |
| 79 | steps { |
| 80 | checkout([ |
| 81 | $class: 'GitSCM', |
| 82 | userRemoteConfigs: [[ |
| 83 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Hardik Windlass | fcb8627 | 2021-02-15 17:01:24 +0530 | [diff] [blame] | 84 | refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 85 | ]], |
| 86 | branches: [[ name: "${branch}", ]], |
| 87 | extensions: [ |
| 88 | [$class: 'WipeWorkspace'], |
| 89 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 90 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 91 | ], |
| 92 | ]) |
Hardik Windlass | d31dfc7 | 2021-02-22 17:53:32 +0530 | [diff] [blame] | 93 | script { |
| 94 | sh(script:""" |
| 95 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 96 | cd $WORKSPACE/voltha-system-tests; |
| 97 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 98 | fi |
| 99 | """) |
| 100 | } |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 101 | } |
| 102 | } |
| 103 | |
| 104 | stage('Deploy Voltha') { |
| 105 | steps { |
| 106 | sh """ |
| 107 | export EXTRA_HELM_FLAGS="" |
| 108 | if [ "${branch}" != "master" ]; then |
| 109 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 110 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 111 | else |
Hardik Windlass | dc6cee1 | 2021-04-30 06:02:12 +0000 | [diff] [blame] | 112 | export INFRA_NS="infra" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 113 | echo "on master, using default settings for kind-voltha" |
| 114 | fi |
| 115 | |
Andrea Campanella | 427d13e | 2020-12-16 18:27:08 +0100 | [diff] [blame] | 116 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} --set defaults.image_registry=mirror.registry.opennetworking.org/ " |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 117 | |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 118 | cd $WORKSPACE/kind-voltha/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 119 | ./voltha up |
| 120 | """ |
| 121 | } |
| 122 | } |
| 123 | |
| 124 | stage('Functional Tests') { |
| 125 | environment { |
| 126 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FunctionalTests" |
| 127 | } |
| 128 | steps { |
| 129 | sh ''' |
| 130 | set +e |
| 131 | mkdir -p $ROBOT_LOGS_DIR |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 132 | cd $WORKSPACE/kind-voltha/scripts |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 133 | ./log-collector.sh > /dev/null & |
| 134 | ./log-combine.sh > /dev/null & |
| 135 | |
| 136 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 137 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 138 | ''' |
| 139 | } |
| 140 | } |
| 141 | |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 142 | stage('Alarm Tests') { |
| 143 | environment { |
| 144 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/AlarmTests" |
| 145 | } |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 146 | when { |
| 147 | expression { |
| 148 | return params.withAlarms |
| 149 | } |
| 150 | } |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 151 | steps { |
| 152 | sh ''' |
| 153 | set +e |
| 154 | mkdir -p $WORKSPACE/RobotLogs |
| 155 | |
| 156 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 157 | make -C $WORKSPACE/voltha-system-tests ${makeAlarmtestTarget} || true |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 158 | ''' |
| 159 | } |
| 160 | } |
| 161 | |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 162 | stage('Failure/Recovery Tests') { |
| 163 | environment { |
| 164 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FailureTests" |
| 165 | } |
| 166 | steps { |
| 167 | sh ''' |
| 168 | set +e |
| 169 | mkdir -p $WORKSPACE/RobotLogs |
| 170 | |
| 171 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 172 | make -C $WORKSPACE/voltha-system-tests ${makeFailtestTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 173 | ''' |
| 174 | } |
| 175 | } |
Suchitra Vemuri | 5eb7195 | 2020-12-15 18:18:32 -0800 | [diff] [blame] | 176 | stage('Multiple OLT Tests') { |
| 177 | environment { |
| 178 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/MultipleOLTTests" |
| 179 | } |
| 180 | steps { |
| 181 | sh ''' |
| 182 | if [ "${olts}" -gt 1 ]; then |
| 183 | set +e |
| 184 | mkdir -p $WORKSPACE/RobotLogs |
| 185 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
| 186 | make -C $WORKSPACE/voltha-system-tests ${makeMultiOltTarget} || true |
| 187 | fi |
| 188 | ''' |
| 189 | } |
| 190 | } |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 191 | |
| 192 | stage('Error Tests') { |
| 193 | environment { |
| 194 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ErrorTests" |
| 195 | } |
| 196 | steps { |
| 197 | sh ''' |
| 198 | set +e |
| 199 | mkdir -p $WORKSPACE/RobotLogs |
| 200 | |
| 201 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 202 | make -C $WORKSPACE/voltha-system-tests ${makeErrortestTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 203 | ''' |
| 204 | } |
| 205 | } |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 206 | } |
| 207 | |
| 208 | post { |
| 209 | always { |
| 210 | sh ''' |
| 211 | set +e |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 212 | cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 213 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 214 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
| 215 | kubectl get nodes -o wide |
| 216 | kubectl get pods -o wide |
| 217 | kubectl get pods -n voltha -o wide |
| 218 | |
| 219 | sleep 60 # Wait for log-collector and log-combine to complete |
| 220 | |
| 221 | ## Pull out errors from log files |
| 222 | extract_errors_go() { |
| 223 | echo |
| 224 | echo "Error summary for $1:" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 225 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 226 | echo |
| 227 | } |
| 228 | |
| 229 | extract_errors_python() { |
| 230 | echo |
| 231 | echo "Error summary for $1:" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 232 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 233 | echo |
| 234 | } |
| 235 | |
| 236 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 237 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 238 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 239 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 240 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 241 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 242 | gzip error-report.log || true |
| 243 | |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 244 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 245 | tar czf $WORKSPACE/container-logs.tgz * |
| 246 | |
| 247 | cd $WORKSPACE |
| 248 | gzip *-combined.log || true |
| 249 | |
| 250 | ## shut down voltha but leave kind-voltha cluster |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame^] | 251 | if [ "${branch}" != "master" ]; then |
| 252 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 253 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 254 | else |
| 255 | echo "on master, using default settings for kind-voltha" |
| 256 | fi |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 257 | cd $WORKSPACE/kind-voltha/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 258 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | fcae383 | 2020-06-04 08:51:10 -0700 | [diff] [blame] | 259 | kubectl delete deployment voltctl || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 260 | ''' |
| 261 | step([$class: 'RobotPublisher', |
| 262 | disableArchiveOutput: false, |
| 263 | logFileName: '**/log*.html', |
| 264 | otherFiles: '', |
| 265 | outputFileName: '**/output*.xml', |
| 266 | outputPath: 'RobotLogs', |
| 267 | passThreshold: 100, |
| 268 | reportFileName: '**/report*.html', |
| 269 | unstableThreshold: 0]); |
| 270 | |
| 271 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
| 272 | |
| 273 | } |
| 274 | } |
| 275 | } |