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 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 20 | TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http or https" |
| 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 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 23 | DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW KUBEPROXY" |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +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 |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 26 | KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 27 | #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list |
| 28 | KUBE_PRESTARTED_IMAGES="" |
| 29 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 30 | #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if |
| 31 | #the image is not configured in the supplied env_file |
| 32 | #Used for images not applicable to all supported profile |
| 33 | CONDITIONALLY_IGNORED_IMAGES="NGW" |
| 34 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 35 | #Supported test environment profiles |
BjornMagnussonXA | fec823b | 2021-08-03 14:14:05 +0200 | [diff] [blame] | 36 | SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 37 | #Supported run modes |
| 38 | SUPPORTED_RUNMODES="DOCKER KUBE" |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 39 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 40 | . ../common/testcase_common.sh $@ |
| 41 | . ../common/agent_api_functions.sh |
| 42 | . ../common/ricsimulator_api_functions.sh |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 43 | . ../common/cr_api_functions.sh |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 44 | . ../common/mr_api_functions.sh |
| 45 | . ../common/control_panel_api_functions.sh |
| 46 | . ../common/controller_api_functions.sh |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame] | 47 | . ../common/consul_cbs_functions.sh |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 48 | . ../common/kube_proxy_api_functions.sh |
| 49 | . ../common/gateway_api_functions.sh |
| 50 | |
| 51 | setup_testenvironment |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 52 | |
| 53 | #### TEST BEGIN #### |
| 54 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 55 | generate_policy_uuid |
BjornMagnussonXA | ad04778 | 2020-06-08 15:54:11 +0200 | [diff] [blame] | 56 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 57 | #Local vars in test script |
| 58 | ########################## |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 59 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 60 | # Number of RICs per interface type (OSC and STD) |
| 61 | NUM_RICS=30 |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 62 | if [ "$PMS_VERSION" == "V2" ]; then |
| 63 | NUM_RICS=20 # 3 A1 interfaces test, less sims per interface. total sims will be same |
| 64 | fi |
| 65 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 66 | # Number of policy instances per RIC |
| 67 | NUM_INSTANCES=5 |
| 68 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 69 | DAYS=3 |
| 70 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 71 | clean_environment |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 72 | |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 73 | start_kube_proxy |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 74 | |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 75 | # use HTTP or HTTPS for all apis |
| 76 | HTTPX=HTTPS |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 77 | |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 78 | if [ $HTTPX == "HTTP" ]; then |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 79 | use_cr_http |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 80 | use_agent_rest_http |
| 81 | use_sdnc_http |
| 82 | use_simulator_http |
| 83 | else |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 84 | use_cr_https |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 85 | use_agent_rest_https |
| 86 | use_sdnc_https |
| 87 | use_simulator_https |
| 88 | fi |
| 89 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 90 | start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0 |
| 91 | |
| 92 | start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3 |
| 93 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 94 | if [ "$PMS_VERSION" == "V2" ]; then |
| 95 | start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0 |
| 96 | fi |
| 97 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 98 | start_mr |
| 99 | |
| 100 | start_cr |
| 101 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 102 | start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 103 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 104 | if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then |
| 105 | start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE |
| 106 | fi |
| 107 | |
| 108 | start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 109 | |
| 110 | if [ $RUNMODE == "DOCKER" ]; then |
| 111 | start_consul_cbs |
| 112 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 113 | |
| 114 | prepare_consul_config SDNC ".consul_config.json" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 115 | |
| 116 | if [ $RUNMODE == "KUBE" ]; then |
| 117 | agent_load_config ".consul_config.json" |
| 118 | else |
| 119 | consul_config_app ".consul_config.json" |
| 120 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 121 | |
| 122 | start_sdnc |
| 123 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 124 | |
| 125 | api_get_status 200 |
| 126 | |
| 127 | echo "Print the interface for group 1 simulators, shall be OSC" |
| 128 | for ((i=1; i<=$NUM_RICS; i++)) |
| 129 | do |
| 130 | sim_print ricsim_g1_$i interface |
| 131 | done |
| 132 | |
| 133 | echo "Print the interface for group 2 simulators, shall be STD" |
| 134 | for ((i=1; i<=$NUM_RICS; i++)) |
| 135 | do |
| 136 | sim_print ricsim_g2_$i interface |
| 137 | done |
| 138 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 139 | if [ "$PMS_VERSION" == "V2" ]; then |
| 140 | echo "Print the interface for group 2 simulators, shall be STD 2" |
| 141 | for ((i=1; i<=$NUM_RICS; i++)) |
| 142 | do |
| 143 | sim_print ricsim_g3_$i interface |
| 144 | done |
| 145 | fi |
| 146 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 147 | echo "Load policy type in group 1 simulators" |
| 148 | for ((i=1; i<=$NUM_RICS; i++)) |
| 149 | do |
| 150 | sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json |
| 151 | done |
| 152 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 153 | if [ "$PMS_VERSION" == "V2" ]; then |
| 154 | echo "Load policy type in group 3 simulators" |
| 155 | for ((i=1; i<=$NUM_RICS; i++)) |
| 156 | do |
| 157 | sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json |
| 158 | done |
| 159 | fi |
| 160 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 161 | echo "Check the number of instances in group 1 simulators, shall be 0" |
| 162 | for ((i=1; i<=$NUM_RICS; i++)) |
| 163 | do |
| 164 | sim_equal ricsim_g1_$i num_instances 0 |
| 165 | done |
| 166 | |
| 167 | echo "Check the number of instances in group 2 simulators, shall be 0" |
| 168 | for ((i=1; i<=$NUM_RICS; i++)) |
| 169 | do |
| 170 | sim_equal ricsim_g2_$i num_instances 0 |
| 171 | done |
| 172 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 173 | if [ "$PMS_VERSION" == "V2" ]; then |
| 174 | echo "Check the number of instances in group 3 simulators, shall be 0" |
| 175 | for ((i=1; i<=$NUM_RICS; i++)) |
| 176 | do |
| 177 | sim_equal ricsim_g3_$i num_instances 0 |
| 178 | done |
| 179 | fi |
| 180 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 181 | echo "Wait for the agent to refresh types from the simulator" |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 182 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 183 | api_equal json:policy-types 3 300 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 184 | else |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 185 | api_equal json:policy_types 2 300 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 186 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 187 | |
| 188 | echo "Check the number of types in the agent for each ric is 1" |
| 189 | for ((i=1; i<=$NUM_RICS; i++)) |
| 190 | do |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 191 | if [ "$PMS_VERSION" == "V2" ]; then |
| 192 | api_equal json:policy-types?ric_id=ricsim_g1_$i 1 120 |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 193 | api_equal json:policy-types?ric_id=ricsim_g3_$i 1 120 |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 194 | else |
| 195 | api_equal json:policy_types?ric=ricsim_g1_$i 1 120 |
| 196 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 197 | done |
| 198 | |
| 199 | echo "Register a service" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 200 | api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH/1" |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 201 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 202 | TEST_DURATION=$((24*3600*$DAYS)) |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 203 | TEST_START=$SECONDS |
| 204 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 205 | AGENT_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH" |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 206 | |
| 207 | MR_MESSAGES=0 |
| 208 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 209 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 210 | notificationurl=$CR_SERVICE_APP_PATH"/test" |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 211 | else |
| 212 | notificationurl="" |
| 213 | fi |
| 214 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 215 | while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do |
| 216 | |
| 217 | echo "" |
| 218 | echo "#########################################################################################################" |
| 219 | echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD |
| 220 | echo "#########################################################################################################" |
| 221 | echo "" |
| 222 | |
| 223 | for interface in $AGENT_INTERFACES ; do |
| 224 | |
| 225 | echo "############################################" |
| 226 | echo "## Testing using agent interface: $interface ##" |
| 227 | echo "############################################" |
| 228 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 229 | if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 230 | if [ $HTTPX == "HTTP" ]; then |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 231 | use_agent_rest_http |
| 232 | else |
| 233 | use_agent_rest_https |
| 234 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 235 | else |
BjornMagnussonXA | 496156d | 2020-08-10 14:16:24 +0200 | [diff] [blame] | 236 | if [ $HTTPX == "HTTPS" ]; then |
| 237 | echo "Using secure ports towards dmaap" |
| 238 | use_agent_dmaap_https |
| 239 | else |
| 240 | echo "Using non-secure ports towards dmaap" |
| 241 | use_agent_dmaap_http |
| 242 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 243 | fi |
| 244 | |
| 245 | echo "Create $NUM_INSTANCES instances in each OSC RIC" |
| 246 | INSTANCE_ID=200000 |
| 247 | INSTANCES=0 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 248 | if [ $interface == "REST_PARALLEL" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 249 | api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 250 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 251 | for ((i=1; i<=$NUM_RICS; i++)) |
| 252 | do |
| 253 | if [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 254 | api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 255 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 256 | api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 257 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 258 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 259 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 260 | fi |
| 261 | sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES |
| 262 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 263 | INSTANCES=$(($INSTANCES+$NUM_INSTANCES)) |
| 264 | done |
| 265 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 266 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 267 | api_equal json:policy-instances $INSTANCES |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 268 | else |
| 269 | api_equal json:policy_ids $INSTANCES |
| 270 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 271 | |
| 272 | echo "Create $NUM_INSTANCES instances in each STD RIC" |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 273 | if [ $interface == "REST_PARALLEL" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 274 | api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 275 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 276 | for ((i=1; i<=$NUM_RICS; i++)) |
| 277 | do |
| 278 | if [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 279 | api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 280 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 281 | api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 282 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 283 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 284 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 285 | fi |
| 286 | sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES |
| 287 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 288 | INSTANCES=$(($INSTANCES+$NUM_INSTANCES)) |
| 289 | done |
| 290 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 291 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 292 | api_equal json:policy-instances $INSTANCES |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 293 | else |
| 294 | api_equal json:policy_ids $INSTANCES |
| 295 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 296 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 297 | if [ "$PMS_VERSION" == "V2" ]; then |
| 298 | echo "Create $NUM_INSTANCES instances in each STD 2 RIC" |
| 299 | if [ $interface == "REST_PARALLEL" ]; then |
| 300 | api_put_policy_parallel 201 "serv1" ricsim_g3_ $NUM_RICS STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES 3 |
| 301 | fi |
| 302 | for ((i=1; i<=$NUM_RICS; i++)) |
| 303 | do |
| 304 | if [ $interface == "DMAAP-BATCH" ]; then |
| 305 | api_put_policy_batch 201 "serv1" ricsim_g3_$i STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES |
| 306 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
| 307 | api_put_policy 201 "serv1" ricsim_g3_$i STD_QOS2_0.1.0 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_INSTANCES |
| 308 | fi |
| 309 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
| 310 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 311 | fi |
| 312 | sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES |
| 313 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 314 | INSTANCES=$(($INSTANCES+$NUM_INSTANCES)) |
| 315 | done |
| 316 | |
| 317 | if [ "$PMS_VERSION" == "V2" ]; then |
| 318 | api_equal json:policy-instances $INSTANCES |
| 319 | else |
| 320 | api_equal json:policy_ids $INSTANCES |
| 321 | fi |
| 322 | fi |
| 323 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 324 | |
| 325 | echo "Delete all instances in each OSC RIC" |
| 326 | |
| 327 | INSTANCE_ID=200000 |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 328 | if [ $interface == "REST_PARALLEL" ]; then |
| 329 | api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3 |
| 330 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 331 | for ((i=1; i<=$NUM_RICS; i++)) |
| 332 | do |
| 333 | if [ $interface == "DMAAP-BATCH" ]; then |
| 334 | api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 335 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 336 | api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES |
| 337 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 338 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 339 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 340 | fi |
| 341 | INSTANCES=$(($INSTANCES-$NUM_INSTANCES)) |
| 342 | sim_equal ricsim_g1_$i num_instances 0 |
| 343 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 344 | done |
| 345 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 346 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 347 | api_equal json:policy-instances $INSTANCES |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 348 | else |
| 349 | api_equal json:policy_ids $INSTANCES |
| 350 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 351 | |
| 352 | echo "Delete all instances in each STD RIC" |
| 353 | |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 354 | if [ $interface == "REST_PARALLEL" ]; then |
| 355 | api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3 |
| 356 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 357 | for ((i=1; i<=$NUM_RICS; i++)) |
| 358 | do |
| 359 | if [ $interface == "DMAAP-BATCH" ]; then |
| 360 | api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 361 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 362 | api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES |
| 363 | fi |
BjornMagnussonXA | bbd2e9d | 2020-05-27 21:24:06 +0200 | [diff] [blame] | 364 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 365 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 366 | fi |
| 367 | INSTANCES=$(($INSTANCES-$NUM_INSTANCES)) |
| 368 | sim_equal ricsim_g2_$i num_instances 0 |
| 369 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 370 | done |
| 371 | |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 372 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 373 | api_equal json:policy-instances $INSTANCES |
BjornMagnussonXA | 4207b83 | 2020-11-03 09:52:49 +0100 | [diff] [blame] | 374 | else |
| 375 | api_equal json:policy_ids $INSTANCES |
| 376 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 377 | |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 378 | if [ "$PMS_VERSION" == "V2" ]; then |
| 379 | echo "Delete all instances in each STD 2 RIC" |
| 380 | |
| 381 | if [ $interface == "REST_PARALLEL" ]; then |
| 382 | api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3 |
| 383 | fi |
| 384 | for ((i=1; i<=$NUM_RICS; i++)) |
| 385 | do |
| 386 | if [ $interface == "DMAAP-BATCH" ]; then |
| 387 | api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES |
| 388 | elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then |
| 389 | api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES |
| 390 | fi |
| 391 | if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then |
| 392 | MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES)) |
| 393 | fi |
| 394 | INSTANCES=$(($INSTANCES-$NUM_INSTANCES)) |
| 395 | sim_equal ricsim_g3_$i num_instances 0 |
| 396 | INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES)) |
| 397 | done |
| 398 | |
| 399 | if [ "$PMS_VERSION" == "V2" ]; then |
| 400 | api_equal json:policy-instances $INSTANCES |
| 401 | else |
| 402 | api_equal json:policy_ids $INSTANCES |
| 403 | fi |
| 404 | fi |
| 405 | |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 406 | mr_equal requests_submitted $MR_MESSAGES |
| 407 | mr_equal requests_fetched $MR_MESSAGES |
| 408 | mr_equal responses_submitted $MR_MESSAGES |
| 409 | mr_equal responses_fetched $MR_MESSAGES |
| 410 | mr_equal current_requests 0 |
| 411 | mr_equal current_responses 0 |
| 412 | |
| 413 | |
| 414 | for ((i=1; i<=$NUM_RICS; i++)) |
| 415 | do |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 416 | sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME |
| 417 | sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 418 | |
| 419 | if [ "$PMS_VERSION" == "V2" ]; then |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 420 | sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME |
BjornMagnussonXA | 2791e08 | 2020-11-12 00:52:08 +0100 | [diff] [blame] | 421 | fi |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 422 | done |
| 423 | |
| 424 | done |
| 425 | |
| 426 | done |
| 427 | |
| 428 | check_policy_agent_logs |
BjornMagnussonXA | 49f0e5a | 2020-11-08 22:41:39 +0100 | [diff] [blame] | 429 | check_sdnc_logs |
BjornMagnussonXA | 70e878f | 2020-05-11 14:11:30 +0200 | [diff] [blame] | 430 | |
| 431 | #### TEST COMPLETE #### |
| 432 | |
| 433 | store_logs END |
| 434 | |
| 435 | print_result |
| 436 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 437 | auto_clean_environment |