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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
20 TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via a1pms REST/DMAAP/DMAAP_BATCH and SDNC using http or https"
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR A1PMS RICSIM SDNC NGW KUBEPROXY"
25 #App names to include in the test when running kubernetes, space separated list
26 KUBE_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC KUBEPROXY NGW"
27 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28 KUBE_PRESTARTED_IMAGES=""
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="CBS CONSUL NGW"
35 #Supported test environment profiles
36 SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ONAP-KOHN ONAP-LONDON ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE ORAN-G-RELEASE"
38 SUPPORTED_RUNMODES="DOCKER KUBE"
40 . ../common/testcase_common.sh $@
48 #Local vars in test script
49 ##########################
51 # Number of RICs per interface type (OSC and STD)
53 if [ "$A1PMS_VERSION" == "V2" ]; then
54 NUM_RICS=20 # 3 A1 interfaces test, less sims per interface. total sims will be same
57 # Number of policy instances per RIC
66 # use HTTP or HTTPS for all apis
69 if [ $HTTPX == "HTTP" ]; then
81 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
83 start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
85 if [ "$A1PMS_VERSION" == "V2" ]; then
86 start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0
93 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
95 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
96 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
100 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
102 __CONFIG_HEADER="NOHEADER"
103 if [ $RUNMODE == "KUBE" ]; then
104 __CONFIG_HEADER="HEADER"
106 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
107 __CONFIG_HEADER="HEADER"
111 prepare_consul_config SDNC ".consul_config.json" $__CONFIG_HEADER
113 if [ $RUNMODE == "KUBE" ]; then
114 a1pms_load_config ".consul_config.json"
116 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
117 a1pms_api_put_configuration 200 ".consul_config.json"
120 consul_config_app ".consul_config.json"
126 sleep_wait 120 "Let A1PMS cofiguration take effect"
128 a1pms_api_get_status 200
130 echo "Print the interface for group 1 simulators, shall be OSC"
131 for ((i=1; i<=$NUM_RICS; i++))
133 sim_print ricsim_g1_$i interface
136 echo "Print the interface for group 2 simulators, shall be STD"
137 for ((i=1; i<=$NUM_RICS; i++))
139 sim_print ricsim_g2_$i interface
142 if [ "$A1PMS_VERSION" == "V2" ]; then
143 echo "Print the interface for group 2 simulators, shall be STD 2"
144 for ((i=1; i<=$NUM_RICS; i++))
146 sim_print ricsim_g3_$i interface
150 echo "Load policy type in group 1 simulators"
151 for ((i=1; i<=$NUM_RICS; i++))
153 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
156 if [ "$A1PMS_VERSION" == "V2" ]; then
157 echo "Load policy type in group 3 simulators"
158 for ((i=1; i<=$NUM_RICS; i++))
160 sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
164 echo "Check the number of instances in group 1 simulators, shall be 0"
165 for ((i=1; i<=$NUM_RICS; i++))
167 sim_equal ricsim_g1_$i num_instances 0
170 echo "Check the number of instances in group 2 simulators, shall be 0"
171 for ((i=1; i<=$NUM_RICS; i++))
173 sim_equal ricsim_g2_$i num_instances 0
176 if [ "$A1PMS_VERSION" == "V2" ]; then
177 echo "Check the number of instances in group 3 simulators, shall be 0"
178 for ((i=1; i<=$NUM_RICS; i++))
180 sim_equal ricsim_g3_$i num_instances 0
184 echo "Wait for the a1pms to refresh types from the simulator"
185 if [ "$A1PMS_VERSION" == "V2" ]; then
186 a1pms_equal json:policy-types 3 300
188 a1pms_equal json:policy_types 2 300
191 echo "Check the number of types in the a1pms for each ric is 1"
192 for ((i=1; i<=$NUM_RICS; i++))
194 if [ "$A1PMS_VERSION" == "V2" ]; then
195 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
196 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
198 a1pms_equal json:policy_types?ric=ricsim_g1_$i 1 120
202 echo "Register a service"
203 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
205 TEST_DURATION=$((24*3600*$DAYS))
208 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
212 if [ "$A1PMS_VERSION" == "V2" ]; then
213 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
218 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
221 echo "#########################################################################################################"
222 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
223 echo "#########################################################################################################"
226 for interface in $A1PMS_INTERFACES ; do
228 echo "############################################"
229 echo "## Testing using a1pms interface: $interface ##"
230 echo "############################################"
232 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
233 if [ $HTTPX == "HTTP" ]; then
239 if [ $HTTPX == "HTTPS" ]; then
240 echo "Using secure ports towards dmaap"
241 use_a1pms_dmaap_https
243 echo "Using non-secure ports towards dmaap"
248 echo "Create $NUM_INSTANCES instances in each OSC RIC"
251 if [ $interface == "REST_PARALLEL" ]; then
252 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
254 for ((i=1; i<=$NUM_RICS; i++))
256 if [ $interface == "DMAAP-BATCH" ]; then
257 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
258 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
259 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
261 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
262 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
264 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
265 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
266 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
269 if [ "$A1PMS_VERSION" == "V2" ]; then
270 a1pms_equal json:policy-instances $INSTANCES
272 a1pms_equal json:policy_ids $INSTANCES
275 echo "Create $NUM_INSTANCES instances in each STD RIC"
276 if [ $interface == "REST_PARALLEL" ]; then
277 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
279 for ((i=1; i<=$NUM_RICS; i++))
281 if [ $interface == "DMAAP-BATCH" ]; then
282 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
283 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
284 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
286 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
287 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
289 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
290 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
291 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
294 if [ "$A1PMS_VERSION" == "V2" ]; then
295 a1pms_equal json:policy-instances $INSTANCES
297 a1pms_equal json:policy_ids $INSTANCES
300 if [ "$A1PMS_VERSION" == "V2" ]; then
301 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
302 if [ $interface == "REST_PARALLEL" ]; then
303 a1pms_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
305 for ((i=1; i<=$NUM_RICS; i++))
307 if [ $interface == "DMAAP-BATCH" ]; then
308 a1pms_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
309 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
310 a1pms_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
312 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
313 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
315 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
316 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
317 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
320 if [ "$A1PMS_VERSION" == "V2" ]; then
321 a1pms_equal json:policy-instances $INSTANCES
323 a1pms_equal json:policy_ids $INSTANCES
328 echo "Delete all instances in each OSC RIC"
331 if [ $interface == "REST_PARALLEL" ]; then
332 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
334 for ((i=1; i<=$NUM_RICS; i++))
336 if [ $interface == "DMAAP-BATCH" ]; then
337 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
338 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
339 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
341 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
342 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
344 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
345 sim_equal ricsim_g1_$i num_instances 0
346 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
349 if [ "$A1PMS_VERSION" == "V2" ]; then
350 a1pms_equal json:policy-instances $INSTANCES
352 a1pms_equal json:policy_ids $INSTANCES
355 echo "Delete all instances in each STD RIC"
357 if [ $interface == "REST_PARALLEL" ]; then
358 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
360 for ((i=1; i<=$NUM_RICS; i++))
362 if [ $interface == "DMAAP-BATCH" ]; then
363 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
364 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
365 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
367 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
368 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
370 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
371 sim_equal ricsim_g2_$i num_instances 0
372 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
375 if [ "$A1PMS_VERSION" == "V2" ]; then
376 a1pms_equal json:policy-instances $INSTANCES
378 a1pms_equal json:policy_ids $INSTANCES
381 if [ "$A1PMS_VERSION" == "V2" ]; then
382 echo "Delete all instances in each STD 2 RIC"
384 if [ $interface == "REST_PARALLEL" ]; then
385 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
387 for ((i=1; i<=$NUM_RICS; i++))
389 if [ $interface == "DMAAP-BATCH" ]; then
390 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
391 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
392 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
394 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
395 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
397 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
398 sim_equal ricsim_g3_$i num_instances 0
399 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
402 if [ "$A1PMS_VERSION" == "V2" ]; then
403 a1pms_equal json:policy-instances $INSTANCES
405 a1pms_equal json:policy_ids $INSTANCES
409 mr_equal requests_submitted $MR_MESSAGES
410 mr_equal requests_fetched $MR_MESSAGES
411 mr_equal responses_submitted $MR_MESSAGES
412 mr_equal responses_fetched $MR_MESSAGES
413 mr_equal current_requests 0
414 mr_equal current_responses 0
417 for ((i=1; i<=$NUM_RICS; i++))
419 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
420 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
422 if [ "$A1PMS_VERSION" == "V2" ]; then
423 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
434 #### TEST COMPLETE ####
440 auto_clean_environment