blob: a180b63b2de9b8d290daf5a7ca97d378294c6ddd [file] [log] [blame]
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02001#!/usr/bin/env bash
2
3# ============LICENSE_START===============================================
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +02004# Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
rohithrajneesh927c17e2023-12-01 14:26:03 +00005# Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +02006# ========================================================================
7# Licensed under the Apache License, Version 2.0 (the "License");
8# you may not use this file except in compliance with the License.
9# You may obtain a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS,
15# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16# See the License for the specific language governing permissions and
17# limitations under the License.
18# ============LICENSE_END=================================================
19#
20
21TC_ONELINE_DESCR="Preparation demo setup - populating a number of ric simulators with types and instances"
22
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010023#App names to include in the test when running docker, space separated list
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010024DOCKER_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC NGW KUBEPROXY"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020025
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010026#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010027KUBE_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM SDNC KUBEPROXY NGW"
BjornMagnussonXAd54225b2023-04-19 14:03:49 +020028#Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010029KUBE_PRESTARTED_IMAGES=""
30
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010031#Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
32#the image is not configured in the supplied env_file
33#Used for images not applicable to all supported profile
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010034CONDITIONALLY_IGNORED_IMAGES="NGW"
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010035
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010036#Supported test environment profiles
rohithrajneesh927c17e2023-12-01 14:26:03 +000037SUPPORTED_PROFILES="ONAP-KOHN ONAP-LONDON ONAP-MONTREAL ORAN-G-RELEASE ORAN-H-RELEASE ORAN-I-RELEASE"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010040
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020041. ../common/testcase_common.sh $@
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010042
43setup_testenvironment
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020044
45#### TEST BEGIN ####
46
47#Local vars in test script
48##########################
BjornMagnussonXA4207b832020-11-03 09:52:49 +010049
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010050use_cr_https
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010051use_a1pms_rest_https
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020052if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
53 deviation "SDNC does not support NB https"
54 use_sdnc_http
55else
56 use_sdnc_https
57fi
BjornMagnussonXA7b36db62020-11-23 10:57:57 +010058use_simulator_https
59
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010060notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXA4207b832020-11-03 09:52:49 +010061
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010062clean_environment
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020063
BjornMagnussonXA663566c2021-11-08 10:25:07 +010064start_kube_proxy
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010065
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020066OSC_NUM_RICS=6
67STD_NUM_RICS=5
68
69start_ric_simulators $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
70
71start_ric_simulators $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
72
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010073start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010074
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020075if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
76 :
77else
78 start_mr #Just to prevent errors in the a1pms log...
79fi
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020080
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +010081start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
82
83if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
84 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
85fi
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020086
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020087start_sdnc
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020088controller_api_wait_for_status_ok 200 ricsim_g1_1
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020089
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010090start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +020091
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010092set_a1pms_trace
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +010093
BjornMagnussonXAf81090f2022-08-24 09:17:44 +020094
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010095
96prepare_a1pms_config SDNC ".a1pms_config.json"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +010097
98if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010099 a1pms_load_config ".a1pms_config.json"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100100else
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100101 a1pms_api_put_configuration 200 ".a1pms_config.json"
BjornMagnussonXAe0b665e2021-01-08 22:19:18 +0100102fi
103
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200104sleep_wait 120 "Let A1PMS configuration take effect"
BjornMagnussonXAf4a7e422022-09-01 16:35:17 +0200105
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100106a1pms_api_get_status 200
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200107
108# Print the A1 version for OSC
109for ((i=1; i<=$OSC_NUM_RICS; i++))
110do
111 sim_print $RIC_SIM_PREFIX"_g1_"$i interface
112done
113
114
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100115# Print the A1 version for STD 1.X
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200116for ((i=1; i<=$STD_NUM_RICS; i++))
117do
118 sim_print $RIC_SIM_PREFIX"_g2_"$i interface
119done
120
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100121# Print the A1 version for STD 2.X
122for ((i=1; i<=$STD_NUM_RICS; i++))
123do
124 sim_print $RIC_SIM_PREFIX"_g3_"$i interface
125done
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100126
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200127
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200128# Load the policytypes in osc
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200129for ((i=1; i<=$OSC_NUM_RICS; i++))
130do
131 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 demo-testdata/OSC/sim_qos.json
132 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 demo-testdata/OSC/sim_tsa.json
133done
134
135
136#Check the number of schemas and the individual schemas in OSC
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100137a1pms_equal json:policy-types 3 300
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100138
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100139for ((i=1; i<=$OSC_NUM_RICS; i++))
140do
141 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g1_"$i 2 120
142done
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200143
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100144# Check the schemas in OSC
145for ((i=1; i<=$OSC_NUM_RICS; i++))
146do
147 a1pms_api_get_policy_type 200 100 demo-testdata/OSC/qos-a1pms-modified.json
148 a1pms_api_get_policy_type 200 20008 demo-testdata/OSC/tsa-a1pms-modified.json
149done
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200150
151
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200152# Load the policytypes in std
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100153for ((i=1; i<=$STD_NUM_RICS; i++))
154do
155 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
156 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
157done
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100158
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100159#Check the number of schemas and the individual schemas in STD
160a1pms_equal json:policy-types 5 120
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100161
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100162for ((i=1; i<=$STD_NUM_RICS; i++))
163do
164 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
165done
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100166
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100167# Check the schemas in STD
168for ((i=1; i<=$STD_NUM_RICS; i++))
169do
170 a1pms_api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-a1pms-modified.json
171 a1pms_api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-a1pms-modified.json
172done
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100173
BjornMagnussonXA2791e082020-11-12 00:52:08 +0100174#Check the number of types
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100175a1pms_equal json:policy-types 5 120
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100176
177
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200178# Create policies
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100179use_a1pms_rest_http
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200180
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100181a1pms_api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200182
183# Create policies in OSC
184for ((i=1; i<=$OSC_NUM_RICS; i++))
185do
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200186 sim_generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100187 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/piqos_template.json 1
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200188 sim_generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100189 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/pitsa_template.json 1
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200190done
191
192
193# Check the number of policies in OSC
194for ((i=1; i<=$OSC_NUM_RICS; i++))
195do
196 sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 2
197done
198
199
200# Create policies in STD
201for ((i=1; i<=$STD_NUM_RICS; i++))
202do
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200203 sim_generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100204 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT $notificationurl demo-testdata/STD/pi1_template.json 1
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200205 sim_generate_policy_uuid
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100206 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 $((2300+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200207 sim_generate_policy_uuid
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100208 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i 'STD_QOS2_0.1.0' $((2400+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200209done
210
211
212# Check the number of policies in STD
213for ((i=1; i<=$STD_NUM_RICS; i++))
214do
215 sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100216 sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200217done
218
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100219check_a1pms_logs
BjornMagnussonXA49f0e5a2020-11-08 22:41:39 +0100220check_sdnc_logs
BjornMagnussonXAbf3700b2020-10-05 08:39:40 +0200221
222#### TEST COMPLETE ####
223
224store_logs END
225
226print_result
BjornMagnussonXAbe9a07f2021-02-25 10:51:46 +0100227
228auto_clean_environment