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 { |
Andrea Campanella | 2f21f98 | 2020-09-11 13:26:40 +0200 | [diff] [blame] | 26 | timeout(time: 60, unit: 'MINUTES') |
Kailash | 4b323ff | 2019-08-02 17:52:49 -0700 | [diff] [blame] | 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" |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 31 | PATH="$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 | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 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" |
Andrea Campanella | fe95038 | 2020-09-10 18:12:11 +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" |
pierventre | f48ebc1 | 2020-07-17 16:01:32 +0200 | [diff] [blame] | 42 | KARAF_HOME="${params.karafHome}" |
| 43 | DIAGS_PROFILE="VOLTHA_PROFILE" |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 44 | } |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 45 | stages { |
| 46 | |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 47 | stage('Clone kind-voltha') { |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 48 | steps { |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 49 | checkout([ |
| 50 | $class: 'GitSCM', |
| 51 | userRemoteConfigs: [[ |
| 52 | url: "https://gerrit.opencord.org/kind-voltha", |
| 53 | // refspec: "${kindVolthaChange}" |
| 54 | ]], |
| 55 | branches: [[ name: "master", ]], |
| 56 | extensions: [ |
| 57 | [$class: 'WipeWorkspace'], |
| 58 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 59 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 60 | ], |
| 61 | ]) |
Andy Bavier | 4c8b323 | 2019-11-22 16:17:47 -0700 | [diff] [blame] | 62 | } |
| 63 | } |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 64 | stage('Cleanup') { |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 65 | steps { |
| 66 | sh """ |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame^] | 67 | if [ "${branch}" != "master" ]; then |
| 68 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 69 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 70 | else |
| 71 | echo "on master, using default settings for kind-voltha" |
| 72 | fi |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 73 | cd $WORKSPACE/kind-voltha/ |
| 74 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || true |
| 75 | """ |
| 76 | } |
| 77 | } |
| 78 | stage('Clone voltha-system-tests') { |
| 79 | steps { |
| 80 | checkout([ |
| 81 | $class: 'GitSCM', |
| 82 | userRemoteConfigs: [[ |
| 83 | url: "https://gerrit.opencord.org/voltha-system-tests", |
| 84 | // refspec: "${volthaSystemTestsChange}" |
| 85 | ]], |
Suchitra Vemuri | 1143ae3 | 2021-03-26 01:08:37 +0000 | [diff] [blame] | 86 | branches: [[ name: "${branch}", ]], |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 87 | extensions: [ |
| 88 | [$class: 'WipeWorkspace'], |
| 89 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 90 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 91 | ], |
| 92 | ]) |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 93 | } |
| 94 | } |
| 95 | |
| 96 | stage('Deploy Voltha') { |
| 97 | steps { |
| 98 | sh """ |
Andy Bavier | dc8bc2c | 2020-03-29 16:25:02 -0700 | [diff] [blame] | 99 | export EXTRA_HELM_FLAGS="" |
Andy Bavier | 6dfaf7e | 2020-03-30 14:52:59 -0700 | [diff] [blame] | 100 | if [ "${branch}" != "master" ]; then |
| 101 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 102 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 103 | else |
| 104 | echo "on master, using default settings for kind-voltha" |
| 105 | fi |
| 106 | |
Hung-Wei Chiu | f284d3f | 2020-04-08 11:38:13 -0700 | [diff] [blame] | 107 | if [ "${workFlow}" == "DT" ]; then |
| 108 | export WITH_DHCP=no |
| 109 | export WITH_IGMP=no |
| 110 | export WITH_EAPOL=no |
| 111 | export WITH_RADIUS=no |
Andrea Campanella | fe95038 | 2020-09-10 18:12:11 +0200 | [diff] [blame] | 112 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
Hung-Wei Chiu | f284d3f | 2020-04-08 11:38:13 -0700 | [diff] [blame] | 113 | fi |
| 114 | |
Andy Bavier | 10926f1 | 2020-03-27 16:53:43 -0700 | [diff] [blame] | 115 | EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${params.extraHelmFlags} " |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 116 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 117 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down || ./voltha down |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 118 | ./voltha up |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 119 | """ |
| 120 | } |
| 121 | } |
| 122 | |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 123 | stage('Run E2E Tests') { |
| 124 | steps { |
| 125 | sh ''' |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 126 | set +e |
Andy Bavier | 2c9ce04 | 2019-11-23 07:36:31 -0700 | [diff] [blame] | 127 | mkdir -p $WORKSPACE/RobotLogs |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 128 | |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 129 | cd $WORKSPACE/kind-voltha/scripts |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 130 | ./log-collector.sh > /dev/null & |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 131 | ./log-combine.sh > /dev/null & |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 132 | |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 133 | make -C $WORKSPACE/voltha-system-tests ${makeTarget} || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 134 | ''' |
| 135 | } |
| 136 | } |
| 137 | } |
| 138 | |
| 139 | post { |
| 140 | always { |
| 141 | sh ''' |
Andy Bavier | 218385e | 2019-11-13 09:51:38 -0700 | [diff] [blame] | 142 | set +e |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 143 | cp $WORKSPACE/kind-voltha/install-minimal.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 144 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 145 | 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] | 146 | kubectl get nodes -o wide |
| 147 | kubectl get pods -o wide |
| 148 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 149 | |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 150 | sleep 60 # Wait for log-collector and log-combine to complete |
| 151 | |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 152 | ## Pull out errors from log files |
| 153 | extract_errors_go() { |
| 154 | echo |
| 155 | echo "Error summary for $1:" |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 156 | grep '"level":"error"' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 157 | echo |
| 158 | } |
| 159 | |
| 160 | extract_errors_python() { |
| 161 | echo |
| 162 | echo "Error summary for $1:" |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 163 | grep 'ERROR' $WORKSPACE/kind-voltha/scripts/logger/combined/$1* |
Andy Bavier | b30c0a0 | 2020-03-03 17:21:23 -0700 | [diff] [blame] | 164 | echo |
| 165 | } |
| 166 | |
| 167 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 168 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 169 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 170 | extract_errors_go voltha-ofagent >> $WORKSPACE/error-report.log |
| 171 | extract_errors_python onos >> $WORKSPACE/error-report.log |
| 172 | |
Andrea Campanella | 9a95cb7 | 2020-09-03 11:28:35 +0200 | [diff] [blame] | 173 | gzip error-report.log || true |
| 174 | |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 175 | cd $WORKSPACE/kind-voltha/scripts/logger/combined/ |
Andy Bavier | 7afb11c | 2020-02-13 11:25:20 -0700 | [diff] [blame] | 176 | tar czf $WORKSPACE/container-logs.tgz * |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 177 | |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 178 | cd $WORKSPACE |
Andy Bavier | b86ca42 | 2020-02-13 05:19:43 -0700 | [diff] [blame] | 179 | gzip *-combined.log || true |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 180 | |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 181 | ## shut down voltha but leave kind-voltha cluster |
Andrea Campanella | 57735a8 | 2021-05-18 13:22:49 +0200 | [diff] [blame^] | 182 | if [ "${branch}" != "master" ]; then |
| 183 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 184 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 185 | else |
| 186 | echo "on master, using default settings for kind-voltha" |
| 187 | fi |
Andrea Campanella | 88f01ea | 2021-01-04 11:36:25 +0100 | [diff] [blame] | 188 | cd $WORKSPACE/kind-voltha/ |
Andy Bavier | 36c688c | 2020-03-17 07:32:30 -0700 | [diff] [blame] | 189 | DEPLOY_K8S=n WAIT_ON_DOWN=y ./voltha down |
Andy Bavier | fcae383 | 2020-06-04 08:51:10 -0700 | [diff] [blame] | 190 | kubectl delete deployment voltctl || true |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 191 | ''' |
| 192 | step([$class: 'RobotPublisher', |
| 193 | disableArchiveOutput: false, |
| 194 | logFileName: 'RobotLogs/log*.html', |
| 195 | otherFiles: '', |
| 196 | outputFileName: 'RobotLogs/output*.xml', |
| 197 | outputPath: '.', |
Matteo Scandolo | 26bc17e | 2019-09-24 09:03:01 -0700 | [diff] [blame] | 198 | passThreshold: 100, |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 199 | reportFileName: 'RobotLogs/report*.html', |
| 200 | unstableThreshold: 0]); |
Andy Bavier | 3c1ccca | 2020-02-12 16:50:04 -0700 | [diff] [blame] | 201 | archiveArtifacts artifacts: '*.log,*.gz,*.tgz' |
Kailash | 8b8de74 | 2019-07-30 08:54:51 -0700 | [diff] [blame] | 202 | |
| 203 | } |
| 204 | } |
| 205 | } |