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="Create 10000 policies in sequence using http/https and Agent REST/DMAAP with/without SDNC controller"
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA 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 PA 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-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 ##########################
50 # Number of policies in each sequence
53 # Tested variants of REST/DMAAP/SDNC config
54 TESTED_VARIANTS="NOSDNC SDNC"
56 #Test agent and simulator protocol versions (others are http only)
57 TESTED_PROTOCOLS="HTTP HTTPS"
59 for __httpx in $TESTED_PROTOCOLS ; do
60 for interface in $TESTED_VARIANTS ; do
62 echo "#####################################################################"
63 echo "#####################################################################"
64 echo "### Testing agent via $interface using $__httpx"
65 echo "#####################################################################"
66 echo "#####################################################################"
68 if [ $__httpx == "HTTPS" ]; then
80 # Policy instance start id
87 start_ric_simulators ricsim_g1 1 OSC_2.1.0
88 start_ric_simulators ricsim_g2 1 STD_1.1.3
89 if [ "$PMS_VERSION" == "V2" ]; then
90 start_ric_simulators ricsim_g3 1 STD_2.0.0
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 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
107 mr_equal requests_submitted 0
109 if [[ $interface == "SDNC" ]]; then
111 prepare_consul_config SDNC ".consul_config.json"
113 prepare_consul_config NOSDNC ".consul_config.json"
116 if [ $RUNMODE == "DOCKER" ]; then
120 if [ $RUNMODE == "KUBE" ]; then
121 agent_load_config ".consul_config.json"
123 consul_config_app ".consul_config.json"
129 sim_print ricsim_g1_1 interface
130 sim_print ricsim_g2_1 interface
131 if [ "$PMS_VERSION" == "V2" ]; then
132 sim_print ricsim_g3_1 interface
135 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
137 if [ "$PMS_VERSION" == "V2" ]; then
138 sim_put_policy_type 201 ricsim_g3_1 STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
140 api_equal json:policy-types 3 300 #Wait for the agent to refresh types from the simulators
142 api_equal json:policy_types 2 300 #Wait for the agent to refresh types from the simulators
145 api_put_service 201 "serv1" 3600 "$CR_SERVICE_APP_PATH_0/1"
147 if [ "$PMS_VERSION" == "V2" ]; then
148 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
153 start_timer "Create polices in OSC via agent REST and $interface using "$__httpx
154 api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
155 print_timer "Create polices in OSC via agent REST and $interface using "$__httpx
157 sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
159 START_ID=$(($START_ID+$NUM_POLICIES))
161 start_timer "Create polices in STD via agent REST and $interface using "$__httpx
162 api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
163 print_timer "Create polices in STD via agent REST and $interface using "$__httpx
165 sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
167 if [ "$PMS_VERSION" == "V2" ]; then
169 START_ID=$(($START_ID+$NUM_POLICIES))
171 start_timer "Create polices in STD 2 via agent REST and $interface using "$__httpx
172 api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
173 print_timer "Create polices in STD via agent REST and $interface using "$__httpx
175 sim_equal ricsim_g3_1 num_instances $NUM_POLICIES
178 if [ $__httpx == "HTTPS" ]; then
179 echo "Using secure ports towards dmaap"
180 use_agent_dmaap_https
182 echo "Using non-secure ports towards dmaap"
186 START_ID=$(($START_ID+$NUM_POLICIES))
188 start_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
189 api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
190 print_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
192 sim_equal ricsim_g1_1 num_instances $((2*$NUM_POLICIES))
194 START_ID=$(($START_ID+$NUM_POLICIES))
196 start_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
197 api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
198 print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
200 sim_equal ricsim_g2_1 num_instances $((2*$NUM_POLICIES))
202 if [ "$PMS_VERSION" == "V2" ]; then
204 START_ID=$(($START_ID+$NUM_POLICIES))
206 start_timer "Create polices in STD 2 via agent DMAAP, one by one, and $interface using "$__httpx
207 api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
208 print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
210 sim_equal ricsim_g3_1 num_instances $((2*$NUM_POLICIES))
213 START_ID=$(($START_ID+$NUM_POLICIES))
215 start_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
216 api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
217 print_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
219 sim_equal ricsim_g1_1 num_instances $((3*$NUM_POLICIES))
221 START_ID=$(($START_ID+$NUM_POLICIES))
223 start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
224 api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
225 print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
227 sim_equal ricsim_g2_1 num_instances $((3*$NUM_POLICIES))
229 if [ "$PMS_VERSION" == "V2" ]; then
231 START_ID=$(($START_ID+$NUM_POLICIES))
233 start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
234 api_put_policy_batch 201 "serv1" ricsim_g3_1 STD_QOS2_0.1.0 $START_ID NOTRANSIENT $notificationurl testdata/STD2/pi_qos2_template.json $NUM_POLICIES
235 print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
237 sim_equal ricsim_g3_1 num_instances $((3*$NUM_POLICIES))
240 if [ $interface == "SDNC" ]; then
241 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
242 sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
243 if [ "$PMS_VERSION" == "V2" ]; then
244 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
247 sim_contains_str ricsim_g1_1 remote_hosts $POLICY_AGENT_APP_NAME
248 sim_contains_str ricsim_g2_1 remote_hosts $POLICY_AGENT_APP_NAME
249 if [ "$PMS_VERSION" == "V2" ]; then
250 sim_contains_str ricsim_g3_1 remote_hosts $POLICY_AGENT_APP_NAME
254 check_policy_agent_logs
255 if [[ $interface = *"SDNC"* ]]; then
259 store_logs "${__httpx}__${interface}"
263 #### TEST COMPLETE ####
267 auto_clean_environment