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="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="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 $@
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
78 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
80 start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
82 start_ric_simulators ricsim_g3 $NUM_RICS STD_2.0.0
88 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
90 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
91 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
95 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
99 prepare_a1pms_config SDNC ".a1pms_config.json"
101 if [ $RUNMODE == "KUBE" ]; then
102 a1pms_load_config ".a1pms_config.json"
104 a1pms_api_put_configuration 200 ".a1pms_config.json"
109 sleep_wait 120 "Let A1PMS cofiguration take effect"
111 a1pms_api_get_status 200
113 echo "Print the interface for group 1 simulators, shall be OSC"
114 for ((i=1; i<=$NUM_RICS; i++))
116 sim_print ricsim_g1_$i interface
119 echo "Print the interface for group 2 simulators, shall be STD"
120 for ((i=1; i<=$NUM_RICS; i++))
122 sim_print ricsim_g2_$i interface
125 echo "Print the interface for group 2 simulators, shall be STD 2"
126 for ((i=1; i<=$NUM_RICS; i++))
128 sim_print ricsim_g3_$i interface
131 echo "Load policy type in group 1 simulators"
132 for ((i=1; i<=$NUM_RICS; i++))
134 sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
137 echo "Load policy type in group 3 simulators"
138 for ((i=1; i<=$NUM_RICS; i++))
140 sim_put_policy_type 201 ricsim_g3_$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
143 echo "Check the number of instances in group 1 simulators, shall be 0"
144 for ((i=1; i<=$NUM_RICS; i++))
146 sim_equal ricsim_g1_$i num_instances 0
149 echo "Check the number of instances in group 2 simulators, shall be 0"
150 for ((i=1; i<=$NUM_RICS; i++))
152 sim_equal ricsim_g2_$i num_instances 0
155 echo "Check the number of instances in group 3 simulators, shall be 0"
156 for ((i=1; i<=$NUM_RICS; i++))
158 sim_equal ricsim_g3_$i num_instances 0
161 echo "Wait for the a1pms to refresh types from the simulator"
162 a1pms_equal json:policy-types 3 300
164 echo "Check the number of types in the a1pms for each ric is 1"
165 for ((i=1; i<=$NUM_RICS; i++))
167 a1pms_equal json:policy-types?ric_id=ricsim_g1_$i 1 120
168 a1pms_equal json:policy-types?ric_id=ricsim_g3_$i 1 120
171 echo "Register a service"
172 a1pms_api_put_service 201 "serv1" 0 "$CR_SERVICE_APP_PATH_0/1"
174 TEST_DURATION=$((24*3600*$DAYS))
177 A1PMS_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
181 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
183 while [ $(($SECONDS-$TEST_START)) -lt $TEST_DURATION ]; do
186 echo "#########################################################################################################"
187 echo -e $BOLD"INFO: Test executed for: "$(($SECONDS-$TEST_START)) "seconds. Target is: "$TEST_DURATION" seconds."$EBOLD
188 echo "#########################################################################################################"
191 for interface in $A1PMS_INTERFACES ; do
193 echo "############################################"
194 echo "## Testing using a1pms interface: $interface ##"
195 echo "############################################"
197 if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
198 if [ $HTTPX == "HTTP" ]; then
204 if [ $HTTPX == "HTTPS" ]; then
205 echo "Using secure ports towards dmaap"
206 use_a1pms_dmaap_https
208 echo "Using non-secure ports towards dmaap"
213 echo "Create $NUM_INSTANCES instances in each OSC RIC"
216 if [ $interface == "REST_PARALLEL" ]; then
217 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES 3
219 for ((i=1; i<=$NUM_RICS; i++))
221 if [ $interface == "DMAAP-BATCH" ]; then
222 a1pms_api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
223 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
224 a1pms_api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_INSTANCES
226 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
227 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
229 sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
230 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
231 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
234 a1pms_equal json:policy-instances $INSTANCES
236 echo "Create $NUM_INSTANCES instances in each STD RIC"
237 if [ $interface == "REST_PARALLEL" ]; then
238 a1pms_api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES 3
240 for ((i=1; i<=$NUM_RICS; i++))
242 if [ $interface == "DMAAP-BATCH" ]; then
243 a1pms_api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
244 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
245 a1pms_api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_INSTANCES
247 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
248 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
250 sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
251 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
252 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
255 a1pms_equal json:policy-instances $INSTANCES
257 echo "Create $NUM_INSTANCES instances in each STD 2 RIC"
258 if [ $interface == "REST_PARALLEL" ]; then
259 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
261 for ((i=1; i<=$NUM_RICS; i++))
263 if [ $interface == "DMAAP-BATCH" ]; then
264 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
265 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
266 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
268 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
269 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
271 sim_equal ricsim_g3_$i num_instances $NUM_INSTANCES
272 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
273 INSTANCES=$(($INSTANCES+$NUM_INSTANCES))
276 a1pms_equal json:policy-instances $INSTANCES
278 echo "Delete all instances in each OSC RIC"
281 if [ $interface == "REST_PARALLEL" ]; then
282 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
284 for ((i=1; i<=$NUM_RICS; i++))
286 if [ $interface == "DMAAP-BATCH" ]; then
287 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
288 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
289 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
291 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
292 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
294 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
295 sim_equal ricsim_g1_$i num_instances 0
296 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
299 a1pms_equal json:policy-instances $INSTANCES
301 echo "Delete all instances in each STD RIC"
303 if [ $interface == "REST_PARALLEL" ]; then
304 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
306 for ((i=1; i<=$NUM_RICS; i++))
308 if [ $interface == "DMAAP-BATCH" ]; then
309 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
310 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
311 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
313 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
314 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
316 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
317 sim_equal ricsim_g2_$i num_instances 0
318 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
321 a1pms_equal json:policy-instances $INSTANCES
323 echo "Delete all instances in each STD 2 RIC"
325 if [ $interface == "REST_PARALLEL" ]; then
326 a1pms_api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
328 for ((i=1; i<=$NUM_RICS; i++))
330 if [ $interface == "DMAAP-BATCH" ]; then
331 a1pms_api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
332 elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
333 a1pms_api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
335 if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
336 MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
338 INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
339 sim_equal ricsim_g3_$i num_instances 0
340 INSTANCE_ID=$(($INSTANCE_ID+$NUM_INSTANCES))
343 a1pms_equal json:policy-instances $INSTANCES
345 mr_equal requests_submitted $MR_MESSAGES
346 mr_equal requests_fetched $MR_MESSAGES
347 mr_equal responses_submitted $MR_MESSAGES
348 mr_equal responses_fetched $MR_MESSAGES
349 mr_equal current_requests 0
350 mr_equal current_responses 0
353 for ((i=1; i<=$NUM_RICS; i++))
355 sim_contains_str ricsim_g1_$i remote_hosts $SDNC_APP_NAME
356 sim_contains_str ricsim_g2_$i remote_hosts $SDNC_APP_NAME
358 sim_contains_str ricsim_g3_$i remote_hosts $SDNC_APP_NAME
368 #### TEST COMPLETE ####
374 auto_clean_environment