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 . ../common/testcase_common.sh $@
26 . ../common/agent_api_functions.sh
27 . ../common/ricsimulator_api_functions.sh
33 #Local vars in test script
34 ##########################
35 # Path to callback receiver
36 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
46 start_ric_simulators ricsim_g1 3 OSC_2.1.0
48 start_ric_simulators ricsim_g2 5 STD_1.1.3
50 if [ "$PMS_VERSION" == "V2" ]; then
51 start_ric_simulators ricsim_g3 1 STD_2.0.0
60 prepare_consul_config NOSDNC ".consul_config.json"
61 consul_config_app ".consul_config.json"
73 sim_print ricsim_g1_1 interface
75 sim_print ricsim_g2_1 interface
77 if [ "$PMS_VERSION" == "V2" ]; then
78 sim_print ricsim_g3_1 interface
81 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
83 if [ "$PMS_VERSION" == "V2" ]; then
84 api_equal json:policy-types 2 60
86 api_equal json:policy_types 2 60
91 if [ "$PMS_VERSION" == "V2" ]; then
92 notificationurl="http://localhost:80"
99 api_put_service 201 "service1" 3600 "$CR_PATH/1"
101 api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
103 sim_equal ricsim_g1_1 num_instances 1
108 api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
110 sim_equal ricsim_g1_1 num_instances 2
115 api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
117 sim_equal ricsim_g2_1 num_instances 1
122 api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
124 sim_equal ricsim_g2_1 num_instances 2
130 api_put_service 200 "service1" 3600 "$CR_PATH/1"
132 api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
134 sim_equal ricsim_g1_1 num_instances 2
139 api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
141 sim_equal ricsim_g1_1 num_instances 2
147 api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
149 sim_equal ricsim_g2_1 num_instances 2
154 api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
156 sim_equal ricsim_g2_1 num_instances 2
159 if [ "$PMS_VERSION" == "V2" ]; then
160 api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
161 api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
162 api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
163 api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
165 api_get_policy 200 2000 testdata/OSC/pi1_template.json
166 api_get_policy 200 3000 testdata/OSC/pi1_template.json
167 api_get_policy 200 2100 testdata/STD/pi1_template.json
168 api_get_policy 200 3100 testdata/STD/pi1_template.json
174 api_delete_policy 204 2000
176 api_delete_policy 204 3000
178 api_delete_policy 204 2100
180 api_delete_policy 204 3100
182 sim_equal ricsim_g1_1 num_instances 0
183 sim_equal ricsim_g2_1 num_instances 0
185 if [ "$PMS_VERSION" == "V2" ]; then
186 sim_equal ricsim_g3_1 num_instances 0
189 # Check remote host access to simulator
191 sim_contains_str ricsim_g1_1 remote_hosts "policy-agent"
192 sim_contains_str ricsim_g2_1 remote_hosts "policy-agent"
193 if [ "$PMS_VERSION" == "V2" ]; then
194 sim_contains_str ricsim_g3_1 remote_hosts "policy-agent"
197 # Check policy removal
199 api_get_policy 404 2000
200 api_get_policy 404 3000
201 api_get_policy 404 2100
202 api_get_policy 404 3100
206 api_delete_services 204 "service1"
208 api_get_services 404 "service1"
212 check_policy_agent_logs
214 #### TEST COMPLETE ####
220 auto_clean_containers