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 __CONFIG_HEADER="NOHEADER"
102 if [ $RUNMODE == "KUBE" ]; then
103 __CONFIG_HEADER="HEADER"
105 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
106 __CONFIG_HEADER="HEADER"
110 prepare_consul_config SDNC ".consul_config.json" $__CONFIG_HEADER
112 if [ $RUNMODE == "KUBE" ]; then
113 a1pms_load_config ".consul_config.json"
115 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
116 a1pms_api_put_configuration 200 ".consul_config.json"
119 consul_config_app ".consul_config.json"
126 a1pms_api_get_status 200
128 echo "Print the interface for group 1 simulators, shall be OSC"
129 for ((i=1; i<=$NUM_RICS; i++))
131 sim_print ricsim_g1_$i interface
134 echo "Print the interface for group 2 simulators, shall be STD"
135 for ((i=1; i<=$NUM_RICS; i++))
137 sim_print ricsim_g2_$i interface
140 if [ "$A1PMS_VERSION" == "V2" ]; then
141 echo "Print the interface for group 2 simulators, shall be STD 2"
142 for ((i=1; i<=$NUM_RICS; i++))
144 sim_print ricsim_g3_$i interface
148 echo "Load policy type in group 1 simulators"
149 for ((i=1; i<=$NUM_RICS; i++))
151 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
154 if [ "$A1PMS_VERSION" == "V2" ]; then
155 echo "Load policy type in group 3 simulators"
156 for ((i=1; i<=$NUM_RICS; i++))
158 sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
162 echo "Check the number of instances in group 1 simulators, shall be 0"
163 for ((i=1; i<=$NUM_RICS; i++))
165 sim_equal ricsim_g1_$i num_instances 0
168 echo "Check the number of instances in group 2 simulators, shall be 0"
169 for ((i=1; i<=$NUM_RICS; i++))
171 sim_equal ricsim_g2_$i num_instances 0
174 if [ "$A1PMS_VERSION" == "V2" ]; then
175 echo "Check the number of instances in group 3 simulators, shall be 0"
176 for ((i=1; i<=$NUM_RICS; i++))
178 sim_equal ricsim_g3_$i num_instances 0
182 echo "Wait for the a1pms to refresh types from the simulator"
183 if [ "$A1PMS_VERSION" == "V2" ]; then
184 a1pms_equal json:policy-types 3 300
186 a1pms_equal json:policy_types 2 300
189 echo "Check the number of types in the a1pms for each ric is 1"
190 for ((i=1; i<=$NUM_RICS; i++))
192 if [ "$A1PMS_VERSION" == "V2" ]; then
193 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
194 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
196 a1pms_equal json:policy_types?ric=ricsim_g1_$i 1 120
200 echo "Register a service"
201 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
203 TEST_DURATION=$((24*3600*$DAYS))
206 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
210 if [ "$A1PMS_VERSION" == "V2" ]; then
211 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
216 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
219 echo "#########################################################################################################"
220 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
221 echo "#########################################################################################################"
224 for interface in $A1PMS_INTERFACES ; do
226 echo "############################################"
227 echo "## Testing using a1pms interface: $interface ##"
228 echo "############################################"
230 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
231 if [ $HTTPX == "HTTP" ]; then
237 if [ $HTTPX == "HTTPS" ]; then
238 echo "Using secure ports towards dmaap"
239 use_a1pms_dmaap_https
241 echo "Using non-secure ports towards dmaap"
246 echo "Create $NUM_INSTANCES instances in each OSC RIC"
249 if [ $interface == "REST_PARALLEL" ]; then
250 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
252 for ((i=1; i<=$NUM_RICS; i++))
254 if [ $interface == "DMAAP-BATCH" ]; then
255 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
256 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
257 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
259 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
260 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
262 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
263 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
264 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
267 if [ "$A1PMS_VERSION" == "V2" ]; then
268 a1pms_equal json:policy-instances $INSTANCES
270 a1pms_equal json:policy_ids $INSTANCES
273 echo "Create $NUM_INSTANCES instances in each STD RIC"
274 if [ $interface == "REST_PARALLEL" ]; then
275 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
277 for ((i=1; i<=$NUM_RICS; i++))
279 if [ $interface == "DMAAP-BATCH" ]; then
280 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
281 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
282 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
284 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
285 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
287 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
288 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
289 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
292 if [ "$A1PMS_VERSION" == "V2" ]; then
293 a1pms_equal json:policy-instances $INSTANCES
295 a1pms_equal json:policy_ids $INSTANCES
298 if [ "$A1PMS_VERSION" == "V2" ]; then
299 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
300 if [ $interface == "REST_PARALLEL" ]; then
301 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
303 for ((i=1; i<=$NUM_RICS; i++))
305 if [ $interface == "DMAAP-BATCH" ]; then
306 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
307 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
308 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
310 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
311 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
313 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
314 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
315 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
318 if [ "$A1PMS_VERSION" == "V2" ]; then
319 a1pms_equal json:policy-instances $INSTANCES
321 a1pms_equal json:policy_ids $INSTANCES
326 echo "Delete all instances in each OSC RIC"
329 if [ $interface == "REST_PARALLEL" ]; then
330 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
332 for ((i=1; i<=$NUM_RICS; i++))
334 if [ $interface == "DMAAP-BATCH" ]; then
335 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
336 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
337 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
339 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
340 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
342 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
343 sim_equal ricsim_g1_$i num_instances 0
344 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
347 if [ "$A1PMS_VERSION" == "V2" ]; then
348 a1pms_equal json:policy-instances $INSTANCES
350 a1pms_equal json:policy_ids $INSTANCES
353 echo "Delete all instances in each STD RIC"
355 if [ $interface == "REST_PARALLEL" ]; then
356 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
358 for ((i=1; i<=$NUM_RICS; i++))
360 if [ $interface == "DMAAP-BATCH" ]; then
361 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
362 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
363 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
365 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
366 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
368 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
369 sim_equal ricsim_g2_$i num_instances 0
370 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
373 if [ "$A1PMS_VERSION" == "V2" ]; then
374 a1pms_equal json:policy-instances $INSTANCES
376 a1pms_equal json:policy_ids $INSTANCES
379 if [ "$A1PMS_VERSION" == "V2" ]; then
380 echo "Delete all instances in each STD 2 RIC"
382 if [ $interface == "REST_PARALLEL" ]; then
383 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
385 for ((i=1; i<=$NUM_RICS; i++))
387 if [ $interface == "DMAAP-BATCH" ]; then
388 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
389 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
390 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
392 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
393 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
395 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
396 sim_equal ricsim_g3_$i num_instances 0
397 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
400 if [ "$A1PMS_VERSION" == "V2" ]; then
401 a1pms_equal json:policy-instances $INSTANCES
403 a1pms_equal json:policy_ids $INSTANCES
407 mr_equal requests_submitted $MR_MESSAGES
408 mr_equal requests_fetched $MR_MESSAGES
409 mr_equal responses_submitted $MR_MESSAGES
410 mr_equal responses_fetched $MR_MESSAGES
411 mr_equal current_requests 0
412 mr_equal current_responses 0
415 for ((i=1; i<=$NUM_RICS; i++))
417 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
418 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
420 if [ "$A1PMS_VERSION" == "V2" ]; then
421 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
432 #### TEST COMPLETE ####
438 auto_clean_environment