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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
21 TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency"
23 #App names to include in the test, space separated list
24 INCLUDED_IMAGES="ECS PRODSTUB CR CP"
26 #SUPPORTED TEST ENV FILE
27 SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
29 . ../common/testcase_common.sh $@
30 . ../common/ecs_api_functions.sh
31 . ../common/prodstub_api_functions.sh
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
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
65 prodstub_arm_type 200 prod-a type1
67 prodstub_arm_type 200 prod-b type1
68 prodstub_arm_type 200 prod-b type2
70 prodstub_arm_type 200 prod-c type1
71 prodstub_arm_type 200 prod-c type2
72 prodstub_arm_type 200 prod-c type3
74 prodstub_arm_type 200 prod-d type4
75 prodstub_arm_type 200 prod-d type5
77 for ((i=1; i<=$NUM_JOBS; i++))
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
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
88 if [ $(($i%5)) -eq 2 ]; then
89 prodstub_arm_job_create 200 prod-c job$i
91 if [ $(($i%5)) -eq 3 ]; then
92 prodstub_arm_job_create 200 prod-d job$i
94 if [ $(($i%5)) -eq 4 ]; then
95 prodstub_arm_job_create 200 prod-d job$i
99 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
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
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
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
107 ecs_equal json:ei-producer/v1/eiproducers 4
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
114 for ((i=1; i<=$NUM_JOBS; i++))
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
121 ecs_api_a1_get_job_status 200 job$i ENABLED
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
129 ecs_api_a1_get_job_status 200 job$i ENABLED
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
137 ecs_api_a1_get_job_status 200 job$i ENABLED
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
145 ecs_api_a1_get_job_status 200 job$i ENABLED
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
153 ecs_api_a1_get_job_status 200 job$i ENABLED
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))
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))
176 for ((i=1; i<=$NUM_JOBS; i++))
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
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
187 if [ $(($i%5)) -eq 2 ]; then
188 prodstub_delete_jobdata 204 prod-c job$i
190 if [ $(($i%5)) -eq 3 ]; then
191 prodstub_delete_jobdata 204 prod-d job$i
193 if [ $(($i%5)) -eq 4 ]; then
194 prodstub_delete_jobdata 204 prod-d job$i
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
203 for ((i=1; i<=$NUM_JOBS; i++))
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
209 ecs_api_a1_get_job_status 200 job$i DISABLED
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
216 ecs_api_a1_get_job_status 200 job$i DISABLED
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
223 ecs_api_a1_get_job_status 200 job$i DISABLED
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
230 ecs_api_a1_get_job_status 200 job$i DISABLED
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
237 ecs_api_a1_get_job_status 200 job$i DISABLED
243 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
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
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
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
251 ecs_equal json:ei-producer/v1/eiproducers 4
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
258 for ((i=1; i<=$NUM_JOBS; i++))
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
264 ecs_api_a1_get_job_status 200 job$i ENABLED
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
271 ecs_api_a1_get_job_status 200 job$i ENABLED
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
278 ecs_api_a1_get_job_status 200 job$i ENABLED
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
285 ecs_api_a1_get_job_status 200 job$i ENABLED
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
292 ecs_api_a1_get_job_status 200 job$i ENABLED
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))
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))
312 for ((i=1; i<=$NUM_JOBS; i++))
314 if [ $(($i%5)) -eq 0 ]; then
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
319 if [ $(($i%5)) -eq 1 ]; then
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
323 if [ $(($i%5)) -eq 2 ]; then
324 prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json
326 if [ $(($i%5)) -eq 3 ]; then
327 prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json
329 if [ $(($i%5)) -eq 4 ]; then
330 prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json
335 for ((i=1; i<=$NUM_JOBS; i++))
337 if [ $(($i%5)) -eq 0 ]; then
338 ecs_api_a1_delete_job 204 job$i
340 if [ $(($i%5)) -eq 1 ]; then
341 ecs_api_a1_delete_job 204 job$i
343 if [ $(($i%5)) -eq 2 ]; then
344 ecs_api_a1_delete_job 204 job$i
346 if [ $(($i%5)) -eq 3 ]; then
347 ecs_api_a1_delete_job 204 job$i
349 if [ $(($i%5)) -eq 4 ]; then
350 ecs_api_a1_delete_job 204 job$i
354 ecs_equal json:ei-producer/v1/eiproducers 4
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
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
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
379 #### TEST COMPLETE ####
384 auto_clean_containers