3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020-2023 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 and with SDNC using http or https"
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="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 #Pre-started 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="NGW"
35 #Supported test environment profiles
36 SUPPORTED_PROFILES="ONAP-JAKARTA ONAP-KOHN ONAP-LONDON ORAN-F-RELEASE ORAN-G-RELEASE ORAN-H-RELEASE"
38 SUPPORTED_RUNMODES="DOCKER KUBE"
40 . ../common/testcase_common.sh $@
46 sim_generate_policy_uuid
48 #Local vars in test script
49 ##########################
51 # Number of RICs per interface type (OSC and STD x 2)
54 # Number of policy instances per RIC
63 # use HTTP or HTTPS for all apis
66 if [ $HTTPX == "HTTP" ]; then
74 if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
75 deviation "SDNC does not support NB https"
83 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
85 start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
87 start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0
89 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
97 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
99 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
100 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
103 A1PMS_RETRY_CODES=423
104 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
108 prepare_a1pms_config SDNC ".a1pms_config.json"
110 if [ $RUNMODE == "KUBE" ]; then
111 a1pms_load_config ".a1pms_config.json"
113 a1pms_api_put_configuration 200 ".a1pms_config.json"
117 controller_api_wait_for_status_ok 200 ricsim_g1_1
119 sleep_wait 120 "Let A1PMS configuration take effect"
121 a1pms_api_get_status 200
123 echo "Print the interface for group 1 simulators, shall be OSC"
124 for ((i=1; i<=$NUM_RICS; i++))
126 sim_print ricsim_g1_$i interface
129 echo "Print the interface for group 2 simulators, shall be STD"
130 for ((i=1; i<=$NUM_RICS; i++))
132 sim_print ricsim_g2_$i interface
135 echo "Print the interface for group 2 simulators, shall be STD 2"
136 for ((i=1; i<=$NUM_RICS; i++))
138 sim_print ricsim_g3_$i interface
141 echo "Load policy type in group 1 simulators"
142 for ((i=1; i<=$NUM_RICS; i++))
144 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
147 echo "Load policy type in group 3 simulators"
148 for ((i=1; i<=$NUM_RICS; i++))
150 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 echo "Check the number of instances in group 3 simulators, shall be 0"
166 for ((i=1; i<=$NUM_RICS; i++))
168 sim_equal ricsim_g3_$i num_instances 0
171 echo "Wait for the a1pms to refresh types from the simulator"
172 a1pms_equal json:policy-types 3 300
174 echo "Check the number of types in the a1pms for each ric is 1"
175 for ((i=1; i<=$NUM_RICS; i++))
177 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
178 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
181 echo "Register a service"
182 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
184 TEST_DURATION=$((24*3600*$DAYS))
188 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
189 A1PMS_INTERFACES="REST REST_PARALLEL"
191 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
196 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
198 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
201 echo "#########################################################################################################"
202 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
203 echo "#########################################################################################################"
206 for interface in $A1PMS_INTERFACES ; do
208 echo "############################################"
209 echo "## Testing using a1pms interface: $interface ##"
210 echo "############################################"
212 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
213 if [ $HTTPX == "HTTP" ]; then
219 if [ $HTTPX == "HTTPS" ]; then
220 echo "Using secure ports towards dmaap"
221 use_a1pms_dmaap_https
223 echo "Using non-secure ports towards dmaap"
228 echo "Create $NUM_INSTANCES instances in each OSC RIC"
231 if [ $interface == "REST_PARALLEL" ]; then
232 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
234 for ((i=1; i<=$NUM_RICS; i++))
236 if [ $interface == "DMAAP-BATCH" ]; then
237 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
238 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
239 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
241 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
242 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
244 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
245 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
246 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
249 a1pms_equal json:policy-instances $INSTANCES
251 echo "Create $NUM_INSTANCES instances in each STD RIC"
252 if [ $interface == "REST_PARALLEL" ]; then
253 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
255 for ((i=1; i<=$NUM_RICS; i++))
257 if [ $interface == "DMAAP-BATCH" ]; then
258 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
259 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
260 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
262 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
263 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
265 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
266 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
267 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
270 a1pms_equal json:policy-instances $INSTANCES
272 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
273 if [ $interface == "REST_PARALLEL" ]; then
274 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
276 for ((i=1; i<=$NUM_RICS; i++))
278 if [ $interface == "DMAAP-BATCH" ]; then
279 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
280 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
281 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
283 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
284 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
286 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
287 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
288 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
291 a1pms_equal json:policy-instances $INSTANCES
293 echo "Delete all instances in each OSC RIC"
296 if [ $interface == "REST_PARALLEL" ]; then
297 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
299 for ((i=1; i<=$NUM_RICS; i++))
301 if [ $interface == "DMAAP-BATCH" ]; then
302 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
303 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
304 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
306 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
307 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
309 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
310 sim_equal ricsim_g1_$i num_instances 0
311 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
314 a1pms_equal json:policy-instances $INSTANCES
316 echo "Delete all instances in each STD RIC"
318 if [ $interface == "REST_PARALLEL" ]; then
319 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
321 for ((i=1; i<=$NUM_RICS; i++))
323 if [ $interface == "DMAAP-BATCH" ]; then
324 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
325 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
326 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
328 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
329 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
331 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
332 sim_equal ricsim_g2_$i num_instances 0
333 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
336 a1pms_equal json:policy-instances $INSTANCES
338 echo "Delete all instances in each STD 2 RIC"
340 if [ $interface == "REST_PARALLEL" ]; then
341 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
343 for ((i=1; i<=$NUM_RICS; i++))
345 if [ $interface == "DMAAP-BATCH" ]; then
346 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
347 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
348 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
350 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
351 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
353 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
354 sim_equal ricsim_g3_$i num_instances 0
355 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
358 a1pms_equal json:policy-instances $INSTANCES
360 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
363 mr_equal requests_submitted $MR_MESSAGES
364 mr_equal requests_fetched $MR_MESSAGES
365 mr_equal responses_submitted $MR_MESSAGES
366 mr_equal responses_fetched $MR_MESSAGES
367 mr_equal current_requests 0
368 mr_equal current_responses 0
372 for ((i=1; i<=$NUM_RICS; i++))
374 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
375 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
377 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
387 #### TEST COMPLETE ####
393 auto_clean_environment