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