Add nginx.conf to docker-compose of control-panel
[nonrtric.git] / test / auto-test / FTC_HELM-RECIPE.sh
1 #!/usr/bin/env 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 TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components"
21
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="" # Not used -  KUBE only test script
24
25 #App names to include in the test when running kubernetes, space separated list
26 KUBE_INCLUDED_IMAGES=" MR CR  PRODSTUB"
27 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28 KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC"
29
30 #Supported test environment profiles
31 SUPPORTED_PROFILES="ORAN-CHERRY ORAN-DAWN"
32 #Supported run modes
33 SUPPORTED_RUNMODES="KUBE"
34
35 . ../common/testcase_common.sh $@
36 . ../common/agent_api_functions.sh
37 . ../common/ricsimulator_api_functions.sh
38 . ../common/ecs_api_functions.sh
39 . ../common/prodstub_api_functions.sh
40 . ../common/cr_api_functions.sh
41 . ../common/rapp_catalogue_api_functions.sh
42 . ../common/mr_api_functions.sh
43 . ../common/control_panel_api_functions.sh
44 . ../common/controller_api_functions.sh
45
46 #### TEST BEGIN ####
47
48 use_mr_http       #MR only supports http?
49 use_cr_https
50 use_agent_rest_https
51 use_sdnc_https
52 use_simulator_https
53 use_ecs_rest_https
54 use_prod_stub_https
55 if [ $ECS_VERSION == "V1-1" ]; then
56     use_rapp_catalogue_http # https not yet supported
57 else
58     use_rapp_catalogue_https
59 fi
60
61 echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
62
63 use_control_panel_https
64
65 if [ "$PMS_VERSION" == "V1" ]; then
66    echo "PMS VERSION 2 (V2) is required"
67    exit 1
68 fi
69
70 clean_environment
71
72 STD_NUM_RICS=2
73 OSC_NUM_RICS=2
74
75 start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
76 echo " RIC MAPPING a1-sim-osc-0 : ric1"
77 echo " RIC MAPPING a1-sim-osc-1 : ric2"
78
79 start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
80 echo " RIC MAPPING a1-sim-std-0 : ric3"
81 echo " RIC MAPPING a1-sim-std-1 : ric4"
82
83 start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
84 echo " RIC MAPPING a1-sim-std2-0 : ric5"
85 echo " RIC MAPPING a1-sim-std2-1 : ric6"
86
87 start_mr
88
89 start_control_panel
90
91 start_sdnc
92
93 start_policy_agent
94
95 start_cr
96
97 start_prod_stub
98
99 start_ecs NOPROXY
100
101 set_ecs_trace
102
103 start_rapp_catalogue
104
105 set_agent_trace
106
107 #### Test RAPP Catalogue ####
108
109 rapp_cat_api_get_services 200 EMPTY
110
111 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
112
113 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
114
115 #Check the number of services
116 rc_equal json:services 1
117
118 api_get_status 200
119
120 #### Test Policy Management Service ####
121
122 # Print the A1 version for STD 1.1.X
123 for ((i=0; i<$STD_NUM_RICS; i++))
124 do
125     sim_print "a1-sim-std-"$i interface
126 done
127
128 # Print the A1 version for STD 2.0.X
129 for ((i=0; i<$STD_NUM_RICS; i++))
130 do
131    sim_print "a1-sim-std2-"$i interface
132 done
133
134 # Print the A1 version for OSC 2.1.X
135 for ((i=0; i<$OSC_NUM_RICS; i++))
136 do
137     sim_print "a1-sim-osc-"$i interface
138 done
139
140
141 # Load the polictypes in STD 2
142 for ((i=0; i<$STD_NUM_RICS; i++))
143 do
144    sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
145    sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
146 done
147
148 # Load the polictypes in OSC
149 for ((i=0; i<$OSC_NUM_RICS; i++))
150 do
151     sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
152     sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
153 done
154
155 # Check that all rics are synced in
156 api_equal json:rics 6 300
157
158 #Check the number of schemas and the individual schemas
159 api_equal json:policy-types 5 300
160
161 for ((i=0; i<$STD_NUM_RICS; i++))
162 do
163     ricid=$((3+$i))
164     api_equal json:policy-types?ric_id=ric$ricid 1 120
165 done
166
167 for ((i=0; i<$STD_NUM_RICS; i++))
168 do
169    ricid=$((5+$i))
170    api_equal json:policy-types?ric_id=ric$ricid 2 120
171 done
172
173 for ((i=0; i<$OSC_NUM_RICS; i++))
174 do
175     ricid=$((1+$i))
176     api_equal json:policy-types?ric_id=ric$ricid 2 120
177 done
178
179 #Check the schemas in STD 2
180 for ((i=0; i<$OSC_NUM_RICS; i++))
181 do
182    ricid=$((5+$i))
183    api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
184    api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
185 done
186
187 # Check the schemas in OSC
188 for ((i=0; i<$OSC_NUM_RICS; i++))
189 do
190     api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
191     api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
192 done
193
194 api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/ER-app"
195
196 # Create policies in STD
197 for ((i=0; i<$STD_NUM_RICS; i++))
198 do
199     ricid=$((3+$i))
200     generate_uuid
201     api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
202     generate_uuid
203     api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1
204 done
205
206 #Create policies in STD 2
207 for ((i=0; i<$STD_NUM_RICS; i++))
208 do
209    ricid=$((5+$i))
210    generate_uuid
211    api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos_template.json 1
212    generate_uuid
213    api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos2_template.json 1
214 done
215
216 # Create policies in OSC
217 for ((i=0; i<$OSC_NUM_RICS; i++))
218 do
219     ricid=$((1+$i))
220     generate_uuid
221     api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi1_template.json 1
222     generate_uuid
223     api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi2_template.json 1
224 done
225
226
227 # Check the number of policies in STD and STD2
228 for ((i=0; i<$STD_NUM_RICS; i++))
229 do
230     sim_equal "a1-sim-std-"$i num_instances 2
231     sim_equal "a1-sim-std2-"$i num_instances 2
232 done
233
234 # Check the number of policies in OSC
235 for ((i=0; i<$STD_NUM_RICS; i++))
236 do
237     sim_equal "a1-sim-osc-"$i num_instances 2
238 done
239
240 echo "ADD EVENT/STATUS CHECK"
241 echo "ADD MR CHECK"
242
243 FLAT_A1_EI="1"
244
245 ecs_api_admin_reset
246
247 CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
248 CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
249 TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
250 TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
251
252 STATUS1="$CR_SERVICE_PATH/job1-status"
253 STATUS2="$CR_SERVICE_PATH/job2-status"
254
255 prodstub_arm_producer 200 prod-a
256 prodstub_arm_type 200 prod-a type1
257 prodstub_arm_job_create 200 prod-a job1
258 prodstub_arm_job_create 200 prod-a job2
259
260
261 ### ecs status
262 ecs_api_service_status 200
263
264 ## Setup prod-a
265 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
266
267 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
268
269 ecs_api_edp_get_producer_status 200 prod-a ENABLED
270
271
272 ## Create a job for prod-a
273 ## job1 - prod-a
274 if [  -z "$FLAT_A1_EI" ]; then
275     ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
276 else
277     ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
278 fi
279
280 # Check the job data in the producer
281 if [ $ECS_VERSION == "V1-1" ]; then
282     prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
283 else
284     prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
285 fi
286
287 ## Create a second job for prod-a
288 ## job2 - prod-a
289 if [  -z "$FLAT_A1_EI" ]; then
290     ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
291 else
292     ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
293 fi
294
295 # Check the job data in the producer
296 if [ $ECS_VERSION == "V1-1" ]; then
297     prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
298 else
299     prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
300 fi
301
302 echo "ADD EVENT/STATUS CHECK"
303
304 check_policy_agent_logs
305 check_ecs_logs
306 check_sdnc_logs
307
308 #### TEST COMPLETE ####
309
310 store_logs          END
311
312 print_result