3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
5 # Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
6 # ========================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=================================================
21 TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via a1pms REST and with SDNC using http or https"
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC NGW KUBEPROXY"
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC KUBEPROXY NGW"
28 #Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
31 #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
32 #the image is not configured in the supplied env_file
33 #Used for images not applicable to all supported profile
34 CONDITIONALLY_IGNORED_IMAGES="NGW"
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ONAP-KOHN ONAP-LONDON ONAP-MONTREAL ORAN-G-RELEASE ORAN-H-RELEASE ORAN-I-RELEASE"
39 SUPPORTED_RUNMODES="DOCKER KUBE"
41 . ../common/testcase_common.sh $@
47 sim_generate_policy_uuid
49 #Local vars in test script
50 ##########################
52 # Number of RICs per interface type (OSC and STD x 2)
55 # Number of policy instances per RIC
64 # use HTTP or HTTPS for all apis
67 if [ $HTTPX == "HTTP" ]; then
75 if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
76 deviation "SDNC does not support NB https"
84 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
86 start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
88 start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0
90 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
98 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
100 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
101 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
104 A1PMS_RETRY_CODES=423
105 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
109 prepare_a1pms_config SDNC ".a1pms_config.json"
111 if [ $RUNMODE == "KUBE" ]; then
112 a1pms_load_config ".a1pms_config.json"
114 a1pms_api_put_configuration 200 ".a1pms_config.json"
118 controller_api_wait_for_status_ok 200 ricsim_g1_1
120 sleep_wait 120 "Let A1PMS configuration take effect"
122 a1pms_api_get_status 200
124 echo "Print the interface for group 1 simulators, shall be OSC"
125 for ((i=1; i<=$NUM_RICS; i++))
127 sim_print ricsim_g1_$i interface
130 echo "Print the interface for group 2 simulators, shall be STD"
131 for ((i=1; i<=$NUM_RICS; i++))
133 sim_print ricsim_g2_$i interface
136 echo "Print the interface for group 2 simulators, shall be STD 2"
137 for ((i=1; i<=$NUM_RICS; i++))
139 sim_print ricsim_g3_$i interface
142 echo "Load policy type in group 1 simulators"
143 for ((i=1; i<=$NUM_RICS; i++))
145 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
148 echo "Load policy type in group 3 simulators"
149 for ((i=1; i<=$NUM_RICS; i++))
151 sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
154 echo "Check the number of instances in group 1 simulators, shall be 0"
155 for ((i=1; i<=$NUM_RICS; i++))
157 sim_equal ricsim_g1_$i num_instances 0
160 echo "Check the number of instances in group 2 simulators, shall be 0"
161 for ((i=1; i<=$NUM_RICS; i++))
163 sim_equal ricsim_g2_$i num_instances 0
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
172 echo "Wait for the a1pms to refresh types from the simulator"
173 a1pms_equal json:policy-types 3 300
175 echo "Check the number of types in the a1pms for each ric is 1"
176 for ((i=1; i<=$NUM_RICS; i++))
178 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
179 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
182 echo "Register a service"
183 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
185 TEST_DURATION=$((24*3600*$DAYS))
189 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
190 A1PMS_INTERFACES="REST REST_PARALLEL"
192 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
197 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
199 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
202 echo "#########################################################################################################"
203 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
204 echo "#########################################################################################################"
207 for interface in $A1PMS_INTERFACES ; do
209 echo "############################################"
210 echo "## Testing using a1pms interface: $interface ##"
211 echo "############################################"
213 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
214 if [ $HTTPX == "HTTP" ]; then
220 if [ $HTTPX == "HTTPS" ]; then
221 echo "Using secure ports towards dmaap"
222 use_a1pms_dmaap_https
224 echo "Using non-secure ports towards dmaap"
229 echo "Create $NUM_INSTANCES instances in each OSC RIC"
232 if [ $interface == "REST_PARALLEL" ]; then
233 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
235 for ((i=1; i<=$NUM_RICS; i++))
237 if [ $interface == "DMAAP-BATCH" ]; then
238 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
239 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
240 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
242 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
243 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
245 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
246 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
247 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
250 a1pms_equal json:policy-instances $INSTANCES
252 echo "Create $NUM_INSTANCES instances in each STD RIC"
253 if [ $interface == "REST_PARALLEL" ]; then
254 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
256 for ((i=1; i<=$NUM_RICS; i++))
258 if [ $interface == "DMAAP-BATCH" ]; then
259 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
260 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
261 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
263 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
264 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
266 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
267 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
268 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
271 a1pms_equal json:policy-instances $INSTANCES
273 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
274 if [ $interface == "REST_PARALLEL" ]; then
275 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
277 for ((i=1; i<=$NUM_RICS; i++))
279 if [ $interface == "DMAAP-BATCH" ]; then
280 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
281 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
282 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
284 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
285 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
287 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
288 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
289 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
292 a1pms_equal json:policy-instances $INSTANCES
294 echo "Delete all instances in each OSC RIC"
297 if [ $interface == "REST_PARALLEL" ]; then
298 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
300 for ((i=1; i<=$NUM_RICS; i++))
302 if [ $interface == "DMAAP-BATCH" ]; then
303 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
304 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
305 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
307 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
308 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
310 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
311 sim_equal ricsim_g1_$i num_instances 0
312 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
315 a1pms_equal json:policy-instances $INSTANCES
317 echo "Delete all instances in each STD RIC"
319 if [ $interface == "REST_PARALLEL" ]; then
320 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
322 for ((i=1; i<=$NUM_RICS; i++))
324 if [ $interface == "DMAAP-BATCH" ]; then
325 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
326 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
327 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
329 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
330 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
332 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
333 sim_equal ricsim_g2_$i num_instances 0
334 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
337 a1pms_equal json:policy-instances $INSTANCES
339 echo "Delete all instances in each STD 2 RIC"
341 if [ $interface == "REST_PARALLEL" ]; then
342 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
344 for ((i=1; i<=$NUM_RICS; i++))
346 if [ $interface == "DMAAP-BATCH" ]; then
347 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
348 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
349 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
351 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
352 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
354 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
355 sim_equal ricsim_g3_$i num_instances 0
356 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
359 a1pms_equal json:policy-instances $INSTANCES
361 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
364 mr_equal requests_submitted $MR_MESSAGES
365 mr_equal requests_fetched $MR_MESSAGES
366 mr_equal responses_submitted $MR_MESSAGES
367 mr_equal responses_fetched $MR_MESSAGES
368 mr_equal current_requests 0
369 mr_equal current_responses 0
373 for ((i=1; i<=$NUM_RICS; i++))
375 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
376 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
378 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
388 #### TEST COMPLETE ####
394 auto_clean_environment