2 # ============LICENSE_START===============================================
3 # Copyright (C) 2024 OpenInfra Foundation Europe. All rights reserved.
4 # ========================================================================
5 # Licensed under the Apache License, Version 2.0 (the "License");
6 # you may not use this file except in compliance with the License.
7 # You may obtain a copy of the License at
9 # http://www.apache.org/licenses/LICENSE-2.0
11 # Unless required by applicable law or agreed to in writing, software
12 # distributed under the License is distributed on an "AS IS" BASIS,
13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 # See the License for the specific language governing permissions and
15 # limitations under the License.
16 # ============LICENSE_END=================================================
18 TC_ONELINE_DESCR="Sanity test, create service and then create, update and delete a policy using http and A1PMS REST and REST+SDNC"
20 # App names to include in the test when running docker, space separated list
21 DOCKER_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY SDNC"
23 # App names to include in the test when running kubernetes, space separated list
24 KUBE_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY SDNC"
25 # Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
26 KUBE_PRESTARTED_IMAGES=""
27 # Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if the image is not configured in the supplied env_file
28 # Used for images not applicable to all supported profile
29 CONDITIONALLY_IGNORED_IMAGES="NGW "
31 # Supported test environment profiles
32 SUPPORTED_PROFILES="ORAN-I-RELEASE"
34 SUPPORTED_RUNMODES="DOCKER KUBE"
36 . ../common/testcase_common.sh $@
40 sim_generate_policy_uuid
42 # Tested variants of REST config
43 TESTED_VARIANTS="REST REST+SDNC"
45 # Test a1pms and mediator protocol versions
46 TESTED_PROTOCOLS="HTTP"
48 for __httpx in $TESTED_PROTOCOLS ; do
49 for interface in $TESTED_VARIANTS ; do
50 echo "#####################################################################"
51 echo "#####################################################################"
52 echo "### Testing a1pms: $interface using $__httpx"
53 echo "#####################################################################"
54 echo "#####################################################################"
61 use_ricmediator_simulator_http
63 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
66 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
69 use_ricmediator_simulator_http
70 if [[ $interface = *"SDNC"* ]]; then
75 start_ricmediator_simulators ricsim_g4 1 NONE
77 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
79 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
80 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
83 if [ -z "$A1PMS_SDNC_ADAPTER_CLASS" ] || [ -z "$A1PMS_NOSDNC_ADAPTER_CLASS" ]; then
84 echo -e $RED"Env vars A1PMS_SDNC_ADAPTER_CLASS and A1PMS_NOSDNC_ADAPTER_CLASS must be set with override file"$ERED
88 if [[ $interface = *"SDNC"* ]]; then
90 prepare_a1pms_config SDNC ".a1pms_config.json" ricsim-g4 $A1PMS_SDNC_ADAPTER_CLASS
92 prepare_a1pms_config NOSDNC ".a1pms_config.json" ricsim-g4 $A1PMS_NOSDNC_ADAPTER_CLASS
95 if [ $RUNMODE == "KUBE" ]; then
96 a1pms_load_config ".a1pms_config.json"
98 a1pms_api_put_configuration 200 ".a1pms_config.json"
101 ricmediatorsim_put_policy_type 201 ricsim_g4_1 $A1PMS_ADAPTER_POLICY_TYPE testdata/OSC/sim_1.json
103 a1pms_equal json:rics 1 300
104 a1pms_equal json:policy-types 1 120
105 a1pms_equal json:policies 0
106 a1pms_equal json:policy-instances 0
107 cr_equal 0 received_callbacks 1 120
108 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g4_1
110 echo "############################################"
111 echo "############## Health check ################"
112 echo "############################################"
113 sleep_wait 120 "Let A1PMS configuration take effect"
114 a1pms_api_get_status 200
116 echo "############################################"
117 echo "##### Service registry and supervision #####"
118 echo "############################################"
119 a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1"
120 a1pms_api_get_service_ids 200 "serv1" "ric-registration"
121 a1pms_api_put_services_keepalive 200 "serv1"
123 echo "############################################"
124 echo "############## RIC Repository ##############"
125 echo "############################################"
126 a1pms_api_get_rics 200 NOTYPE "ricsim_g4_1:me1_ricsim_g4_1,me2_ricsim_g4_1:$A1PMS_ADAPTER_POLICY_TYPE:AVAILABLE"
128 echo "############################################"
129 echo "########### A1 Policy Management ###########"
130 echo "############################################"
131 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
132 a1pms_api_put_policy 201 "serv1" ricsim_g4_1 $A1PMS_ADAPTER_POLICY_TYPE 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
133 a1pms_api_put_policy 200 "serv1" ricsim_g4_1 $A1PMS_ADAPTER_POLICY_TYPE 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
135 a1pms_equal json:policies 1
136 a1pms_api_delete_policy 204 5300
137 a1pms_equal json:policies 0
138 a1pms_equal json:policy-instances 0
139 cr_equal 0 received_callbacks 1
145 #### TEST COMPLETE ####
147 auto_clean_environment