BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 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 | . ../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 |
| 31 | CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks" |
| 32 | |
| 33 | |
| 34 | #### TEST BEGIN #### |
| 35 | |
| 36 | clean_containers |
| 37 | |
| 38 | start_ric_simulators ricsim_g1 1 OSC_2.1.0 |
| 39 | |
| 40 | start_mr |
| 41 | |
| 42 | start_cr |
| 43 | |
| 44 | start_consul_cbs |
| 45 | |
| 46 | prepare_consul_config NOSDNC ".consul_config.json" |
| 47 | consul_config_app ".consul_config.json" |
| 48 | |
| 49 | start_control_panel |
| 50 | |
| 51 | start_policy_agent |
| 52 | |
| 53 | set_agent_debug |
| 54 | |
| 55 | use_agent_rest_http |
| 56 | |
| 57 | #Verify no callbacks or dmaap messages has been sent |
| 58 | cr_equal received_callbacks 0 |
| 59 | mr_equal requests_submitted 0 |
| 60 | |
| 61 | #Check agent alive |
| 62 | api_get_status 200 |
| 63 | |
| 64 | #Print simulator interface version |
| 65 | sim_print ricsim_g1_1 interface |
| 66 | |
| 67 | api_put_service 201 "service1" 15 "$CR_PATH/service1" |
| 68 | |
| 69 | api_get_services 200 "service1" "service1" 15 "$CR_PATH/service1" |
| 70 | |
| 71 | api_put_service 201 "service2" 120 "$CR_PATH/service2" |
| 72 | |
| 73 | api_get_services 200 "service2" "service2" 120 "$CR_PATH/service2" |
| 74 | |
| 75 | api_put_service 200 "service1" 50 "$CR_PATH/service1" |
| 76 | api_put_service 200 "service2" 180 "$CR_PATH/service2" |
| 77 | |
| 78 | api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1" |
| 79 | api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2" |
| 80 | |
| 81 | api_get_service_ids 200 "service1" "service2" |
| 82 | |
| 83 | sleep_wait 30 "Waiting for keep alive timeout" |
| 84 | |
| 85 | api_get_services 200 "service1" "service1" 50 "$CR_PATH/service1" |
| 86 | api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2" |
| 87 | |
| 88 | sleep_wait 100 "Waiting for keep alive timeout" |
| 89 | |
| 90 | api_get_services 404 "service1" |
| 91 | api_get_services 200 "service2" "service2" 180 "$CR_PATH/service2" |
| 92 | |
| 93 | api_delete_services 204 "service2" |
| 94 | |
| 95 | api_get_services 404 "service1" |
| 96 | api_get_services 404 "service2" |
| 97 | |
| 98 | api_put_service 201 "service3" 60 "$CR_PATH/service3" |
| 99 | |
| 100 | api_get_services 200 "service3" "service3" 60 "$CR_PATH/service3" |
| 101 | |
| 102 | sleep_wait 30 "Waiting for keep alive timeout" |
| 103 | |
| 104 | api_put_service 200 "service3" 60 "$CR_PATH/service3" |
| 105 | |
| 106 | sleep_wait 100 "Waiting for keep alive timeout" |
| 107 | |
| 108 | api_get_services 404 "service3" |
| 109 | |
| 110 | api_put_service 201 "service4" 120 "$CR_PATH/service4" |
| 111 | |
| 112 | sleep_wait 60 "Waiting for keep alive timeout" |
| 113 | |
| 114 | api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4" |
| 115 | |
| 116 | api_put_services_keepalive 200 "service4" |
| 117 | |
| 118 | sleep_wait 90 "Waiting for keep alive timeout" |
| 119 | |
| 120 | api_get_services 200 "service4" "service4" 120 "$CR_PATH/service4" |
| 121 | |
| 122 | api_delete_services 204 "service4" |
| 123 | |
| 124 | api_get_services 404 "service4" |
| 125 | |
| 126 | api_get_services 404 "service1" |
| 127 | api_get_services 404 "service2" |
| 128 | api_get_services 404 "service3" |
| 129 | |
| 130 | api_get_service_ids 200 |
| 131 | |
| 132 | api_delete_services 404 "service1" |
| 133 | api_delete_services 404 "service2" |
| 134 | api_delete_services 404 "service3" |
| 135 | api_delete_services 404 "service4" |
| 136 | |
| 137 | api_put_services_keepalive 404 "service1" |
| 138 | api_put_services_keepalive 404 "service2" |
| 139 | api_put_services_keepalive 404 "service3" |
| 140 | api_put_services_keepalive 404 "service4" |
| 141 | |
| 142 | api_get_service_ids 200 |
| 143 | |
| 144 | deviation "TR18 Agents sends callback with empty body" |
| 145 | cr_equal received_callbacks 0 |
| 146 | mr_equal requests_submitted 0 |
| 147 | |
| 148 | check_policy_agent_logs |
| 149 | check_control_panel_logs |
| 150 | |
| 151 | #### TEST COMPLETE #### |
| 152 | |
| 153 | store_logs END |
| 154 | |
| 155 | print_result |
| 156 | |
| 157 | auto_clean_containers |