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 . ../common/testcase_common.sh $@
24 . ../common/agent_api_functions.sh
25 . ../common/ricsimulator_api_functions.sh
28 #Local vars in test script
29 ##########################
30 # Path to callback receiver
31 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
38 start_ric_simulators ricsim_g1 1 OSC_2.1.0
46 prepare_consul_config NOSDNC ".consul_config.json"
47 consul_config_app ".consul_config.json"
55 #Verify no callbacks or dmaap messages has been sent
56 cr_equal received_callbacks 0
57 mr_equal requests_submitted 0
62 #Print simulator interface version
63 sim_print ricsim_g1_1 interface
65 api_put_service 201 "rapp1" 15 "$CR_PATH/rapp1"
67 api_get_services 200 "rapp1" 15 "$CR_PATH/rapp1"
69 api_put_service 201 "rapp2" 120 "$CR_PATH/rapp2"
71 api_get_services 200 "rapp2" 120 "$CR_PATH/rapp2"
73 api_put_service 200 "rapp1" 50 "$CR_PATH/rapp1"
74 api_put_service 200 "rapp2" 180 "$CR_PATH/rapp2"
76 api_get_services 200 "rapp1" 50 "$CR_PATH/rapp1"
77 api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
79 api_get_service_ids 200 "rapp1" "rapp2"
81 sleep_wait 30 "Waiting for keep alive timeout"
83 api_get_services 200 "rapp1" 50 "$CR_PATH/rapp1"
84 api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
86 sleep_wait 100 "Waiting for keep alive timeout"
88 api_get_services 404 "rapp1"
89 api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
91 api_delete_services 204 "rapp2"
93 api_get_services 404 "rapp1"
94 api_get_services 404 "rapp2"
96 api_put_service 201 "rapp3" 60 "$CR_PATH/rapp3"
98 api_get_services 200 "rapp3" 60 "$CR_PATH/rapp3"
100 sleep_wait 30 "Waiting for keep alive timeout"
102 api_put_service 200 "rapp3" 60 "$CR_PATH/rapp3"
104 sleep_wait 100 "Waiting for keep alive timeout"
106 api_get_services 404 "rapp3"
108 api_put_service 201 "rapp4" 120 "$CR_PATH/rapp4"
110 sleep_wait 60 "Waiting for keep alive timeout"
112 api_get_services 200 "rapp4" 120 "$CR_PATH/rapp4"
114 api_put_services_keepalive 200 "rapp4"
116 sleep_wait 90 "Waiting for keep alive timeout"
118 api_get_services 200 "rapp4" 120 "$CR_PATH/rapp4"
120 api_delete_services 204 "rapp4"
122 api_get_services 404 "rapp4"
124 api_get_services 404 "rapp1"
125 api_get_services 404 "rapp2"
126 api_get_services 404 "rapp3"
128 api_get_service_ids 200
130 api_delete_services 404 "rapp1"
131 api_delete_services 404 "rapp2"
132 api_delete_services 404 "rapp3"
133 api_delete_services 404 "rapp4"
135 api_put_services_keepalive 404 "rapp1"
136 api_put_services_keepalive 404 "rapp2"
137 api_put_services_keepalive 404 "rapp3"
138 api_put_services_keepalive 404 "rapp4"
140 api_get_service_ids 200
144 cr_equal received_callbacks 0
145 mr_equal requests_submitted 0
147 check_policy_agent_logs
148 check_control_panel_logs
150 #### TEST COMPLETE ####
156 auto_clean_containers