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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
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"
22 #App names to include in the test, space separated list
23 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
25 #SUPPORTED TEST ENV FILE
26 SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-CHERRY"
28 . ../common/testcase_common.sh $@
29 . ../common/agent_api_functions.sh
30 . ../common/ricsimulator_api_functions.sh
43 start_ric_simulators ricsim_g1 3 OSC_2.1.0
45 start_ric_simulators ricsim_g2 5 STD_1.1.3
47 if [ "$PMS_VERSION" == "V2" ]; then
48 start_ric_simulators ricsim_g3 1 STD_2.0.0
55 prepare_consul_config NOSDNC ".consul_config.json"
56 consul_config_app ".consul_config.json"
68 sim_print ricsim_g1_1 interface
70 sim_print ricsim_g2_1 interface
72 if [ "$PMS_VERSION" == "V2" ]; then
73 sim_print ricsim_g3_1 interface
76 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
78 if [ "$PMS_VERSION" == "V2" ]; then
79 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
80 api_equal json:policy-types 3 60
82 api_equal json:policy_types 2 60
87 if [ "$PMS_VERSION" == "V2" ]; then
88 notificationurl=$CR_PATH"/test"
95 api_put_service 201 "service1" 3600 "$CR_PATH/1"
97 api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
99 sim_equal ricsim_g1_1 num_instances 1
104 api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
106 sim_equal ricsim_g1_1 num_instances 2
111 api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
113 sim_equal ricsim_g2_1 num_instances 1
118 api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
120 sim_equal ricsim_g2_1 num_instances 2
122 if [ "$PMS_VERSION" == "V2" ]; then
125 api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
127 sim_equal ricsim_g3_1 num_instances 1
131 api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
133 sim_equal ricsim_g3_1 num_instances 2
140 api_put_service 200 "service1" 3600 "$CR_PATH/1"
142 api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
144 sim_equal ricsim_g1_1 num_instances 2
149 api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
151 sim_equal ricsim_g1_1 num_instances 2
157 api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
159 sim_equal ricsim_g2_1 num_instances 2
164 api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
166 sim_equal ricsim_g2_1 num_instances 2
168 if [ "$PMS_VERSION" == "V2" ]; then
171 api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
173 sim_equal ricsim_g3_1 num_instances 2
178 api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
180 sim_equal ricsim_g3_1 num_instances 2
184 if [ "$PMS_VERSION" == "V2" ]; then
185 api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
186 api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
187 api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
188 api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
189 api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
190 api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
192 api_get_policy 200 2000 testdata/OSC/pi1_template.json
193 api_get_policy 200 3000 testdata/OSC/pi1_template.json
194 api_get_policy 200 2100 testdata/STD/pi1_template.json
195 api_get_policy 200 3100 testdata/STD/pi1_template.json
198 sim_equal ricsim_g1_1 num_instances 2
199 sim_equal ricsim_g2_1 num_instances 2
201 if [ "$PMS_VERSION" == "V2" ]; then
202 sim_equal ricsim_g3_1 num_instances 2
208 api_delete_policy 204 2000
210 api_delete_policy 204 3000
212 api_delete_policy 204 2100
214 api_delete_policy 204 3100
215 if [ "$PMS_VERSION" == "V2" ]; then
217 api_delete_policy 204 2200
219 api_delete_policy 204 3200
222 sim_equal ricsim_g1_1 num_instances 0
223 sim_equal ricsim_g2_1 num_instances 0
225 if [ "$PMS_VERSION" == "V2" ]; then
226 sim_equal ricsim_g3_1 num_instances 0
229 # Check remote host access to simulator
231 sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
232 sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
233 if [ "$PMS_VERSION" == "V2" ]; then
234 sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
237 # Check policy removal
239 api_get_policy 404 2000
240 api_get_policy 404 3000
241 api_get_policy 404 2100
242 api_get_policy 404 3100
244 if [ "$PMS_VERSION" == "V2" ]; then
245 api_get_policy 404 2200
246 api_get_policy 404 3200
251 api_delete_services 204 "service1"
253 api_get_services 404 "service1"
255 check_policy_agent_logs
257 #### TEST COMPLETE ####
263 auto_clean_containers