blob: b53ae4e1f469382a16053ef1edab87e3ea51e1b2 [file] [log] [blame]
BjornMagnussonXA80a92002020-03-19 14:31:06 +01001#!/usr/bin/env 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
21TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
22
23. ../common/testcase_common.sh $@
24. ../common/agent_api_functions.sh
25. ../common/ricsimulator_api_functions.sh
26
27
28#Local vars in test script
29##########################
30# Path to callback receiver
31CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
32
33
34#### TEST BEGIN ####
35
36clean_containers
37
38start_ric_simulators ricsim_g1 1 OSC_2.1.0
39
40start_mr
41
42start_cr
43
44start_consul_cbs
45
46prepare_consul_config NOSDNC ".consul_config.json"
47consul_config_app ".consul_config.json"
48
49start_control_panel
50
BjornMagnussonXA80a92002020-03-19 14:31:06 +010051start_policy_agent
52
BjornMagnussonXA72667f12020-04-24 09:20:18 +020053use_agent_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +010054
55#Verify no callbacks or dmaap messages has been sent
56cr_equal received_callbacks 0
57mr_equal requests_submitted 0
58
59#Check agent alive
60api_get_status 200
61
62#Print simulator interface version
63sim_print ricsim_g1_1 interface
64
65api_put_service 201 "rapp1" 15 "$CR_PATH/rapp1"
66
67api_get_services 200 "rapp1" 15 "$CR_PATH/rapp1"
68
69api_put_service 201 "rapp2" 120 "$CR_PATH/rapp2"
70
71api_get_services 200 "rapp2" 120 "$CR_PATH/rapp2"
72
73api_put_service 200 "rapp1" 50 "$CR_PATH/rapp1"
74api_put_service 200 "rapp2" 180 "$CR_PATH/rapp2"
75
76api_get_services 200 "rapp1" 50 "$CR_PATH/rapp1"
77api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
78
79api_get_service_ids 200 "rapp1" "rapp2"
80
81sleep_wait 30 "Waiting for keep alive timeout"
82
83api_get_services 200 "rapp1" 50 "$CR_PATH/rapp1"
84api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
85
86sleep_wait 100 "Waiting for keep alive timeout"
87
88api_get_services 404 "rapp1"
89api_get_services 200 "rapp2" 180 "$CR_PATH/rapp2"
90
91api_delete_services 204 "rapp2"
92
93api_get_services 404 "rapp1"
94api_get_services 404 "rapp2"
95
96api_put_service 201 "rapp3" 60 "$CR_PATH/rapp3"
97
98api_get_services 200 "rapp3" 60 "$CR_PATH/rapp3"
99
100sleep_wait 30 "Waiting for keep alive timeout"
101
102api_put_service 200 "rapp3" 60 "$CR_PATH/rapp3"
103
104sleep_wait 100 "Waiting for keep alive timeout"
105
106api_get_services 404 "rapp3"
107
108api_put_service 201 "rapp4" 120 "$CR_PATH/rapp4"
109
110sleep_wait 60 "Waiting for keep alive timeout"
111
112api_get_services 200 "rapp4" 120 "$CR_PATH/rapp4"
113
114api_put_services_keepalive 200 "rapp4"
115
116sleep_wait 90 "Waiting for keep alive timeout"
117
118api_get_services 200 "rapp4" 120 "$CR_PATH/rapp4"
119
120api_delete_services 204 "rapp4"
121
122api_get_services 404 "rapp4"
123
124api_get_services 404 "rapp1"
125api_get_services 404 "rapp2"
126api_get_services 404 "rapp3"
127
128api_get_service_ids 200
129
130api_delete_services 404 "rapp1"
131api_delete_services 404 "rapp2"
132api_delete_services 404 "rapp3"
133api_delete_services 404 "rapp4"
134
135api_put_services_keepalive 404 "rapp1"
136api_put_services_keepalive 404 "rapp2"
137api_put_services_keepalive 404 "rapp3"
138api_put_services_keepalive 404 "rapp4"
139
140api_get_service_ids 200
141
142
143
144cr_equal received_callbacks 0
145mr_equal requests_submitted 0
146
147check_policy_agent_logs
148check_control_panel_logs
149
150#### TEST COMPLETE ####
151
152store_logs END
153
154print_result
155
156auto_clean_containers