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