blob: 02b8db989ec066eb923bd3a48b071177b9be825a [file] [log] [blame]
BjornMagnussonXA70e878f2020-05-11 14:11:30 +02001#!/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
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020020TC_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
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010022#App names to include in the test when running docker, space separated list
BjornMagnussonXA663566c2021-11-08 10:25:07 +010023DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC NGW KUBEPROXY"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020024
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010025#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010026KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY NGW"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010027#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28KUBE_PRESTARTED_IMAGES=""
29
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010030#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
33CONDITIONALLY_IGNORED_IMAGES="NGW"
34
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010035#Supported test environment profiles
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020036SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010037#Supported run modes
38SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010039
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020040. ../common/testcase_common.sh $@
41. ../common/agent_api_functions.sh
42. ../common/ricsimulator_api_functions.sh
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010043. ../common/cr_api_functions.sh
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010044. ../common/mr_api_functions.sh
45. ../common/control_panel_api_functions.sh
46. ../common/controller_api_functions.sh
BjornMagnussonXAc963b732021-01-20 14:24:13 +010047. ../common/consul_cbs_functions.sh
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010048. ../common/kube_proxy_api_functions.sh
49. ../common/gateway_api_functions.sh
50
51setup_testenvironment
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020052
53#### TEST BEGIN ####
54
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010055generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020056
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020057#Local vars in test script
58##########################
BjornMagnussonXA496156d2020-08-10 14:16:24 +020059
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020060# Number of RICs per interface type (OSC and STD)
61NUM_RICS=30
BjornMagnussonXA2791e082020-11-12 00:52:08 +010062if [ "$PMS_VERSION" == "V2" ]; then
63 NUM_RICS=20 # 3 A1 interfaces test, less sims per interface. total sims will be same
64fi
65
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020066# Number of policy instances per RIC
67NUM_INSTANCES=5
68
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020069DAYS=3
70
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010071clean_environment
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020072
BjornMagnussonXA663566c2021-11-08 10:25:07 +010073start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010074
BjornMagnussonXA496156d2020-08-10 14:16:24 +020075# use HTTP or HTTPS for all apis
76HTTPX=HTTPS
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020077
BjornMagnussonXA496156d2020-08-10 14:16:24 +020078if [ $HTTPX == "HTTP" ]; then
BjornMagnussonXA496156d2020-08-10 14:16:24 +020079 use_cr_http
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020080 use_agent_rest_http
81 use_sdnc_http
82 use_simulator_http
83else
BjornMagnussonXA496156d2020-08-10 14:16:24 +020084 use_cr_https
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020085 use_agent_rest_https
86 use_sdnc_https
87 use_simulator_https
88fi
89
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020090start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
91
92start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
93
BjornMagnussonXA2791e082020-11-12 00:52:08 +010094if [ "$PMS_VERSION" == "V2" ]; then
95 start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0
96fi
97
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020098start_mr
99
100start_cr
101
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +0100102start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100103
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +0100104if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
105 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
106fi
107
108start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100109
110if [ $RUNMODE == "DOCKER" ]; then
111 start_consul_cbs
112fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200113
114prepare_consul_config SDNC ".consul_config.json"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100115
116if [ $RUNMODE == "KUBE" ]; then
117 agent_load_config ".consul_config.json"
118else
119 consul_config_app ".consul_config.json"
120fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200121
122start_sdnc
123
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200124
125api_get_status 200
126
127echo "Print the interface for group 1 simulators, shall be OSC"
128for ((i=1; i<=$NUM_RICS; i++))
129do
130 sim_print ricsim_g1_$i interface
131done
132
133echo "Print the interface for group 2 simulators, shall be STD"
134for ((i=1; i<=$NUM_RICS; i++))
135do
136 sim_print ricsim_g2_$i interface
137done
138
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100139if [ "$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
145fi
146
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200147echo "Load policy type in group 1 simulators"
148for ((i=1; i<=$NUM_RICS; i++))
149do
150 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
151done
152
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100153if [ "$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
159fi
160
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200161echo "Check the number of instances in group 1 simulators, shall be 0"
162for ((i=1; i<=$NUM_RICS; i++))
163do
164 sim_equal ricsim_g1_$i num_instances 0
165done
166
167echo "Check the number of instances in group 2 simulators, shall be 0"
168for ((i=1; i<=$NUM_RICS; i++))
169do
170 sim_equal ricsim_g2_$i num_instances 0
171done
172
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100173if [ "$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
179fi
180
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200181echo "Wait for the agent to refresh types from the simulator"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100182if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100183 api_equal json:policy-types 3 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100184else
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100185 api_equal json:policy_types 2 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100186fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200187
188echo "Check the number of types in the agent for each ric is 1"
189for ((i=1; i<=$NUM_RICS; i++))
190do
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100191 if [ "$PMS_VERSION" == "V2" ]; then
192 api_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100193 api_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100194 else
195 api_equal json:policy_types?ric=ricsim_g1_$i 1 120
196 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200197done
198
199echo "Register a service"
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100200api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH/1"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200201
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200202TEST_DURATION=$((24*3600*$DAYS))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200203TEST_START=$SECONDS
204
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200205AGENT_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200206
207MR_MESSAGES=0
208
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100209if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100210 notificationurl=$CR_SERVICE_APP_PATH"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100211else
212 notificationurl=""
213fi
214
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200215while [ $(($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
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200229 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200230 if [ $HTTPX == "HTTP" ]; then
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200231 use_agent_rest_http
232 else
233 use_agent_rest_https
234 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200235 else
BjornMagnussonXA496156d2020-08-10 14:16:24 +0200236 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
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200243 fi
244
245 echo "Create $NUM_INSTANCES instances in each OSC RIC"
246 INSTANCE_ID=200000
247 INSTANCES=0
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200248 if [ $interface == "REST_PARALLEL" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100249 api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200250 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200251 for ((i=1; i<=$NUM_RICS; i++))
252 do
253 if [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100254 api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200255 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100256 api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200257 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200258 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200259 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
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100266 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100267 api_equal json:policy-instances $INSTANCES
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100268 else
269 api_equal json:policy_ids $INSTANCES
270 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200271
272 echo "Create $NUM_INSTANCES instances in each STD RIC"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200273 if [ $interface == "REST_PARALLEL" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100274 api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200275 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200276 for ((i=1; i<=$NUM_RICS; i++))
277 do
278 if [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100279 api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200280 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100281 api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200282 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200283 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200284 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
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100291 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100292 api_equal json:policy-instances $INSTANCES
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100293 else
294 api_equal json:policy_ids $INSTANCES
295 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200296
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100297 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
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200324
325 echo "Delete all instances in each OSC RIC"
326
327 INSTANCE_ID=200000
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200328 if [ $interface == "REST_PARALLEL" ]; then
329 api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
330 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200331 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
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200335 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200336 api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
337 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200338 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200339 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
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100346 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100347 api_equal json:policy-instances $INSTANCES
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100348 else
349 api_equal json:policy_ids $INSTANCES
350 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200351
352 echo "Delete all instances in each STD RIC"
353
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200354 if [ $interface == "REST_PARALLEL" ]; then
355 api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
356 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200357 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
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200361 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200362 api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
363 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200364 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200365 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
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100372 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100373 api_equal json:policy-instances $INSTANCES
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100374 else
375 api_equal json:policy_ids $INSTANCES
376 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200377
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100378 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
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200406 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
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100416 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
417 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100418
419 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100420 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100421 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200422 done
423
424 done
425
426done
427
428check_policy_agent_logs
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100429check_sdnc_logs
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200430
431#### TEST COMPLETE ####
432
433store_logs END
434
435print_result
436
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100437auto_clean_environment