blob: 713d330f4c2d3dd1a13b7fc64e3d3e7096613ddd [file] [log] [blame]
BjornMagnussonXA70e878f2020-05-11 14:11:30 +02001#!/bin/bash
BjornMagnussonXA80a92002020-03-19 14:31:06 +01002
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
9#
10# http://www.apache.org/licenses/LICENSE-2.0
11#
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=================================================
18#
19
BjornMagnussonXA4207b832020-11-03 09:52:49 +010020TC_ONELINE_DESCR="Resync 10000 policies using OSC and STD interface"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010021
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +020022#App names to include in the test, space separated list
23INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020024
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010025#SUPPORTED TEST ENV FILE
BjornMagnussonXA89b64ab2020-12-16 09:21:01 +010026SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ORAN-CHERRY ORAN-DAWN"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010027
BjornMagnussonXA80a92002020-03-19 14:31:06 +010028. ../common/testcase_common.sh $@
29. ../common/agent_api_functions.sh
30. ../common/ricsimulator_api_functions.sh
31
32#### TEST BEGIN ####
33
BjornMagnussonXAad047782020-06-08 15:54:11 +020034generate_uuid
35
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020036# Tested variants of REST/DMAAP/SDNC config
37TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC DMAAP_BATCH DMAAP_BATCH+SDNC"
38#Test agent and simulator protocol versions (others are http only)
39TESTED_PROTOCOLS="HTTP HTTPS"
40for __httpx in $TESTED_PROTOCOLS ; do
41 for interface in $TESTED_VARIANTS ; do
BjornMagnussonXA80a92002020-03-19 14:31:06 +010042
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020043 echo "#####################################################################"
44 echo "#####################################################################"
45 echo "### Testing agent: "$interface" and "$__httpx
46 echo "#####################################################################"
47 echo "#####################################################################"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010048
BjornMagnussonXA496156d2020-08-10 14:16:24 +020049 if [ $__httpx == "HTTPS" ]; then
BjornMagnussonXA496156d2020-08-10 14:16:24 +020050 use_cr_https
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020051 use_simulator_https
52 use_mr_https
53 if [[ $interface = *"SDNC"* ]]; then
54 use_sdnc_https
55 fi
56 if [[ $interface = *"DMAAP"* ]]; then
57 use_agent_dmaap_https
58 else
59 use_agent_rest_https
60 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +020061 else
BjornMagnussonXA496156d2020-08-10 14:16:24 +020062 use_cr_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020063 use_simulator_http
64 use_mr_http
65 if [[ $interface = *"SDNC"* ]]; then
66 use_sdnc_http
67 fi
68 if [[ $interface = *"DMAAP"* ]]; then
69 use_agent_dmaap_http
70 else
71 use_agent_rest_http
72 fi
BjornMagnussonXA496156d2020-08-10 14:16:24 +020073 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +010074
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020075 # Clean container and start all needed containers #
76 clean_containers
BjornMagnussonXA80a92002020-03-19 14:31:06 +010077
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020078 start_ric_simulators ricsim_g1 4 OSC_2.1.0
BjornMagnussonXA80a92002020-03-19 14:31:06 +010079
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020080 start_ric_simulators ricsim_g2 4 STD_1.1.3
BjornMagnussonXA80a92002020-03-19 14:31:06 +010081
BjornMagnussonXA4207b832020-11-03 09:52:49 +010082 if [ "$PMS_VERSION" == "V2" ]; then
83 start_ric_simulators ricsim_g3 4 STD_2.0.0
84 fi
85
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020086 start_mr
BjornMagnussonXA80a92002020-03-19 14:31:06 +010087
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020088 start_cr
BjornMagnussonXA80a92002020-03-19 14:31:06 +010089
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020090 start_consul_cbs
BjornMagnussonXA80a92002020-03-19 14:31:06 +010091
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020092 if [[ $interface = *"SDNC"* ]]; then
93 start_sdnc
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020094 prepare_consul_config SDNC ".consul_config.json"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020095 else
96 prepare_consul_config NOSDNC ".consul_config.json"
97 fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +010098
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020099 consul_config_app ".consul_config.json"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100100
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200101 start_control_panel
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100102
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200103 start_policy_agent
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100104
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200105 set_agent_debug
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100106
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200107 api_get_status 200
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100108
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200109 sim_print ricsim_g1_1 interface
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100110
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200111 sim_print ricsim_g2_1 interface
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100112
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100113 if [ "$PMS_VERSION" == "V2" ]; then
114 sim_print ricsim_g3_1 interface
115 fi
116
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200117 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
118
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100119 if [ "$PMS_VERSION" == "V2" ]; then
120 api_equal json:policy-types 2 120 #Wait for the agent to refresh types from the simulator
121 else
122 api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator
123 fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200124
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200125 api_put_service 201 "serv1" 3600 "$CR_PATH/1"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200126
127 START_ID=2000
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100128 NUM_POLICIES=10000 # Must be at least 100
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200129
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100130 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100131 notificationurl=$CR_PATH"/test"
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200132 else
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100133 notificationurl=""
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200134 fi
135
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100136 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
138 else
139 api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json $NUM_POLICIES
140 fi
141
142 sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200143
144 sim_post_delete_instances 200 ricsim_g1_1
145
146 sim_equal ricsim_g1_1 num_instances 0
147
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100148 sim_equal ricsim_g1_1 num_instances $NUM_POLICIES 300
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200149
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100150 START_ID2=$(($START_ID+$NUM_POLICIES))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200151
152 if [[ $interface == *"BATCH"* ]]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100153 api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200154 else
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100155 api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID2 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json $NUM_POLICIES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200156 fi
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100157 sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200158
159 sim_post_delete_instances 200 ricsim_g2_1
160
161 sim_equal ricsim_g2_1 num_instances 0
162
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100163 sim_equal ricsim_g2_1 num_instances $NUM_POLICIES 300
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200164
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100165 api_delete_policy 204 $(($START_ID+47))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200166
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100167 api_delete_policy 204 $(($START_ID+$NUM_POLICIES-39))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200168
169 sim_post_delete_instances 200 ricsim_g1_1
170
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100171 sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200172
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100173 api_delete_policy 204 $(($START_ID2+37))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200174
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100175 api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-93))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200176
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100177 api_delete_policy 204 $(($START_ID2+$NUM_POLICIES-91))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200178
179 sim_post_delete_instances 200 ricsim_g2_1
180
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100181 sim_equal ricsim_g1_1 num_instances $(($NUM_POLICIES-2)) 300
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200182
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100183 sim_equal ricsim_g2_1 num_instances $(($NUM_POLICIES-3)) 300
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200184
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100185 api_equal json:policies $(($NUM_POLICIES-2+$NUM_POLICIES-3))
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200186
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200187 check_policy_agent_logs
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100188 if [[ $interface = *"SDNC"* ]]; then
189 check_sdnc_logs
190 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200191
192 store_logs "${__httpx}__${interface}"
193
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200194 done
195
196done
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100197
198
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100199#### TEST COMPLETE ####
200
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100201
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200202print_result
203
204auto_clean_containers