Functional Test Updates for I Release
[nonrtric.git] / test / auto-test / FTC10.sh
1 #!/bin/bash
2
3 #  ============LICENSE_START===============================================
4 #  Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
5 #  Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
6 #  ========================================================================
7 #  Licensed under the Apache License, Version 2.0 (the "License");
8 #  you may not use this file except in compliance with the License.
9 #  You may obtain a copy of the License at
10 #
11 #       http://www.apache.org/licenses/LICENSE-2.0
12 #
13 #  Unless required by applicable law or agreed to in writing, software
14 #  distributed under the License is distributed on an "AS IS" BASIS,
15 #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 #  See the License for the specific language governing permissions and
17 #  limitations under the License.
18 #  ============LICENSE_END=================================================
19 #
20
21 TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST"
22
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM NGW KUBEPROXY"
25
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES=" MR CR A1PMS RICSIM CP KUBEPROXY NGW"
28 #Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
30
31 #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
32 #the image is not configured in the supplied env_file
33 #Used for images not applicable to all supported profile
34 CONDITIONALLY_IGNORED_IMAGES="NGW"
35
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ONAP-KOHN ONAP-LONDON ONAP-MONTREAL  ORAN-G-RELEASE ORAN-H-RELEASE ORAN-I-RELEASE"
38 #Supported run modes
39 SUPPORTED_RUNMODES="DOCKER KUBE"
40
41 . ../common/testcase_common.sh $@
42
43 setup_testenvironment
44
45 #### TEST BEGIN ####
46
47 sim_generate_policy_uuid
48
49 use_simulator_http
50 use_mr_http
51 use_a1pms_rest_http
52
53
54 clean_environment
55
56 start_kube_proxy
57
58 start_ric_simulators  ricsim_g1 3 OSC_2.1.0
59
60 start_ric_simulators  ricsim_g2 5 STD_1.1.3
61
62 start_ric_simulators ricsim_g3 1  STD_2.0.0
63
64 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
65     :
66 else
67     start_mr
68 fi
69
70 start_cr 1
71
72
73 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
74
75 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
76     start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
77 fi
78
79 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
80
81 set_a1pms_debug
82
83 use_a1pms_rest_http
84
85
86 prepare_a1pms_config      NOSDNC  ".a1pms_config.json"
87
88 if [ $RUNMODE == "KUBE" ]; then
89     a1pms_load_config                       ".a1pms_config.json"
90 else
91     a1pms_api_put_configuration 200 ".a1pms_config.json"
92 fi
93
94 sleep_wait 120 "Let A1PMS configuration take effect"
95
96 a1pms_api_get_status 200
97
98 sim_print ricsim_g1_1 interface
99
100 sim_print ricsim_g2_1 interface
101
102 sim_print ricsim_g3_1 interface
103
104 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
105
106 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
107 a1pms_equal json:policy-types 3 300
108
109 # Create policies
110
111 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
112
113 use_a1pms_rest_http
114
115 a1pms_api_put_service 201 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
116
117 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
118
119 sim_equal ricsim_g1_1 num_instances 1
120
121 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
122     use_a1pms_rest_http
123 else
124     use_a1pms_dmaap_http
125 fi
126
127 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
128
129 sim_equal ricsim_g1_1 num_instances 2
130
131
132 use_a1pms_rest_http
133
134 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
135
136 sim_equal ricsim_g2_1 num_instances 1
137
138
139 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
140     use_a1pms_rest_http
141 else
142     use_a1pms_dmaap_http
143 fi
144
145 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
146
147 sim_equal ricsim_g2_1 num_instances 2
148
149 use_a1pms_rest_http
150
151 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
152
153 sim_equal ricsim_g3_1 num_instances 1
154
155 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
156     use_a1pms_rest_http
157 else
158     use_a1pms_dmaap_http
159 fi
160
161 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
162
163 sim_equal ricsim_g3_1 num_instances 2
164
165 #Update policies
166 use_a1pms_rest_http
167
168 a1pms_api_put_service 200 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
169
170 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
171
172 sim_equal ricsim_g1_1 num_instances 2
173
174
175 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
176     use_a1pms_rest_http
177 else
178     use_a1pms_dmaap_http
179 fi
180
181 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
182
183 sim_equal ricsim_g1_1 num_instances 2
184
185
186 use_a1pms_rest_http
187
188
189 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
190
191 sim_equal ricsim_g2_1 num_instances 2
192
193
194 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
195     use_a1pms_rest_http
196 else
197     use_a1pms_dmaap_http
198 fi
199
200 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
201
202 sim_equal ricsim_g2_1 num_instances 2
203
204 use_a1pms_rest_http
205
206 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
207
208 sim_equal ricsim_g3_1 num_instances 2
209
210
211 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
212     use_a1pms_rest_http
213 else
214     use_a1pms_dmaap_http
215 fi
216
217 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
218
219 sim_equal ricsim_g3_1 num_instances 2
220
221 # Check policies
222 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
223 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
224 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
225 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
226 a1pms_api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
227 a1pms_api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
228
229 sim_equal ricsim_g1_1 num_instances 2
230 sim_equal ricsim_g2_1 num_instances 2
231
232 sim_equal ricsim_g3_1 num_instances 2
233
234 # Remove policies
235
236 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
237     use_a1pms_rest_http
238 else
239     use_a1pms_dmaap_http
240 fi
241 a1pms_api_delete_policy 204 2000
242 use_a1pms_rest_http
243 a1pms_api_delete_policy 204 3000
244 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
245     use_a1pms_rest_http
246 else
247     use_a1pms_dmaap_http
248 fi
249 a1pms_api_delete_policy 204 2100
250 use_a1pms_rest_http
251 a1pms_api_delete_policy 204 3100
252 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
253     use_a1pms_rest_http
254 else
255     use_a1pms_dmaap_http
256 fi
257 a1pms_api_delete_policy 204 2200
258 use_a1pms_rest_http
259 a1pms_api_delete_policy 204 3200
260
261 sim_equal ricsim_g1_1 num_instances 0
262 sim_equal ricsim_g2_1 num_instances 0
263
264 sim_equal ricsim_g3_1 num_instances 0
265
266 # Check remote host access to simulator
267
268 sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
269 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
270 sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
271
272 # Check policy removal
273 use_a1pms_rest_http
274 a1pms_api_get_policy 404 2000
275 a1pms_api_get_policy 404 3000
276 a1pms_api_get_policy 404 2100
277 a1pms_api_get_policy 404 3100
278
279 a1pms_api_get_policy 404 2200
280 a1pms_api_get_policy 404 3200
281
282 # Remove the service
283 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
284     use_a1pms_rest_http
285 else
286     use_a1pms_dmaap_http
287 fi
288 a1pms_api_delete_services 204 "service1"
289
290 a1pms_api_get_services 404 "service1"
291
292 check_a1pms_logs
293
294 #### TEST COMPLETE ####
295
296 store_logs          END
297
298 print_result
299
300 auto_clean_environment