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