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