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