blob: 266b3b506ecbb08749a4da589296803db5610f42 [file] [log] [blame]
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001#!/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
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010021TC_ONELINE_DESCR="ECS full intefaces walkthrough"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020022
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020023#App names to include in the test, space separated list
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010024INCLUDED_IMAGES="ECS PRODSTUB CR RICSIM CP"
25
26#SUPPORTED TEST ENV FILE
27SUPPORTED_PROFILES="ONAP-MASTER ORAN-MASTER"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020028
29. ../common/testcase_common.sh $@
30. ../common/ecs_api_functions.sh
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020031. ../common/prodstub_api_functions.sh
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010032. ../common/cr_api_functions.sh
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020033
34#### TEST BEGIN ####
35
BjornMagnussonXA4207b832020-11-03 09:52:49 +010036FLAT_A1_EI="1"
37
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020038clean_containers
39
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010040use_ecs_rest_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020041
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010042use_prod_stub_https
43
44use_simulator_https
45
46use_cr_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020047
48start_ecs
49
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020050start_prod_stub
51
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020052set_ecs_trace
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020053
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010054start_control_panel
55
56if [ "$PMS_VERSION" == "V2" ]; then
57 start_ric_simulators ricsim_g3 4 STD_2.0.0
58fi
59
60start_cr
61
62CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
63CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
64TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
65TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
66TARGET3="$RIC_SIM_HTTPX://ricsim_g3_3:$RIC_SIM_PORT/datadelivery"
67TARGET8="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
68TARGET10="$RIC_SIM_HTTPX://ricsim_g3_4:$RIC_SIM_PORT/datadelivery"
69
70STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
71STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
72STATUS3="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job3-status"
73STATUS8="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job8-status"
74STATUS10="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job10-status"
75
76### Setup prodstub sim to accept calls for producers, types and jobs
77## prod-a type1
78## prod-b type1 and type2
79## prod-c no-type
80## prod-d type4
81## prod-e type6
82## prod-f type6
83
84## job1 -> prod-a
85## job2 -> prod-a
86## job3 -> prod-b
87## job4 -> prod-a
88## job6 -> prod-b
89## job8 -> prod-d
90## job10 -> prod-e and prod-f
91
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020092prodstub_arm_producer 200 prod-a
93prodstub_arm_producer 200 prod-b
94prodstub_arm_producer 200 prod-c
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020095prodstub_arm_producer 200 prod-d
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010096prodstub_arm_producer 200 prod-e
97prodstub_arm_producer 200 prod-f
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020098
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020099prodstub_arm_type 200 prod-a type1
100prodstub_arm_type 200 prod-b type2
101prodstub_arm_type 200 prod-b type3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100102prodstub_arm_type 200 prod-d type4
103prodstub_arm_type 200 prod-e type6
104prodstub_arm_type 200 prod-f type6
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200105
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200106prodstub_disarm_type 200 prod-b type3
107prodstub_arm_type 200 prod-b type1
108prodstub_disarm_type 200 prod-b type1
109
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100110
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200111prodstub_arm_job_create 200 prod-a job1
112prodstub_arm_job_create 200 prod-a job2
113prodstub_arm_job_create 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200114
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200115prodstub_arm_job_delete 200 prod-a job1
116prodstub_arm_job_delete 200 prod-a job2
117prodstub_arm_job_delete 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200118
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200119prodstub_arm_job_create 200 prod-b job4
120prodstub_arm_job_create 200 prod-a job4
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200121
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200122prodstub_arm_job_create 200 prod-b job6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200123
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100124prodstub_arm_job_create 200 prod-d job8
125
126prodstub_arm_job_create 200 prod-e job10
127prodstub_arm_job_create 200 prod-f job10
128
129### ecs status
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200130ecs_api_service_status 200
131
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100132cr_equal received_callbacks 0
133
134### Initial tests - no config made
135### GET: type ids, types, producer ids, producers, job ids, jobs
136### DELETE: jobs
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200137ecs_api_a1_get_type_ids 200 EMPTY
138ecs_api_a1_get_type 404 test-type
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200139
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200140ecs_api_edp_get_type_ids 200 EMPTY
141ecs_api_edp_get_type 404 test-type
142
143ecs_api_edp_get_producer_ids 200 EMPTY
144ecs_api_edp_get_producer 404 test-prod
145
146ecs_api_edp_get_producer_status 404 test-prod
147
148ecs_api_edp_delete_producer 404 test-prod
149
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100150if [ -z "$FLAT_A1_EI" ]; then
151 ecs_api_a1_get_job_ids 404 test-type NOWNER
152 ecs_api_a1_get_job_ids 404 test-type test-owner
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200153
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100154 ecs_api_a1_get_job 404 test-type test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200155
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100156 ecs_api_a1_get_job_status 404 test-type test-job
157else
158 ecs_api_a1_get_job_ids 200 test-type NOWNER EMPTY
159 ecs_api_a1_get_job_ids 200 test-type test-owner EMPTY
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200160
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100161 ecs_api_a1_get_job 404 test-job
162
163 ecs_api_a1_get_job_status 404 test-job
164fi
165
166if [ -z "$FLAT_A1_EI" ]; then
167 ecs_api_a1_delete_job 404 test-type test-job
168else
169 ecs_api_a1_delete_job 404 test-job
170fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200171
172ecs_api_edp_get_producer_jobs 404 test-prod
173
174
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100175### Setup of producer/job and testing apis ###
176
177## Setup prod-a
178ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
179ecs_api_edp_put_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
180
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200181
182ecs_api_a1_get_type_ids 200 type1
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100183if [ -z "$FLAT_A1_EI" ]; then
184 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
185else
186 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
187fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200188
189ecs_api_edp_get_type_ids 200 type1
190ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
191
192ecs_api_edp_get_producer_ids 200 prod-a
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100193
194ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200195
196ecs_api_edp_get_producer_status 200 prod-a ENABLED
197
198ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
199ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
200
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100201if [ -z "$FLAT_A1_EI" ]; then
202 ecs_api_a1_get_job 404 type1 test-job
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200203
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100204 ecs_api_a1_get_job_status 404 type1 test-job
205else
206 ecs_api_a1_get_job 404 test-job
207
208 ecs_api_a1_get_job_status 404 test-job
209fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200210
211ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
212
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100213## Create a job for prod-a
214## job1 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100215if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100216 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100217else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100218 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100219fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200220
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100221# Check the job data in the producer
222prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200223
224ecs_api_a1_get_job_ids 200 type1 NOWNER job1
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100225ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
226
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100227if [ ! -z "$FLAT_A1_EI" ]; then
228 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1
229fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200230
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100231if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100232 ecs_api_a1_get_job 200 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200233
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100234 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
235else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100236 ecs_api_a1_get_job 200 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100237
238 ecs_api_a1_get_job_status 200 job1 ENABLED
239fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200240
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100241prodstub_equal create/prod-a/job1 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200242
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100243ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200244
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100245## Create a second job for prod-a
246## job2 - prod-a
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100247if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100248 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100249else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100250 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100251fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200252
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100253# Check the job data in the producer
254prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200255
256ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100257ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
258ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100259if [ ! -z "$FLAT_A1_EI" ]; then
260 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
261fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200262
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100263if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100264 ecs_api_a1_get_job 200 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200265
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100266 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
267else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100268 ecs_api_a1_get_job 200 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100269
270 ecs_api_a1_get_job_status 200 job2 ENABLED
271fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200272
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100273prodstub_equal create/prod-a/job2 1
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200274
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100275ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200276
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100277## Setup prod-b
278ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200279
280ecs_api_a1_get_type_ids 200 type1 type2
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100281if [ -z "$FLAT_A1_EI" ]; then
282 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
283 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
284else
285 ecs_api_a1_get_type 200 type1 testdata/ecs/empty-type.json
286 ecs_api_a1_get_type 200 type2 testdata/ecs/empty-type.json
287fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200288
289ecs_api_edp_get_type_ids 200 type1 type2
290ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
291ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
292
293ecs_api_edp_get_producer_ids 200 prod-a prod-b
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100294
295ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
296ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
297
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200298
299ecs_api_edp_get_producer_status 200 prod-b ENABLED
300
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100301## Create job for prod-b
302## job3 - prod-b
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100303if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100304 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100305else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100306 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100307fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200308
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100309prodstub_equal create/prod-b/job3 1
310
311# Check the job data in the producer
312prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200313
314ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
315ecs_api_a1_get_job_ids 200 type2 NOWNER job3
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100316ecs_api_a1_get_job_ids 200 type1 ricsim_g3_1 job1
317ecs_api_a1_get_job_ids 200 type1 ricsim_g3_2 job2
318ecs_api_a1_get_job_ids 200 type2 ricsim_g3_3 job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200319
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100320if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100321 ecs_api_a1_get_job 200 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200322
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100323 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
324else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100325 ecs_api_a1_get_job 200 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100326
327 ecs_api_a1_get_job_status 200 job3 ENABLED
328fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200329
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100330ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 $TARGET1 testdata/ecs/job-template.json job2 type1 $TARGET2 testdata/ecs/job-template.json
331ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template.json
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200332
333
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100334## Setup prod-c (no types)
335ecs_api_edp_put_producer 201 prod-c $CB_JOB/prod-c $CB_SV/prod-c NOTYPE
336
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200337
338ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100339
340ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
341ecs_api_edp_get_producer 200 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
342ecs_api_edp_get_producer 200 prod-c $CB_JOB/prod-c $CB_SV/prod-c EMPTY
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200343
344ecs_api_edp_get_producer_status 200 prod-c ENABLED
345
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100346
347## Delete job3 and prod-b and re-create if different order
348
349# Delete job then producer
350ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
351ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
352
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100353if [ -z "$FLAT_A1_EI" ]; then
354 ecs_api_a1_delete_job 204 type2 job3
355else
356 ecs_api_a1_delete_job 204 job3
357fi
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200358
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100359ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
360ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
361
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200362ecs_api_edp_delete_producer 204 prod-b
363
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100364ecs_api_edp_get_producer_status 404 prod-b
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200365
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100366ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2
367ecs_api_edp_get_producer_ids 200 prod-a prod-c
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200368
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100369prodstub_equal delete/prod-b/job3 1
370
371if [ -z "$FLAT_A1_EI" ]; then
372 ecs_api_a1_put_job 404 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template.json
373else
374 ecs_api_a1_put_job 404 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template.json
375fi
376
377# Put producer then job
378ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
379
380ecs_api_edp_get_producer_status 200 prod-b ENABLED
381
382if [ -z "$FLAT_A1_EI" ]; then
383 ecs_api_a1_put_job 201 type2 job3 $TARGET3 ricsim_g3_3 testdata/ecs/job-template2.json
384 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
385else
386 ecs_api_a1_put_job 201 job3 type2 $TARGET3 ricsim_g3_3 $STATUS3 testdata/ecs/job-template2.json
387 ecs_api_a1_get_job_status 200 job3 ENABLED
388fi
389
390prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
391
392ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
393ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
394
395prodstub_equal create/prod-b/job3 2
396prodstub_equal delete/prod-b/job3 1
397
398# Delete only the producer
399ecs_api_edp_delete_producer 204 prod-b
400
401ecs_api_edp_get_producer_status 404 prod-b
402
403ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3
404ecs_api_edp_get_producer_ids 200 prod-a prod-c
405
406if [ -z "$FLAT_A1_EI" ]; then
407 ecs_api_a1_get_job_status 200 type2 job3 DISABLED
408else
409 ecs_api_a1_get_job_status 200 job3 DISABLED
410fi
411
412cr_equal received_callbacks 1 30
413cr_equal received_callbacks?id=job3-status 1
414cr_api_check_all_ecs_events 200 job3-status DISABLED
415
416# Re-create the producer
417ecs_api_edp_put_producer 201 prod-b $CB_JOB/prod-b $CB_SV/prod-b type2 testdata/ecs/ei-type-2.json
418
419ecs_api_edp_get_producer_status 200 prod-b ENABLED
420
421if [ -z "$FLAT_A1_EI" ]; then
422 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
423else
424 ecs_api_a1_get_job_status 200 job3 ENABLED
425fi
426
427cr_equal received_callbacks 2 30
428cr_equal received_callbacks?id=job3-status 2
429cr_api_check_all_ecs_events 200 job3-status ENABLED
430
431prodstub_check_jobdata 200 prod-b job3 type2 $TARGET3 testdata/ecs/job-template2.json
432
433
434## Setup prod-d
435ecs_api_edp_put_producer 201 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200436
437ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
438
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100439if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100440 ecs_api_a1_put_job 201 type4 job8 $TARGET8 ricsim_g3_4 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100441else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100442 ecs_api_a1_put_job 201 job8 type4 $TARGET8 ricsim_g3_4 $STATUS8 testdata/ecs/job-template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100443fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100444
445prodstub_check_jobdata 200 prod-d job8 type4 $TARGET8 testdata/ecs/job-template.json
446
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200447prodstub_equal create/prod-d/job8 1
448prodstub_equal delete/prod-d/job8 0
449
450ecs_api_a1_get_job_ids 200 type4 NOWNER job8
451
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100452if [ -z "$FLAT_A1_EI" ]; then
453 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
454else
455 ecs_api_a1_get_job_status 200 job8 ENABLED
456fi
457
458# Re-PUT the producer with zero types
459ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d NOTYPE
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200460
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100461if [ -z "$FLAT_A1_EI" ]; then
462 ecs_api_a1_get_job_ids 404 type4 NOWNER
463else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100464 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
465 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100466fi
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200467
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100468if [ -z "$FLAT_A1_EI" ]; then
469 ecs_api_a1_get_job_status 200 type4 job8 DISABLED
470else
471 ecs_api_a1_get_job_status 200 job8 DISABLED
472fi
473
474cr_equal received_callbacks 3 30
475cr_equal received_callbacks?id=job8-status 1
476cr_api_check_all_ecs_events 200 job8-status DISABLED
477
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200478prodstub_equal create/prod-d/job8 1
479prodstub_equal delete/prod-d/job8 0
480
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100481## Re-setup prod-d
482ecs_api_edp_put_producer 200 prod-d $CB_JOB/prod-d $CB_SV/prod-d type4 testdata/ecs/ei-type-1.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100483
484if [ -z "$FLAT_A1_EI" ]; then
485 ecs_api_a1_get_job_ids 404 type4 NOWNER
486else
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100487 ecs_api_a1_get_job_ids 200 type4 NOWNER job8
488 ecs_api_a1_get_job_ids 200 NOTYPE NOWNER job1 job2 job3 job8
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100489fi
490
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100491if [ -z "$FLAT_A1_EI" ]; then
492 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
493else
494 ecs_api_a1_get_job_status 200 job8 ENABLED
495fi
496
497ecs_api_edp_get_producer_status 200 prod-a ENABLED
498ecs_api_edp_get_producer_status 200 prod-b ENABLED
499ecs_api_edp_get_producer_status 200 prod-c ENABLED
500ecs_api_edp_get_producer_status 200 prod-d ENABLED
501
502cr_equal received_callbacks 4 30
503cr_equal received_callbacks?id=job8-status 2
504cr_api_check_all_ecs_events 200 job8-status ENABLED
505
506prodstub_equal create/prod-d/job8 2
507prodstub_equal delete/prod-d/job8 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100508
509
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100510## Setup prod-e
511ecs_api_edp_put_producer 201 prod-e $CB_JOB/prod-e $CB_SV/prod-e type6 testdata/ecs/ei-type-6.json
512
513ecs_api_a1_get_job_ids 200 type6 NOWNER EMPTY
514
515if [ -z "$FLAT_A1_EI" ]; then
516 ecs_api_a1_put_job 201 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template.json
517else
518 ecs_api_a1_put_job 201 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template.json
519fi
520
521prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template.json
522
523prodstub_equal create/prod-e/job10 1
524prodstub_equal delete/prod-e/job10 0
525
526ecs_api_a1_get_job_ids 200 type6 NOWNER job10
527
528if [ -z "$FLAT_A1_EI" ]; then
529 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
530else
531 ecs_api_a1_get_job_status 200 job10 ENABLED
532fi
533
534## Setup prod-f
535ecs_api_edp_put_producer 201 prod-f $CB_JOB/prod-f $CB_SV/prod-f type6 testdata/ecs/ei-type-6.json
536
537ecs_api_a1_get_job_ids 200 type6 NOWNER job10
538
539prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template.json
540
541prodstub_equal create/prod-f/job10 1
542prodstub_equal delete/prod-f/job10 0
543
544ecs_api_a1_get_job_ids 200 type6 NOWNER job10
545
546if [ -z "$FLAT_A1_EI" ]; then
547 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
548else
549 ecs_api_a1_get_job_status 200 job10 ENABLED
550fi
551
552## Status updates prod-a and jobs
553
554ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
555
556ecs_api_edp_get_producer_status 200 prod-a ENABLED
557ecs_api_edp_get_producer_status 200 prod-b ENABLED
558ecs_api_edp_get_producer_status 200 prod-c ENABLED
559ecs_api_edp_get_producer_status 200 prod-d ENABLED
560ecs_api_edp_get_producer_status 200 prod-e ENABLED
561ecs_api_edp_get_producer_status 200 prod-f ENABLED
562
563# Arm producer prod-a for supervision failure
564prodstub_arm_producer 200 prod-a 400
565
566# Wait for producer prod-a to go disabled
567ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
568
569ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
570
571ecs_api_edp_get_producer_status 200 prod-a DISABLED
572ecs_api_edp_get_producer_status 200 prod-b ENABLED
573ecs_api_edp_get_producer_status 200 prod-c ENABLED
574ecs_api_edp_get_producer_status 200 prod-d ENABLED
575ecs_api_edp_get_producer_status 200 prod-e ENABLED
576ecs_api_edp_get_producer_status 200 prod-f ENABLED
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100577
578
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100579if [ -z "$FLAT_A1_EI" ]; then
580 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
581 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
582 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
583 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
584 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
585else
586 ecs_api_a1_get_job_status 200 job1 ENABLED
587 ecs_api_a1_get_job_status 200 job2 ENABLED
588 ecs_api_a1_get_job_status 200 job3 ENABLED
589 ecs_api_a1_get_job_status 200 job8 ENABLED
590 ecs_api_a1_get_job_status 200 job10 ENABLED
591fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100592
BjornMagnussonXA7b36db62020-11-23 10:57:57 +0100593# Arm producer prod-a for supervision
594prodstub_arm_producer 200 prod-a 200
595
596# Wait for producer prod-a to go enabled
597ecs_api_edp_get_producer_status 200 prod-a ENABLED 360
598
599ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
600
601ecs_api_edp_get_producer_status 200 prod-a ENABLED
602ecs_api_edp_get_producer_status 200 prod-b ENABLED
603ecs_api_edp_get_producer_status 200 prod-c ENABLED
604ecs_api_edp_get_producer_status 200 prod-d ENABLED
605ecs_api_edp_get_producer_status 200 prod-e ENABLED
606ecs_api_edp_get_producer_status 200 prod-f ENABLED
607
608if [ -z "$FLAT_A1_EI" ]; then
609 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
610 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
611 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
612 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
613 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
614else
615 ecs_api_a1_get_job_status 200 job1 ENABLED
616 ecs_api_a1_get_job_status 200 job2 ENABLED
617 ecs_api_a1_get_job_status 200 job3 ENABLED
618 ecs_api_a1_get_job_status 200 job8 ENABLED
619 ecs_api_a1_get_job_status 200 job10 ENABLED
620fi
621
622# Arm producer prod-a for supervision failure
623prodstub_arm_producer 200 prod-a 400
624
625# Wait for producer prod-a to go disabled
626ecs_api_edp_get_producer_status 200 prod-a DISABLED 360
627
628ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c prod-d prod-e prod-f
629
630ecs_api_edp_get_producer_status 200 prod-a DISABLED
631ecs_api_edp_get_producer_status 200 prod-b ENABLED
632ecs_api_edp_get_producer_status 200 prod-c ENABLED
633ecs_api_edp_get_producer_status 200 prod-d ENABLED
634ecs_api_edp_get_producer_status 200 prod-e ENABLED
635ecs_api_edp_get_producer_status 200 prod-f ENABLED
636
637if [ -z "$FLAT_A1_EI" ]; then
638 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
639 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
640 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
641 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
642 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
643else
644 ecs_api_a1_get_job_status 200 job1 ENABLED
645 ecs_api_a1_get_job_status 200 job2 ENABLED
646 ecs_api_a1_get_job_status 200 job3 ENABLED
647 ecs_api_a1_get_job_status 200 job8 ENABLED
648 ecs_api_a1_get_job_status 200 job10 ENABLED
649fi
650
651# Wait for producer prod-a to be removed
652ecs_equal json:ei-producer/v1/eiproducers 5 1000
653
654ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
655
656ecs_api_edp_get_producer_status 404 prod-a
657ecs_api_edp_get_producer_status 200 prod-b ENABLED
658ecs_api_edp_get_producer_status 200 prod-c ENABLED
659ecs_api_edp_get_producer_status 200 prod-d ENABLED
660ecs_api_edp_get_producer_status 200 prod-e ENABLED
661ecs_api_edp_get_producer_status 200 prod-f ENABLED
662
663if [ -z "$FLAT_A1_EI" ]; then
664 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
665 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
666 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
667 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
668 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
669else
670 ecs_api_a1_get_job_status 200 job1 DISABLED
671 ecs_api_a1_get_job_status 200 job2 DISABLED
672 ecs_api_a1_get_job_status 200 job3 ENABLED
673 ecs_api_a1_get_job_status 200 job8 ENABLED
674 ecs_api_a1_get_job_status 200 job10 ENABLED
675fi
676
677cr_equal received_callbacks 6 30
678cr_equal received_callbacks?id=job1-status 1
679cr_equal received_callbacks?id=job2-status 1
680
681cr_api_check_all_ecs_events 200 job1-status DISABLED
682cr_api_check_all_ecs_events 200 job2-status DISABLED
683
684
685# Arm producer prod-e for supervision failure
686prodstub_arm_producer 200 prod-e 400
687
688ecs_api_edp_get_producer_status 200 prod-e DISABLED 1000
689
690ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
691
692ecs_api_edp_get_producer_status 404 prod-a
693ecs_api_edp_get_producer_status 200 prod-b ENABLED
694ecs_api_edp_get_producer_status 200 prod-c ENABLED
695ecs_api_edp_get_producer_status 200 prod-d ENABLED
696ecs_api_edp_get_producer_status 200 prod-e DISABLED
697ecs_api_edp_get_producer_status 200 prod-f ENABLED
698
699if [ -z "$FLAT_A1_EI" ]; then
700 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
701 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
702 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
703 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
704 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
705else
706 ecs_api_a1_get_job_status 200 job1 DISABLED
707 ecs_api_a1_get_job_status 200 job2 DISABLED
708 ecs_api_a1_get_job_status 200 job3 ENABLED
709 ecs_api_a1_get_job_status 200 job8 ENABLED
710 ecs_api_a1_get_job_status 200 job10 ENABLED
711fi
712
713#Disable create for job10 in prod-e
714prodstub_arm_job_create 200 prod-e job10 400
715
716#Update tjob 10 - only prod-f will be updated
717if [ -z "$FLAT_A1_EI" ]; then
718 ecs_api_a1_put_job 200 type6 job10 $TARGET10 ricsim_g3_4 testdata/ecs/job-template2.json
719else
720 ecs_api_a1_put_job 200 job10 type6 $TARGET10 ricsim_g3_4 $STATUS10 testdata/ecs/job-template2.json
721fi
722#Reset producer and job responses
723prodstub_arm_producer 200 prod-e 200
724prodstub_arm_job_create 200 prod-e job10 200
725
726ecs_api_edp_get_producer_status 200 prod-e ENABLED 360
727
728ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e prod-f
729
730#Job 10 should be updated when the producer goes enabled
731deviation "Job 10 should be updated when the producer prod-e goes enabled"
732prodstub_check_jobdata 200 prod-e job10 type6 $TARGET10 testdata/ecs/job-template2.json
733prodstub_check_jobdata 200 prod-f job10 type6 $TARGET10 testdata/ecs/job-template2.json
734
735prodstub_arm_producer 200 prod-f 400
736
737ecs_api_edp_get_producer_status 200 prod-f DISABLED 360
738
739ecs_equal json:ei-producer/v1/eiproducers 4 1000
740
741ecs_api_edp_get_producer_ids 200 prod-b prod-c prod-d prod-e
742
743ecs_api_edp_get_producer_status 404 prod-a
744ecs_api_edp_get_producer_status 200 prod-b ENABLED
745ecs_api_edp_get_producer_status 200 prod-c ENABLED
746ecs_api_edp_get_producer_status 200 prod-d ENABLED
747ecs_api_edp_get_producer_status 200 prod-e ENABLED
748ecs_api_edp_get_producer_status 404 prod-f
749
750if [ -z "$FLAT_A1_EI" ]; then
751 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
752 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
753 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
754 ecs_api_a1_get_job_status 200 type4 job8 ENABLED
755 ecs_api_a1_get_job_status 200 type6 job10 ENABLED
756else
757 ecs_api_a1_get_job_status 200 job1 DISABLED
758 ecs_api_a1_get_job_status 200 job2 DISABLED
759 ecs_api_a1_get_job_status 200 job3 ENABLED
760 ecs_api_a1_get_job_status 200 job8 ENABLED
761 ecs_api_a1_get_job_status 200 job10 ENABLED
762fi
763
764cr_equal received_callbacks 6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200765
766check_ecs_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200767
768store_logs END
769
770#### TEST COMPLETE ####
771
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200772print_result
773
774auto_clean_containers