Kailash | 8b8de74 | 2019-07-30 08:54:51 -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 { |
Zack Williams | b329208 | 2019-10-11 17:15:18 -0700 | [diff] [blame] | 23 | label "${params.buildNode}" |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 24 | } |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 25 | options { |
| 26 | timeout(time: 40, unit: 'MINUTES') |
| 27 | } |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 28 | environment { |
| 29 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 30 | VOLTCONFIG="$HOME/.volt/config-minimal" |
Andy Bavier | 292121d | 2020-04-09 12:50:35 -0700 | [diff] [blame] | 31 | PATH="$HOME/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 32 | TYPE="minimal" |
| 33 | FANCY=0 |
Hung-Wei Chiu | f284d3f | 2020-04-08 11:38:13 -0700 | [diff] [blame] | 34 | WITH_SIM_ADAPTERS="no" |
| 35 | WITH_RADIUS="yes" |
| 36 | WITH_BBSIM="yes" |
| 37 | DEPLOY_K8S="yes" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 38 | VOLTHA_LOG_LEVEL="DEBUG" |
Hung-Wei Chiu | f284d3f | 2020-04-08 11:38:13 -0700 | [diff] [blame] | 39 | CONFIG_SADIS="no" |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 40 | ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs -e PowerSwitch" |
pierventre | f48ebc1 | 2020-07-17 16:01:32 +0200 | [diff] [blame] | 41 | KARAF_HOME="${params.karafHome}" |
| 42 | DIAGS_PROFILE="VOLTHA_PROFILE" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 43 | } |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 44 | stages { |
| 45 | |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 46 | stage('Repo') { |
| 47 | steps { |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 48 | step([$class: 'WsCleanup']) |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 49 | checkout(changelog: true, |
| 50 | poll: false, |
| 51 | scm: [$class: 'RepoScm', |
| 52 | manifestRepositoryUrl: "${params.manifestUrl}", |
Andy Bavier | 6dfaf7e | 2020-03-30 14:52:59 -0700 | [diff] [blame] | 53 | manifestBranch: "${params.branch}", |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 54 | currentBranch: true, |
| 55 | destinationDir: 'voltha', |
| 56 | forceSync: true, |
| 57 | resetFirst: true, |
| 58 | quiet: true, |
| 59 | jobs: 4, |
| 60 | showAllChanges: true] |
| 61 | ) |
| 62 | } |
| 63 | } |
| 64 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 65 | stage('Download kind-voltha') { |
| 66 | steps { |
| 67 | sh """ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 68 | cd $HOME |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 69 | [ -d kind-voltha ] || git clone https://gerrit.opencord.org/kind-voltha |
Andy Bavier | 2e00930 | 2020-03-19 08:46:13 -0700 | [diff] [blame] | 70 | rm -rf $HOME/kind-voltha/scripts/logger |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 71 | cd $HOME/kind-voltha |
| 72 | git pull |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 73 | """ |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | stage('Deploy Voltha') { |
| 78 | steps { |
| 79 | sh """ |
Andy Bavier | dc8bc2c | 2020-03-29 16:25:02 -0700 | [diff] [blame] | 80 | export EXTRA_HELM_FLAGS="" |
Andy Bavier | 6dfaf7e | 2020-03-30 14:52:59 -0700 | [diff] [blame] | 81 | if [ "${branch}" != "master" ]; then |
| 82 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 83 | source "$HOME/kind-voltha/releases/${branch}" |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 84 | else |
| 85 | echo "on master, using default settings for kind-voltha" |
| 86 | fi |
| 87 | |
Hung-Wei Chiu | f284d3f | 2020-04-08 11:38:13 -0700 | [diff] [blame] | 88 | if [ "${workFlow}" == "DT" ]; then |
| 89 | export WITH_DHCP=no |
| 90 | export WITH_IGMP=no |
| 91 | export WITH_EAPOL=no |
| 92 | export WITH_RADIUS=no |
| 93 | fi |
| 94 | |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 95 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} " |
| 96 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 97 | cd $HOME/kind-voltha/ |
| 98 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 99 | ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 100 | """ |
| 101 | } |
| 102 | } |
| 103 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 104 | stage('Run E2E Tests') { |
| 105 | steps { |
| 106 | sh ''' |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 107 | set +e |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 108 | mkdir -p $WORKSPACE/RobotLogs |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 109 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 110 | cd $HOME/kind-voltha/scripts |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 111 | ./log-collector.sh > /dev/null & |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 112 | ./log-combine.sh > /dev/null & |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 113 | |
Andy Bavier | 6612f07 | 2020-04-16 10:22:19 -0700 | [diff] [blame] | 114 | make -C $WORKSPACE/voltha/voltha-system-tests ${makeTarget} || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 115 | ''' |
| 116 | } |
| 117 | } |
| 118 | } |
| 119 | |
| 120 | post { |
| 121 | always { |
| 122 | sh ''' |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 123 | set +e |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 124 | cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 125 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 126 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
Kailash | 887a296 | 2019-08-14 13:26:33 -0700 | [diff] [blame] | 127 | kubectl get nodes -o wide |
| 128 | kubectl get pods -o wide |
| 129 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 130 | |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 131 | sleep 60 # Wait for log-collector and log-combine to complete |
| 132 | |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 133 | ## Pull out errors from log files |
| 134 | extract_errors_go() { |
| 135 | echo |
| 136 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 137 | grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 138 | echo |
| 139 | } |
| 140 | |
| 141 | extract_errors_python() { |
| 142 | echo |
| 143 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 144 | grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 145 | echo |
| 146 | } |
| 147 | |
| 148 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 149 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 150 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 151 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 152 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 153 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 154 | gzip error-report.log || true |
| 155 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 156 | cd $HOME/kind-voltha/scripts/logger/combined/ |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 157 | tar czf $WORKSPACE/container-logs.tgz * |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 158 | |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 159 | cd $WORKSPACE |
Andy Bavier | b86ca42 | 2020-02-13 05:19:43 -0700 | [diff] [blame] | 160 | gzip *-combined.log || true |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 161 | |
Hung-Wei Chiu | 9669b7d | 2020-05-14 12:12:05 -0700 | [diff] [blame] | 162 | ## Collect ONOS log |
| 163 | wget https://raw.githubusercontent.com/opennetworkinglab/onos/master/tools/package/runtime/bin/onos-diagnostics-k8s |
| 164 | wget https://raw.githubusercontent.com/opennetworkinglab/onos/master/tools/package/runtime/bin/onos-diagnostics-profile |
| 165 | chmod 755 onos-diagnostics-k8s |
pierventre | f48ebc1 | 2020-07-17 16:01:32 +0200 | [diff] [blame] | 166 | pod_names=$(kubectl get pods -lapp=onos-onos-classic -o name | cut -d '/' -f2 | tr '\n' ' ') |
| 167 | ./onos-diagnostics-k8s ${pod_names} |
Hung-Wei Chiu | 9669b7d | 2020-05-14 12:12:05 -0700 | [diff] [blame] | 168 | cp /tmp/onos-diags.tar.gz $WORKSPACE/onos-diags.tar.gz |
| 169 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 170 | ## shut down voltha but leave kind-voltha cluster |
| 171 | cd $HOME/kind-voltha/ |
| 172 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | fcae383 | 2020-06-04 08:51:10 -0700 | [diff] [blame] | 173 | kubectl delete deployment voltctl || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 174 | ''' |
| 175 | step([$class: 'RobotPublisher', |
| 176 | disableArchiveOutput: false, |
| 177 | logFileName: 'RobotLogs/log*.html', |
| 178 | otherFiles: '', |
| 179 | outputFileName: 'RobotLogs/output*.xml', |
| 180 | outputPath: '.', |
Matteo Scandolo | 26bc17e | 2019-09-24 09:03:01 -0700 | [diff] [blame] | 181 | passThreshold: 100, |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 182 | reportFileName: 'RobotLogs/report*.html', |
| 183 | unstableThreshold: 0]); |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 184 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 185 | |
| 186 | } |
| 187 | } |
| 188 | } |