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" |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 31 | PATH="$HOME/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 32 | TYPE="minimal" |
| 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 | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 41 | ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs -e PowerSwitch" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 42 | } |
| 43 | stages { |
| 44 | |
| 45 | stage('Repo') { |
| 46 | steps { |
| 47 | step([$class: 'WsCleanup']) |
| 48 | checkout(changelog: true, |
| 49 | poll: false, |
| 50 | scm: [$class: 'RepoScm', |
| 51 | manifestRepositoryUrl: "${params.manifestUrl}", |
Andy Bavier | 6dfaf7e | 2020-03-30 14:52:59 -0700 | [diff] [blame] | 52 | manifestBranch: "${params.branch}", |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 53 | currentBranch: true, |
| 54 | destinationDir: 'voltha', |
| 55 | forceSync: true, |
| 56 | resetFirst: true, |
| 57 | quiet: true, |
| 58 | jobs: 4, |
| 59 | showAllChanges: true] |
| 60 | ) |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | stage('Download kind-voltha') { |
| 65 | steps { |
| 66 | sh """ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 67 | cd $HOME |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 68 | [ -d kind-voltha ] || git clone https://gerrit.opencord.org/kind-voltha |
Andy Bavier | 2e00930 | 2020-03-19 08:46:13 -0700 | [diff] [blame] | 69 | rm -rf $HOME/kind-voltha/scripts/logger |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 70 | cd $HOME/kind-voltha |
| 71 | git pull |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 72 | """ |
| 73 | } |
| 74 | } |
| 75 | |
| 76 | stage('Deploy Voltha') { |
| 77 | steps { |
| 78 | sh """ |
Andy Bavier | dc8bc2c | 2020-03-29 16:25:02 -0700 | [diff] [blame] | 79 | export EXTRA_HELM_FLAGS="" |
Andy Bavier | 6dfaf7e | 2020-03-30 14:52:59 -0700 | [diff] [blame] | 80 | if [ "${branch}" != "master" ]; then |
| 81 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 82 | source "$HOME/kind-voltha/releases/${branch}" |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 83 | else |
| 84 | echo "on master, using default settings for kind-voltha" |
| 85 | fi |
| 86 | |
| 87 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} " |
| 88 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 89 | cd $HOME/kind-voltha/ |
| 90 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 91 | ./voltha up |
| 92 | """ |
| 93 | } |
| 94 | } |
| 95 | |
| 96 | stage('Run E2E Tests') { |
| 97 | steps { |
| 98 | sh ''' |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 99 | set +e |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 100 | mkdir -p $WORKSPACE/RobotLogs |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 101 | |
| 102 | cd $HOME/kind-voltha/scripts |
| 103 | ./log-collector.sh > /dev/null & |
| 104 | ./log-combine.sh > /dev/null & |
| 105 | |
Andy Bavier | 0d10139 | 2020-03-17 09:36:41 -0700 | [diff] [blame] | 106 | for i in \$(seq 1 ${testRuns}) |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 107 | do |
Andy Bavier | 6612f07 | 2020-04-16 10:22:19 -0700 | [diff] [blame] | 108 | make -C $WORKSPACE/voltha/voltha-system-tests ${makeTarget} |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 109 | echo "Completed run: \$i" |
| 110 | echo "" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 111 | done |
| 112 | ''' |
| 113 | } |
| 114 | } |
| 115 | } |
| 116 | |
| 117 | post { |
| 118 | always { |
| 119 | sh ''' |
| 120 | set +e |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 121 | cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 122 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 123 | 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] | 124 | kubectl get nodes -o wide |
| 125 | kubectl get pods -o wide |
| 126 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 127 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 128 | sleep 60 # Wait for log-collector and log-combine to complete |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 129 | |
| 130 | ## Pull out errors from log files |
| 131 | extract_errors_go() { |
| 132 | echo |
| 133 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 134 | grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 135 | echo |
| 136 | } |
| 137 | |
| 138 | extract_errors_python() { |
| 139 | echo |
| 140 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 141 | grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 142 | echo |
| 143 | } |
| 144 | |
| 145 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 146 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 147 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 148 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 149 | extract_errors_python onos >> $WORKSPACE/error-report.log |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 150 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 151 | gzip error-report.log || true |
| 152 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 153 | cd $HOME/kind-voltha/scripts/logger/combined/ |
| 154 | tar czf $WORKSPACE/container-logs.tgz * |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 155 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 156 | cd $WORKSPACE |
| 157 | gzip *-combined.log || true |
| 158 | |
| 159 | ## shut down voltha but leave kind-voltha cluster |
| 160 | cd $HOME/kind-voltha/ |
| 161 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 162 | ''' |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 163 | step([$class: 'RobotPublisher', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 164 | disableArchiveOutput: false, |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 165 | logFileName: '**/log*.html', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 166 | otherFiles: '', |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 167 | outputFileName: '**/output*.xml', |
| 168 | outputPath: 'RobotLogs', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 169 | passThreshold: 100, |
Andrea Campanella | cd02520 | 2020-07-31 13:29:40 +0200 | [diff] [blame] | 170 | reportFileName: '**/report*.html', |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 171 | unstableThreshold: 0]); |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 172 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 173 | |
| 174 | } |
| 175 | } |
| 176 | } |