blob: cc8ce0db34e3d442150075bcaf974b8bfee51d6a [file] [log] [blame]
BjornMagnussonXAbb648282021-03-19 09:12:42 +01001#!/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.
BjornMagnussonXAbb648282021-03-19 09:12:42 +01006# ========================================================================
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
21
22TC_ONELINE_DESCR="ONAP Use case REQ-626"
23#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 DMAAPMR A1PMS RICSIM SDNC NGW KUBEPROXY"
BjornMagnussonXAbb648282021-03-19 09:12:42 +010025
26#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 DMAAPMR 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
BjornMagnussonXAbb648282021-03-19 09:12:42 +010029KUBE_PRESTARTED_IMAGES=""
30
31#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"
BjornMagnussonXAbb648282021-03-19 09:12:42 +010035
36#Supported test environment profiles
raviteja.karumurib71c7492024-06-25 15:06:15 +010037SUPPORTED_PROFILES="ONAP-KOHN ONAP-LONDON ONAP-MONTREAL ONAP-NEWDELHI"
BjornMagnussonXAbb648282021-03-19 09:12:42 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
40
41. ../common/testcase_common.sh $@
BjornMagnussonXAbb648282021-03-19 09:12:42 +010042
43setup_testenvironment
44
45#### TEST BEGIN ####
46
47#Local vars in test script
48##########################
49
50use_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
BjornMagnussonXAbb648282021-03-19 09:12:42 +010058use_simulator_https
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020059if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
60 :
61else
62 use_mr_https
63fi
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010064__httpx="HTTPS"
BjornMagnussonXAf83c3622023-02-28 10:05:51 +010065notificationurl=$CR_SERVICE_APP_PATH_0"/test"
BjornMagnussonXAbb648282021-03-19 09:12:42 +010066
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020067sim_generate_policy_uuid
BjornMagnussonXAbb648282021-03-19 09:12:42 +010068
69# Tested variants of REST/DMAAP/SDNC config
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020070
71
72if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
73 TESTED_VARIANTS="REST REST+SDNC"
74else
75 TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
76fi
77
BjornMagnussonXAbb648282021-03-19 09:12:42 +010078for interface in $TESTED_VARIANTS ; do
79
80 echo "#####################################################################"
81 echo "#####################################################################"
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010082 echo "### Testing a1pms: $interface using https"
BjornMagnussonXAbb648282021-03-19 09:12:42 +010083 echo "#####################################################################"
84 echo "#####################################################################"
85
86 clean_environment
87
BjornMagnussonXA663566c2021-11-08 10:25:07 +010088 start_kube_proxy
BjornMagnussonXAbb648282021-03-19 09:12:42 +010089
90 if [[ $interface = *"DMAAP"* ]]; then
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010091 use_a1pms_dmaap_https
BjornMagnussonXAbb648282021-03-19 09:12:42 +010092 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010093 use_a1pms_rest_https
BjornMagnussonXAbb648282021-03-19 09:12:42 +010094 fi
95
96 OSC_NUM_RICS=1
97 STD_NUM_RICS=1
98
99 start_ric_simulators $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
100
101 start_ric_simulators $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
102
103 start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
104
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200105 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
106 :
107 else
108 start_mr "$MR_READ_TOPIC" "/events" "users/policy-agent" \
109 "$MR_WRITE_TOPIC" "/events" "users/mr-stub"
110 fi
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100111
112 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
113
114 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
115 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
116 fi
117
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100118
BjornMagnussonXAf81090f2022-08-24 09:17:44 +0200119
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100120 if [[ $interface = *"SDNC"* ]]; then
121 start_sdnc
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200122 controller_api_wait_for_status_ok 200 ricsim_g1_1
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100123 prepare_a1pms_config SDNC ".a1pms_config.json"
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100124 else
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100125 prepare_a1pms_config NOSDNC ".a1pms_config.json"
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100126 fi
127
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100128 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100129
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100130 set_a1pms_trace
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100131
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100132 if [ $RUNMODE == "KUBE" ]; then
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100133 a1pms_load_config ".a1pms_config.json"
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100134 else
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200135 #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100136 if [ $__httpx == "HTTPS" ]; then
137 use_a1pms_rest_https
138 else
139 use_a1pms_rest_http
140 fi
141 a1pms_api_put_configuration 200 ".a1pms_config.json"
142 if [ $__httpx == "HTTPS" ]; then
143 if [[ $interface = *"DMAAP"* ]]; then
144 use_a1pms_dmaap_https
145 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100146 use_a1pms_rest_https
BjornMagnussonXAf83c3622023-02-28 10:05:51 +0100147 fi
148 else
149 if [[ $interface = *"DMAAP"* ]]; then
150 use_a1pms_dmaap_http
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100151 else
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100152 use_a1pms_rest_http
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100153 fi
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100154 fi
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100155 fi
156
157 # Check that all rics are synced in
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100158 a1pms_equal json:rics 3 300
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100159
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100160 a1pms_api_get_status 200
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100161
162 # Print the A1 version for OSC
163 for ((i=1; i<=$OSC_NUM_RICS; i++))
164 do
165 sim_print $RIC_SIM_PREFIX"_g1_"$i interface
166 done
167
168
169 # Print the A1 version for STD 1.X
170 for ((i=1; i<=$STD_NUM_RICS; i++))
171 do
172 sim_print $RIC_SIM_PREFIX"_g2_"$i interface
173 done
174
175 # Print the A1 version for STD 2.X
176 for ((i=1; i<=$STD_NUM_RICS; i++))
177 do
178 sim_print $RIC_SIM_PREFIX"_g3_"$i interface
179 done
180
181 #################################################################
182 ## REQ: Synchronize A1 Policy Information in RAN
183 #################################################################
184
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200185 # Load the policytypes in osc
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100186 for ((i=1; i<=$OSC_NUM_RICS; i++))
187 do
188 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 demo-testdata/OSC/sim_qos.json
189 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 demo-testdata/OSC/sim_tsa.json
190 done
191
192 #Check the number of schemas and the individual schemas in OSC
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100193 a1pms_equal json:policy-types 3 300
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100194
195 for ((i=1; i<=$OSC_NUM_RICS; i++))
196 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100197 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g1_"$i 2 120
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100198 done
199
200 # Check the schemas in OSC
201 for ((i=1; i<=$OSC_NUM_RICS; i++))
202 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100203 a1pms_api_get_policy_type 200 100 demo-testdata/OSC/qos-a1pms-modified.json
204 a1pms_api_get_policy_type 200 20008 demo-testdata/OSC/tsa-a1pms-modified.json
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100205 done
206
207
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200208 # Load the policytypes in std
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100209 for ((i=1; i<=$STD_NUM_RICS; i++))
210 do
211 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
212 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
213 done
214
215 #Check the number of schemas and the individual schemas in STD
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100216 a1pms_equal json:policy-types 5 120
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100217
218 for ((i=1; i<=$STD_NUM_RICS; i++))
219 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100220 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100221 done
222
223 # Check the schemas in STD
224 for ((i=1; i<=$STD_NUM_RICS; i++))
225 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100226 a1pms_api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-a1pms-modified.json
227 a1pms_api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-a1pms-modified.json
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100228 done
229
230 #Check the number of types
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100231 a1pms_equal json:policy-types 5 120
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100232
233 #################################################################
234 ## REQ: A1 Policy Type / Instance Operations
235 #################################################################
236
237 # Create policies
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100238 use_a1pms_rest_http
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100239
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100240 a1pms_api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/1"
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100241
242 # Create policies in OSC
243 for ((i=1; i<=$OSC_NUM_RICS; i++))
244 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100245 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
246 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
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100247 done
248
249
250 # Check the number of policies in OSC
251 for ((i=1; i<=$OSC_NUM_RICS; i++))
252 do
253 sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 2
254 done
255
256
257 # Create policies in STD
258 for ((i=1; i<=$STD_NUM_RICS; i++))
259 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100260 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
261 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
262 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
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100263 done
264
265
266 # Check the number of policies in STD
267 for ((i=1; i<=$STD_NUM_RICS; i++))
268 do
269 sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
270 sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
271 done
272
273 #################################################################
274 ## REQ: A1 Policy Instance Status Operations
275 #################################################################
276
277 # Check status STD
278 for ((i=1; i<=$STD_NUM_RICS; i++))
279 do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100280 a1pms_api_get_policy_status 200 $((2100+$i)) STD "UNDEFINED"
281 a1pms_api_get_policy_status 200 $((2300+$i)) STD2 EMPTY EMPTY
282 a1pms_api_get_policy_status 200 $((2400+$i)) STD2 EMPTY EMPTY
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100283 done
284
285 # Check status OSC
raviteja.karumuri2c6c06e2024-05-27 10:58:44 +0100286 if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then
287 VAL='NOT IN EFFECT'
288 VAL2="false"
289 else
290 VAL='NOT_ENFORCED'
291 VAL2="OTHER_REASON"
292 fi
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100293 for ((i=1; i<=$OSC_NUM_RICS; i++))
294 do
raviteja.karumuri2c6c06e2024-05-27 10:58:44 +0100295 a1pms_api_get_policy_status 200 $((3000+$i)) OSC "$VAL" "$VAL2"
296 a1pms_api_get_policy_status 200 $((4000+$i)) OSC "$VAL" "$VAL2"
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100297 done
298
299 # Note: Status callback is not tested since this callback (http POST) is made from the
300 # ricsim directly to the receiver of the status, i.e. the status does NOT
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100301 # pass through A1PMS
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100302
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100303 check_a1pms_logs
BjornMagnussonXAbb648282021-03-19 09:12:42 +0100304
305 if [[ $interface = *"SDNC"* ]]; then
306 check_sdnc_logs
307 fi
308
309 #### TEST COMPLETE ####
310
311 store_logs "https__${interface}"
312
313done
314
315print_result
316
317auto_clean_environment