Kailash | aad7101 | 2019-08-27 10:36:53 -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 | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 24 | } |
| 25 | options { |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 26 | timeout(time: 90, unit: 'MINUTES') |
| 27 | } |
| 28 | environment { |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 29 | PATH="$WORKSPACE/voltha/kind-voltha/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 30 | VOLTHA_LOG_LEVEL="DEBUG" |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 31 | FANCY=0 |
| 32 | WITH_SIM_ADAPTERS="n" |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 33 | NAME="test" |
| 34 | VOLTCONFIG="$HOME/.volt/config-$NAME" |
| 35 | KUBECONFIG="$HOME/.kube/kind-config-voltha-$NAME" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 36 | } |
| 37 | |
| 38 | stages { |
| 39 | |
| 40 | stage('Repo') { |
| 41 | steps { |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 42 | step([$class: 'WsCleanup']) |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 43 | checkout(changelog: false, \ |
| 44 | poll: false, |
| 45 | scm: [$class: 'RepoScm', \ |
| 46 | manifestRepositoryUrl: "${params.manifestUrl}", \ |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 47 | manifestBranch: "${params.branch}", \ |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 48 | currentBranch: true, \ |
| 49 | destinationDir: 'voltha', \ |
| 50 | forceSync: true, |
| 51 | resetFirst: true, \ |
| 52 | quiet: true, \ |
| 53 | jobs: 4, \ |
| 54 | showAllChanges: true] \ |
| 55 | ) |
| 56 | } |
| 57 | } |
| 58 | stage('Patch') { |
| 59 | steps { |
| 60 | sh """ |
| 61 | pushd voltha |
Andy Bavier | b35171c | 2020-03-06 15:47:29 -0700 | [diff] [blame] | 62 | if [ "${gerritProject}" != "" -a "${gerritChangeNumber}" != "" -a "${gerritPatchsetNumber}" != "" ] |
| 63 | then |
| 64 | repo download "${gerritProject}" "${gerritChangeNumber}/${gerritPatchsetNumber}" |
| 65 | else |
| 66 | echo "No patchset to download!" |
| 67 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 68 | popd |
| 69 | """ |
| 70 | } |
| 71 | } |
| 72 | stage('Create K8s Cluster') { |
| 73 | steps { |
| 74 | sh """ |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 75 | if [ "${branch}" != "master" ]; then |
| 76 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 77 | source "$WORKSPACE/voltha/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 78 | else |
| 79 | echo "on master, using default settings for kind-voltha" |
| 80 | fi |
| 81 | |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 82 | cd $WORKSPACE/voltha/kind-voltha/ |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 83 | JUST_K8S=y ./voltha up |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 84 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/voltha/kind-voltha/bin" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 85 | """ |
| 86 | } |
| 87 | } |
| 88 | |
| 89 | stage('Build Images') { |
| 90 | steps { |
| 91 | sh """ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 92 | make-local () { |
| 93 | make -C $WORKSPACE/voltha/\$1 DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build |
| 94 | } |
Andy Bavier | 0ed7706 | 2020-02-18 10:09:19 -0700 | [diff] [blame] | 95 | if [ "${gerritProject}" = "pyvoltha" ]; then |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 96 | make -C $WORKSPACE/voltha/pyvoltha/ dist |
Andy Bavier | 0ed7706 | 2020-02-18 10:09:19 -0700 | [diff] [blame] | 97 | export LOCAL_PYVOLTHA=$WORKSPACE/voltha/pyvoltha/ |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 98 | make-local voltha-openonu-adapter |
| 99 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
| 100 | make -C $WORKSPACE/voltha/voltha-lib-go/ build |
| 101 | export LOCAL_LIB_GO=$WORKSPACE/voltha/voltha-lib-go/ |
| 102 | make-local voltha-go |
| 103 | make-local voltha-openolt-adapter |
| 104 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
| 105 | make -C $WORKSPACE/voltha/voltha-protos/ build |
| 106 | export LOCAL_PROTOS=$WORKSPACE/voltha/voltha-protos/ |
| 107 | make-local voltha-go |
| 108 | make-local voltha-openolt-adapter |
| 109 | make-local voltha-openonu-adapter |
| 110 | make-local ofagent-py |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 111 | elif [ "${gerritProject}" = "voltctl" ]; then |
Andy Bavier | decde3f | 2020-04-01 15:29:43 -0700 | [diff] [blame] | 112 | # Set and handle GOPATH and PATH |
| 113 | export GOPATH=\${GOPATH:-$WORKSPACE/go} |
| 114 | export PATH=\$PATH:/usr/lib/go-1.12/bin:/usr/local/go/bin:\$GOPATH/bin |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 115 | make -C $WORKSPACE/voltha/voltctl/ build |
Andy Bavier | 4318f8d | 2020-04-09 13:50:53 -0700 | [diff] [blame] | 116 | elif ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|kind-voltha)\$ ]]; then |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 117 | make-local ${gerritProject} |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 118 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 119 | """ |
| 120 | } |
| 121 | } |
| 122 | |
| 123 | stage('Push Images') { |
| 124 | steps { |
| 125 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 126 | if [ "${branch}" != "master" ]; then |
| 127 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 128 | source "$WORKSPACE/voltha/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 129 | else |
| 130 | echo "on master, using default settings for kind-voltha" |
| 131 | fi |
| 132 | |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 133 | if ! [[ "${gerritProject}" =~ ^(voltha-helm-charts|voltha-system-tests|voltctl|kind-voltha)\$ ]]; then |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 134 | export GOROOT=/usr/local/go |
| 135 | export GOPATH=\$(pwd) |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 136 | docker images | grep citest |
Matteo Scandolo | 2e64c10 | 2020-07-29 19:41:02 -0700 | [diff] [blame] | 137 | for image in \$(docker images -f "reference=*/*citest" --format "{{.Repository}}"); do echo "Pushing \$image to nodes"; kind load docker-image \$image:citest --name voltha-\$NAME --nodes voltha-\$NAME-worker,voltha-\$NAME-worker2; done |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 138 | fi |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 139 | ''' |
| 140 | } |
| 141 | } |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 142 | |
| 143 | stage('ATT workflow') { |
| 144 | environment { |
| 145 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 146 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 147 | steps { |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 148 | sh ''' |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 149 | if [ "${branch}" != "master" ]; then |
| 150 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 151 | source "$WORKSPACE/voltha/kind-voltha/releases/${branch}" |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 152 | else |
| 153 | echo "on master, using default settings for kind-voltha" |
| 154 | fi |
| 155 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 156 | # Workflow-specific flags |
| 157 | export WITH_RADIUS=yes |
| 158 | export WITH_BBSIM=yes |
| 159 | export DEPLOY_K8S=yes |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 160 | export CONFIG_SADIS="external" |
| 161 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 162 | |
Zack Williams | 03ebb27 | 2020-03-27 09:42:33 -0700 | [diff] [blame] | 163 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 164 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 165 | IMAGES="" |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 166 | if [ "${gerritProject}" = "voltha-go" ]; then |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 167 | IMAGES="rw_core ro_core " |
| 168 | elif [ "${gerritProject}" = "ofagent-py" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 169 | IMAGES="ofagent_py " |
| 170 | EXTRA_HELM_FLAGS+="--set use_ofagent_go=false " |
Andy Bavier | 9c412a8 | 2020-03-23 12:00:28 -0700 | [diff] [blame] | 171 | elif [ "${gerritProject}" = "ofagent-go" ]; then |
Andy Bavier | 8d81642 | 2020-03-23 15:34:26 -0700 | [diff] [blame] | 172 | IMAGES="ofagent_go " |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 173 | elif [ "${gerritProject}" = "voltha-onos" ]; then |
| 174 | IMAGES="onos " |
| 175 | elif [ "${gerritProject}" = "voltha-openolt-adapter" ]; then |
| 176 | IMAGES="adapter_open_olt " |
| 177 | elif [ "${gerritProject}" = "voltha-openonu-adapter" ]; then |
| 178 | IMAGES="adapter_open_onu " |
| 179 | elif [ "${gerritProject}" = "voltha-api-server" ]; then |
| 180 | IMAGES="afrouter afrouterd " |
| 181 | elif [ "${gerritProject}" = "bbsim" ]; then |
| 182 | IMAGES="bbsim " |
Andy Bavier | ec0c10d | 2020-02-14 13:06:27 -0700 | [diff] [blame] | 183 | elif [ "${gerritProject}" = "pyvoltha" ]; then |
| 184 | IMAGES="adapter_open_onu " |
Andy Bavier | b99c3d3 | 2020-02-18 11:14:17 -0700 | [diff] [blame] | 185 | elif [ "${gerritProject}" = "voltha-lib-go" ]; then |
| 186 | IMAGES="rw_core ro_core adapter_open_olt " |
| 187 | elif [ "${gerritProject}" = "voltha-protos" ]; then |
| 188 | IMAGES="rw_core ro_core adapter_open_olt adapter_open_onu ofagent " |
Zack Williams | 0499750 | 2019-10-04 14:32:20 -0700 | [diff] [blame] | 189 | else |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 190 | echo "No images to push" |
Scott Baker | 9ac2371 | 2019-10-02 09:26:50 -0700 | [diff] [blame] | 191 | fi |
| 192 | |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 193 | for I in \$IMAGES |
| 194 | do |
| 195 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 196 | done |
| 197 | |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 198 | if [ "${gerritProject}" = "voltha-helm-charts" ]; then |
Andy Bavier | 4540634 | 2019-10-02 16:45:40 -0700 | [diff] [blame] | 199 | export CHART_PATH=$WORKSPACE/voltha/voltha-helm-charts |
| 200 | export VOLTHA_CHART=\$CHART_PATH/voltha |
| 201 | export VOLTHA_ADAPTER_OPEN_OLT_CHART=\$CHART_PATH/voltha-adapter-openolt |
| 202 | export VOLTHA_ADAPTER_OPEN_ONU_CHART=\$CHART_PATH/voltha-adapter-openonu |
Kailash Khalasi | af3a2a6 | 2019-10-02 09:44:08 -0700 | [diff] [blame] | 203 | helm dep update \$VOLTHA_CHART |
| 204 | helm dep update \$VOLTHA_ADAPTER_OPEN_OLT_CHART |
| 205 | helm dep update \$VOLTHA_ADAPTER_OPEN_ONU_CHART |
| 206 | fi |
| 207 | |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 208 | if [ "${gerritProject}" = "voltctl" ]; then |
| 209 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltha/voltctl/VERSION) |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 210 | cp $WORKSPACE/voltha/voltctl/voltctl $WORKSPACE/voltha/kind-voltha/bin/voltctl |
| 211 | md5sum $WORKSPACE/voltha/kind-voltha/bin/voltctl |
Andy Bavier | 178c47b | 2020-04-01 13:05:43 -0700 | [diff] [blame] | 212 | fi |
| 213 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 214 | printenv |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 215 | kail -n voltha -n default > $WORKSPACE/onos-voltha-combined.log & |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 216 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 217 | cd $WORKSPACE/voltha/kind-voltha/ |
| 218 | ./voltha up |
| 219 | |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 220 | # $NAME-env.sh contains the environment we used |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 221 | # Save value of EXTRA_HELM_FLAGS there to use in subsequent stages |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 222 | echo export EXTRA_HELM_FLAGS=\\"\$EXTRA_HELM_FLAGS\\" >> $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 223 | |
| 224 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 225 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 226 | |
| 227 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 228 | # like running through the ATT workflow for a single subscriber. |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 229 | export TARGET=sanity-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 230 | |
| 231 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 232 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 233 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 234 | REGEX="functional tests" |
| 235 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 236 | TARGET=functional-single-kind |
Andy Bavier | db00308 | 2020-02-04 11:57:36 -0700 | [diff] [blame] | 237 | fi |
| 238 | |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 239 | make -C $WORKSPACE/voltha/voltha-system-tests \$TARGET || true |
| 240 | ''' |
| 241 | } |
| 242 | } |
| 243 | |
| 244 | stage('DT workflow') { |
| 245 | environment { |
| 246 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 247 | } |
| 248 | steps { |
| 249 | sh ''' |
| 250 | cd $WORKSPACE/voltha/kind-voltha/ |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 251 | source $NAME-env.sh |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 252 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 253 | |
| 254 | # Workflow-specific flags |
| 255 | export WITH_RADIUS=no |
| 256 | export WITH_EAPOL=no |
| 257 | export WITH_DHCP=no |
| 258 | export WITH_IGMP=no |
Matteo Scandolo | 3d6a21d | 2020-09-04 07:34:24 -0700 | [diff] [blame] | 259 | export CONFIG_SADIS="external" |
| 260 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 261 | |
| 262 | DEPLOY_K8S=n ./voltha up |
| 263 | |
| 264 | mkdir -p $ROBOT_LOGS_DIR |
Andy Bavier | d987004 | 2020-06-23 13:16:47 -0700 | [diff] [blame] | 265 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 266 | |
| 267 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 268 | # like running through the DT workflow for a single subscriber. |
| 269 | export TARGET=sanity-kind-dt |
| 270 | |
| 271 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 272 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 273 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 274 | REGEX="functional tests" |
| 275 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 276 | TARGET=functional-single-kind-dt |
| 277 | fi |
| 278 | |
| 279 | make -C $WORKSPACE/voltha/voltha-system-tests \$TARGET || true |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 280 | ''' |
| 281 | } |
| 282 | } |
Matteo Scandolo | 294133a | 2020-09-04 11:19:43 -0700 | [diff] [blame] | 283 | |
| 284 | stage('TT workflow') { |
| 285 | environment { |
| 286 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 287 | } |
| 288 | steps { |
| 289 | sh ''' |
| 290 | cd $WORKSPACE/voltha/kind-voltha/ |
| 291 | source $NAME-env.sh |
| 292 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 293 | |
| 294 | # Workflow-specific flags |
| 295 | export WITH_RADIUS=no |
| 296 | export WITH_EAPOL=no |
| 297 | export WITH_DHCP=yes |
| 298 | export WITH_IGMP=yes |
| 299 | export CONFIG_SADIS="external" |
| 300 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
| 301 | |
| 302 | DEPLOY_K8S=n ./voltha up |
| 303 | |
| 304 | mkdir -p $ROBOT_LOGS_DIR |
| 305 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 306 | |
| 307 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 308 | # like running through the TT workflow for a single subscriber. |
| 309 | export TARGET=sanity-kind-tt |
| 310 | |
| 311 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 312 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 313 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 314 | REGEX="functional tests" |
| 315 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 316 | TARGET=functional-single-kind-tt |
| 317 | fi |
| 318 | |
| 319 | make -C $WORKSPACE/voltha/voltha-system-tests \$TARGET || true |
| 320 | ''' |
| 321 | } |
| 322 | } |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 323 | } |
| 324 | |
| 325 | post { |
| 326 | always { |
| 327 | sh ''' |
Andy Bavier | 07615f9 | 2019-10-03 12:31:18 -0700 | [diff] [blame] | 328 | set +e |
Matteo Scandolo | 39045a9 | 2020-07-29 08:58:29 -0700 | [diff] [blame] | 329 | cp $WORKSPACE/voltha/kind-voltha/install-$NAME.log $WORKSPACE/ |
Matteo Scandolo | 97b1257 | 2020-04-13 12:44:46 -0700 | [diff] [blame] | 330 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 331 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.imageID}{'\\n'}" | sort | uniq |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 332 | kubectl get nodes -o wide |
| 333 | kubectl get pods -o wide |
| 334 | kubectl get pods -n voltha -o wide |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 335 | |
| 336 | sync |
| 337 | pkill kail || true |
Andy Bavier | b5c8caf | 2020-04-06 14:12:07 -0700 | [diff] [blame] | 338 | md5sum $WORKSPACE/voltha/kind-voltha/bin/voltctl |
Andy Bavier | 4af0272 | 2020-01-15 10:24:24 -0700 | [diff] [blame] | 339 | |
| 340 | ## Pull out errors from log files |
| 341 | extract_errors_go() { |
| 342 | echo |
| 343 | echo "Error summary for $1:" |
| 344 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 345 | echo |
| 346 | } |
| 347 | |
| 348 | extract_errors_python() { |
| 349 | echo |
| 350 | echo "Error summary for $1:" |
| 351 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 352 | echo |
| 353 | } |
| 354 | |
| 355 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 356 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 357 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 358 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 359 | |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 360 | gzip $WORKSPACE/onos-voltha-combined.log |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 361 | ''' |
| 362 | step([$class: 'RobotPublisher', |
| 363 | disableArchiveOutput: false, |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 364 | logFileName: 'RobotLogs/*/log*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 365 | otherFiles: '', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 366 | outputFileName: 'RobotLogs/*/output*.xml', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 367 | outputPath: '.', |
Andy Bavier | 8b118b7 | 2020-04-28 12:59:30 -0700 | [diff] [blame] | 368 | passThreshold: 100, |
| 369 | reportFileName: 'RobotLogs/*/report*.html', |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 370 | unstableThreshold: 0]); |
Andy Bavier | 2178d10 | 2020-02-06 16:22:11 -0700 | [diff] [blame] | 371 | archiveArtifacts artifacts: '*.log,*.gz' |
Kailash | aad7101 | 2019-08-27 10:36:53 -0700 | [diff] [blame] | 372 | } |
| 373 | } |
| 374 | } |