Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -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 | 2f21f98 | 2020-09-11 13:26:40 +0200 | [diff] [blame] | 26 | timeout(time: 60, unit: 'MINUTES') |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 27 | } |
| 28 | environment { |
| 29 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 30 | VOLTCONFIG="$HOME/.volt/config-minimal" |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 31 | 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" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 33 | FANCY=0 |
| 34 | WITH_SIM_ADAPTERS="n" |
| 35 | WITH_RADIUS="y" |
| 36 | WITH_BBSIM="y" |
| 37 | DEPLOY_K8S="y" |
| 38 | VOLTHA_LOG_LEVEL="DEBUG" |
Andrea Campanella | 2f21f98 | 2020-09-11 13:26:40 +0200 | [diff] [blame] | 39 | CONFIG_SADIS="external" |
| 40 | BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 41 | } |
| 42 | stages { |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 43 | stage('Clone kind-voltha') { |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 44 | steps { |
| 45 | step([$class: 'WsCleanup']) |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 46 | checkout([ |
| 47 | $class: 'GitSCM', |
| 48 | userRemoteConfigs: [[ |
| 49 | url: "https://gerrit.opencord.org/kind-voltha", |
| 50 | refspec: "${kindVolthaChange}" |
| 51 | ]], |
| 52 | branches: [[ name: "master", ]], |
| 53 | extensions: [ |
| 54 | [$class: 'WipeWorkspace'], |
| 55 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 56 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 57 | ], |
| 58 | ]) |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 59 | } |
| 60 | } |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 61 | stage('Clone voltha-system-tests') { |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 62 | steps { |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 63 | checkout([ |
| 64 | $class: 'GitSCM', |
| 65 | userRemoteConfigs: [[ |
| 66 | url: "https://gerrit.opencord.org/voltha-system-tests", |
| 67 | refspec: "${volthaSystemTestsChange}" |
| 68 | ]], |
Suchitra Vemuri | 1143ae3 | 2021-03-26 01:08:37 +0000 | [diff] [blame] | 69 | branches: [[ name: "${branch}", ]], |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 70 | extensions: [ |
| 71 | [$class: 'WipeWorkspace'], |
| 72 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 73 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 74 | ], |
| 75 | ]) |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 76 | } |
| 77 | } |
| 78 | |
| 79 | stage('Deploy Voltha') { |
| 80 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 81 | timeout(time: 15, unit: 'MINUTES') { |
| 82 | sh """ |
| 83 | export EXTRA_HELM_FLAGS="" |
| 84 | if [ "${branch}" != "master" ]; then |
| 85 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 86 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 87 | else |
| 88 | echo "on master, using default settings for kind-voltha" |
| 89 | fi |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 90 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 91 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} " |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 92 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 93 | cd $WORKSPACE/kind-voltha/ |
| 94 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
| 95 | ./voltha up |
| 96 | """ |
| 97 | } |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 98 | } |
| 99 | } |
| 100 | |
| 101 | stage('Run E2E Tests') { |
| 102 | steps { |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 103 | // this may potentially fail as we don't know how many times we repeat this tests |
| 104 | timeout(time: 30, unit: 'MINUTES') { |
| 105 | sh """ |
| 106 | set +e |
| 107 | mkdir -p $WORKSPACE/RobotLogs |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 108 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 109 | cd $WORKSPACE/kind-voltha/scripts |
| 110 | ./log-collector.sh > /dev/null & |
| 111 | ./log-combine.sh > /dev/null & |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 112 | |
Matteo Scandolo | e4abf85 | 2021-05-18 09:12:11 -0700 | [diff] [blame] | 113 | for i in \$(seq 1 ${testRuns}) |
| 114 | do |
| 115 | export ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs/\$i -e PowerSwitch" |
| 116 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} |
| 117 | echo "Completed run: \$i" |
| 118 | echo "" |
| 119 | done |
| 120 | """ |
| 121 | } |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 122 | } |
| 123 | } |
| 124 | } |
| 125 | |
| 126 | post { |
| 127 | always { |
| 128 | sh ''' |
| 129 | set +e |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 130 | cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 131 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 132 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 133 | kubectl get nodes -o wide |
| 134 | kubectl get pods -o wide |
| 135 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 136 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 137 | sleep 60 # Wait for log-collector and log-combine to complete |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 138 | |
| 139 | ## Pull out errors from log files |
| 140 | extract_errors_go() { |
| 141 | echo |
| 142 | echo "Error summary for $1:" |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 143 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 144 | echo |
| 145 | } |
| 146 | |
| 147 | extract_errors_python() { |
| 148 | echo |
| 149 | echo "Error summary for $1:" |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 150 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 151 | echo |
| 152 | } |
| 153 | |
| 154 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 155 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 156 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 157 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 158 | extract_errors_python onos >> $WORKSPACE/error-report.log |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 159 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 160 | gzip error-report.log || true |
| 161 | |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 162 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 163 | tar czf $WORKSPACE/container-logs.tgz * |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 164 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 165 | cd $WORKSPACE |
| 166 | gzip *-combined.log || true |
| 167 | |
| 168 | ## shut down voltha but leave kind-voltha cluster |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame] | 169 | if [ "${branch}" != "master" ]; then |
| 170 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 171 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 172 | else |
| 173 | echo "on master, using default settings for kind-voltha" |
| 174 | fi |
Matteo Scandolo | 4548f09 | 2020-09-29 11:27:35 -0700 | [diff] [blame] | 175 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 176 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 177 | ''' |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 178 | step([$class: 'RobotPublisher', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 179 | disableArchiveOutput: false, |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 180 | logFileName: '**/log*.html', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 181 | otherFiles: '', |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 182 | outputFileName: '**/output*.xml', |
| 183 | outputPath: 'RobotLogs', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 184 | passThreshold: 100, |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 185 | reportFileName: '**/report*.html', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 186 | unstableThreshold: 0]); |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 187 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 188 | |
| 189 | } |
| 190 | } |
| 191 | } |