3 # ============LICENSE_START===============================================
4 # Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
5 # Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
6 # ========================================================================
7 # Licensed under the Apache License, Version 2.0 (the "License");
8 # you may not use this file except in compliance with the License.
9 # You may obtain a copy of the License at
11 # http://www.apache.org/licenses/LICENSE-2.0
13 # Unless required by applicable law or agreed to in writing, software
14 # distributed under the License is distributed on an "AS IS" BASIS,
15 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 # See the License for the specific language governing permissions and
17 # limitations under the License.
18 # ============LICENSE_END=================================================
21 TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST"
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CP CR MR A1PMS RICSIM NGW KUBEPROXY"
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES=" MR CR A1PMS RICSIM CP KUBEPROXY NGW"
28 #Pre-started 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"
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ONAP-KOHN ONAP-LONDON ONAP-MONTREAL ORAN-G-RELEASE ORAN-H-RELEASE ORAN-I-RELEASE"
39 SUPPORTED_RUNMODES="DOCKER KUBE"
41 . ../common/testcase_common.sh $@
48 if [ -n "$A1PMS_V3_FLAG" ] && [ "${A1PMS_V3_FLAG,,}" == "true" ]; then
52 for version in $(seq 2 $VERSIONS_TO_RUN); do
54 echo "#####################################################################"
55 echo "#####################################################################"
56 echo "### Testing a1pms: V${version}"
57 echo "#####################################################################"
58 echo "#####################################################################"
60 if [ "$version" == "3" ]; then
61 if [ -n "$A1PMS_V3" ] && [ -n "$A1PMS_API_PREFIX_V3" ] && [ -n "$A1PMS_ALIVE_URL_V3" ]; then
62 export A1PMS_VERSION="$A1PMS_V3"
63 export A1PMS_API_PREFIX="$A1PMS_API_PREFIX_V3"
64 export A1PMS_ALIVE_URL="$A1PMS_API_PREFIX$A1PMS_ALIVE_URL_V3"
66 echo "One/All parameters not set in env file (<A1PMS_V3>, <A1PMS_API_PREFIX_V3>, <A1PMS_ALIVE_URL_V3>)"
70 sim_generate_policy_uuid
81 start_ric_simulators ricsim_g1 3 OSC_2.1.0
83 start_ric_simulators ricsim_g2 5 STD_1.1.3
85 start_ric_simulators ricsim_g3 1 STD_2.0.0
87 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
96 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
98 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
99 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
102 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
109 prepare_a1pms_config NOSDNC ".a1pms_config.json"
111 if [ $RUNMODE == "KUBE" ]; then
112 a1pms_load_config ".a1pms_config.json"
114 a1pms_api_put_configuration 200 ".a1pms_config.json"
117 sleep_wait 120 "Let A1PMS configuration take effect"
119 a1pms_api_get_status 200
121 sim_print ricsim_g1_1 interface
123 sim_print ricsim_g2_1 interface
125 sim_print ricsim_g3_1 interface
127 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
129 sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json
130 if [ "$A1PMS_VERSION" == "V3" ]; then
131 a1pms_equal json:policytypes 7 300
133 a1pms_equal json:policy-types 3 300
138 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
142 a1pms_api_put_service 201 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
144 if [ "$A1PMS_VERSION" == "V3" ]; then
145 a1pms_api_post_policy_v3 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
147 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
150 sim_equal ricsim_g1_1 num_instances 1
152 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
158 if [ "$A1PMS_VERSION" == "V3" ]; then
159 a1pms_api_post_policy_v3 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
161 a1pms_api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
164 sim_equal ricsim_g1_1 num_instances 2
169 if [ "$A1PMS_VERSION" == "V3" ]; then
170 a1pms_api_post_policy_v3 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
172 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
175 sim_equal ricsim_g2_1 num_instances 1
178 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
184 if [ "$A1PMS_VERSION" == "V3" ]; then
185 a1pms_api_post_policy_v3 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
187 a1pms_api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
190 sim_equal ricsim_g2_1 num_instances 2
194 if [ "$A1PMS_VERSION" == "V3" ]; then
195 a1pms_api_post_policy_v3 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
197 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
200 sim_equal ricsim_g3_1 num_instances 1
202 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
208 if [ "$A1PMS_VERSION" == "V3" ]; then
209 a1pms_api_post_policy_v3 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
211 a1pms_api_put_policy 201 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 NOTRANSIENT $notificationurl testdata/STD2/pi_qos_template.json 1
214 sim_equal ricsim_g3_1 num_instances 2
216 if [ "$A1PMS_VERSION" == "V3" ]; then
218 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
219 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
220 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
221 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
222 a1pms_api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
223 a1pms_api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
229 a1pms_api_put_service 200 "service1" 3600 "$CR_SERVICE_APP_PATH_0/1"
231 if [ "$A1PMS_VERSION" == "V3" ]; then
232 a1pms_api_put_policy_v3 200 2000 testdata/OSC/pi1_template.json 1
234 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
237 sim_equal ricsim_g1_1 num_instances 2
240 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
246 if [ "$A1PMS_VERSION" == "V3" ]; then
247 a1pms_api_put_policy_v3 200 3000 testdata/OSC/pi1_template.json 1
249 a1pms_api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json 1
252 sim_equal ricsim_g1_1 num_instances 2
257 if [ "$A1PMS_VERSION" == "V3" ]; then
258 a1pms_api_put_policy_v3 200 2100 testdata/STD/pi1_template.json 1
260 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
263 sim_equal ricsim_g2_1 num_instances 2
266 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
272 if [ "$A1PMS_VERSION" == "V3" ]; then
273 a1pms_api_put_policy_v3 200 3100 testdata/STD/pi1_template.json 1
275 a1pms_api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json 1
278 sim_equal ricsim_g2_1 num_instances 2
282 if [ "$A1PMS_VERSION" == "V3" ]; then
283 a1pms_api_put_policy_v3 200 2200 testdata/STD2/pi_qos_template.json 1
285 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 2200 true $notificationurl testdata/STD2/pi_qos_template.json 1
288 sim_equal ricsim_g3_1 num_instances 2
291 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
297 if [ "$A1PMS_VERSION" == "V3" ]; then
298 a1pms_api_put_policy_v3 200 3200 testdata/STD2/pi_qos_template.json 1
300 a1pms_api_put_policy 200 "service1" ricsim_g3_1 STD_QOS_0_2_0 3200 true $notificationurl testdata/STD2/pi_qos_template.json 1
303 sim_equal ricsim_g3_1 num_instances 2
305 if [ "$A1PMS_VERSION" != "V3" ]; then
307 a1pms_api_get_policy 200 2000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
308 a1pms_api_get_policy 200 3000 testdata/OSC/pi1_template.json "service1" ricsim_g1_1 1 false $notificationurl
309 a1pms_api_get_policy 200 2100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
310 a1pms_api_get_policy 200 3100 testdata/STD/pi1_template.json "service1" ricsim_g2_1 NOTYPE false $notificationurl
311 a1pms_api_get_policy 200 2200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
312 a1pms_api_get_policy 200 3200 testdata/STD2/pi_qos_template.json "service1" ricsim_g3_1 STD_QOS_0_2_0 true $notificationurl
315 sim_equal ricsim_g1_1 num_instances 2
316 sim_equal ricsim_g2_1 num_instances 2
318 sim_equal ricsim_g3_1 num_instances 2
322 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
327 a1pms_api_delete_policy 204 2000
329 a1pms_api_delete_policy 204 3000
330 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
335 a1pms_api_delete_policy 204 2100
337 a1pms_api_delete_policy 204 3100
338 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
343 a1pms_api_delete_policy 204 2200
345 a1pms_api_delete_policy 204 3200
347 sim_equal ricsim_g1_1 num_instances 0
348 sim_equal ricsim_g2_1 num_instances 0
350 sim_equal ricsim_g3_1 num_instances 0
352 # Check remote host access to simulator
354 sim_contains_str ricsim_g1_1 remote_hosts $A1PMS_APP_NAME
355 sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME
356 sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME
358 # Check policy removal
360 a1pms_api_get_policy 404 2000
361 a1pms_api_get_policy 404 3000
362 a1pms_api_get_policy 404 2100
363 a1pms_api_get_policy 404 3100
365 a1pms_api_get_policy 404 2200
366 a1pms_api_get_policy 404 3200
369 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
374 a1pms_api_delete_services 204 "service1"
376 a1pms_api_get_services 404 "service1"
380 #### TEST COMPLETE ####
386 auto_clean_environment