blob: 35fc80bea6c259f7c1f065fc8f61ecadfcf1ba5d [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
BjornMagnussonXA70e878f2020-05-11 14:11:30 +020020TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST and Dmaap"
BjornMagnussonXA80a92002020-03-19 14:31:06 +010021
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010022#App names to include in the test when running docker, space separated list
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010023DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR A1PMS RICSIM NGW 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
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010026KUBE_INCLUDED_IMAGES=" MR CR A1PMS RICSIM CP KUBEPROXY NGW"
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
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +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
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010033CONDITIONALLY_IGNORED_IMAGES="CBS CONSUL NGW"
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010034
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
BjornMagnussonXA80a92002020-03-19 14:31:06 +010040. ../common/testcase_common.sh $@
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010041
42setup_testenvironment
BjornMagnussonXA80a92002020-03-19 14:31:06 +010043
44#### TEST BEGIN ####
45
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010046generate_policy_uuid
BjornMagnussonXAad047782020-06-08 15:54:11 +020047
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020048use_simulator_http
49use_mr_http
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010050use_a1pms_rest_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020051
BjornMagnussonXA80a92002020-03-19 14:31:06 +010052
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010053clean_environment
BjornMagnussonXA80a92002020-03-19 14:31:06 +010054
BjornMagnussonXA663566c2021-11-08 10:25:07 +010055start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010056
BjornMagnussonXA80a92002020-03-19 14:31:06 +010057start_ric_simulators ricsim_g1 3 OSC_2.1.0
58
59start_ric_simulators ricsim_g2 5 STD_1.1.3
60
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010061if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +010062 start_ric_simulators ricsim_g3 1 STD_2.0.0
63fi
64
BjornMagnussonXA80a92002020-03-19 14:31:06 +010065start_mr
66
BjornMagnussonXA79e37002021-11-22 13:36:04 +010067start_cr 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +010068
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010069if [ $RUNMODE == "DOCKER" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010070 if [[ "$A1PMS_FEATURE_LEVEL" != *"NOCONSUL"* ]]; then
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010071 start_consul_cbs
72 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010073fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +010074
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010075start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
BjornMagnussonXA80a92002020-03-19 14:31:06 +010076
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010077if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
78 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
79fi
80
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010081start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
BjornMagnussonXA80a92002020-03-19 14:31:06 +010082
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010083set_a1pms_debug
BjornMagnussonXA72667f12020-04-24 09:20:18 +020084
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010085use_a1pms_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +010086
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010087prepare_consul_config NOSDNC ".consul_config.json"
88
89if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010090 a1pms_load_config ".consul_config.json"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010091else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010092 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
93 a1pms_api_put_configuration 200 ".consul_config.json"
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010094 else
95 consul_config_app ".consul_config.json"
96 fi
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010097fi
98
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010099a1pms_api_get_status 200
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100100
101sim_print ricsim_g1_1 interface
102
103sim_print ricsim_g2_1 interface
104
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100105if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100106 sim_print ricsim_g3_1 interface
107fi
108
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100109sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
110
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100111if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100112 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100113 a1pms_equal json:policy-types 3 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100114else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100115 a1pms_equal json:policy_types 2 300
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100116fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100117
118# Create policies
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100119
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100120if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100121 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100122else
123 notificationurl=""
124fi
125
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100126use_a1pms_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100127
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100128a1pms_api_put_service 201 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100129
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100130a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100131
132sim_equal ricsim_g1_1 num_instances 1
133
134
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100135use_a1pms_dmaap_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100136
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100137a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100138
139sim_equal ricsim_g1_1 num_instances 2
140
141
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100142use_a1pms_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100143
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100144a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100145
146sim_equal ricsim_g2_1 num_instances 1
147
148
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100149use_a1pms_dmaap_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100150
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100151a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100152
153sim_equal ricsim_g2_1 num_instances 2
154
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100155if [ "$A1PMS_VERSION" == "V2" ]; then
156 use_a1pms_rest_http
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100157
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100158 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100159
160 sim_equal ricsim_g3_1 num_instances 1
161
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100162 use_a1pms_dmaap_http
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100163
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100164 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100165
166 sim_equal ricsim_g3_1 num_instances 2
167
168fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100169
170#Update policies
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100171use_a1pms_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100172
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100173a1pms_api_put_service 200 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100174
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100175a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100176
177sim_equal ricsim_g1_1 num_instances 2
178
179
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100180use_a1pms_dmaap_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100181
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100182a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100183
184sim_equal ricsim_g1_1 num_instances 2
185
186
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100187use_a1pms_rest_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100188
189
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100190a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100191
192sim_equal ricsim_g2_1 num_instances 2
193
194
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100195use_a1pms_dmaap_http
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100196
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100197a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100198
199sim_equal ricsim_g2_1 num_instances 2
200
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100201if [ "$A1PMS_VERSION" == "V2" ]; then
202 use_a1pms_rest_http
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100203
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100204 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100205
206 sim_equal ricsim_g3_1 num_instances 2
207
208
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100209 use_a1pms_dmaap_http
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100210
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100211 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100212
213 sim_equal ricsim_g3_1 num_instances 2
214fi
215
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100216# Check policies
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100217if [ "$A1PMS_VERSION" == "V2" ]; then
218 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
219 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
220 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
221 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
222 a1pms_api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
223 a1pms_api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100224else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100225 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json
226 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json
227 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json
228 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100229fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100230
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100231sim_equal ricsim_g1_1 num_instances 2
232sim_equal ricsim_g2_1 num_instances 2
233
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100234if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100235 sim_equal ricsim_g3_1 num_instances 2
236fi
237
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100238# Remove policies
239
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100240use_a1pms_dmaap_http
241a1pms_api_delete_policy 204 2000
242use_a1pms_rest_http
243a1pms_api_delete_policy 204 3000
244use_a1pms_dmaap_http
245a1pms_api_delete_policy 204 2100
246use_a1pms_rest_http
247a1pms_api_delete_policy 204 3100
248if [ "$A1PMS_VERSION" == "V2" ]; then
249 use_a1pms_dmaap_http
250 a1pms_api_delete_policy 204 2200
251 use_a1pms_rest_http
252 a1pms_api_delete_policy 204 3200
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100253fi
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100254
255sim_equal ricsim_g1_1 num_instances 0
256sim_equal ricsim_g2_1 num_instances 0
257
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100258if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100259 sim_equal ricsim_g3_1 num_instances 0
260fi
261
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200262# Check remote host access to simulator
263
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100264sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
265sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
266if [ "$A1PMS_VERSION" == "V2" ]; then
267 sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
BjornMagnussonXA4207b832020-11-03 09:52:49 +0100268fi
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200269
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100270# Check policy removal
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100271use_a1pms_rest_http
272a1pms_api_get_policy 404 2000
273a1pms_api_get_policy 404 3000
274a1pms_api_get_policy 404 2100
275a1pms_api_get_policy 404 3100
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100276
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100277if [ "$A1PMS_VERSION" == "V2" ]; then
278 a1pms_api_get_policy 404 2200
279 a1pms_api_get_policy 404 3200
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100280fi
281
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100282# Remove the service
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100283use_a1pms_dmaap_http
284a1pms_api_delete_services 204 "service1"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100285
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100286a1pms_api_get_services 404 "service1"
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100287
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100288check_a1pms_logs
BjornMagnussonXA80a92002020-03-19 14:31:06 +0100289
290#### TEST COMPLETE ####
291
292store_logs END
293
BjornMagnussonXA70e878f2020-05-11 14:11:30 +0200294print_result
295
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100296auto_clean_environment