blob: 63c2931f83879b655a5a5ccb831cbf0054dadfbb [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
21TC_ONELINE_DESCR="Experimental ECS test case"
22
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020023#App names to include in the test, space separated list
24INCLUDED_IMAGES="ECS PRODSTUB"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020025
26. ../common/testcase_common.sh $@
27. ../common/ecs_api_functions.sh
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020028. ../common/prodstub_api_functions.sh
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020029
30#### TEST BEGIN ####
31
32clean_containers
33
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020034use_ecs_rest_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020035
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020036use_prod_stub_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020037
38start_ecs
39
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020040start_prod_stub
41
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020042set_ecs_debug
43
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020044set_ecs_trace
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020045
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020046# Setup prodstub sim to accept calls for producers, types and jobs
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020047prodstub_arm_producer 200 prod-a
48prodstub_arm_producer 200 prod-b
49prodstub_arm_producer 200 prod-c
50
51prodstub_arm_producer 200 prod-d
52prodstub_arm_type 200 prod-d type4
53prodstub_arm_job_create 200 prod-d job8
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020054
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020055prodstub_arm_type 200 prod-a type1
56prodstub_arm_type 200 prod-b type2
57prodstub_arm_type 200 prod-b type3
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020058
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020059prodstub_disarm_type 200 prod-b type3
60prodstub_arm_type 200 prod-b type1
61prodstub_disarm_type 200 prod-b type1
62
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020063prodstub_arm_job_create 200 prod-a job1
64prodstub_arm_job_create 200 prod-a job2
65prodstub_arm_job_create 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020066
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020067prodstub_arm_job_delete 200 prod-a job1
68prodstub_arm_job_delete 200 prod-a job2
69prodstub_arm_job_delete 200 prod-b job3
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020070
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020071prodstub_arm_job_create 200 prod-b job4
72prodstub_arm_job_create 200 prod-a job4
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020073
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020074prodstub_arm_job_create 200 prod-b job5
75prodstub_arm_job_create 200 prod-a job5
76prodstub_arm_job_delete 200 prod-a job5
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020077
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +020078prodstub_arm_job_create 200 prod-b job6
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020079
80# ecs status
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020081ecs_api_service_status 200
82
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020083# Initial tests - no config made
84ecs_api_a1_get_type_ids 200 EMPTY
85ecs_api_a1_get_type 404 test-type
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020086
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020087ecs_api_edp_get_type_ids 200 EMPTY
88ecs_api_edp_get_type 404 test-type
89
90ecs_api_edp_get_producer_ids 200 EMPTY
91ecs_api_edp_get_producer 404 test-prod
92
93ecs_api_edp_get_producer_status 404 test-prod
94
95ecs_api_edp_delete_producer 404 test-prod
96
97ecs_api_a1_get_job_ids 404 test-type NOWNER
98ecs_api_a1_get_job_ids 404 test-type test-owner
99
100ecs_api_a1_get_job 404 test-type test-job
101
102ecs_api_a1_get_job_status 404 test-type test-job
103
104ecs_api_a1_delete_job 404 test-type test-job
105
106ecs_api_edp_get_producer_jobs 404 test-prod
107
108
109# Setup of producer/job and test apis
110#prod-a
111ecs_api_edp_put_producer 201 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
112ecs_api_edp_put_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
113
114ecs_api_a1_get_type_ids 200 type1
115ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
116
117ecs_api_edp_get_type_ids 200 type1
118ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
119
120ecs_api_edp_get_producer_ids 200 prod-a
121ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
122
123ecs_api_edp_get_producer_status 200 prod-a ENABLED
124
125ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
126ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
127
128ecs_api_a1_get_job 404 type1 test-job
129
130ecs_api_a1_get_job_status 404 type1 test-job
131
132ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
133
134
135#job1 - prod-a
136ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
137
138prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
139
140ecs_api_a1_get_job_ids 200 type1 NOWNER job1
141ecs_api_a1_get_job_ids 200 type1 ric1 job1
142
143ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
144
145ecs_api_a1_get_job_status 200 type1 job1 ENABLED
146
147ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
148
149
150#job2 - prod-a
151ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
152
153prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
154
155ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
156ecs_api_a1_get_job_ids 200 type1 ric1 job1
157ecs_api_a1_get_job_ids 200 type1 ric2 job2
158
159ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
160
161ecs_api_a1_get_job_status 200 type1 job2 ENABLED
162
163ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
164
165
166#prod-b
167ecs_api_edp_put_producer 201 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
168
169ecs_api_a1_get_type_ids 200 type1 type2
170ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
171ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
172
173ecs_api_edp_get_type_ids 200 type1 type2
174ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
175ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
176
177ecs_api_edp_get_producer_ids 200 prod-a prod-b
178ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
179ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
180
181ecs_api_edp_get_producer_status 200 prod-b ENABLED
182
183
184#job3 - prod-b
185ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
186
187prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
188
189ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
190ecs_api_a1_get_job_ids 200 type2 NOWNER job3
191ecs_api_a1_get_job_ids 200 type1 ric1 job1
192ecs_api_a1_get_job_ids 200 type1 ric2 job2
193ecs_api_a1_get_job_ids 200 type2 ric3 job3
194
195ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
196
197ecs_api_a1_get_job_status 200 type2 job3 ENABLED
198
199ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
200ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
201
202
203#prod-c (no types)
204ecs_api_edp_put_producer 201 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c NOTYPE
205
206ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
207ecs_api_edp_get_producer 200 prod-a http://producer-stub:8092/callbacks/create/prod-a http://producer-stub:8092/callbacks/delete/prod-a http://producer-stub:8092/callbacks/supervision/prod-a type1 testdata/ecs/ei-type-1.json
208ecs_api_edp_get_producer 200 prod-b http://producer-stub:8092/callbacks/create/prod-b http://producer-stub:8092/callbacks/delete/prod-b http://producer-stub:8092/callbacks/supervision/prod-b type2 testdata/ecs/ei-type-2.json
209ecs_api_edp_get_producer 200 prod-c http://producer-stub:8092/callbacks/create/prod-c http://producer-stub:8092/callbacks/delete/prod-c http://producer-stub:8092/callbacks/supervision/prod-c EMPTY
210
211ecs_api_edp_get_producer_status 200 prod-c ENABLED
212
213ecs_api_a1_delete_job 204 type2 job3
214
215ecs_api_edp_delete_producer 204 prod-b
216
217
BjornMagnussonXA39ad50e2020-10-22 09:55:25 +0200218prodstub_equal create/prod-d/job8 0
219prodstub_equal delete/prod-d/job8 0
220
221ecs_api_edp_put_producer 201 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d type4 testdata/ecs/ei-type-1.json
222
223ecs_api_a1_get_job_ids 200 type4 NOWNER EMPTY
224
225ecs_api_a1_put_job 201 type4 job8 http://localhost:80/target8 ric4 testdata/ecs/job-template.json
226
227prodstub_equal create/prod-d/job8 1
228prodstub_equal delete/prod-d/job8 0
229
230ecs_api_a1_get_job_ids 200 type4 NOWNER job8
231
232ecs_api_edp_put_producer 200 prod-d http://producer-stub:8092/callbacks/create/prod-d http://producer-stub:8092/callbacks/delete/prod-d http://producer-stub:8092/callbacks/supervision/prod-d NOTYPE
233
234ecs_api_a1_get_job_ids 404 type4 NOWNER
235
236prodstub_equal create/prod-d/job8 1
237prodstub_equal delete/prod-d/job8 0
238
239check_sdnc_logs
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200240
241check_ecs_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200242
243store_logs END
244
245#### TEST COMPLETE ####
246
247
248print_result
249
250auto_clean_containers