2 # ============LICENSE_START===============================================
3 # Copyright (C) 2023 Nordix Foundation. All rights reserved.
4 # Copyright (C) 2023 OpenInfra Foundation Europe. 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 and A1PMS REST"
23 # App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY"
26 # App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY "
28 # Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
30 # Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if the image is not configured in the supplied env_file
31 # Used for images not applicable to all supported profile
32 CONDITIONALLY_IGNORED_IMAGES="NGW "
34 # Supported test environment profiles
35 SUPPORTED_PROFILES="ORAN-I-RELEASE"
37 SUPPORTED_RUNMODES="DOCKER KUBE"
39 . ../common/testcase_common.sh $@
43 sim_generate_policy_uuid
45 # Tested variants of REST config
46 TESTED_VARIANTS="REST"
48 # Test a1pms and mediator protocol versions
49 TESTED_PROTOCOLS="HTTP"
51 for __httpx in $TESTED_PROTOCOLS ; do
52 for interface in $TESTED_VARIANTS ; do
53 echo "#####################################################################"
54 echo "#####################################################################"
55 echo "### Testing a1pms: $interface using $__httpx"
56 echo "#####################################################################"
57 echo "#####################################################################"
64 use_ricmediator_simulator_http
66 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
69 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
72 use_ricmediator_simulator_http
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 prepare_a1pms_config NOSDNC ".a1pms_config.json"
85 if [ $RUNMODE == "KUBE" ]; then
86 a1pms_load_config ".a1pms_config.json"
88 a1pms_api_put_configuration 200 ".a1pms_config.json"
91 ricmediatorsim_put_policy_type 201 ricsim_g4_1 1 testdata/STD2/sim_qos.json
93 a1pms_equal json:rics 1 300
94 a1pms_equal json:policy-types 1 120
95 a1pms_equal json:policies 0
96 a1pms_equal json:policy-instances 0
97 cr_equal 0 received_callbacks 1 120
98 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g4_1
100 echo "############################################"
101 echo "############## Health check ################"
102 echo "############################################"
103 sleep_wait 120 "Let A1PMS configuration take effect"
104 a1pms_api_get_status 200
106 echo "############################################"
107 echo "##### Service registry and supervision #####"
108 echo "############################################"
109 a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1"
110 a1pms_api_get_service_ids 200 "serv1" "ric-registration"
111 a1pms_api_put_services_keepalive 200 "serv1"
113 echo "############################################"
114 echo "############## RIC Repository ##############"
115 echo "############################################"
116 a1pms_api_get_rics 200 NOTYPE "ricsim_g4_1:me1_ricsim_g4_1,me2_ricsim_g4_1:1:AVAILABLE"
118 echo "############################################"
119 echo "########### A1 Policy Management ###########"
120 echo "############################################"
121 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
122 a1pms_api_put_policy 201 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
123 a1pms_api_put_policy 200 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
125 a1pms_equal json:policies 1
126 a1pms_api_delete_policy 204 5300
127 a1pms_equal json:policies 0
128 a1pms_equal json:policy-instances 0
129 cr_equal 0 received_callbacks 1
135 #### TEST COMPLETE ####
137 auto_clean_environment