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