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 { |
Suchitra Vemuri | fcbec0f | 2020-11-30 10:35:52 -0800 | [diff] [blame] | 26 | timeout(time: 190, 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 """ |
| 67 | cd $WORKSPACE/kind-voltha/ |
| 68 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
| 69 | """ |
| 70 | } |
| 71 | } |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 72 | stage('Clone voltha-system-tests') { |
| 73 | steps { |
| 74 | checkout([ |
| 75 | $class: 'GitSCM', |
| 76 | userRemoteConfigs: [[ |
| 77 | url: "https://gerrit.opencord.org/voltha-system-tests", |
Matteo Scandolo | a42c6f5 | 2020-09-19 01:35:12 +0000 | [diff] [blame] | 78 | // refspec: "${volthaSystemTestsChange}" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 79 | ]], |
| 80 | branches: [[ name: "${branch}", ]], |
| 81 | extensions: [ |
| 82 | [$class: 'WipeWorkspace'], |
| 83 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 84 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 85 | ], |
| 86 | ]) |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 87 | } |
| 88 | } |
| 89 | |
| 90 | stage('Deploy Voltha') { |
| 91 | steps { |
| 92 | sh """ |
| 93 | export EXTRA_HELM_FLAGS="" |
| 94 | if [ "${branch}" != "master" ]; then |
| 95 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 96 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 97 | else |
| 98 | echo "on master, using default settings for kind-voltha" |
| 99 | fi |
| 100 | |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 101 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags}" |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 102 | |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 103 | cd $WORKSPACE/kind-voltha/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 104 | ./voltha up |
| 105 | """ |
| 106 | } |
| 107 | } |
| 108 | |
| 109 | stage('Functional Tests') { |
| 110 | environment { |
| 111 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FunctionalTests" |
| 112 | } |
| 113 | steps { |
| 114 | sh ''' |
| 115 | set +e |
| 116 | mkdir -p $ROBOT_LOGS_DIR |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 117 | cd $WORKSPACE/kind-voltha/scripts |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 118 | ./log-collector.sh > /dev/null & |
| 119 | ./log-combine.sh > /dev/null & |
| 120 | |
| 121 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 122 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 123 | ''' |
| 124 | } |
| 125 | } |
| 126 | |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 127 | stage('Alarm Tests') { |
| 128 | environment { |
| 129 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/AlarmTests" |
| 130 | } |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 131 | when { |
| 132 | expression { |
| 133 | return params.withAlarms |
| 134 | } |
| 135 | } |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 136 | steps { |
| 137 | sh ''' |
| 138 | set +e |
| 139 | mkdir -p $WORKSPACE/RobotLogs |
| 140 | |
| 141 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Suchitra Vemuri | 456b6b4 | 2020-11-10 19:06:22 -0800 | [diff] [blame] | 142 | make -C $WORKSPACE/voltha-system-tests ${makeAlarmtestTarget} || true |
Hung-Wei Chiu | c72fe1f | 2020-05-04 13:54:32 -0700 | [diff] [blame] | 143 | ''' |
| 144 | } |
| 145 | } |
| 146 | |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 147 | stage('Failure/Recovery Tests') { |
| 148 | environment { |
| 149 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/FailureTests" |
| 150 | } |
| 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 ${makeFailtestTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 158 | ''' |
| 159 | } |
| 160 | } |
| 161 | |
| 162 | stage('Error Tests') { |
| 163 | environment { |
| 164 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ErrorTests" |
| 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 ${makeErrortestTarget} || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 173 | ''' |
| 174 | } |
| 175 | } |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | post { |
| 179 | always { |
| 180 | sh ''' |
| 181 | set +e |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 182 | cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 183 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 184 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
| 185 | kubectl get nodes -o wide |
| 186 | kubectl get pods -o wide |
| 187 | kubectl get pods -n voltha -o wide |
| 188 | |
| 189 | sleep 60 # Wait for log-collector and log-combine to complete |
| 190 | |
| 191 | ## Pull out errors from log files |
| 192 | extract_errors_go() { |
| 193 | echo |
| 194 | echo "Error summary for $1:" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 195 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 196 | echo |
| 197 | } |
| 198 | |
| 199 | extract_errors_python() { |
| 200 | echo |
| 201 | echo "Error summary for $1:" |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 202 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 203 | echo |
| 204 | } |
| 205 | |
| 206 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 207 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 208 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 209 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 210 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 211 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 212 | gzip error-report.log || true |
| 213 | |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 214 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 215 | tar czf $WORKSPACE/container-logs.tgz * |
| 216 | |
| 217 | cd $WORKSPACE |
| 218 | gzip *-combined.log || true |
| 219 | |
| 220 | ## shut down voltha but leave kind-voltha cluster |
Matteo Scandolo | 861a53a | 2020-09-16 11:39:42 -0700 | [diff] [blame] | 221 | cd $WORKSPACE/kind-voltha/ |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 222 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | fcae383 | 2020-06-04 08:51:10 -0700 | [diff] [blame] | 223 | kubectl delete deployment voltctl || true |
Hung-Wei Chiu | 5ec2edf | 2020-04-30 14:53:13 -0700 | [diff] [blame] | 224 | ''' |
| 225 | step([$class: 'RobotPublisher', |
| 226 | disableArchiveOutput: false, |
| 227 | logFileName: '**/log*.html', |
| 228 | otherFiles: '', |
| 229 | outputFileName: '**/output*.xml', |
| 230 | outputPath: 'RobotLogs', |
| 231 | passThreshold: 100, |
| 232 | reportFileName: '**/report*.html', |
| 233 | unstableThreshold: 0]); |
| 234 | |
| 235 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
| 236 | |
| 237 | } |
| 238 | } |
| 239 | } |