BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 1 | #!/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 | TC_ONELINE_DESCR="Testing of the health check app" |
| 21 | |
| 22 | . ../common/testcase_common.sh $@ |
| 23 | . ../common/agent_api_functions.sh |
| 24 | . ../common/ricsimulator_api_functions.sh |
| 25 | |
| 26 | #### TEST BEGIN #### |
| 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 | clean_containers |
| 34 | |
| 35 | start_ric_simulators ricsim_g1 6 OSC_2.1.0 |
| 36 | |
| 37 | start_ric_simulators ricsim_g2 5 STD_1.1.3 |
| 38 | |
| 39 | |
| 40 | |
| 41 | start_consul_cbs |
| 42 | |
| 43 | prepare_consul_config NOSDNC ".consul_config.json" |
| 44 | consul_config_app ".consul_config.json" |
| 45 | |
| 46 | |
| 47 | start_policy_agent |
| 48 | |
| 49 | |
| 50 | use_agent_rest_http |
| 51 | |
| 52 | api_get_status 200 |
| 53 | |
| 54 | sim_print ricsim_g1_1 interface |
| 55 | sim_print ricsim_g1_2 interface |
| 56 | sim_print ricsim_g1_3 interface |
| 57 | sim_print ricsim_g1_4 interface |
| 58 | sim_print ricsim_g1_5 interface |
| 59 | sim_print ricsim_g1_6 interface |
| 60 | |
| 61 | sim_print ricsim_g2_1 interface |
| 62 | sim_print ricsim_g2_2 interface |
| 63 | sim_print ricsim_g2_3 interface |
| 64 | sim_print ricsim_g2_4 interface |
| 65 | sim_print ricsim_g2_5 interface |
| 66 | |
| 67 | sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json |
| 68 | sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json |
| 69 | sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json |
| 70 | sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json |
| 71 | sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json |
| 72 | sim_put_policy_type 201 ricsim_g1_6 1 testdata/OSC/sim_1.json |
| 73 | |
| 74 | api_equal json:policy_types 2 120 |
| 75 | |
| 76 | sleep_wait 30 "Give the agent some extra time...." |
| 77 | |
| 78 | # Create policies |
| 79 | use_agent_rest_http |
| 80 | |
| 81 | api_put_service 201 "rapp1" 3600 "$CR_PATH/1" |
| 82 | |
| 83 | api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 testdata/OSC/pi1_template.json 1 |
| 84 | api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 testdata/OSC/pi1_template.json 1 |
| 85 | api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 testdata/OSC/pi1_template.json 1 |
| 86 | api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 testdata/OSC/pi1_template.json 1 |
| 87 | api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 testdata/OSC/pi1_template.json 1 |
| 88 | api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 testdata/OSC/pi1_template.json 1 |
| 89 | |
| 90 | sim_equal ricsim_g1_1 num_instances 1 |
| 91 | sim_equal ricsim_g1_2 num_instances 1 |
| 92 | sim_equal ricsim_g1_3 num_instances 1 |
| 93 | sim_equal ricsim_g1_4 num_instances 1 |
| 94 | sim_equal ricsim_g1_5 num_instances 1 |
| 95 | sim_equal ricsim_g1_6 num_instances 1 |
| 96 | |
| 97 | api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 testdata/STD/pi1_template.json 1 |
| 98 | api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 testdata/STD/pi1_template.json 1 |
| 99 | api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 testdata/STD/pi1_template.json 1 |
| 100 | api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 testdata/STD/pi1_template.json 1 |
| 101 | api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 testdata/STD/pi1_template.json 1 |
| 102 | |
| 103 | sim_equal ricsim_g2_1 num_instances 1 |
| 104 | sim_equal ricsim_g2_2 num_instances 1 |
| 105 | sim_equal ricsim_g2_3 num_instances 1 |
| 106 | sim_equal ricsim_g2_4 num_instances 1 |
| 107 | sim_equal ricsim_g2_5 num_instances 1 |
| 108 | |
| 109 | |
| 110 | check_policy_agent_logs |
| 111 | |
| 112 | #### TEST COMPLETE #### |
| 113 | |
| 114 | store_logs END |
| 115 | |
| 116 | print_result |