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