blob: c7222457f0327a427b32e94923e9f0856934197a [file] [log] [blame]
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +02001#!/bin/bash
2
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
20TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
21
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010022#App names to include in the test when running docker, space separated list
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010023DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC KUBEPROXY"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020024
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010025#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010026KUBE_INCLUDED_IMAGES="CP CR MR PA RICSIM SDNC KUBEPROXY"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010027#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28KUBE_PRESTARTED_IMAGES=""
29
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010030#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
33CONDITIONALLY_IGNORED_IMAGES="CBS CONSUL"
34
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010035#Supported test environment profiles
BjornMagnussonXAe60d04e2021-12-27 13:38:01 +010036SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010037#Supported run modes
38SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010039
BjornMagnussonXA79e37002021-11-22 13:36:04 +010040. ../common/testcase_common.sh $@
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010041
42setup_testenvironment
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020043
44#### TEST BEGIN ####
45
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010046generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020047
BjornMagnussonXA496156d2020-08-10 14:16:24 +020048use_cr_http
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020049
50NUM_RICS=10
51NUM_RICS_2=$(($NUM_RICS-2))
52
53# Tested variants of REST/SDNC config
54TESTED_VARIANTS="REST REST+SDNC"
55
56for interface in $TESTED_VARIANTS ; do
57
58 echo "#####################################################################"
59 echo "#####################################################################"
60 echo "### Testing agent: "$interface
61 echo "#####################################################################"
62 echo "#####################################################################"
63
64
65 # Clean container and start all needed containers #
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010066 clean_environment
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020067
BjornMagnussonXA663566c2021-11-08 10:25:07 +010068 start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010069
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020070 #Start simulators and prepare two configs
71
72 start_ric_simulators ricsim_g1 $NUM_RICS_2 OSC_2.1.0
73
BjornMagnussonXA79e37002021-11-22 13:36:04 +010074 start_cr 1
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020075
76 start_mr
77
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010078 if [ $RUNMODE == "DOCKER" ]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010079 if [[ "$PMS_FEATURE_LEVEL" != *"NOCONSUL"* ]]; then
80 start_consul_cbs
81 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010082 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020083
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010084 # Create first config
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020085 if [[ $interface = *"SDNC"* ]]; then
86 start_sdnc
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010087 prepare_consul_config SDNC ".consul_config_initial.json"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020088 else
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010089 prepare_consul_config NOSDNC ".consul_config_initial.json"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020090 fi
91
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020092 # Create 2nd config and save for later
93 start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
94
95 if [[ $interface = *"SDNC"* ]]; then
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +020096 prepare_consul_config SDNC ".consul_config_all.json"
97 else
98 prepare_consul_config NOSDNC ".consul_config_all.json"
99 fi
100
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100101 if [ $RUNMODE == "KUBE" ] && [[ "$PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
102 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/application2.yaml
103 else
104 start_policy_agent NORPOXY $SIM_GROUP/$POLICY_AGENT_COMPOSE_DIR/$POLICY_AGENT_CONFIG_FILE
105 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200106
BjornMagnussonXAf38e1e82020-10-11 23:05:02 +0200107 set_agent_trace
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200108
109 api_get_status 200
110
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100111 # Create service to be able to receive events when rics becomes available
112 # Must use rest towards the agent since dmaap is not configured yet
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100113 api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100114
115 #Load first config
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100116 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100117 if [[ "$PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
118 api_put_configuration 200 ".consul_config_initial.json"
119 api_get_configuration 200 ".consul_config_initial.json"
120 else
121 agent_load_config ".consul_config_initial.json"
122 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100123 else
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100124 if [[ "$PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
125 api_put_configuration 200 ".consul_config_initial.json"
126 api_get_configuration 200 ".consul_config_initial.json"
127 else
128 consul_config_app ".consul_config_initial.json"
129 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100130 fi
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100131
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200132 for ((i=1; i<=${NUM_RICS}; i++))
133 do
134 sim_print ricsim_g1_$i interface
135 done
136
137 # All sims running but 2 are not configured in consul
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100138 api_equal json:rics 8 300
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200139
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100140 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100141 cr_equal 0 received_callbacks?id=ric-registration 8 120
142 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100143 fi
144
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200145 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:NOTYPE:???? \
146 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:NOTYPE:???? \
147 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:NOTYPE:???? \
148 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:NOTYPE:???? \
149 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:NOTYPE:???? \
150 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:NOTYPE:???? \
151 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:NOTYPE:???? \
152 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:NOTYPE:???? "
153
154
155 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
156 sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
157 sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
158 sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
159 sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
160
161 sim_put_policy_type 201 ricsim_g1_2 2 testdata/OSC/sim_2.json
162 sim_put_policy_type 201 ricsim_g1_3 2 testdata/OSC/sim_2.json
163 sim_put_policy_type 201 ricsim_g1_4 2 testdata/OSC/sim_2.json
164 sim_put_policy_type 201 ricsim_g1_5 2 testdata/OSC/sim_2.json
165 sim_put_policy_type 201 ricsim_g1_6 2 testdata/OSC/sim_2.json
166
167 sim_put_policy_type 201 ricsim_g1_3 3 testdata/OSC/sim_3.json
168 sim_put_policy_type 201 ricsim_g1_4 3 testdata/OSC/sim_3.json
169 sim_put_policy_type 201 ricsim_g1_5 3 testdata/OSC/sim_3.json
170 sim_put_policy_type 201 ricsim_g1_6 3 testdata/OSC/sim_3.json
171 sim_put_policy_type 201 ricsim_g1_7 3 testdata/OSC/sim_3.json
172
173 sim_put_policy_type 201 ricsim_g1_4 4 testdata/OSC/sim_4.json
174 sim_put_policy_type 201 ricsim_g1_5 4 testdata/OSC/sim_4.json
175 sim_put_policy_type 201 ricsim_g1_6 4 testdata/OSC/sim_4.json
176 sim_put_policy_type 201 ricsim_g1_7 4 testdata/OSC/sim_4.json
177 sim_put_policy_type 201 ricsim_g1_8 4 testdata/OSC/sim_4.json
178
179 sim_put_policy_type 201 ricsim_g1_5 5 testdata/OSC/sim_5.json
180 sim_put_policy_type 201 ricsim_g1_6 5 testdata/OSC/sim_5.json
181 sim_put_policy_type 201 ricsim_g1_7 5 testdata/OSC/sim_5.json
182 sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200183
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100184 if [ "$PMS_VERSION" == "V2" ]; then
185 api_equal json:policy-types 5 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200186
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100187 echo "Check the number of types in the agent for each ric"
188 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
189 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
190 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
191 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
192 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
193 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
194 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
195 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
196 else
197 api_equal json:policy_types 5 120
198
199 echo "Check the number of types in the agent for each ric"
200 api_equal json:policy_types?ric=ricsim_g1_1 1 120
201 api_equal json:policy_types?ric=ricsim_g1_2 2 120
202 api_equal json:policy_types?ric=ricsim_g1_3 3 120
203 api_equal json:policy_types?ric=ricsim_g1_4 4 120
204 api_equal json:policy_types?ric=ricsim_g1_5 5 120
205 api_equal json:policy_types?ric=ricsim_g1_6 4 120
206 api_equal json:policy_types?ric=ricsim_g1_7 3 120
207 api_equal json:policy_types?ric=ricsim_g1_8 2 120
208 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200209
210 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
211 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
212 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
213 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
214 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
215 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
216 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
217 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
218
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100219 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100220 cr_equal 0 received_callbacks?id=ric-registration 16 120
221 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g1_2 ricsim_g1_3 ricsim_g1_4 ricsim_g1_5 ricsim_g1_6 ricsim_g1_7 ricsim_g1_8
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100222 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200223
224 #Load config with all rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100225 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100226 if [[ "$PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
227 api_put_configuration 200 ".consul_config_all.json"
228 api_get_configuration 200 ".consul_config_all.json"
229 else
230 agent_load_config ".consul_config_all.json"
231 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100232 else
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100233 if [[ "$PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
234 api_put_configuration 200 ".consul_config_all.json"
235 api_get_configuration 200 ".consul_config_all.json"
236 else
237 consul_config_app ".consul_config_all.json"
238 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100239 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200240
241 api_equal json:rics 10 120
242
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100243 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100244 cr_equal 0 received_callbacks?id=ric-registration 18 120
245 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_9 ricsim_g1_10
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100246 fi
247
248 sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json
249
250 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100251
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200252 api_equal json:policy-types 5 120
253
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100254 echo "Check the number of types in the agent for each ric"
255 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
256 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
257 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
258 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
259 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
260 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
261 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
262 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
263 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
264 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
265 else
266
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200267 api_equal json:policy_types 5 120
268
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100269 echo "Check the number of types in the agent for each ric"
270 api_equal json:policy_types?ric=ricsim_g1_1 1 120
271 api_equal json:policy_types?ric=ricsim_g1_2 2 120
272 api_equal json:policy_types?ric=ricsim_g1_3 3 120
273 api_equal json:policy_types?ric=ricsim_g1_4 4 120
274 api_equal json:policy_types?ric=ricsim_g1_5 5 120
275 api_equal json:policy_types?ric=ricsim_g1_6 4 120
276 api_equal json:policy_types?ric=ricsim_g1_7 3 120
277 api_equal json:policy_types?ric=ricsim_g1_8 2 120
278 api_equal json:policy_types?ric=ricsim_g1_9 1 120
279 api_equal json:policy_types?ric=ricsim_g1_10 0 120
280 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200281
282 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
283 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
284 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
285 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
286 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
287 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
288 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
289 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
290 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
291 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
292
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100293 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100294 cr_equal 0 received_callbacks?id=ric-registration 19 120
295 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_9
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100296 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200297
298 #No policy type in sim #10
299
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100300 if [ "$PMS_VERSION" == "V2" ]; then
301 api_equal json:policy-types 5
302 else
303 api_equal json:policy_types 5
304 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200305
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100306 api_put_service 201 "serv1" 3600 "$CR_SERVICE_APP_PATH_0/serv1"
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200307
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100308 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100309 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100310 else
311 notificationurl=""
312 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200313
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100314 sleep_wait 120
315
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200316 # Load config with reduced number of rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100317 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100318 if [[ "$PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
319 api_put_configuration 200 ".consul_config_initial.json"
320 api_get_configuration 200 ".consul_config_initial.json"
321 else
322 agent_load_config ".consul_config_initial.json"
323 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100324 else
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100325 if [[ "$PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
326 api_put_configuration 200 ".consul_config_initial.json"
327 api_get_configuration 200 ".consul_config_initial.json"
328 else
329 consul_config_app ".consul_config_initial.json"
330 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100331 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200332
333 api_equal json:rics 8 120
334
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100335 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100336 cr_equal 0 received_callbacks?id=ric-registration 19 120
337 cr_api_check_all_sync_events 200 0 ric-registration EMPTY
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100338 fi
339
340 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200341
342 api_equal json:policy-types 5 120
343
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100344 echo "Check the number of types in the agent for each ric"
345 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
346 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
347 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
348 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
349 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
350 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
351 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
352 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
353 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200354
355 api_equal json:policy_types 5 120
356
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100357 echo "Check the number of types in the agent for each ric"
358 api_equal json:policy_types?ric=ricsim_g1_1 1 120
359 api_equal json:policy_types?ric=ricsim_g1_2 2 120
360 api_equal json:policy_types?ric=ricsim_g1_3 3 120
361 api_equal json:policy_types?ric=ricsim_g1_4 4 120
362 api_equal json:policy_types?ric=ricsim_g1_5 5 120
363 api_equal json:policy_types?ric=ricsim_g1_6 4 120
364 api_equal json:policy_types?ric=ricsim_g1_7 3 120
365 api_equal json:policy_types?ric=ricsim_g1_8 2 120
366 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200367
368 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
369 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
370 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
371 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
372 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
373 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
374 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
375 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
376
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200377 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200378
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100379 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100380 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100381 else
382 api_equal json:policy_ids 0
383 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200384
385 api_get_policy_types 404 ricsim_g1_9
386
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200387 # Load config with all rics
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100388 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100389 if [[ "$PMS_FEATURE_LEVEL" == *"INITIALCONFIGMAP"* ]]; then
390 api_put_configuration 200 ".consul_config_all.json"
391 api_get_configuration 200 ".consul_config_all.json"
392 else
393 agent_load_config ".consul_config_all.json"
394 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100395 else
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100396 if [[ "$PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
397 api_put_configuration 200 ".consul_config_all.json"
398 api_get_configuration 200 ".consul_config_all.json"
399 else
400 consul_config_app ".consul_config_all.json"
401 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100402 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200403
404 api_equal json:rics 10 120
405
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100406 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200407
408 api_equal json:policy-types 5 120
409
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100410 echo "Check the number of types in the agent for each ric"
411 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
412 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
413 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
414 api_equal json:policy-types?ric_id=ricsim_g1_4 4 120
415 api_equal json:policy-types?ric_id=ricsim_g1_5 5 120
416 api_equal json:policy-types?ric_id=ricsim_g1_6 4 120
417 api_equal json:policy-types?ric_id=ricsim_g1_7 3 120
418 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
419 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
420 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
421 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200422
423 api_equal json:policy_types 5 120
424
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100425 echo "Check the number of types in the agent for each ric"
426 api_equal json:policy_types?ric=ricsim_g1_1 1 120
427 api_equal json:policy_types?ric=ricsim_g1_2 2 120
428 api_equal json:policy_types?ric=ricsim_g1_3 3 120
429 api_equal json:policy_types?ric=ricsim_g1_4 4 120
430 api_equal json:policy_types?ric=ricsim_g1_5 5 120
431 api_equal json:policy_types?ric=ricsim_g1_6 4 120
432 api_equal json:policy_types?ric=ricsim_g1_7 3 120
433 api_equal json:policy_types?ric=ricsim_g1_8 2 120
434 api_equal json:policy_types?ric=ricsim_g1_9 1 120
435 api_equal json:policy_types?ric=ricsim_g1_10 0 120
436 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200437
438 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
439 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
440 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
441 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
442 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
443 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
444 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
445 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
446 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
447 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
448
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200449 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200450
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100451 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100452 api_equal json:policy-instances 0
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100453 else
454 api_equal json:policy_ids 0
455 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200456
457 sim_equal ricsim_g1_9 num_instances 0
458
459
460 sim_delete_policy_type 204 ricsim_g1_4 4
461 sim_delete_policy_type 204 ricsim_g1_5 4
462 sim_delete_policy_type 204 ricsim_g1_6 4
463 sim_delete_policy_type 204 ricsim_g1_7 4
464
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200465 sleep_wait 120
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200466
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100467 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200468
469 api_equal json:policy-types 5 120
470
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100471 api_equal json:policy-types?ric_id=ricsim_g1_1 1 120
472 api_equal json:policy-types?ric_id=ricsim_g1_2 2 120
473 api_equal json:policy-types?ric_id=ricsim_g1_3 3 120
474 api_equal json:policy-types?ric_id=ricsim_g1_4 3 120
475 api_equal json:policy-types?ric_id=ricsim_g1_5 4 120
476 api_equal json:policy-types?ric_id=ricsim_g1_6 3 120
477 api_equal json:policy-types?ric_id=ricsim_g1_7 2 120
478 api_equal json:policy-types?ric_id=ricsim_g1_8 2 120
479 api_equal json:policy-types?ric_id=ricsim_g1_9 1 120
480 api_equal json:policy-types?ric_id=ricsim_g1_10 0 120
481 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200482
483 api_equal json:policy_types 5 120
484
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100485 api_equal json:policy_types?ric=ricsim_g1_1 1 120
486 api_equal json:policy_types?ric=ricsim_g1_2 2 120
487 api_equal json:policy_types?ric=ricsim_g1_3 3 120
488 api_equal json:policy_types?ric=ricsim_g1_4 3 120
489 api_equal json:policy_types?ric=ricsim_g1_5 4 120
490 api_equal json:policy_types?ric=ricsim_g1_6 3 120
491 api_equal json:policy_types?ric=ricsim_g1_7 2 120
492 api_equal json:policy_types?ric=ricsim_g1_8 2 120
493 api_equal json:policy_types?ric=ricsim_g1_9 1 120
494 api_equal json:policy_types?ric=ricsim_g1_10 0 120
495 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200496
497 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
498 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
499 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
500 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
501 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
502 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
503 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
504 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
505 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
506 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
507
508 sim_delete_policy_type 204 ricsim_g1_8 4
509
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100510 if [ "$PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200511 api_equal json:policy-types 5 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100512 api_equal json:policy-types?ric_id=ricsim_g1_8 1 120
513 else
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200514 api_equal json:policy_types 5 120
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100515 api_equal json:policy_types?ric=ricsim_g1_8 1 120
516 fi
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200517
518 api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
519 ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
520 ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
521 ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
522 ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
523 ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
524 ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
525 ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:5:???? \
526 ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
527 ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
528
529
530
531 check_policy_agent_logs
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100532 if [[ $interface = *"SDNC"* ]]; then
533 check_sdnc_logs
534 fi
535
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200536 store_logs ${interface}
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200537
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200538done
539
540
BjornMagnussonXAbbd2e9d2020-05-27 21:24:06 +0200541#### TEST COMPLETE ####
542
543
544print_result
545
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100546auto_clean_environment