Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -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 { |
| 23 | label "${params.buildNode}" |
| 24 | } |
| 25 | options { |
| 26 | timeout(time: 90, unit: 'MINUTES') |
| 27 | } |
| 28 | environment { |
| 29 | KUBECONFIG="$HOME/.kube/kind-config-voltha-minimal" |
| 30 | VOLTCONFIG="$HOME/.volt/config-minimal" |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 31 | 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" |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 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" |
Andrea Campanella | a0cd5be | 2020-09-07 15:47:18 +0200 | [diff] [blame] | 39 | CONFIG_SADIS="external" |
| 40 | BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 41 | ROBOT_MISC_ARGS="-d $WORKSPACE/RobotLogs" |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 42 | EXTRA_HELM_FLAGS=" --set global.image_registry=mirror.registry.opennetworking.org/ --set defaults.image_registry=mirror.registry.opennetworking.org/ " |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 43 | } |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 44 | stages { |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 45 | stage('Clone kind-voltha') { |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 46 | steps { |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 47 | checkout([ |
| 48 | $class: 'GitSCM', |
| 49 | userRemoteConfigs: [[ |
| 50 | url: "https://gerrit.opencord.org/kind-voltha", |
| 51 | refspec: "${kindVolthaChange}" |
| 52 | ]], |
| 53 | branches: [[ name: "master", ]], |
| 54 | extensions: [ |
| 55 | [$class: 'WipeWorkspace'], |
| 56 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "kind-voltha"], |
| 57 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 58 | ], |
| 59 | ]) |
| 60 | sh """ |
| 61 | if [ '${kindVolthaChange}' != '' ] ; then |
| 62 | cd $WORKSPACE/kind-voltha |
| 63 | git fetch https://gerrit.opencord.org/kind-voltha ${kindVolthaChange} && git checkout FETCH_HEAD |
| 64 | fi |
| 65 | """ |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 66 | } |
| 67 | } |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 68 | stage('Clone voltha-system-tests') { |
| 69 | steps { |
| 70 | checkout([ |
| 71 | $class: 'GitSCM', |
| 72 | userRemoteConfigs: [[ |
| 73 | url: "https://gerrit.opencord.org/voltha-system-tests", |
| 74 | refspec: "${volthaSystemTestsChange}" |
| 75 | ]], |
| 76 | branches: [[ name: "${branch}", ]], |
| 77 | extensions: [ |
| 78 | [$class: 'WipeWorkspace'], |
| 79 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "voltha-system-tests"], |
| 80 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 81 | ], |
| 82 | ]) |
| 83 | sh """ |
| 84 | if [ '${volthaSystemTestsChange}' != '' ] ; then |
| 85 | cd $WORKSPACE/voltha-system-tests |
| 86 | git fetch https://gerrit.opencord.org/voltha-system-tests ${volthaSystemTestsChange} && git checkout FETCH_HEAD |
| 87 | fi |
| 88 | """ |
| 89 | } |
| 90 | } |
| 91 | // If the repo under test is not kind-voltha |
| 92 | // then download it and checkout the patch |
| 93 | stage('Download Patch') { |
| 94 | when { |
| 95 | expression { |
| 96 | return "${gerritProject}" != 'kind-voltha'; |
| 97 | } |
| 98 | } |
| 99 | steps { |
| 100 | checkout([ |
| 101 | $class: 'GitSCM', |
| 102 | userRemoteConfigs: [[ |
| 103 | url: "https://gerrit.opencord.org/${gerritProject}", |
| 104 | refspec: "${gerritRefspec}" |
| 105 | ]], |
| 106 | branches: [[ name: "${branch}", ]], |
| 107 | extensions: [ |
| 108 | [$class: 'WipeWorkspace'], |
| 109 | [$class: 'RelativeTargetDirectory', relativeTargetDir: "${gerritProject}"], |
| 110 | [$class: 'CloneOption', depth: 0, noTags: false, reference: '', shallow: false], |
| 111 | ], |
| 112 | ]) |
| 113 | sh """ |
| 114 | pushd $WORKSPACE/${gerritProject} |
| 115 | git fetch https://gerrit.opencord.org/${gerritProject} ${gerritRefspec} && git checkout FETCH_HEAD |
| 116 | echo "Currently on commit: \n" |
| 117 | git log -1 --oneline |
| 118 | popd |
| 119 | """ |
| 120 | } |
| 121 | } |
| 122 | // If the repo under test is kind-voltha we don't need to download it again, |
| 123 | // as we already have it, simply checkout the patch |
| 124 | stage('Checkout kind-voltha patch') { |
| 125 | when { |
| 126 | expression { |
| 127 | return "${gerritProject}" == 'kind-voltha'; |
| 128 | } |
| 129 | } |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 130 | steps { |
| 131 | sh """ |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 132 | cd $WORKSPACE/kind-voltha |
| 133 | git fetch https://gerrit.opencord.org/kind-voltha ${gerritRefspec} && git checkout FETCH_HEAD |
| 134 | """ |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 135 | } |
| 136 | } |
| 137 | stage('Create K8s Cluster') { |
| 138 | steps { |
| 139 | sh """ |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 140 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 141 | |
| 142 | if [ "${branch}" != "master" ]; then |
| 143 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 144 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 145 | else |
| 146 | echo "on master, using default settings for kind-voltha" |
| 147 | fi |
| 148 | |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 149 | JUST_K8S=y ./voltha up |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 150 | bash <( curl -sfL https://raw.githubusercontent.com/boz/kail/master/godownloader.sh) -b "$WORKSPACE/kind-voltha/bin" |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 151 | """ |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | stage('Build Images') { |
| 156 | steps { |
| 157 | sh """ |
Matteo Scandolo | 4adf119 | 2020-12-15 09:44:14 -1000 | [diff] [blame] | 158 | make -C $WORKSPACE/voltha-openonu-adapter-go DOCKER_REGISTRY=mirror.registry.opennetworking.org/ DOCKER_REPOSITORY=voltha/ DOCKER_TAG=citest docker-build |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 159 | """ |
| 160 | } |
| 161 | } |
| 162 | |
| 163 | stage('Push Images') { |
| 164 | steps { |
| 165 | sh ''' |
| 166 | docker images | grep citest |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 167 | 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-control-plane,voltha-\$NAME-worker,voltha-\$NAME-worker2; done |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 168 | ''' |
| 169 | } |
| 170 | } |
| 171 | stage('Deploy Voltha') { |
| 172 | steps { |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 173 | sh """ |
TorstenThieme | 326e797 | 2021-01-19 14:27:59 +0000 | [diff] [blame] | 174 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 175 | |
| 176 | IMAGES="adapter_open_onu_go" |
| 177 | |
| 178 | for I in \$IMAGES |
| 179 | do |
| 180 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 181 | done |
| 182 | |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 183 | cd $WORKSPACE/kind-voltha/ |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 184 | echo \$EXTRA_HELM_FLAGS |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 185 | |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 186 | if [ "${branch}" != "master" ]; then |
| 187 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 188 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 189 | else |
| 190 | echo "on master, using default settings for kind-voltha" |
| 191 | fi |
| 192 | |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 193 | ./voltha up |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 194 | """ |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 195 | } |
| 196 | } |
| 197 | |
Andrea Campanella | a2f32c3 | 2020-12-17 18:30:47 +0100 | [diff] [blame] | 198 | stage('Run E2E Tests 1t8gem') { |
| 199 | environment { |
| 200 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/1t8gem" |
| 201 | } |
| 202 | steps { |
| 203 | sh ''' |
| 204 | cd $WORKSPACE/kind-voltha/ |
Andrea Campanella | a2f32c3 | 2020-12-17 18:30:47 +0100 | [diff] [blame] | 205 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 206 | |
TorstenThieme | 326e797 | 2021-01-19 14:27:59 +0000 | [diff] [blame] | 207 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Andrea Campanella | a2f32c3 | 2020-12-17 18:30:47 +0100 | [diff] [blame] | 208 | |
| 209 | IMAGES="adapter_open_onu_go" |
| 210 | |
| 211 | for I in \$IMAGES |
| 212 | do |
| 213 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 214 | done |
| 215 | #1t8gem |
| 216 | mkdir -p $WORKSPACE/1t8gem |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 217 | _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log & |
| 218 | |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 219 | if [ "${branch}" != "master" ]; then |
| 220 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 221 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 222 | else |
| 223 | echo "on master, using default settings for kind-voltha" |
| 224 | fi |
| 225 | |
Andrea Campanella | a2f32c3 | 2020-12-17 18:30:47 +0100 | [diff] [blame] | 226 | DEPLOY_K8S=n ./voltha up |
| 227 | |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 228 | mkdir -p $ROBOT_LOGS_DIR/1t8gem |
Andrea Campanella | a2f32c3 | 2020-12-17 18:30:47 +0100 | [diff] [blame] | 229 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 230 | export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test |
Andrea Campanella | 71bb910 | 2021-01-28 11:24:56 +0100 | [diff] [blame] | 231 | |
| 232 | if [ "${branch}" != "voltha-2.6" ]; then |
TorstenThieme | 41c0863 | 2021-02-11 11:08:18 +0000 | [diff] [blame] | 233 | export KVSTOREPREFIX=voltha_voltha |
Andrea Campanella | 71bb910 | 2021-01-28 11:24:56 +0100 | [diff] [blame] | 234 | fi |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 235 | |
| 236 | make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true |
| 237 | |
| 238 | # stop logging |
| 239 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')" |
| 240 | if [ -n "$P_IDS" ]; then |
| 241 | echo $P_IDS |
| 242 | for P_ID in $P_IDS; do |
| 243 | kill -9 $P_ID |
| 244 | done |
| 245 | fi |
| 246 | |
| 247 | # get pods information |
| 248 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 249 | ''' |
| 250 | } |
| 251 | } |
Andrea Campanella | 40ff56f | 2020-05-11 15:22:29 +0200 | [diff] [blame] | 252 | |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 253 | stage('DT workflow') { |
| 254 | environment { |
| 255 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 256 | } |
| 257 | steps { |
| 258 | sh ''' |
| 259 | cd $WORKSPACE/kind-voltha/ |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 260 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 261 | |
TorstenThieme | 326e797 | 2021-01-19 14:27:59 +0000 | [diff] [blame] | 262 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 263 | |
| 264 | IMAGES="adapter_open_onu_go" |
| 265 | |
| 266 | for I in \$IMAGES |
| 267 | do |
| 268 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 269 | done |
| 270 | |
| 271 | # Workflow-specific flags |
| 272 | export WITH_RADIUS=no |
| 273 | export WITH_EAPOL=no |
| 274 | export WITH_DHCP=no |
| 275 | export WITH_IGMP=no |
| 276 | export CONFIG_SADIS="external" |
| 277 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
| 278 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 279 | # start logging |
| 280 | mkdir -p $WORKSPACE/dt |
| 281 | _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log & |
| 282 | |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 283 | if [ "${branch}" != "master" ]; then |
| 284 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 285 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 286 | else |
| 287 | echo "on master, using default settings for kind-voltha" |
| 288 | fi |
| 289 | |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 290 | DEPLOY_K8S=n ./voltha up |
| 291 | |
| 292 | mkdir -p $ROBOT_LOGS_DIR |
| 293 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 294 | |
| 295 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 296 | # like running through the DT workflow for a single subscriber. |
| 297 | export TARGET=sanity-kind-dt |
| 298 | |
| 299 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 300 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 301 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 302 | REGEX="functional tests" |
| 303 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 304 | TARGET=functional-single-kind-dt |
| 305 | fi |
| 306 | |
| 307 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 308 | |
| 309 | # stop logging |
| 310 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')" |
| 311 | if [ -n "$P_IDS" ]; then |
| 312 | echo $P_IDS |
| 313 | for P_ID in $P_IDS; do |
| 314 | kill -9 $P_ID |
| 315 | done |
| 316 | fi |
| 317 | |
| 318 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 319 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/dt/pods.txt || true |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 320 | ''' |
| 321 | } |
| 322 | } |
| 323 | |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 324 | stage('ATT workflow') { |
| 325 | environment { |
| 326 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 327 | } |
| 328 | steps { |
| 329 | sh ''' |
| 330 | cd $WORKSPACE/kind-voltha/ |
| 331 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 332 | |
TorstenThieme | 326e797 | 2021-01-19 14:27:59 +0000 | [diff] [blame] | 333 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 334 | |
| 335 | IMAGES="adapter_open_onu_go" |
| 336 | |
| 337 | for I in \$IMAGES |
| 338 | do |
| 339 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 340 | done |
| 341 | |
| 342 | # Workflow-specific flags |
| 343 | export WITH_RADIUS=yes |
| 344 | export WITH_EAPOL=yes |
| 345 | export WITH_BBSIM=yes |
| 346 | export DEPLOY_K8S=yes |
| 347 | export CONFIG_SADIS="external" |
| 348 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
| 349 | |
| 350 | if [ "${gerritProject}" = "voltctl" ]; then |
| 351 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION) |
| 352 | cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl |
| 353 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
| 354 | fi |
| 355 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 356 | # start logging |
| 357 | mkdir -p $WORKSPACE/att |
| 358 | _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log & |
| 359 | |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 360 | if [ "${branch}" != "master" ]; then |
| 361 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 362 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 363 | else |
| 364 | echo "on master, using default settings for kind-voltha" |
| 365 | fi |
| 366 | |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 367 | DEPLOY_K8S=n ./voltha up |
| 368 | |
| 369 | mkdir -p $ROBOT_LOGS_DIR |
| 370 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 371 | |
| 372 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 373 | # like running through the ATT workflow for a single subscriber. |
| 374 | export TARGET=sanity-single-kind |
| 375 | |
| 376 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 377 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 378 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 379 | REGEX="functional tests" |
| 380 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 381 | TARGET=functional-single-kind |
| 382 | fi |
| 383 | |
| 384 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 385 | |
| 386 | # stop logging |
| 387 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 388 | if [ -n "$P_IDS" ]; then |
| 389 | echo $P_IDS |
| 390 | for P_ID in $P_IDS; do |
| 391 | kill -9 $P_ID |
| 392 | done |
| 393 | fi |
| 394 | |
| 395 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 396 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/att/pods.txt || true |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 397 | ''' |
| 398 | } |
| 399 | } |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 400 | |
| 401 | stage('TT workflow') { |
| 402 | environment { |
| 403 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 404 | } |
| 405 | steps { |
| 406 | sh ''' |
| 407 | cd $WORKSPACE/kind-voltha/ |
| 408 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 409 | |
TorstenThieme | 326e797 | 2021-01-19 14:27:59 +0000 | [diff] [blame] | 410 | export EXTRA_HELM_FLAGS+="--set log_agent.enabled=False ${extraHelmFlags} " |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 411 | |
| 412 | IMAGES="adapter_open_onu_go" |
| 413 | |
| 414 | for I in \$IMAGES |
| 415 | do |
| 416 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 417 | done |
| 418 | |
| 419 | # Workflow-specific flags |
| 420 | export WITH_RADIUS=no |
| 421 | export WITH_EAPOL=no |
| 422 | export WITH_DHCP=yes |
| 423 | export WITH_IGMP=yes |
| 424 | export CONFIG_SADIS="external" |
| 425 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
| 426 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 427 | # start logging |
| 428 | mkdir -p $WORKSPACE/tt |
| 429 | _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log & |
| 430 | |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 431 | if [ "${branch}" != "master" ]; then |
| 432 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
| 433 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
| 434 | else |
| 435 | echo "on master, using default settings for kind-voltha" |
| 436 | fi |
| 437 | |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 438 | DEPLOY_K8S=n ./voltha up |
| 439 | |
| 440 | mkdir -p $ROBOT_LOGS_DIR |
| 441 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 442 | |
| 443 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 444 | # like running through the TT workflow for a single subscriber. |
| 445 | export TARGET=sanity-kind-tt |
| 446 | |
| 447 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 448 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 449 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 450 | REGEX="functional tests" |
| 451 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 452 | TARGET=functional-single-kind-tt |
| 453 | fi |
| 454 | |
| 455 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 456 | |
| 457 | # stop logging |
| 458 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-tt" | grep -v grep | awk '{print $1}')" |
| 459 | if [ -n "$P_IDS" ]; then |
| 460 | echo $P_IDS |
| 461 | for P_ID in $P_IDS; do |
| 462 | kill -9 $P_ID |
| 463 | done |
| 464 | fi |
| 465 | |
| 466 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 467 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/tt/pods.txt || true |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 468 | ''' |
| 469 | } |
| 470 | } |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 471 | } |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 472 | post { |
| 473 | always { |
| 474 | sh ''' |
| 475 | set +e |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 476 | # get pods information |
Matteo Scandolo | 697b8b8 | 2021-01-27 13:07:59 -0800 | [diff] [blame] | 477 | kubectl get pods -o wide --all-namespaces |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 478 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" |
| 479 | helm ls |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 480 | |
| 481 | sync |
| 482 | pkill kail || true |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 483 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 484 | |
| 485 | ## Pull out errors from log files |
| 486 | extract_errors_go() { |
| 487 | echo |
| 488 | echo "Error summary for $1:" |
| 489 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 490 | echo |
| 491 | } |
| 492 | |
| 493 | extract_errors_python() { |
| 494 | echo |
| 495 | echo "Error summary for $1:" |
| 496 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 497 | echo |
| 498 | } |
| 499 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 500 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log || true |
| 501 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log || true |
| 502 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log || true |
| 503 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log || true |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 504 | |
Matteo Scandolo | 7eba41c | 2020-12-15 08:59:36 -1000 | [diff] [blame] | 505 | gzip $WORKSPACE/onos-voltha-combined.log || true |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 506 | ''' |
Andrea Campanella | 40ff56f | 2020-05-11 15:22:29 +0200 | [diff] [blame] | 507 | step([$class: 'RobotPublisher', |
| 508 | disableArchiveOutput: false, |
| 509 | logFileName: 'RobotLogs/*/log*.html', |
| 510 | otherFiles: '', |
| 511 | outputFileName: 'RobotLogs/*/output*.xml', |
| 512 | outputPath: '.', |
| 513 | passThreshold: 100, |
| 514 | reportFileName: 'RobotLogs/*/report*.html', |
| 515 | unstableThreshold: 0]); |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 516 | archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt' |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 517 | } |
| 518 | } |
| 519 | } |