Removal of older test profiles
[nonrtric.git] / test / auto-test / FTC10.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 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 and Dmaap"
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 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 start_mr
64
65 start_cr 1
66
67
68 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
69
70 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
71     start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
72 fi
73
74 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
75
76 set_a1pms_debug
77
78 use_a1pms_rest_http
79
80
81 prepare_a1pms_config      NOSDNC  ".a1pms_config.json"
82
83 if [ $RUNMODE == "KUBE" ]; then
84     a1pms_load_config                       ".a1pms_config.json"
85 else
86     a1pms_api_put_configuration 200 ".a1pms_config.json"
87 fi
88
89 sleep_wait 120 "Let A1PMS cofiguration take effect"
90
91 a1pms_api_get_status 200
92
93 sim_print ricsim_g1_1 interface
94
95 sim_print ricsim_g2_1 interface
96
97 sim_print ricsim_g3_1 interface
98
99 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
100
101 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
102 a1pms_equal json:policy-types 3 300
103
104 # Create policies
105
106 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
107
108 use_a1pms_rest_http
109
110 a1pms_api_put_service 201 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
111
112 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
113
114 sim_equal ricsim_g1_1 num_instances 1
115
116
117 use_a1pms_dmaap_http
118
119 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
120
121 sim_equal ricsim_g1_1 num_instances 2
122
123
124 use_a1pms_rest_http
125
126 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
127
128 sim_equal ricsim_g2_1 num_instances 1
129
130
131 use_a1pms_dmaap_http
132
133 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
134
135 sim_equal ricsim_g2_1 num_instances 2
136
137 use_a1pms_rest_http
138
139 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
140
141 sim_equal ricsim_g3_1 num_instances 1
142
143 use_a1pms_dmaap_http
144
145 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
146
147 sim_equal ricsim_g3_1 num_instances 2
148
149 #Update policies
150 use_a1pms_rest_http
151
152 a1pms_api_put_service 200 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
153
154 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
155
156 sim_equal ricsim_g1_1 num_instances 2
157
158
159 use_a1pms_dmaap_http
160
161 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
162
163 sim_equal ricsim_g1_1 num_instances 2
164
165
166 use_a1pms_rest_http
167
168
169 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
170
171 sim_equal ricsim_g2_1 num_instances 2
172
173
174 use_a1pms_dmaap_http
175
176 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
177
178 sim_equal ricsim_g2_1 num_instances 2
179
180 use_a1pms_rest_http
181
182 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
183
184 sim_equal ricsim_g3_1 num_instances 2
185
186
187 use_a1pms_dmaap_http
188
189 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
190
191 sim_equal ricsim_g3_1 num_instances 2
192
193 # Check policies
194 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
195 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
196 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
197 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
198 a1pms_api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
199 a1pms_api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
200
201 sim_equal ricsim_g1_1 num_instances 2
202 sim_equal ricsim_g2_1 num_instances 2
203
204 sim_equal ricsim_g3_1 num_instances 2
205
206 # Remove policies
207
208 use_a1pms_dmaap_http
209 a1pms_api_delete_policy 204 2000
210 use_a1pms_rest_http
211 a1pms_api_delete_policy 204 3000
212 use_a1pms_dmaap_http
213 a1pms_api_delete_policy 204 2100
214 use_a1pms_rest_http
215 a1pms_api_delete_policy 204 3100
216 use_a1pms_dmaap_http
217 a1pms_api_delete_policy 204 2200
218 use_a1pms_rest_http
219 a1pms_api_delete_policy 204 3200
220
221 sim_equal ricsim_g1_1 num_instances 0
222 sim_equal ricsim_g2_1 num_instances 0
223
224 sim_equal ricsim_g3_1 num_instances 0
225
226 # Check remote host access to simulator
227
228 sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
229 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
230 sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
231
232 # Check policy removal
233 use_a1pms_rest_http
234 a1pms_api_get_policy 404 2000
235 a1pms_api_get_policy 404 3000
236 a1pms_api_get_policy 404 2100
237 a1pms_api_get_policy 404 3100
238
239 a1pms_api_get_policy 404 2200
240 a1pms_api_get_policy 404 3200
241
242 # Remove the service
243 use_a1pms_dmaap_http
244 a1pms_api_delete_services 204 "service1"
245
246 a1pms_api_get_services 404 "service1"
247
248 check_a1pms_logs
249
250 #### TEST COMPLETE ####
251
252 store_logs          END
253
254 print_result
255
256 auto_clean_environment