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=================================================
21 TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
23 #App names to include in the test, space separated list
24 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM"
26 #SUPPORTED TEST ENV FILE
27 SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN"
29 . ../common/testcase_common.sh $@
30 . ../common/agent_api_functions.sh
31 . ../common/ricsimulator_api_functions.sh
32 . ../common/cr_api_functions.sh
46 start_ric_simulators ricsim_g1 1 OSC_2.1.0
47 start_ric_simulators ricsim_g2 1 STD_1.1.3
48 if [ "$PMS_VERSION" == "V2" ]; then
49 start_ric_simulators ricsim_g3 1 STD_2.0.0
58 prepare_consul_config NOSDNC ".consul_config.json"
59 consul_config_app ".consul_config.json"
67 mr_equal requests_submitted 0
72 #Print simulator interface version
73 sim_print ricsim_g1_1 interface
74 sim_print ricsim_g2_1 interface
75 if [ "$PMS_VERSION" == "V2" ]; then
76 sim_print ricsim_g3_1 interface
79 api_put_service 201 "service1" 15 "$CR_PATH/service1"
81 api_get_services 200 "service1" "service1" 15 "$CR_PATH/service1"
83 api_put_service 201 "service2" 120 "$CR_PATH/service2"
85 api_get_services 200 "service2" "service2" 120 "$CR_PATH/service2"
87 api_put_service 200 "service1" 50 "$CR_PATH/service1"
88 api_put_service 200 "service2" 180 "$CR_PATH/service2"
90 api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
91 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
93 api_get_service_ids 200 "service1" "service2"
95 sleep_wait 30 "Waiting for keep alive timeout"
97 api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
98 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
100 sleep_wait 100 "Waiting for keep alive timeout"
102 api_get_services 404 "service1"
103 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
105 api_delete_services 204 "service2"
107 api_get_services 404 "service1"
108 api_get_services 404 "service2"
110 api_put_service 201 "service3" 60 "$CR_PATH/service3"
112 api_get_services 200 "service3" "service3" 60 "$CR_PATH/service3"
114 sleep_wait 30 "Waiting for keep alive timeout"
116 api_put_service 200 "service3" 60 "$CR_PATH/service3"
118 sleep_wait 100 "Waiting for keep alive timeout"
120 api_get_services 404 "service3"
122 api_put_service 201 "service4" 120 "$CR_PATH/service4"
124 sleep_wait 60 "Waiting for keep alive timeout"
126 api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
128 api_put_services_keepalive 200 "service4"
130 sleep_wait 90 "Waiting for keep alive timeout"
132 api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
134 api_delete_services 204 "service4"
136 api_get_services 404 "service4"
138 api_get_services 404 "service1"
139 api_get_services 404 "service2"
140 api_get_services 404 "service3"
142 api_get_service_ids 200
144 api_delete_services 404 "service1"
145 api_delete_services 404 "service2"
146 api_delete_services 404 "service3"
147 api_delete_services 404 "service4"
149 api_put_services_keepalive 404 "service1"
150 api_put_services_keepalive 404 "service2"
151 api_put_services_keepalive 404 "service3"
152 api_put_services_keepalive 404 "service4"
154 # Policy delete after timeout
155 api_put_service 201 "service10" 600 "$CR_PATH/service10"
157 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
159 if [ "$PMS_VERSION" == "V2" ]; then
160 api_equal json:rics 3 60
162 #api_equal json:policy_schemas 2 120
164 api_equal json:policy-types 2 120
166 api_equal json:policies 0
168 api_equal json:rics 2 60
170 api_equal json:policy_schemas 2 120
172 api_equal json:policy_types 2
174 api_equal json:policies 0
177 if [ "$PMS_VERSION" == "V2" ]; then
178 notificationurl=$CR_PATH"/test"
183 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
184 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
186 api_equal json:policies 2
188 sim_equal ricsim_g1_1 num_instances 1
189 sim_equal ricsim_g2_1 num_instances 1
191 api_put_policy 201 "service10" ricsim_g1_1 1 5001 true $notificationurl testdata/OSC/pi1_template.json
192 api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5101 true $notificationurl testdata/STD/pi1_template.json
194 api_equal json:policies 4
196 sim_equal ricsim_g1_1 num_instances 2
197 sim_equal ricsim_g2_1 num_instances 2
199 sim_post_delete_instances 200 ricsim_g1_1
200 sim_post_delete_instances 200 ricsim_g2_1
202 #Wait for recreate of non transient policy
203 api_equal json:policies 2 180
205 sim_equal ricsim_g1_1 num_instances 1
206 sim_equal ricsim_g2_1 num_instances 1
208 api_put_service 200 "service10" 10 "$CR_PATH/service10"
210 #Wait for service expiry
211 api_equal json:policies 0 120
213 sim_equal ricsim_g1_1 num_instances 0
214 sim_equal ricsim_g2_1 num_instances 0
216 api_get_service_ids 200
218 mr_equal requests_submitted 0
220 check_policy_agent_logs
221 check_control_panel_logs
223 #### TEST COMPLETE ####
229 auto_clean_containers