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 ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-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
99 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
101 prepare_consul_config SDNC ".consul_config.json"
103 if [ $RUNMODE == "KUBE" ]; then
104 a1pms_load_config ".consul_config.json"
106 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
107 a1pms_api_put_configuration 200 ".consul_config.json"
110 consul_config_app ".consul_config.json"
117 a1pms_api_get_status 200
119 echo "Print the interface for group 1 simulators, shall be OSC"
120 for ((i=1; i<=$NUM_RICS; i++))
122 sim_print ricsim_g1_$i interface
125 echo "Print the interface for group 2 simulators, shall be STD"
126 for ((i=1; i<=$NUM_RICS; i++))
128 sim_print ricsim_g2_$i interface
131 if [ "$A1PMS_VERSION" == "V2" ]; then
132 echo "Print the interface for group 2 simulators, shall be STD 2"
133 for ((i=1; i<=$NUM_RICS; i++))
135 sim_print ricsim_g3_$i interface
139 echo "Load policy type in group 1 simulators"
140 for ((i=1; i<=$NUM_RICS; i++))
142 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
145 if [ "$A1PMS_VERSION" == "V2" ]; then
146 echo "Load policy type in group 3 simulators"
147 for ((i=1; i<=$NUM_RICS; i++))
149 sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
153 echo "Check the number of instances in group 1 simulators, shall be 0"
154 for ((i=1; i<=$NUM_RICS; i++))
156 sim_equal ricsim_g1_$i num_instances 0
159 echo "Check the number of instances in group 2 simulators, shall be 0"
160 for ((i=1; i<=$NUM_RICS; i++))
162 sim_equal ricsim_g2_$i num_instances 0
165 if [ "$A1PMS_VERSION" == "V2" ]; then
166 echo "Check the number of instances in group 3 simulators, shall be 0"
167 for ((i=1; i<=$NUM_RICS; i++))
169 sim_equal ricsim_g3_$i num_instances 0
173 echo "Wait for the a1pms to refresh types from the simulator"
174 if [ "$A1PMS_VERSION" == "V2" ]; then
175 a1pms_equal json:policy-types 3 300
177 a1pms_equal json:policy_types 2 300
180 echo "Check the number of types in the a1pms for each ric is 1"
181 for ((i=1; i<=$NUM_RICS; i++))
183 if [ "$A1PMS_VERSION" == "V2" ]; then
184 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
185 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
187 a1pms_equal json:policy_types?ric=ricsim_g1_$i 1 120
191 echo "Register a service"
192 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
194 TEST_DURATION=$((24*3600*$DAYS))
197 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
201 if [ "$A1PMS_VERSION" == "V2" ]; then
202 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
207 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
210 echo "#########################################################################################################"
211 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
212 echo "#########################################################################################################"
215 for interface in $A1PMS_INTERFACES ; do
217 echo "############################################"
218 echo "## Testing using a1pms interface: $interface ##"
219 echo "############################################"
221 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
222 if [ $HTTPX == "HTTP" ]; then
228 if [ $HTTPX == "HTTPS" ]; then
229 echo "Using secure ports towards dmaap"
230 use_a1pms_dmaap_https
232 echo "Using non-secure ports towards dmaap"
237 echo "Create $NUM_INSTANCES instances in each OSC RIC"
240 if [ $interface == "REST_PARALLEL" ]; then
241 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
243 for ((i=1; i<=$NUM_RICS; i++))
245 if [ $interface == "DMAAP-BATCH" ]; then
246 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
247 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
248 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
250 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
251 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
253 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
254 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
255 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
258 if [ "$A1PMS_VERSION" == "V2" ]; then
259 a1pms_equal json:policy-instances $INSTANCES
261 a1pms_equal json:policy_ids $INSTANCES
264 echo "Create $NUM_INSTANCES instances in each STD RIC"
265 if [ $interface == "REST_PARALLEL" ]; then
266 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
268 for ((i=1; i<=$NUM_RICS; i++))
270 if [ $interface == "DMAAP-BATCH" ]; then
271 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
272 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
273 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
275 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
276 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
278 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
279 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
280 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
283 if [ "$A1PMS_VERSION" == "V2" ]; then
284 a1pms_equal json:policy-instances $INSTANCES
286 a1pms_equal json:policy_ids $INSTANCES
289 if [ "$A1PMS_VERSION" == "V2" ]; then
290 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
291 if [ $interface == "REST_PARALLEL" ]; then
292 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
294 for ((i=1; i<=$NUM_RICS; i++))
296 if [ $interface == "DMAAP-BATCH" ]; then
297 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
298 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
299 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
301 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
302 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
304 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
305 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
306 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
309 if [ "$A1PMS_VERSION" == "V2" ]; then
310 a1pms_equal json:policy-instances $INSTANCES
312 a1pms_equal json:policy_ids $INSTANCES
317 echo "Delete all instances in each OSC RIC"
320 if [ $interface == "REST_PARALLEL" ]; then
321 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
323 for ((i=1; i<=$NUM_RICS; i++))
325 if [ $interface == "DMAAP-BATCH" ]; then
326 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
327 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
328 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
330 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
331 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
333 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
334 sim_equal ricsim_g1_$i num_instances 0
335 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
338 if [ "$A1PMS_VERSION" == "V2" ]; then
339 a1pms_equal json:policy-instances $INSTANCES
341 a1pms_equal json:policy_ids $INSTANCES
344 echo "Delete all instances in each STD RIC"
346 if [ $interface == "REST_PARALLEL" ]; then
347 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
349 for ((i=1; i<=$NUM_RICS; i++))
351 if [ $interface == "DMAAP-BATCH" ]; then
352 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
353 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
354 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
356 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
357 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
359 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
360 sim_equal ricsim_g2_$i num_instances 0
361 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
364 if [ "$A1PMS_VERSION" == "V2" ]; then
365 a1pms_equal json:policy-instances $INSTANCES
367 a1pms_equal json:policy_ids $INSTANCES
370 if [ "$A1PMS_VERSION" == "V2" ]; then
371 echo "Delete all instances in each STD 2 RIC"
373 if [ $interface == "REST_PARALLEL" ]; then
374 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
376 for ((i=1; i<=$NUM_RICS; i++))
378 if [ $interface == "DMAAP-BATCH" ]; then
379 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
380 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
381 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
383 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
384 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
386 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
387 sim_equal ricsim_g3_$i num_instances 0
388 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
391 if [ "$A1PMS_VERSION" == "V2" ]; then
392 a1pms_equal json:policy-instances $INSTANCES
394 a1pms_equal json:policy_ids $INSTANCES
398 mr_equal requests_submitted $MR_MESSAGES
399 mr_equal requests_fetched $MR_MESSAGES
400 mr_equal responses_submitted $MR_MESSAGES
401 mr_equal responses_fetched $MR_MESSAGES
402 mr_equal current_requests 0
403 mr_equal current_responses 0
406 for ((i=1; i<=$NUM_RICS; i++))
408 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
409 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
411 if [ "$A1PMS_VERSION" == "V2" ]; then
412 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
423 #### TEST COMPLETE ####
429 auto_clean_environment