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="Resync 10000 policies using OSC and STD interface"
22 #App names to include in the test, space separated list
23 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
25 #SUPPORTED TEST ENV FILE
26 SUPPORTED_PROFILES="ONAP-MASTER ONAP-GUILIN ORAN-MASTER"
28 . ../common/testcase_common.sh $@
29 . ../common/agent_api_functions.sh
30 . ../common/ricsimulator_api_functions.sh
36 # Tested variants of REST/DMAAP/SDNC config
37 TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC DMAAP_BATCH DMAAP_BATCH+SDNC"
38 #Test agent and simulator protocol versions (others are http only)
39 TESTED_PROTOCOLS="HTTP HTTPS"
40 for __httpx in $TESTED_PROTOCOLS ; do
41 for interface in $TESTED_VARIANTS ; do
43 echo "#####################################################################"
44 echo "#####################################################################"
45 echo "### Testing agent: "$interface" and "$__httpx
46 echo "#####################################################################"
47 echo "#####################################################################"
49 if [ $__httpx == "HTTPS" ]; then
53 if [[ $interface = *"SDNC"* ]]; then
56 if [[ $interface = *"DMAAP"* ]]; then
65 if [[ $interface = *"SDNC"* ]]; then
68 if [[ $interface = *"DMAAP"* ]]; then
75 # Clean container and start all needed containers #
78 start_ric_simulators ricsim_g1 4 OSC_2.1.0
80 start_ric_simulators ricsim_g2 4 STD_1.1.3
82 if [ "$PMS_VERSION" == "V2" ]; then
83 start_ric_simulators ricsim_g3 4 STD_2.0.0
92 if [[ $interface = *"SDNC"* ]]; then
94 prepare_consul_config SDNC ".consul_config.json"
96 prepare_consul_config NOSDNC ".consul_config.json"
99 consul_config_app ".consul_config.json"
109 sim_print ricsim_g1_1 interface
111 sim_print ricsim_g2_1 interface
113 if [ "$PMS_VERSION" == "V2" ]; then
114 sim_print ricsim_g3_1 interface
117 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
119 if [ "$PMS_VERSION" == "V2" ]; then
120 api_equal json:policy-types 2 120 #Wait for the agent to refresh types from the simulator
122 api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator
125 api_put_service 201 "serv1" 3600 "$CR_PATH/1"
128 NUM_POLICIES=10000 # Must be at least 100
130 if [ "$PMS_VERSION" == "V2" ]; then
131 notificationurl=$CR_PATH"/test"
136 if [[ $interface == *"BATCH"* ]]; then
137 api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
139 api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
142 sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
144 sim_post_delete_instances 200 ricsim_g1_1
146 sim_equal ricsim_g1_1 num_instances 0
148 sim_equal ricsim_g1_1 num_instances $NUM_POLICIES 300
150 START_ID2=$(($START_ID+$NUM_POLICIES))
152 if [[ $interface == *"BATCH"* ]]; then
153 api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
155 api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
157 sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
159 sim_post_delete_instances 200 ricsim_g2_1
161 sim_equal ricsim_g2_1 num_instances 0
163 sim_equal ricsim_g2_1 num_instances $NUM_POLICIES 300
165 api_delete_policy 204 $(($START_ID+47))
167 api_delete_policy 204 $(($START_ID+$NUM_POLICIES-39))
169 sim_post_delete_instances 200 ricsim_g1_1
171 sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
173 api_delete_policy 204 $(($START_ID2+37))
175 api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-93))
177 api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-91))
179 sim_post_delete_instances 200 ricsim_g2_1
181 sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
183 sim_equal ricsim_g2_1 num_instances $(($NUM_POLICIES-3)) 300
185 api_equal json:policies $(($NUM_POLICIES-2+$NUM_POLICIES-3))
187 check_policy_agent_logs
188 if [[ $interface = *"SDNC"* ]]; then
192 store_logs "${__httpx}__${interface}"
199 #### TEST COMPLETE ####
204 auto_clean_containers