blob: caec9398a369bfa69fc9345bfe930c20cab75283 [file] [log] [blame]
BjornMagnussonXA7b36db62020-11-23 10:57:57 +01001#!/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
21TC_ONELINE_DESCR="ECS Create 10000 jobs and restart, test job persisency"
22
23#App names to include in the test, space separated list
24INCLUDED_IMAGES="ECS PRODSTUB CR CP"
25
26#SUPPORTED TEST ENV FILE
BjornMagnussonXAde4d0f82020-11-29 16:04:06 +010027SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010028
29. ../common/testcase_common.sh $@
30. ../common/ecs_api_functions.sh
31. ../common/prodstub_api_functions.sh
32
33#### TEST BEGIN ####
34
35FLAT_A1_EI="1"
36
37clean_containers
38
39use_ecs_rest_http
40
41use_prod_stub_http
42
43start_ecs
44
45start_prod_stub
46
47set_ecs_trace
48
49start_control_panel
50
51start_cr
52
53CB_JOB="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
54CB_SV="http://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
55TARGET="http://localhost:80/target" # Dummy target
56
57NUM_JOBS=10000
58
59# Setup prodstub sim to accept calls for producers, types and jobs
60prodstub_arm_producer 200 prod-a
61prodstub_arm_producer 200 prod-b
62prodstub_arm_producer 200 prod-c
63prodstub_arm_producer 200 prod-d
64
65prodstub_arm_type 200 prod-a type1
66
67prodstub_arm_type 200 prod-b type1
68prodstub_arm_type 200 prod-b type2
69
70prodstub_arm_type 200 prod-c type1
71prodstub_arm_type 200 prod-c type2
72prodstub_arm_type 200 prod-c type3
73
74prodstub_arm_type 200 prod-d type4
75prodstub_arm_type 200 prod-d type5
76
77for ((i=1; i<=$NUM_JOBS; i++))
78do
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
97done
98
99ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
100
101ecs_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
103ecs_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
105ecs_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
107ecs_equal json:ei-producer/v1/eiproducers 4
108
109ecs_api_edp_get_producer_status 200 prod-a ENABLED
110ecs_api_edp_get_producer_status 200 prod-b ENABLED
111ecs_api_edp_get_producer_status 200 prod-c ENABLED
112ecs_api_edp_get_producer_status 200 prod-d ENABLED
113
114for ((i=1; i<=$NUM_JOBS; i++))
115do
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
156done
157
158if [ -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))
164else
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))
170fi
171
172restart_ecs
173
174set_ecs_trace
175
176for ((i=1; i<=$NUM_JOBS; i++))
177do
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
196done
197
198ecs_api_edp_get_producer_status 404 prod-a
199ecs_api_edp_get_producer_status 404 prod-b
200ecs_api_edp_get_producer_status 404 prod-c
201ecs_api_edp_get_producer_status 404 prod-d
202
203for ((i=1; i<=$NUM_JOBS; i++))
204do
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
240done
241
242
243ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
244
245ecs_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
247ecs_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
249ecs_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
251ecs_equal json:ei-producer/v1/eiproducers 4
252
253ecs_api_edp_get_producer_status 200 prod-a ENABLED
254ecs_api_edp_get_producer_status 200 prod-b ENABLED
255ecs_api_edp_get_producer_status 200 prod-c ENABLED
256ecs_api_edp_get_producer_status 200 prod-d ENABLED
257
258for ((i=1; i<=$NUM_JOBS; i++))
259do
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
295done
296
297
298if [ -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))
304else
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))
310fi
311
312for ((i=1; i<=$NUM_JOBS; i++))
313do
314 if [ $(($i%5)) -eq 0 ]; then
BjornMagnussonXA2138b632020-11-30 21:17:32 +0100315 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
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100318 fi
319 if [ $(($i%5)) -eq 1 ]; then
BjornMagnussonXA2138b632020-11-30 21:17:32 +0100320 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
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100322 fi
323 if [ $(($i%5)) -eq 2 ]; then
BjornMagnussonXA2138b632020-11-30 21:17:32 +0100324 prodstub_check_jobdata 200 prod-c job$i type3 $TARGET ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100325 fi
326 if [ $(($i%5)) -eq 3 ]; then
BjornMagnussonXA2138b632020-11-30 21:17:32 +0100327 prodstub_check_jobdata 200 prod-d job$i type4 $TARGET ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100328 fi
329 if [ $(($i%5)) -eq 4 ]; then
BjornMagnussonXA2138b632020-11-30 21:17:32 +0100330 prodstub_check_jobdata 200 prod-d job$i type5 $TARGET ric1 testdata/ecs/job-template.json
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100331 fi
332done
333
334
335for ((i=1; i<=$NUM_JOBS; i++))
336do
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
352done
353
354ecs_equal json:ei-producer/v1/eiproducers 4
355
356ecs_api_edp_get_producer_status 200 prod-a ENABLED
357ecs_api_edp_get_producer_status 200 prod-b ENABLED
358ecs_api_edp_get_producer_status 200 prod-c ENABLED
359ecs_api_edp_get_producer_status 200 prod-d ENABLED
360
361if [ -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
367else
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
373fi
374
375check_ecs_logs
376
377store_logs END
378
379#### TEST COMPLETE ####
380
381
382print_result
383
384auto_clean_containers