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 |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 189 | mkdir -p $WORKSPACE/1t1gem |
| 190 | _TAG=kail-1t1gem kail -n voltha -n default > $WORKSPACE/1t1gem/onos-voltha-combined.log & |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 191 | |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 192 | mkdir -p $ROBOT_LOGS_DIR/1t1gem |
| 193 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR/1t1gem" |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 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 | # stop logging |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 199 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t1gem" | grep -v grep | awk '{print $1}')" |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 200 | if [ -n "$P_IDS" ]; then |
| 201 | echo $P_IDS |
| 202 | for P_ID in $P_IDS; do |
| 203 | kill -9 $P_ID |
| 204 | done |
| 205 | fi |
| 206 | |
| 207 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 208 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t1gem/pods.txt || true |
| 209 | |
| 210 | _TAG=kail-1t8gem kail -n voltha -n default > $WORKSPACE/1t8gem/onos-voltha-combined.log & |
| 211 | |
| 212 | mkdir -p $ROBOT_LOGS_DIR/1t8gem |
| 213 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR/1t8gem" |
| 214 | export TARGET_1T8GEM=1t8gem-openonu-go-adapter-test |
| 215 | |
| 216 | make -C $WORKSPACE/voltha-system-tests \$TARGET_1T8GEM || true |
| 217 | |
| 218 | # stop logging |
| 219 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-1t8gem" | grep -v grep | awk '{print $1}')" |
| 220 | if [ -n "$P_IDS" ]; then |
| 221 | echo $P_IDS |
| 222 | for P_ID in $P_IDS; do |
| 223 | kill -9 $P_ID |
| 224 | done |
| 225 | fi |
| 226 | |
| 227 | # get pods information |
| 228 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/1t8gem/pods.txt || true |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 229 | ''' |
| 230 | } |
| 231 | } |
Andrea Campanella | 40ff56f | 2020-05-11 15:22:29 +0200 | [diff] [blame] | 232 | |
TorstenThieme | 0a0fc52 | 2020-10-08 10:31:29 +0000 | [diff] [blame] | 233 | stage('Run MIB Upload Tests') { |
| 234 | environment { |
| 235 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/openonu-go-MIB" |
| 236 | } |
| 237 | steps { |
| 238 | sh ''' |
| 239 | cd $WORKSPACE/kind-voltha/ |
| 240 | #source $NAME-env.sh |
| 241 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 242 | |
| 243 | export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} " |
| 244 | |
Andrea Campanella | 12146d5 | 2020-10-13 23:35:17 +0200 | [diff] [blame] | 245 | export EXTRA_HELM_FLAGS+="--set pon=2,onu=2,controlledActivation=only-onu " |
TorstenThieme | 0a0fc52 | 2020-10-08 10:31:29 +0000 | [diff] [blame] | 246 | |
| 247 | IMAGES="adapter_open_onu_go" |
| 248 | |
| 249 | for I in \$IMAGES |
| 250 | do |
| 251 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 252 | done |
| 253 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 254 | # start logging |
| 255 | mkdir -p $WORKSPACE/mib |
| 256 | _TAG=kail-mib kail -n voltha -n default > $WORKSPACE/mib/onos-voltha-combined.log & |
| 257 | |
TorstenThieme | 0a0fc52 | 2020-10-08 10:31:29 +0000 | [diff] [blame] | 258 | DEPLOY_K8S=n ./voltha up |
| 259 | |
| 260 | mkdir -p $ROBOT_LOGS_DIR |
| 261 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR" |
| 262 | export TARGET_DEFAULT=mib-upload-templating-openonu-go-adapter-test |
| 263 | |
| 264 | make -C $WORKSPACE/voltha-system-tests \$TARGET_DEFAULT || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 265 | |
| 266 | # stop logging |
| 267 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-mib" | grep -v grep | awk '{print $1}')" |
| 268 | if [ -n "$P_IDS" ]; then |
| 269 | echo $P_IDS |
| 270 | for P_ID in $P_IDS; do |
| 271 | kill -9 $P_ID |
| 272 | done |
| 273 | fi |
| 274 | |
| 275 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 276 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/mib/pods.txt || true |
TorstenThieme | 0a0fc52 | 2020-10-08 10:31:29 +0000 | [diff] [blame] | 277 | ''' |
| 278 | } |
| 279 | } |
| 280 | |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 281 | stage('DT workflow') { |
| 282 | environment { |
| 283 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/DTWorkflow" |
| 284 | } |
| 285 | steps { |
| 286 | sh ''' |
| 287 | cd $WORKSPACE/kind-voltha/ |
| 288 | #source $NAME-env.sh |
| 289 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 290 | |
| 291 | export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} " |
| 292 | |
| 293 | IMAGES="adapter_open_onu_go" |
| 294 | |
| 295 | for I in \$IMAGES |
| 296 | do |
| 297 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 298 | done |
| 299 | |
| 300 | # Workflow-specific flags |
| 301 | export WITH_RADIUS=no |
| 302 | export WITH_EAPOL=no |
| 303 | export WITH_DHCP=no |
| 304 | export WITH_IGMP=no |
| 305 | export CONFIG_SADIS="external" |
| 306 | export BBSIM_CFG="configs/bbsim-sadis-dt.yaml" |
| 307 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 308 | # start logging |
| 309 | mkdir -p $WORKSPACE/dt |
| 310 | _TAG=kail-dt kail -n voltha -n default > $WORKSPACE/dt/onos-voltha-combined.log & |
| 311 | |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 312 | DEPLOY_K8S=n ./voltha up |
| 313 | |
| 314 | mkdir -p $ROBOT_LOGS_DIR |
| 315 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 316 | |
| 317 | # By default, all tests tagged 'sanityDt' are run. This covers basic functionality |
| 318 | # like running through the DT workflow for a single subscriber. |
| 319 | export TARGET=sanity-kind-dt |
| 320 | |
| 321 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 322 | # functional test suite. This covers tests tagged either 'sanityDt' or 'functionalDt'. |
| 323 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 324 | REGEX="functional tests" |
| 325 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 326 | TARGET=functional-single-kind-dt |
| 327 | fi |
| 328 | |
| 329 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 330 | |
| 331 | # stop logging |
| 332 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-dt" | grep -v grep | awk '{print $1}')" |
| 333 | if [ -n "$P_IDS" ]; then |
| 334 | echo $P_IDS |
| 335 | for P_ID in $P_IDS; do |
| 336 | kill -9 $P_ID |
| 337 | done |
| 338 | fi |
| 339 | |
| 340 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 341 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/dt/pods.txt || true |
TorstenThieme | 987a730 | 2020-09-23 08:54:58 +0000 | [diff] [blame] | 342 | ''' |
| 343 | } |
| 344 | } |
| 345 | |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 346 | stage('ATT workflow') { |
| 347 | environment { |
| 348 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/ATTWorkflow" |
| 349 | } |
| 350 | steps { |
| 351 | sh ''' |
| 352 | cd $WORKSPACE/kind-voltha/ |
| 353 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 354 | |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 355 | export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} " |
| 356 | |
| 357 | IMAGES="adapter_open_onu_go" |
| 358 | |
| 359 | for I in \$IMAGES |
| 360 | do |
| 361 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 362 | done |
| 363 | |
| 364 | # Workflow-specific flags |
| 365 | export WITH_RADIUS=yes |
| 366 | export WITH_EAPOL=yes |
| 367 | export WITH_BBSIM=yes |
| 368 | export DEPLOY_K8S=yes |
| 369 | export CONFIG_SADIS="external" |
| 370 | export BBSIM_CFG="configs/bbsim-sadis-att.yaml" |
| 371 | |
| 372 | if [ "${gerritProject}" = "voltctl" ]; then |
| 373 | export VOLTCTL_VERSION=$(cat $WORKSPACE/voltctl/VERSION) |
| 374 | cp $WORKSPACE/voltctl/voltctl $WORKSPACE/kind-voltha/bin/voltctl |
| 375 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
| 376 | fi |
| 377 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 378 | # start logging |
| 379 | mkdir -p $WORKSPACE/att |
| 380 | _TAG=kail-att kail -n voltha -n default > $WORKSPACE/att/onos-voltha-combined.log & |
| 381 | |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 382 | DEPLOY_K8S=n ./voltha up |
| 383 | |
| 384 | mkdir -p $ROBOT_LOGS_DIR |
| 385 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 386 | |
| 387 | # By default, all tests tagged 'sanity' are run. This covers basic functionality |
| 388 | # like running through the ATT workflow for a single subscriber. |
| 389 | export TARGET=sanity-single-kind |
| 390 | |
| 391 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 392 | # functional test suite. This covers tests tagged either 'sanity' or 'functional'. |
| 393 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 394 | REGEX="functional tests" |
| 395 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 396 | TARGET=functional-single-kind |
| 397 | fi |
| 398 | |
| 399 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 400 | |
| 401 | # stop logging |
| 402 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-att" | grep -v grep | awk '{print $1}')" |
| 403 | if [ -n "$P_IDS" ]; then |
| 404 | echo $P_IDS |
| 405 | for P_ID in $P_IDS; do |
| 406 | kill -9 $P_ID |
| 407 | done |
| 408 | fi |
| 409 | |
| 410 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 411 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/att/pods.txt || true |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 412 | ''' |
| 413 | } |
| 414 | } |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 415 | |
| 416 | stage('TT workflow') { |
| 417 | environment { |
| 418 | ROBOT_LOGS_DIR="$WORKSPACE/RobotLogs/TTWorkflow" |
| 419 | } |
| 420 | steps { |
| 421 | sh ''' |
| 422 | cd $WORKSPACE/kind-voltha/ |
| 423 | WAIT_ON_DOWN=y DEPLOY_K8S=n ./voltha down |
| 424 | |
| 425 | export EXTRA_HELM_FLAGS+="--set use_openonu_adapter_go=true,log_agent.enabled=False ${extraHelmFlags} " |
| 426 | |
| 427 | IMAGES="adapter_open_onu_go" |
| 428 | |
| 429 | for I in \$IMAGES |
| 430 | do |
| 431 | EXTRA_HELM_FLAGS+="--set images.\$I.tag=citest,images.\$I.pullPolicy=Never " |
| 432 | done |
| 433 | |
| 434 | # Workflow-specific flags |
| 435 | export WITH_RADIUS=no |
| 436 | export WITH_EAPOL=no |
| 437 | export WITH_DHCP=yes |
| 438 | export WITH_IGMP=yes |
| 439 | export CONFIG_SADIS="external" |
| 440 | export BBSIM_CFG="configs/bbsim-sadis-tt.yaml" |
| 441 | |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 442 | # start logging |
| 443 | mkdir -p $WORKSPACE/tt |
| 444 | _TAG=kail-tt kail -n voltha -n default > $WORKSPACE/tt/onos-voltha-combined.log & |
| 445 | |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 446 | DEPLOY_K8S=n ./voltha up |
| 447 | |
| 448 | mkdir -p $ROBOT_LOGS_DIR |
| 449 | export ROBOT_MISC_ARGS="-d $ROBOT_LOGS_DIR -e PowerSwitch" |
| 450 | |
| 451 | # By default, all tests tagged 'sanityTt' are run. This covers basic functionality |
| 452 | # like running through the TT workflow for a single subscriber. |
| 453 | export TARGET=sanity-kind-tt |
| 454 | |
| 455 | # If the Gerrit comment contains a line with "functional tests" then run the full |
| 456 | # functional test suite. This covers tests tagged either 'sanityTt' or 'functionalTt'. |
| 457 | # Note: Gerrit comment text will be prefixed by "Patch set n:" and a blank line |
| 458 | REGEX="functional tests" |
| 459 | if [[ "$GERRIT_EVENT_COMMENT_TEXT" =~ \$REGEX ]]; then |
| 460 | TARGET=functional-single-kind-tt |
| 461 | fi |
| 462 | |
| 463 | make -C $WORKSPACE/voltha-system-tests \$TARGET || true |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 464 | |
| 465 | # stop logging |
| 466 | P_IDS="$(ps e -ww -A | grep "_TAG=kail-tt" | grep -v grep | awk '{print $1}')" |
| 467 | if [ -n "$P_IDS" ]; then |
| 468 | echo $P_IDS |
| 469 | for P_ID in $P_IDS; do |
| 470 | kill -9 $P_ID |
| 471 | done |
| 472 | fi |
| 473 | |
| 474 | # get pods information |
Matteo Scandolo | f566cc4 | 2020-12-11 14:05:29 -0800 | [diff] [blame] | 475 | kubectl get pods -o wide --all-namespaces > $WORKSPACE/tt/pods.txt || true |
Andrea Campanella | 50e3a0b | 2020-10-01 06:28:08 +0000 | [diff] [blame] | 476 | ''' |
| 477 | } |
| 478 | } |
TorstenThieme | 30b7a32 | 2020-09-28 11:13:18 +0000 | [diff] [blame] | 479 | } |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 480 | post { |
| 481 | always { |
| 482 | sh ''' |
| 483 | set +e |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 484 | kubectl get pods --all-namespaces -o jsonpath="{range .items[*].status.containerStatuses[*]}{.image}{'\\n'}" | sort | uniq |
| 485 | 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] | 486 | |
| 487 | sync |
| 488 | pkill kail || true |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 489 | md5sum $WORKSPACE/kind-voltha/bin/voltctl |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 490 | |
| 491 | ## Pull out errors from log files |
| 492 | extract_errors_go() { |
| 493 | echo |
| 494 | echo "Error summary for $1:" |
| 495 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep '"level":"error"' | cut -d ' ' -f 2- | jq -r '.msg' |
| 496 | echo |
| 497 | } |
| 498 | |
| 499 | extract_errors_python() { |
| 500 | echo |
| 501 | echo "Error summary for $1:" |
| 502 | grep $1 $WORKSPACE/onos-voltha-combined.log | grep 'ERROR' | cut -d ' ' -f 2- |
| 503 | echo |
| 504 | } |
| 505 | |
| 506 | extract_errors_go voltha-rw-core > $WORKSPACE/error-report.log |
| 507 | extract_errors_go adapter-open-olt >> $WORKSPACE/error-report.log |
| 508 | extract_errors_python adapter-open-onu >> $WORKSPACE/error-report.log |
| 509 | extract_errors_python voltha-ofagent >> $WORKSPACE/error-report.log |
| 510 | |
| 511 | gzip $WORKSPACE/onos-voltha-combined.log |
| 512 | |
| 513 | |
| 514 | ## shut down kind-voltha |
| 515 | if [ "${branch}" != "master" ]; then |
| 516 | echo "on branch: ${branch}, sourcing kind-voltha/releases/${branch}" |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 517 | source "$WORKSPACE/kind-voltha/releases/${branch}" |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 518 | else |
| 519 | echo "on master, using default settings for kind-voltha" |
| 520 | fi |
| 521 | |
Andrea Campanella | 919361e | 2020-09-21 14:27:19 +0200 | [diff] [blame] | 522 | cd $WORKSPACE/kind-voltha |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 523 | WAIT_ON_DOWN=y ./voltha down |
| 524 | ''' |
Andrea Campanella | 40ff56f | 2020-05-11 15:22:29 +0200 | [diff] [blame] | 525 | step([$class: 'RobotPublisher', |
| 526 | disableArchiveOutput: false, |
| 527 | logFileName: 'RobotLogs/*/log*.html', |
| 528 | otherFiles: '', |
| 529 | outputFileName: 'RobotLogs/*/output*.xml', |
| 530 | outputPath: '.', |
| 531 | passThreshold: 100, |
| 532 | reportFileName: 'RobotLogs/*/report*.html', |
| 533 | unstableThreshold: 0]); |
Matteo Scandolo | aca2762 | 2020-12-11 09:04:07 -0800 | [diff] [blame] | 534 | archiveArtifacts artifacts: '**/*.log,**/*.gz,**/*.txt' |
Matteo Scandolo | fff6e06 | 2020-04-29 13:36:33 -0700 | [diff] [blame] | 535 | } |
| 536 | } |
| 537 | } |