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