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