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 | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 31 | PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/kind-voltha/bin" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -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" |
Andy Bavier | 0088c21 | 2020-01-08 13:44:03 -0700 | [diff] [blame] | 39 | CONFIG_SADIS="n" |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 40 | EXTRA_HELM_FLAGS="--set log_agent.enabled=False ${params.extraHelmFlags}" |
Andy Bavier | 3708d07 | 2019-12-10 15:22:18 -0700 | [diff] [blame] | 41 | ROBOT_MISC_ARGS="${params.extraRobotArgs} -d $WORKSPACE/RobotLogs" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 42 | } |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 43 | stages { |
| 44 | |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 45 | stage('Repo') { |
| 46 | steps { |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 47 | step([$class: 'WsCleanup']) |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 48 | checkout(changelog: true, |
| 49 | poll: false, |
| 50 | scm: [$class: 'RepoScm', |
| 51 | manifestRepositoryUrl: "${params.manifestUrl}", |
| 52 | manifestBranch: "${params.manifestBranch}", |
| 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 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 64 | stage('Download kind-voltha') { |
| 65 | steps { |
| 66 | sh """ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 67 | cd $HOME |
| 68 | [ -d kind-voltha ] || git clone https://github.com/ciena/kind-voltha.git |
| 69 | cd $HOME/kind-voltha |
| 70 | git pull |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 71 | """ |
| 72 | } |
| 73 | } |
| 74 | |
| 75 | stage('Deploy Voltha') { |
| 76 | steps { |
| 77 | sh """ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 78 | cd $HOME/kind-voltha/ |
| 79 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 80 | ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 81 | """ |
| 82 | } |
| 83 | } |
| 84 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 85 | stage('Run E2E Tests') { |
| 86 | steps { |
| 87 | sh ''' |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 88 | set +e |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 89 | mkdir -p $WORKSPACE/RobotLogs |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 90 | git clone https://gerrit.opencord.org/voltha-system-tests |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 91 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 92 | cd $HOME/kind-voltha/scripts |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 93 | ./log-collector.sh > /dev/null & |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 94 | ./log-combine.sh > /dev/null & |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 95 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 96 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 97 | ''' |
| 98 | } |
| 99 | } |
| 100 | } |
| 101 | |
| 102 | post { |
| 103 | always { |
| 104 | sh ''' |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 105 | set +e |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 106 | cp $HOME/kind-voltha/install-minimal.log $WORKSPACE/ |
Andy Bavier | aec6038 | 2019-10-29 15:09:04 -0700 | [diff] [blame] | 107 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\t'}{.imageID}{'\\n'}" | sort | uniq -c |
Kailash | 887a296 | 2019-08-14 13:26:33 -0700 | [diff] [blame] | 108 | kubectl get nodes -o wide |
| 109 | kubectl get pods -o wide |
| 110 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 111 | |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 112 | sleep 60 # Wait for log-collector and log-combine to complete |
| 113 | |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 114 | ## Pull out errors from log files |
| 115 | extract_errors_go() { |
| 116 | echo |
| 117 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 118 | grep '"level":"error"' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 119 | echo |
| 120 | } |
| 121 | |
| 122 | extract_errors_python() { |
| 123 | echo |
| 124 | echo "Error summary for $1:" |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 125 | grep 'ERROR' $HOME/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 126 | echo |
| 127 | } |
| 128 | |
| 129 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 130 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 131 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 132 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 133 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 134 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 135 | cd $HOME/kind-voltha/scripts/logger/combined/ |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 136 | tar czf $WORKSPACE/container-logs.tgz * |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 137 | |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 138 | cd $WORKSPACE |
Andy Bavier | b86ca42 | 2020-02-13 05:19:43 -0700 | [diff] [blame] | 139 | gzip *-combined.log || true |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 140 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 141 | ## shut down voltha but leave kind-voltha cluster |
| 142 | cd $HOME/kind-voltha/ |
| 143 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 144 | ''' |
| 145 | step([$class: 'RobotPublisher', |
| 146 | disableArchiveOutput: false, |
| 147 | logFileName: 'RobotLogs/log*.html', |
| 148 | otherFiles: '', |
| 149 | outputFileName: 'RobotLogs/output*.xml', |
| 150 | outputPath: '.', |
Matteo Scandolo | 26bc17e | 2019-09-24 09:03:01 -0700 | [diff] [blame] | 151 | passThreshold: 100, |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 152 | reportFileName: 'RobotLogs/report*.html', |
| 153 | unstableThreshold: 0]); |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 154 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 155 | |
| 156 | } |
| 157 | } |
| 158 | } |