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 | TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent REST/DMAAP with/without SDNC controller" |
| 21 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 22 | #App names to include in the test when running docker, space separated list |
| 23 | DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 24 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 25 | #App names to include in the test when running kubernetes, space separated list |
| 26 | KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC" |
| 27 | #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list |
| 28 | KUBE_PRESTARTED_IMAGES="" |
| 29 | |
| 30 | #Supported test environment profiles |
BjornMagnussonXA | 89b64ab | 2020-12-16 09:21:01 +0100 | [diff] [blame] | 31 | SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 32 | #Supported run modes |
| 33 | SUPPORTED_RUNMODES="DOCKER KUBE" |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 34 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 35 | . ../common/testcase_common.sh $@ |
| 36 | . ../common/agent_api_functions.sh |
| 37 | . ../common/ricsimulator_api_functions.sh |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 38 | . ../common/cr_api_functions.sh |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 39 | . ../common/mr_api_functions.sh |
| 40 | . ../common/control_panel_api_functions.sh |
| 41 | . ../common/controller_api_functions.sh |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame^] | 42 | . ../common/consul_cbs_functions.sh |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 43 | |
| 44 | #### TEST BEGIN #### |
| 45 | |
BjornMagnussonXA | ad04778 | 2020-06-08 15:54:11 +0200 | [diff] [blame] | 46 | generate_uuid |
| 47 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 48 | #Local vars in test script |
| 49 | ########################## |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 50 | # Number of policies in each sequence |
| 51 | NUM_POLICIES=10000 |
| 52 | |
| 53 | # Tested variants of REST/DMAAP/SDNC config |
| 54 | TESTED_VARIANTS="NOSDNC SDNC" |
| 55 | |
| 56 | #Test agent and simulator protocol versions (others are http only) |
| 57 | TESTED_PROTOCOLS="HTTP HTTPS" |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 58 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 59 | for __httpx in $TESTED_PROTOCOLS ; do |
| 60 | for interface in $TESTED_VARIANTS ; do |
| 61 | |
| 62 | echo "#####################################################################" |
| 63 | echo "#####################################################################" |
| 64 | echo "### Testing agent via $interface using $__httpx" |
| 65 | echo "#####################################################################" |
| 66 | echo "#####################################################################" |
| 67 | |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 68 | if [ $__httpx == "HTTPS" ]; then |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 69 | use_cr_https |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 70 | use_simulator_https |
| 71 | use_mr_https |
| 72 | use_agent_rest_https |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 73 | else |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 74 | use_cr_http |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 75 | use_simulator_http |
| 76 | use_mr_http |
| 77 | use_agent_rest_http |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 78 | fi |
| 79 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 80 | # Policy instance start id |
| 81 | START_ID=1 |
| 82 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 83 | clean_environment |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 84 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 85 | start_ric_simulators ricsim_g1 1 OSC_2.1.0 |
| 86 | start_ric_simulators ricsim_g2 1 STD_1.1.3 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 87 | if [ "$PMS_VERSION" == "V2" ]; then |
| 88 | start_ric_simulators ricsim_g3 1 STD_2.0.0 |
| 89 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 90 | |
| 91 | start_mr |
| 92 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 93 | start_cr |
| 94 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 95 | start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/application.properties |
| 96 | |
| 97 | start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application.yaml |
| 98 | |
| 99 | set_agent_debug |
| 100 | |
| 101 | mr_equal requests_submitted 0 |
| 102 | |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 103 | if [[ $interface == "SDNC" ]]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 104 | start_sdnc |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 105 | prepare_consul_config SDNC ".consul_config.json" |
| 106 | else |
| 107 | prepare_consul_config NOSDNC ".consul_config.json" |
| 108 | fi |
| 109 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 110 | if [ $RUNMODE == "DOCKER" ]; then |
| 111 | start_consul_cbs |
| 112 | fi |
BjornMagnussonXA | bf3700b | 2020-10-05 08:39:40 +0200 | [diff] [blame] | 113 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 114 | if [ $RUNMODE == "KUBE" ]; then |
| 115 | agent_load_config ".consul_config.json" |
| 116 | else |
| 117 | consul_config_app ".consul_config.json" |
| 118 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 119 | |
| 120 | |
| 121 | api_get_status 200 |
| 122 | |
| 123 | sim_print ricsim_g1_1 interface |
| 124 | sim_print ricsim_g2_1 interface |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 125 | if [ "$PMS_VERSION" == "V2" ]; then |
| 126 | sim_print ricsim_g3_1 interface |
| 127 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 128 | |
| 129 | sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json |
| 130 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 131 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 132 | sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json |
| 133 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 134 | api_equal json:policy-types 3 300 #Wait for the agent to refresh types from the simulators |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 135 | else |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 136 | api_equal json:policy_types 2 300 #Wait for the agent to refresh types from the simulators |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 137 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 138 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 139 | api_put_service 201 "serv1" 3600 "$CR_SERVICE_PATH/1" |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 140 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 141 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 142 | notificationurl=$CR_SERVICE_PATH"/test" |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 143 | else |
| 144 | notificationurl="" |
| 145 | fi |
| 146 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 147 | start_timer "Create polices in OSC via agent REST and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 148 | api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 149 | print_timer "Create polices in OSC via agent REST and $interface using "$__httpx |
| 150 | |
| 151 | sim_equal ricsim_g1_1 num_instances $NUM_POLICIES |
| 152 | |
| 153 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 154 | |
| 155 | start_timer "Create polices in STD via agent REST and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 156 | api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 157 | print_timer "Create polices in STD via agent REST and $interface using "$__httpx |
| 158 | |
| 159 | sim_equal ricsim_g2_1 num_instances $NUM_POLICIES |
| 160 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 161 | if [ "$PMS_VERSION" == "V2" ]; then |
| 162 | |
| 163 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 164 | |
| 165 | start_timer "Create polices in STD 2 via agent REST and $interface using "$__httpx |
| 166 | api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES |
| 167 | print_timer "Create polices in STD via agent REST and $interface using "$__httpx |
| 168 | |
| 169 | sim_equal ricsim_g3_1 num_instances $NUM_POLICIES |
| 170 | fi |
| 171 | |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 172 | if [ $__httpx == "HTTPS" ]; then |
| 173 | echo "Using secure ports towards dmaap" |
| 174 | use_agent_dmaap_https |
| 175 | else |
| 176 | echo "Using non-secure ports towards dmaap" |
| 177 | use_agent_dmaap_http |
| 178 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 179 | |
| 180 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 181 | |
| 182 | start_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 183 | api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 184 | print_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx |
| 185 | |
| 186 | sim_equal ricsim_g1_1 num_instances $((2*$NUM_POLICIES)) |
| 187 | |
| 188 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 189 | |
| 190 | start_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 191 | api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 192 | print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx |
| 193 | |
| 194 | sim_equal ricsim_g2_1 num_instances $((2*$NUM_POLICIES)) |
| 195 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 196 | if [ "$PMS_VERSION" == "V2" ]; then |
| 197 | |
| 198 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 199 | |
| 200 | start_timer "Create polices in STD 2 via agent DMAAP, one by one, and $interface using "$__httpx |
| 201 | api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES |
| 202 | print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx |
| 203 | |
| 204 | sim_equal ricsim_g3_1 num_instances $((2*$NUM_POLICIES)) |
| 205 | fi |
| 206 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 207 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 208 | |
| 209 | start_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 210 | api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 211 | print_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx |
| 212 | |
| 213 | sim_equal ricsim_g1_1 num_instances $((3*$NUM_POLICIES)) |
| 214 | |
| 215 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 216 | |
| 217 | start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 218 | api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 219 | print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx |
| 220 | |
| 221 | sim_equal ricsim_g2_1 num_instances $((3*$NUM_POLICIES)) |
| 222 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 223 | if [ "$PMS_VERSION" == "V2" ]; then |
| 224 | |
| 225 | START_ID=$(($START_ID+$NUM_POLICIES)) |
| 226 | |
| 227 | start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx |
| 228 | api_put_policy_batch 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES |
| 229 | print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx |
| 230 | |
| 231 | sim_equal ricsim_g3_1 num_instances $((3*$NUM_POLICIES)) |
| 232 | fi |
| 233 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 234 | if [ $interface == "SDNC" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 235 | sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME |
| 236 | sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 237 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 238 | sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 239 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 240 | else |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 241 | sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME |
| 242 | sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 243 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 244 | sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 245 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 246 | fi |
| 247 | |
| 248 | check_policy_agent_logs |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 249 | if [[ $interface = *"SDNC"* ]]; then |
| 250 | check_sdnc_logs |
| 251 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 252 | |
| 253 | store_logs "${__httpx}__${interface}" |
| 254 | done |
| 255 | done |
| 256 | |
| 257 | #### TEST COMPLETE #### |
| 258 | |
| 259 | print_result |
| 260 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 261 | auto_clean_environment |