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