Merge "Fix typos in documentation"
[nonrtric.git] / test / auto-test / FTC1100.sh
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="Experimental ECS test case"
22
23 #App names to include in the test, space separated list
24 INCLUDED_IMAGES="ECS PRODSTUB"
25
26 . ../common/testcase_common.sh  $@
27 . ../common/ecs_api_functions.sh
28 . ../common/prodstub_api_functions.sh
29
30 #### TEST BEGIN ####
31
32 clean_containers
33
34 use_ecs_rest_http
35
36 use_prod_stub_http
37
38 start_ecs
39
40 start_prod_stub
41
42 set_ecs_debug
43
44 set_ecs_trace
45
46 # Setup prodstub sim to accept calls for producers, types and jobs
47 prodstub_arm_supervision 200 prod-a
48 prodstub_arm_supervision 200 prod-b
49 prodstub_arm_supervision 200 prod-c
50
51 prodstub_arm_type 200 prod-a type1
52 prodstub_arm_type 200 prod-b type2
53 prodstub_arm_type 200 prod-b type3
54
55 prodstub_disarm_type 200 prod-b type3
56 prodstub_arm_type 200 prod-b type1
57 prodstub_disarm_type 200 prod-b type1
58
59 prodstub_arm_create 200 prod-a job1
60 prodstub_arm_create 200 prod-a job2
61 prodstub_arm_create 200 prod-b job3
62
63 prodstub_arm_delete 200 prod-a job1
64 prodstub_arm_delete 200 prod-a job2
65 prodstub_arm_delete 200 prod-b job3
66
67 prodstub_arm_create 200 prod-b job4
68 prodstub_arm_create 200 prod-a job4
69
70 prodstub_arm_create 200 prod-b job5
71 prodstub_arm_create 200 prod-a job5
72 prodstub_arm_delete 200 prod-a job5
73
74 prodstub_arm_create 200 prod-b job6
75
76 # ecs status
77 ecs_api_service_status 200
78
79 # Initial tests - no config made
80 ecs_api_a1_get_type_ids 200 EMPTY
81 ecs_api_a1_get_type 404 test-type
82
83 ecs_api_edp_get_type_ids 200 EMPTY
84 ecs_api_edp_get_type 404 test-type
85
86 ecs_api_edp_get_producer_ids 200 EMPTY
87 ecs_api_edp_get_producer 404 test-prod
88
89 ecs_api_edp_get_producer_status 404 test-prod
90
91 ecs_api_edp_delete_producer 404 test-prod
92
93 ecs_api_a1_get_job_ids 404 test-type NOWNER
94 ecs_api_a1_get_job_ids 404 test-type test-owner
95
96 ecs_api_a1_get_job 404 test-type test-job
97
98 ecs_api_a1_get_job_status 404 test-type test-job
99
100 ecs_api_a1_delete_job 404 test-type test-job
101
102 ecs_api_edp_get_producer_jobs 404 test-prod
103
104
105 # Setup of producer/job and test apis
106 #prod-a
107 ecs_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
108 ecs_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
109
110 ecs_api_a1_get_type_ids 200 type1
111 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
112
113 ecs_api_edp_get_type_ids 200 type1
114 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
115
116 ecs_api_edp_get_producer_ids 200 prod-a
117 ecs_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
118
119 ecs_api_edp_get_producer_status 200 prod-a ENABLED
120
121 ecs_api_a1_get_job_ids 200 type1 NOWNER EMPTY
122 ecs_api_a1_get_job_ids 200 type1 test-owner EMPTY
123
124 ecs_api_a1_get_job 404 type1 test-job
125
126 ecs_api_a1_get_job_status 404 type1 test-job
127
128 ecs_api_edp_get_producer_jobs 200 prod-a EMPTY
129
130
131 #job1 - prod-a
132 ecs_api_a1_put_job 201 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
133
134 prodstub_check_jobdata 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
135
136 ecs_api_a1_get_job_ids 200 type1 NOWNER job1
137 ecs_api_a1_get_job_ids 200 type1 ric1 job1
138
139 ecs_api_a1_get_job 200 type1 job1 http://localhost:80/target1 ric1 testdata/ecs/job-template.json
140
141 ecs_api_a1_get_job_status 200 type1 job1 ENABLED
142
143 ecs_api_edp_get_producer_jobs 200 prod-a job1 type1 http://localhost:80/target1 testdata/ecs/job-template.json
144
145
146 #job2 - prod-a
147 ecs_api_a1_put_job 201 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
148
149 prodstub_check_jobdata 200 prod-a job2 type1 http://localhost:80/target2 testdata/ecs/job-template.json
150
151 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
152 ecs_api_a1_get_job_ids 200 type1 ric1 job1
153 ecs_api_a1_get_job_ids 200 type1 ric2 job2
154
155 ecs_api_a1_get_job 200 type1 job2 http://localhost:80/target2 ric2 testdata/ecs/job-template.json
156
157 ecs_api_a1_get_job_status 200 type1 job2 ENABLED
158
159 ecs_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
160
161
162 #prod-b
163 ecs_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
164
165 ecs_api_a1_get_type_ids 200 type1 type2
166 ecs_api_a1_get_type 200 type1 testdata/ecs/ei-type-1.json
167 ecs_api_a1_get_type 200 type2 testdata/ecs/ei-type-2.json
168
169 ecs_api_edp_get_type_ids 200 type1 type2
170 ecs_api_edp_get_type 200 type1 testdata/ecs/ei-type-1.json prod-a
171 ecs_api_edp_get_type 200 type2 testdata/ecs/ei-type-2.json prod-b
172
173 ecs_api_edp_get_producer_ids 200 prod-a prod-b
174 ecs_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
175 ecs_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
176
177 ecs_api_edp_get_producer_status 200 prod-b ENABLED
178
179
180 #job3 - prod-b
181 ecs_api_a1_put_job 201 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
182
183 prodstub_check_jobdata 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
184
185 ecs_api_a1_get_job_ids 200 type1 NOWNER job1 job2
186 ecs_api_a1_get_job_ids 200 type2 NOWNER job3
187 ecs_api_a1_get_job_ids 200 type1 ric1 job1
188 ecs_api_a1_get_job_ids 200 type1 ric2 job2
189 ecs_api_a1_get_job_ids 200 type2 ric3 job3
190
191 ecs_api_a1_get_job 200 type2 job3 http://localhost:80/target3 ric3 testdata/ecs/job-template.json
192
193 ecs_api_a1_get_job_status 200 type2 job3 ENABLED
194
195 ecs_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
196 ecs_api_edp_get_producer_jobs 200 prod-b job3 type2 http://localhost:80/target3 testdata/ecs/job-template.json
197
198
199 #prod-c (no types)
200 ecs_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
201
202 ecs_api_edp_get_producer_ids 200 prod-a prod-b prod-c
203 ecs_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
204 ecs_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
205 ecs_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
206
207 ecs_api_edp_get_producer_status 200 prod-c ENABLED
208
209 ecs_api_a1_delete_job 204 type2 job3
210
211 ecs_api_edp_delete_producer 204 prod-b
212
213
214 check_sndc_logs
215
216 check_ecs_logs
217
218 store_logs END
219
220 #### TEST COMPLETE ####
221
222
223 print_result
224
225 auto_clean_containers