blob: 3e27282994a8bb81c76487fe394694b66c99a9e5 [file] [log] [blame]
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +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
20
21TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy with A1PMS adapter using http/https and A1PMS REST with/without SDNC controller"
22
23#App names to include in the test when running docker, space separated list
24DOCKER_INCLUDED_IMAGES="CP CR A1PMS RICSIM SDNC NGW KUBEPROXY"
25
26#App names to include in the test when running kubernetes, space separated list
27KUBE_INCLUDED_IMAGES="CP CR A1PMS RICSIM SDNC NGW KUBEPROXY "
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
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020029KUBE_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
34CONDITIONALLY_IGNORED_IMAGES="NGW "
35
36#Supported test environment profiles
37SUPPORTED_PROFILES="ORAN-H-RELEASE ONAP-LONDON"
38#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
40
41. ../common/testcase_common.sh $@
42
43setup_testenvironment
44
45#### TEST BEGIN ####
46
47sim_generate_policy_uuid
48
49# Tested variants of REST/DMAAP/SDNC config
50TESTED_VARIANTS="REST REST+SDNC"
51
52#Test a1pms and simulator protocol versions (others are http only)
53TESTED_PROTOCOLS="HTTP HTTPS"
54for __httpx in $TESTED_PROTOCOLS ; do
55 for interface in $TESTED_VARIANTS ; do
56
57 echo "#####################################################################"
58 echo "#####################################################################"
59 echo "### Testing a1pms: $interface using $__httpx"
60 echo "#####################################################################"
61 echo "#####################################################################"
62
63 clean_environment
64
65 start_kube_proxy
66
67 if [ $__httpx == "HTTPS" ]; then
68 use_a1pms_rest_https
69 else
70 use_a1pms_rest_http
71 fi
72
73 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
74
75 set_a1pms_trace
76
77 # Create service to be able to receive events when rics becomes available
78 # Must use rest towards the a1pms since dmaap is not configured yet
79 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
80
81 if [ $__httpx == "HTTPS" ]; then
82 use_cr_https
83 use_simulator_https
84 if [[ $interface = *"SDNC"* ]]; then
85 if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
86 deviation "SDNC does not support NB https"
87 use_sdnc_http
88 else
89 use_sdnc_https
90 fi
91 fi
92 use_a1pms_rest_https
93 else
94 use_cr_http
95 use_simulator_http
96 if [[ $interface = *"SDNC"* ]]; then
97 use_sdnc_http
98 fi
99 use_a1pms_rest_http
100 fi
101
102 start_ric_simulators ricsim_g1 1 STD_2.0.0
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200103 start_ric_simulators ricsim_g2 1 STD_2.0.0 #A1PMS will use adapter class towards this sim
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200104
105 start_cr 1
106
107 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
108
109 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
110 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
111 fi
112
113 if [ -z "$A1PMS_ADAPTER_CLASS" ]; then
114 echo -e $RED"Env var A1PMS_ADAPTER_CLASS must be set with override file"$ERED
115 exit 1
116 fi
117 if [[ $interface = *"SDNC"* ]]; then
118 start_sdnc
119 controller_api_wait_for_status_ok 200 ricsim_g1_1
120 prepare_a1pms_config SDNC ".a1pms_config.json" ricsim-g2 $A1PMS_ADAPTER_CLASS
121 else
122 prepare_a1pms_config NOSDNC ".a1pms_config.json" ricsim-g2 $A1PMS_ADAPTER_CLASS
123 fi
124
125 if [ $RUNMODE == "KUBE" ]; then
126 a1pms_load_config ".a1pms_config.json"
127 else
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200128 #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200129 if [ $__httpx == "HTTPS" ]; then
130 use_a1pms_rest_https
131 else
132 use_a1pms_rest_http
133 fi
134 a1pms_api_put_configuration 200 ".a1pms_config.json"
135 if [ $__httpx == "HTTPS" ]; then
136 use_a1pms_rest_https
137 else
138 use_a1pms_rest_http
139 fi
140 fi
141
142 sim_put_policy_type 201 ricsim_g1_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
143 sim_put_policy_type 201 ricsim_g2_1 $A1PMS_ADAPTER_POLICY_NAME testdata/STD2/sim_qos.json
144
145 a1pms_equal json:rics 2 300
146
147 a1pms_equal json:policy-types 2 120
148
149 a1pms_equal json:policies 0
150
151 a1pms_equal json:policy-instances 0
152
153 cr_equal 0 received_callbacks 2 120
154
155 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1
156
157 echo "############################################"
158 echo "############## Health check ################"
159 echo "############################################"
160
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200161 sleep_wait 120 "Let A1PMS configuration take effect"
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200162
163 a1pms_api_get_status 200
164
165 echo "############################################"
166 echo "##### Service registry and supervision #####"
167 echo "############################################"
168
169 a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1"
170
171 a1pms_api_get_service_ids 200 "serv1" "ric-registration"
172
173 a1pms_api_put_services_keepalive 200 "serv1"
174
175 echo "############################################"
176 echo "############## RIC Repository ##############"
177 echo "############################################"
178
179 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:STD_QOS_0_2_0:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:$A1PMS_ADAPTER_POLICY_NAME:AVAILABLE"
180
181 echo "############################################"
182 echo "########### A1 Policy Management ###########"
183 echo "############################################"
184
185 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
186
187 a1pms_api_put_policy 201 "serv1" ricsim_g1_1 STD_QOS_0_2_0 5000 true $notificationurl testdata/STD2/pi_qos_template.json
188 a1pms_api_put_policy 200 "serv1" ricsim_g1_1 STD_QOS_0_2_0 5000 true $notificationurl testdata/STD2/pi_qos_template.json
189
190 a1pms_api_put_policy 201 "serv1" ricsim_g2_1 $A1PMS_ADAPTER_POLICY_NAME 5100 true $notificationurl testdata/STD2/pi_qos_template.json
191 a1pms_api_put_policy 200 "serv1" ricsim_g2_1 $A1PMS_ADAPTER_POLICY_NAME 5100 true $notificationurl testdata/STD2/pi_qos_template.json
192
193 a1pms_equal json:policies 2
194
195 a1pms_api_delete_policy 204 5000
196
197 a1pms_api_delete_policy 204 5100
198
199 a1pms_equal json:policies 0
200
201 a1pms_equal json:policy-instances 0
202
203 cr_equal 0 received_callbacks 2
204
205
206 if [[ $interface = *"SDNC"* ]]; then
207 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200208 # Adapter does not go through SDNC
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +0200209 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
210 else
211 sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
212 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
213 fi
214
215 check_a1pms_logs
216
217
218 if [[ $interface = *"SDNC"* ]]; then
219 check_sdnc_logs
220 fi
221
222 store_logs "${__httpx}__${interface}"
223
224 done
225
226done
227
228#### TEST COMPLETE ####
229
230
231print_result
232
233auto_clean_environment