BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
| 4 | # Copyright (C) 2020 Nordix Foundation. All rights reserved. |
| 5 | # ======================================================================== |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # ============LICENSE_END================================================= |
| 18 | # |
| 19 | |
| 20 | |
| 21 | TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency" |
| 22 | |
| 23 | #App names to include in the test, space separated list |
| 24 | INCLUDED_IMAGES="ECS PRODSTUB CR CP" |
| 25 | |
| 26 | #SUPPORTED TEST ENV FILE |
BjornMagnussonXA | de4d0f8 | 2020-11-29 16:04:06 +0100 | [diff] [blame] | 27 | SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY" |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 28 | |
| 29 | . ../common/testcase_common.sh $@ |
| 30 | . ../common/ecs_api_functions.sh |
| 31 | . ../common/prodstub_api_functions.sh |
| 32 | |
| 33 | #### TEST BEGIN #### |
| 34 | |
| 35 | FLAT_A1_EI="1" |
| 36 | |
| 37 | clean_containers |
| 38 | |
| 39 | use_ecs_rest_http |
| 40 | |
| 41 | use_prod_stub_http |
| 42 | |
| 43 | start_ecs |
| 44 | |
| 45 | start_prod_stub |
| 46 | |
| 47 | set_ecs_trace |
| 48 | |
| 49 | start_control_panel |
| 50 | |
| 51 | start_cr |
| 52 | |
| 53 | CB_JOB="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job" |
| 54 | CB_SV="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision" |
| 55 | TARGET="http://localhost:80/target" # Dummy target |
| 56 | |
| 57 | NUM_JOBS=10000 |
| 58 | |
| 59 | # Setup prodstub sim to accept calls for producers, types and jobs |
| 60 | prodstub_arm_producer 200 prod-a |
| 61 | prodstub_arm_producer 200 prod-b |
| 62 | prodstub_arm_producer 200 prod-c |
| 63 | prodstub_arm_producer 200 prod-d |
| 64 | |
| 65 | prodstub_arm_type 200 prod-a type1 |
| 66 | |
| 67 | prodstub_arm_type 200 prod-b type1 |
| 68 | prodstub_arm_type 200 prod-b type2 |
| 69 | |
| 70 | prodstub_arm_type 200 prod-c type1 |
| 71 | prodstub_arm_type 200 prod-c type2 |
| 72 | prodstub_arm_type 200 prod-c type3 |
| 73 | |
| 74 | prodstub_arm_type 200 prod-d type4 |
| 75 | prodstub_arm_type 200 prod-d type5 |
| 76 | |
| 77 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 78 | do |
| 79 | if [ $(($i%5)) -eq 0 ]; then |
| 80 | prodstub_arm_job_create 200 prod-a job$i |
| 81 | prodstub_arm_job_create 200 prod-b job$i |
| 82 | prodstub_arm_job_create 200 prod-c job$i |
| 83 | fi |
| 84 | if [ $(($i%5)) -eq 1 ]; then |
| 85 | prodstub_arm_job_create 200 prod-b job$i |
| 86 | prodstub_arm_job_create 200 prod-c job$i |
| 87 | fi |
| 88 | if [ $(($i%5)) -eq 2 ]; then |
| 89 | prodstub_arm_job_create 200 prod-c job$i |
| 90 | fi |
| 91 | if [ $(($i%5)) -eq 3 ]; then |
| 92 | prodstub_arm_job_create 200 prod-d job$i |
| 93 | fi |
| 94 | if [ $(($i%5)) -eq 4 ]; then |
| 95 | prodstub_arm_job_create 200 prod-d job$i |
| 96 | fi |
| 97 | done |
| 98 | |
| 99 | ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json |
| 100 | |
| 101 | ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json |
| 102 | |
| 103 | ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json |
| 104 | |
| 105 | ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json |
| 106 | |
| 107 | ecs_equal json:ei-producer/v1/eiproducers 4 |
| 108 | |
| 109 | ecs_api_edp_get_producer_status 200 prod-a ENABLED |
| 110 | ecs_api_edp_get_producer_status 200 prod-b ENABLED |
| 111 | ecs_api_edp_get_producer_status 200 prod-c ENABLED |
| 112 | ecs_api_edp_get_producer_status 200 prod-d ENABLED |
| 113 | |
| 114 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 115 | do |
| 116 | if [ $(($i%5)) -eq 0 ]; then |
| 117 | ecs_api_a1_put_job 201 job$i type1 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json |
| 118 | if [ -z "$FLAT_A1_EI" ]; then |
| 119 | ecs_api_a1_get_job_status 200 type1 job$i ENABLED |
| 120 | else |
| 121 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 122 | fi |
| 123 | fi |
| 124 | if [ $(($i%5)) -eq 1 ]; then |
| 125 | ecs_api_a1_put_job 201 job$i type2 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json |
| 126 | if [ -z "$FLAT_A1_EI" ]; then |
| 127 | ecs_api_a1_get_job_status 200 type2 job$i ENABLED |
| 128 | else |
| 129 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 130 | fi |
| 131 | fi |
| 132 | if [ $(($i%5)) -eq 2 ]; then |
| 133 | ecs_api_a1_put_job 201 job$i type3 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json |
| 134 | if [ -z "$FLAT_A1_EI" ]; then |
| 135 | ecs_api_a1_get_job_status 200 type3 job$i ENABLED |
| 136 | else |
| 137 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 138 | fi |
| 139 | fi |
| 140 | if [ $(($i%5)) -eq 3 ]; then |
| 141 | ecs_api_a1_put_job 201 job$i type4 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json |
| 142 | if [ -z "$FLAT_A1_EI" ]; then |
| 143 | ecs_api_a1_get_job_status 200 type4 job$i ENABLED |
| 144 | else |
| 145 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 146 | fi |
| 147 | fi |
| 148 | if [ $(($i%5)) -eq 4 ]; then |
| 149 | ecs_api_a1_put_job 201 job$i type5 $TARGET ric1 $CR_PATH/job_status_ric1 testdata/ecs/job-template.json |
| 150 | if [ -z "$FLAT_A1_EI" ]; then |
| 151 | ecs_api_a1_get_job_status 200 type5 job$i ENABLED |
| 152 | else |
| 153 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 154 | fi |
| 155 | fi |
| 156 | done |
| 157 | |
| 158 | if [ -z "$FLAT_A1_EI" ]; then |
| 159 | ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5)) |
| 160 | ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5)) |
| 161 | ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5)) |
| 162 | ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5)) |
| 163 | ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5)) |
| 164 | else |
| 165 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 166 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 167 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 168 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 169 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 170 | fi |
| 171 | |
| 172 | restart_ecs |
| 173 | |
| 174 | set_ecs_trace |
| 175 | |
| 176 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 177 | do |
| 178 | if [ $(($i%5)) -eq 0 ]; then |
| 179 | prodstub_delete_jobdata 204 prod-a job$i |
| 180 | prodstub_delete_jobdata 204 prod-b job$i |
| 181 | prodstub_delete_jobdata 204 prod-c job$i |
| 182 | fi |
| 183 | if [ $(($i%5)) -eq 1 ]; then |
| 184 | prodstub_delete_jobdata 204 prod-b job$i |
| 185 | prodstub_delete_jobdata 204 prod-c job$i |
| 186 | fi |
| 187 | if [ $(($i%5)) -eq 2 ]; then |
| 188 | prodstub_delete_jobdata 204 prod-c job$i |
| 189 | fi |
| 190 | if [ $(($i%5)) -eq 3 ]; then |
| 191 | prodstub_delete_jobdata 204 prod-d job$i |
| 192 | fi |
| 193 | if [ $(($i%5)) -eq 4 ]; then |
| 194 | prodstub_delete_jobdata 204 prod-d job$i |
| 195 | fi |
| 196 | done |
| 197 | |
| 198 | ecs_api_edp_get_producer_status 404 prod-a |
| 199 | ecs_api_edp_get_producer_status 404 prod-b |
| 200 | ecs_api_edp_get_producer_status 404 prod-c |
| 201 | ecs_api_edp_get_producer_status 404 prod-d |
| 202 | |
| 203 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 204 | do |
| 205 | if [ $(($i%5)) -eq 0 ]; then |
| 206 | if [ -z "$FLAT_A1_EI" ]; then |
| 207 | ecs_api_a1_get_job_status 200 type1 job$i DISABLED |
| 208 | else |
| 209 | ecs_api_a1_get_job_status 200 job$i DISABLED |
| 210 | fi |
| 211 | fi |
| 212 | if [ $(($i%5)) -eq 1 ]; then |
| 213 | if [ -z "$FLAT_A1_EI" ]; then |
| 214 | ecs_api_a1_get_job_status 200 type2 job$i DISABLED |
| 215 | else |
| 216 | ecs_api_a1_get_job_status 200 job$i DISABLED |
| 217 | fi |
| 218 | fi |
| 219 | if [ $(($i%5)) -eq 2 ]; then |
| 220 | if [ -z "$FLAT_A1_EI" ]; then |
| 221 | ecs_api_a1_get_job_status 200 type3 job$i DISABLED |
| 222 | else |
| 223 | ecs_api_a1_get_job_status 200 job$i DISABLED |
| 224 | fi |
| 225 | fi |
| 226 | if [ $(($i%5)) -eq 3 ]; then |
| 227 | if [ -z "$FLAT_A1_EI" ]; then |
| 228 | ecs_api_a1_get_job_status 200 type4 job$i DISABLED |
| 229 | else |
| 230 | ecs_api_a1_get_job_status 200 job$i DISABLED |
| 231 | fi |
| 232 | fi |
| 233 | if [ $(($i%5)) -eq 4 ]; then |
| 234 | if [ -z "$FLAT_A1_EI" ]; then |
| 235 | ecs_api_a1_get_job_status 200 type5 job$i DISABLED |
| 236 | else |
| 237 | ecs_api_a1_get_job_status 200 job$i DISABLED |
| 238 | fi |
| 239 | fi |
| 240 | done |
| 241 | |
| 242 | |
| 243 | ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json |
| 244 | |
| 245 | ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json |
| 246 | |
| 247 | ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c type1 testdata/ecs/ei-type-1.json type2 testdata/ecs/ei-type-2.json type3 testdata/ecs/ei-type-3.json |
| 248 | |
| 249 | ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-4.json type5 testdata/ecs/ei-type-5.json |
| 250 | |
| 251 | ecs_equal json:ei-producer/v1/eiproducers 4 |
| 252 | |
| 253 | ecs_api_edp_get_producer_status 200 prod-a ENABLED |
| 254 | ecs_api_edp_get_producer_status 200 prod-b ENABLED |
| 255 | ecs_api_edp_get_producer_status 200 prod-c ENABLED |
| 256 | ecs_api_edp_get_producer_status 200 prod-d ENABLED |
| 257 | |
| 258 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 259 | do |
| 260 | if [ $(($i%5)) -eq 0 ]; then |
| 261 | if [ -z "$FLAT_A1_EI" ]; then |
| 262 | ecs_api_a1_get_job_status 200 type1 job$i ENABLED |
| 263 | else |
| 264 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 265 | fi |
| 266 | fi |
| 267 | if [ $(($i%5)) -eq 1 ]; then |
| 268 | if [ -z "$FLAT_A1_EI" ]; then |
| 269 | ecs_api_a1_get_job_status 200 type2 job$i ENABLED |
| 270 | else |
| 271 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 272 | fi |
| 273 | fi |
| 274 | if [ $(($i%5)) -eq 2 ]; then |
| 275 | if [ -z "$FLAT_A1_EI" ]; then |
| 276 | ecs_api_a1_get_job_status 200 type3 job$i ENABLED |
| 277 | else |
| 278 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 279 | fi |
| 280 | fi |
| 281 | if [ $(($i%5)) -eq 3 ]; then |
| 282 | if [ -z "$FLAT_A1_EI" ]; then |
| 283 | ecs_api_a1_get_job_status 200 type4 job$i ENABLED |
| 284 | else |
| 285 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 286 | fi |
| 287 | fi |
| 288 | if [ $(($i%5)) -eq 4 ]; then |
| 289 | if [ -z "$FLAT_A1_EI" ]; then |
| 290 | ecs_api_a1_get_job_status 200 type5 job$i ENABLED |
| 291 | else |
| 292 | ecs_api_a1_get_job_status 200 job$i ENABLED |
| 293 | fi |
| 294 | fi |
| 295 | done |
| 296 | |
| 297 | |
| 298 | if [ -z "$FLAT_A1_EI" ]; then |
| 299 | ecs_equal json:A1-EI/v1/eitypes/type1/eijobs $(($NUM_JOBS/5)) |
| 300 | ecs_equal json:A1-EI/v1/eitypes/type2/eijobs $(($NUM_JOBS/5)) |
| 301 | ecs_equal json:A1-EI/v1/eitypes/type3/eijobs $(($NUM_JOBS/5)) |
| 302 | ecs_equal json:A1-EI/v1/eitypes/type4/eijobs $(($NUM_JOBS/5)) |
| 303 | ecs_equal json:A1-EI/v1/eitypes/type5/eijobs $(($NUM_JOBS/5)) |
| 304 | else |
| 305 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 306 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 307 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 308 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 309 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 $(($NUM_JOBS/5)) |
| 310 | fi |
| 311 | |
| 312 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 313 | do |
| 314 | if [ $(($i%5)) -eq 0 ]; then |
BjornMagnussonXA | 2138b63 | 2020-11-30 21:17:32 +0100 | [diff] [blame] | 315 | prodstub_check_jobdata 200 prod-a job$i type1 $TARGET ric1 testdata/ecs/job-template.json |
| 316 | prodstub_check_jobdata 200 prod-b job$i type1 $TARGET ric1 testdata/ecs/job-template.json |
| 317 | prodstub_check_jobdata 200 prod-c job$i type1 $TARGET ric1 testdata/ecs/job-template.json |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 318 | fi |
| 319 | if [ $(($i%5)) -eq 1 ]; then |
BjornMagnussonXA | 2138b63 | 2020-11-30 21:17:32 +0100 | [diff] [blame] | 320 | prodstub_check_jobdata 200 prod-b job$i type2 $TARGET ric1 testdata/ecs/job-template.json |
| 321 | prodstub_check_jobdata 200 prod-c job$i type2 $TARGET ric1 testdata/ecs/job-template.json |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 322 | fi |
| 323 | if [ $(($i%5)) -eq 2 ]; then |
BjornMagnussonXA | 2138b63 | 2020-11-30 21:17:32 +0100 | [diff] [blame] | 324 | prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 325 | fi |
| 326 | if [ $(($i%5)) -eq 3 ]; then |
BjornMagnussonXA | 2138b63 | 2020-11-30 21:17:32 +0100 | [diff] [blame] | 327 | prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 328 | fi |
| 329 | if [ $(($i%5)) -eq 4 ]; then |
BjornMagnussonXA | 2138b63 | 2020-11-30 21:17:32 +0100 | [diff] [blame] | 330 | prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json |
BjornMagnussonXA | 7b36db6 | 2020-11-23 10:57:57 +0100 | [diff] [blame] | 331 | fi |
| 332 | done |
| 333 | |
| 334 | |
| 335 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 336 | do |
| 337 | if [ $(($i%5)) -eq 0 ]; then |
| 338 | ecs_api_a1_delete_job 204 job$i |
| 339 | fi |
| 340 | if [ $(($i%5)) -eq 1 ]; then |
| 341 | ecs_api_a1_delete_job 204 job$i |
| 342 | fi |
| 343 | if [ $(($i%5)) -eq 2 ]; then |
| 344 | ecs_api_a1_delete_job 204 job$i |
| 345 | fi |
| 346 | if [ $(($i%5)) -eq 3 ]; then |
| 347 | ecs_api_a1_delete_job 204 job$i |
| 348 | fi |
| 349 | if [ $(($i%5)) -eq 4 ]; then |
| 350 | ecs_api_a1_delete_job 204 job$i |
| 351 | fi |
| 352 | done |
| 353 | |
| 354 | ecs_equal json:ei-producer/v1/eiproducers 4 |
| 355 | |
| 356 | ecs_api_edp_get_producer_status 200 prod-a ENABLED |
| 357 | ecs_api_edp_get_producer_status 200 prod-b ENABLED |
| 358 | ecs_api_edp_get_producer_status 200 prod-c ENABLED |
| 359 | ecs_api_edp_get_producer_status 200 prod-d ENABLED |
| 360 | |
| 361 | if [ -z "$FLAT_A1_EI" ]; then |
| 362 | ecs_equal json:A1-EI/v1/eitypes/type1/eijobs 0 |
| 363 | ecs_equal json:A1-EI/v1/eitypes/type2/eijobs 0 |
| 364 | ecs_equal json:A1-EI/v1/eitypes/type3/eijobs 0 |
| 365 | ecs_equal json:A1-EI/v1/eitypes/type4/eijobs 0 |
| 366 | ecs_equal json:A1-EI/v1/eitypes/type5/eijobs 0 |
| 367 | else |
| 368 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 |
| 369 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 |
| 370 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 |
| 371 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 |
| 372 | ecs_equal json:A1-EI/v1/eijobs?eiTypeId=type1 0 |
| 373 | fi |
| 374 | |
| 375 | check_ecs_logs |
| 376 | |
| 377 | store_logs END |
| 378 | |
| 379 | #### TEST COMPLETE #### |
| 380 | |
| 381 | |
| 382 | print_result |
| 383 | |
| 384 | auto_clean_containers |