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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
21 TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy using http/https and A1PMS REST/DMAAP with/without SDNC controller"
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CBS CONSUL CP CR MR DMAAPMR A1PMS RICSIM SDNC NGW KUBEPROXY"
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES="CP CR MR DMAAPMR A1PMS RICSIM SDNC NGW KUBEPROXY "
28 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
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
34 CONDITIONALLY_IGNORED_IMAGES="NGW CBS CONSUL"
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ONAP-GUILIN ONAP-HONOLULU ONAP-ISTANBUL ONAP-JAKARTA ORAN-CHERRY ORAN-D-RELEASE ORAN-E-RELEASE ORAN-F-RELEASE"
39 SUPPORTED_RUNMODES="DOCKER KUBE"
41 . ../common/testcase_common.sh $@
49 # Tested variants of REST/DMAAP/SDNC config
50 TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
51 #Test a1pms and simulator protocol versions (others are http only)
52 TESTED_PROTOCOLS="HTTP HTTPS"
53 for __httpx in $TESTED_PROTOCOLS ; do
54 for interface in $TESTED_VARIANTS ; do
56 echo "#####################################################################"
57 echo "#####################################################################"
58 echo "### Testing a1pms: $interface using $__httpx"
59 echo "#####################################################################"
60 echo "#####################################################################"
66 if [ $__httpx == "HTTPS" ]; then
72 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
76 # Create service to be able to receive events when rics becomes available
77 # Must use rest towards the a1pms since dmaap is not configured yet
78 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
80 if [ $__httpx == "HTTPS" ]; then
84 if [[ $interface = *"SDNC"* ]]; then
87 if [[ $interface = *"DMAAP"* ]]; then
96 if [[ $interface = *"SDNC"* ]]; then
99 if [[ $interface = *"DMAAP"* ]]; then
106 start_ric_simulators ricsim_g1 1 OSC_2.1.0
107 start_ric_simulators ricsim_g2 1 STD_1.1.3
108 if [ "$A1PMS_VERSION" == "V2" ]; then
109 start_ric_simulators ricsim_g3 1 STD_2.0.0
112 start_mr "$MR_READ_TOPIC" "/events" "users/policy-agent" \
113 "$MR_WRITE_TOPIC" "/events" "users/mr-stub"
117 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
119 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
120 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
123 if [[ $interface = *"SDNC"* ]]; then
125 prepare_consul_config SDNC ".consul_config.json"
127 prepare_consul_config NOSDNC ".consul_config.json"
130 if [ $RUNMODE == "KUBE" ]; then
131 a1pms_load_config ".consul_config.json"
133 if [[ "$A1PMS_FEATURE_LEVEL" == *"NOCONSUL"* ]]; then
134 #Temporary switch to http/https if dmaap use. Otherwise it is not possibble to push config
135 if [ $__httpx == "HTTPS" ]; then
140 a1pms_api_put_configuration 200 ".consul_config.json"
141 if [ $__httpx == "HTTPS" ]; then
142 if [[ $interface = *"DMAAP"* ]]; then
143 use_a1pms_dmaap_https
148 if [[ $interface = *"DMAAP"* ]]; then
156 consul_config_app ".consul_config.json"
160 mr_equal requests_submitted 0
162 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
164 if [ "$A1PMS_VERSION" == "V2" ]; then
166 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
168 a1pms_equal json:rics 3 300
170 a1pms_equal json:policy-types 3 120
172 a1pms_equal json:policies 0
174 a1pms_equal json:policy-instances 0
176 cr_equal 0 received_callbacks 3 120
178 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1
181 a1pms_equal json:rics 2 300
183 a1pms_equal json:policy_schemas 2 120
185 a1pms_equal json:policy_types 2
187 a1pms_equal json:policies 0
189 a1pms_equal json:policy_ids 0
192 echo "############################################"
193 echo "############## Health check ################"
194 echo "############################################"
196 a1pms_api_get_status 200
198 echo "############################################"
199 echo "##### Service registry and supervision #####"
200 echo "############################################"
202 a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1"
204 a1pms_api_get_service_ids 200 "serv1" "ric-registration"
206 a1pms_api_put_services_keepalive 200 "serv1"
208 echo "############################################"
209 echo "############## RIC Repository ##############"
210 echo "############################################"
212 if [ "$A1PMS_VERSION" == "V2" ]; then
213 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0:AVAILABLE"
215 a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE"
218 echo "############################################"
219 echo "########### A1 Policy Management ###########"
220 echo "############################################"
222 if [ "$A1PMS_VERSION" == "V2" ]; then
223 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
227 a1pms_api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
228 a1pms_api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
229 if [ "$A1PMS_VERSION" == "V2" ]; then
230 a1pms_api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json
231 a1pms_api_put_policy 200 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json
234 a1pms_api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
235 a1pms_api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json
237 if [ "$A1PMS_VERSION" == "V2" ]; then
238 a1pms_equal json:policies 3
240 a1pms_equal json:policies 2
243 a1pms_api_delete_policy 204 5000
245 a1pms_api_delete_policy 204 5100
247 if [ "$A1PMS_VERSION" == "V2" ]; then
248 a1pms_api_delete_policy 204 5200
251 if [ "$A1PMS_VERSION" == "V2" ]; then
252 a1pms_equal json:policies 0
254 a1pms_equal json:policy-instances 0
256 a1pms_equal json:policies 0
258 a1pms_equal json:policy_ids 0
261 if [ "$A1PMS_VERSION" == "V2" ]; then
262 cr_equal 0 received_callbacks 3
265 if [[ $interface = *"DMAAP"* ]]; then
267 if [ "$A1PMS_VERSION" == "V2" ]; then
268 VAL=14 # Number of a1pms API calls over DMAAP
270 VAL=11 # Number of a1pms API calls over DMAAP
272 mr_equal requests_fetched $VAL
273 mr_equal responses_submitted $VAL
274 mr_equal responses_fetched $VAL
275 mr_equal current_requests 0
276 mr_equal current_responses 0
278 mr_equal requests_submitted 0
281 if [[ $interface = *"SDNC"* ]]; then
282 sim_contains_str ricsim_g1_1 remote_hosts $SDNC_APP_NAME
283 sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME
284 if [ "$A1PMS_VERSION" == "V2" ]; then
285 sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME
288 sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
289 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
290 if [ "$A1PMS_VERSION" == "V2" ]; then
291 sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
298 if [[ $interface = *"SDNC"* ]]; then
302 store_logs "${__httpx}__${interface}"
308 #### TEST COMPLETE ####
313 auto_clean_environment