BjornMagnussonXA | 80a9200 | 2020-03-19 14:31:06 +0100 | [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="Create 1 policy with SDNC and 1 policy without SDNC over agent REST" |
| 21 | |
| 22 | . ../common/testcase_common.sh $@ |
| 23 | . ../common/agent_api_functions.sh |
BjornMagnussonXA | 72667f1 | 2020-04-24 09:20:18 +0200 | [diff] [blame] | 24 | . ../common/ricsimulator_api_functions.sh |
| 25 | . ../common/controller_api_functions.sh |
BjornMagnussonXA | 80a9200 | 2020-03-19 14:31:06 +0100 | [diff] [blame] | 26 | |
| 27 | #### TEST BEGIN #### |
| 28 | |
| 29 | VARIANTS="NOSDNC SDNC" |
| 30 | |
| 31 | for TEST in $VARIANTS ; do |
| 32 | |
| 33 | |
| 34 | clean_containers |
| 35 | |
| 36 | start_ric_simulators ricsim_g1 1 OSC_2.1.0 |
| 37 | start_ric_simulators ricsim_g2 1 STD_1.1.3 |
| 38 | |
| 39 | start_mr |
| 40 | |
| 41 | start_cr |
| 42 | |
| 43 | start_consul_cbs |
| 44 | |
| 45 | prepare_consul_config $TEST ".consul_config.json" |
| 46 | consul_config_app ".consul_config.json" |
| 47 | |
| 48 | start_control_panel |
| 49 | |
| 50 | if [ $TEST == "SDNC" ]; then |
| 51 | start_sdnc |
| 52 | fi |
| 53 | |
| 54 | start_policy_agent |
| 55 | |
| 56 | |
| 57 | set_agent_debug |
| 58 | |
BjornMagnussonXA | 72667f1 | 2020-04-24 09:20:18 +0200 | [diff] [blame] | 59 | use_agent_rest_http |
BjornMagnussonXA | 80a9200 | 2020-03-19 14:31:06 +0100 | [diff] [blame] | 60 | |
| 61 | echo "Using: "$TEST |
| 62 | |
| 63 | api_get_status 200 |
| 64 | |
| 65 | sim_print ricsim_g1_1 interface |
| 66 | sim_print ricsim_g2_1 interface |
| 67 | |
| 68 | sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json |
| 69 | |
| 70 | api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator |
| 71 | |
| 72 | api_put_service 201 "rapp1" 3600 "http://callback-receiver:8090/callbacks/1" |
| 73 | |
| 74 | api_put_policy 201 "rapp1" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json 10 |
| 75 | |
| 76 | api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 3000 testdata/STD/pi1_template.json 10 |
| 77 | |
| 78 | sim_equal ricsim_g1_1 num_instances 10 |
| 79 | sim_equal ricsim_g2_1 num_instances 10 |
| 80 | |
| 81 | |
| 82 | check_policy_agent_logs |
| 83 | check_control_panel_logs |
| 84 | |
| 85 | store_logs $TEST |
| 86 | |
| 87 | echo "" |
| 88 | echo -e $BOLD"Test complete for variant: "$TEST $EBOLD |
| 89 | echo "" |
| 90 | |
| 91 | done |
| 92 | |
| 93 | #### TEST COMPLETE #### |
| 94 | |
| 95 | print_result |
| 96 | |