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