2 # ============LICENSE_START===============================================
3 # Copyright (C) 2023 Nordix Foundation. 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=================================================
20 TC_ONELINE_DESCR="Sanity test, create service and then create, update and delete a policy using http and A1PMS REST"
22 # App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY"
25 # App names to include in the test when running kubernetes, space separated list
26 KUBE_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM NGW KUBEPROXY "
27 # Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
28 KUBE_PRESTARTED_IMAGES=""
29 # Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if the image is not configured in the supplied env_file
30 # Used for images not applicable to all supported profile
31 CONDITIONALLY_IGNORED_IMAGES="NGW "
33 # Supported test environment profiles
34 SUPPORTED_PROFILES="ORAN-H-RELEASE"
36 SUPPORTED_RUNMODES="DOCKER KUBE"
38 . ../common/testcase_common.sh $@
42 sim_generate_policy_uuid
44 # Tested variants of REST config
45 TESTED_VARIANTS="REST"
47 # Test a1pms and mediator protocol versions
48 TESTED_PROTOCOLS="HTTP"
50 for __httpx in $TESTED_PROTOCOLS ; do
51 for interface in $TESTED_VARIANTS ; do
52 echo "#####################################################################"
53 echo "#####################################################################"
54 echo "### Testing a1pms: $interface using $__httpx"
55 echo "#####################################################################"
56 echo "#####################################################################"
63 use_ricmediator_simulator_http
65 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
68 a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration"
71 use_ricmediator_simulator_http
74 start_ricmediator_simulators ricsim_g4 1 NONE
76 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
78 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
79 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
82 prepare_a1pms_config NOSDNC ".a1pms_config.json"
84 if [ $RUNMODE == "KUBE" ]; then
85 a1pms_load_config ".a1pms_config.json"
87 a1pms_api_put_configuration 200 ".a1pms_config.json"
90 ricmediatorsim_put_policy_type 201 ricsim_g4_1 1 testdata/OSC/sim_1.json
92 a1pms_equal json:rics 1 300
93 a1pms_equal json:policy-types 1 120
94 a1pms_equal json:policies 0
95 a1pms_equal json:policy-instances 0
96 cr_equal 0 received_callbacks 1 120
97 cr_api_check_all_sync_events 200 0 ric-registration ricsim_g4_1
99 echo "############################################"
100 echo "############## Health check ################"
101 echo "############################################"
102 sleep_wait 120 "Let A1PMS configuration take effect"
103 a1pms_api_get_status 200
105 echo "############################################"
106 echo "##### Service registry and supervision #####"
107 echo "############################################"
108 a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1"
109 a1pms_api_get_service_ids 200 "serv1" "ric-registration"
110 a1pms_api_put_services_keepalive 200 "serv1"
112 echo "############################################"
113 echo "############## RIC Repository ##############"
114 echo "############################################"
115 a1pms_api_get_rics 200 NOTYPE "ricsim_g4_1:me1_ricsim_g4_1,me2_ricsim_g4_1:1:AVAILABLE"
117 echo "############################################"
118 echo "########### A1 Policy Management ###########"
119 echo "############################################"
120 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
121 a1pms_api_put_policy 201 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
122 a1pms_api_put_policy 200 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json
124 a1pms_equal json:policies 1
125 a1pms_api_delete_policy 204 5300
126 a1pms_equal json:policies 0
127 a1pms_equal json:policy-instances 0
128 cr_equal 0 received_callbacks 1
134 #### TEST COMPLETE ####
136 auto_clean_environment