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