Merge "Step version for release"
[nonrtric.git] / test / auto-test / FTC110.sh
1 #!/bin/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
21 TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
22
23 #App names to exclude checking pulling images for, space separated list
24 EXCLUDED_IMAGES="SDMC SDNC_ONAP"
25
26 . ../common/testcase_common.sh  $@
27 . ../common/agent_api_functions.sh
28 . ../common/ricsimulator_api_functions.sh
29
30
31 #Local vars in test script
32 ##########################
33 # Path to callback receiver
34 CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
35
36
37 #### TEST BEGIN ####
38
39 clean_containers
40
41 start_ric_simulators ricsim_g1 1  OSC_2.1.0
42
43 start_mr
44
45 start_cr
46
47 start_consul_cbs
48
49 prepare_consul_config      NOSDNC  ".consul_config.json"
50 consul_config_app                  ".consul_config.json"
51
52 start_control_panel
53
54 start_policy_agent
55
56 set_agent_debug
57
58 use_agent_rest_http
59
60 #Verify no callbacks or dmaap messages has been sent
61 cr_equal received_callbacks 0
62 mr_equal requests_submitted 0
63
64 #Check agent alive
65 api_get_status 200
66
67 #Print simulator interface version
68 sim_print ricsim_g1_1 interface
69
70 api_put_service 201 "service1" 15 "$CR_PATH/service1"
71
72 api_get_services 200 "service1" "service1" 15 "$CR_PATH/service1"
73
74 api_put_service 201 "service2" 120 "$CR_PATH/service2"
75
76 api_get_services 200 "service2" "service2" 120 "$CR_PATH/service2"
77
78 api_put_service 200 "service1" 50 "$CR_PATH/service1"
79 api_put_service 200 "service2" 180 "$CR_PATH/service2"
80
81 api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
82 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
83
84 api_get_service_ids 200 "service1" "service2"
85
86 sleep_wait 30 "Waiting for keep alive timeout"
87
88 api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1"
89 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
90
91 sleep_wait 100 "Waiting for keep alive timeout"
92
93 api_get_services 404 "service1"
94 api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2"
95
96 api_delete_services 204 "service2"
97
98 api_get_services 404 "service1"
99 api_get_services 404 "service2"
100
101 api_put_service 201 "service3" 60 "$CR_PATH/service3"
102
103 api_get_services 200 "service3" "service3" 60 "$CR_PATH/service3"
104
105 sleep_wait 30 "Waiting for keep alive timeout"
106
107 api_put_service 200 "service3" 60 "$CR_PATH/service3"
108
109 sleep_wait 100 "Waiting for keep alive timeout"
110
111 api_get_services 404 "service3"
112
113 api_put_service 201 "service4" 120 "$CR_PATH/service4"
114
115 sleep_wait 60 "Waiting for keep alive timeout"
116
117 api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
118
119 api_put_services_keepalive 200 "service4"
120
121 sleep_wait 90 "Waiting for keep alive timeout"
122
123 api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4"
124
125 api_delete_services 204 "service4"
126
127 api_get_services 404 "service4"
128
129 api_get_services 404 "service1"
130 api_get_services 404 "service2"
131 api_get_services 404 "service3"
132
133 api_get_service_ids 200
134
135 api_delete_services 404 "service1"
136 api_delete_services 404 "service2"
137 api_delete_services 404 "service3"
138 api_delete_services 404 "service4"
139
140 api_put_services_keepalive 404 "service1"
141 api_put_services_keepalive 404 "service2"
142 api_put_services_keepalive 404 "service3"
143 api_put_services_keepalive 404 "service4"
144
145 # Policy delete after timeout
146 api_put_service 201 "service10" 600 "$CR_PATH/service10"
147
148 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
149
150 api_equal json:rics 1 60
151
152 api_equal json:policy_schemas 1 120
153
154 api_equal json:policy_types 1
155
156 api_equal json:policies 0
157
158 api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
159
160 api_equal json:policies 1
161
162 sim_equal ricsim_g1_1 num_instances 1
163
164 api_put_policy 201 "service10" ricsim_g1_1 1 5001 true testdata/OSC/pi1_template.json
165
166 api_equal json:policies 2
167
168 sim_equal ricsim_g1_1 num_instances 2
169
170 sim_post_delete_instances 200 ricsim_g1_1
171
172 #Wait for recreate of non transient policy
173 api_equal json:policies 1 180
174
175 sim_equal ricsim_g1_1 num_instances 1
176
177 api_put_service 200 "service10" 10 "$CR_PATH/service10"
178
179 #Wait for service expiry
180 api_equal json:policies 0 120
181
182 sim_equal ricsim_g1_1 num_instances 0
183
184
185 api_get_service_ids 200
186
187 deviation "TR18 Agents sends callback with empty body"
188 cr_equal received_callbacks 0
189 mr_equal requests_submitted 0
190
191 check_policy_agent_logs
192 check_control_panel_logs
193
194 #### TEST COMPLETE ####
195
196 store_logs          END
197
198 print_result
199
200 auto_clean_containers