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=================================================
22 TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http/https (no a1pms)"
24 #App names to include in the test when running docker, space separated list
25 DOCKER_INCLUDED_IMAGES="RICSIM SDNC KUBEPROXY"
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES=" RICSIM SDNC KUBEPROXY"
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=""
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 $@
47 sim_generate_policy_uuid
49 #Test a1pms and simulator protocol versions (others are http only)
50 NB_TESTED_PROTOCOLS="HTTP HTTPS"
51 SB_TESTED_PROTOCOLS="HTTP HTTPS"
53 for __nb_httpx in $NB_TESTED_PROTOCOLS ; do
54 for __sb_httpx in $SB_TESTED_PROTOCOLS ; do
56 echo "#####################################################################"
57 echo "#####################################################################"
58 echo "### Testing SDNC using Northbound: $__nb_httpx and Southbound: $__sb_httpx"
59 echo "#####################################################################"
60 echo "#####################################################################"
63 # Clean container and start all needed containers #
68 start_ric_simulators ricsim_g1 1 OSC_2.1.0
69 start_ric_simulators ricsim_g2 1 STD_1.1.3
70 start_ric_simulators ricsim_g3 1 STD_2.0.0
73 if [ $__nb_httpx == "HTTPS" ]; then
74 # "Using secure ports towards SDNC"
75 if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
76 deviation "SDNC does not support NB https"
82 #"Using non-secure ports towards SDNC"
87 controller_api_wait_for_status_ok 200 ricsim_g1_1
89 if [ $__sb_httpx == "HTTPS" ]; then
90 # "Using secure ports towards SDNC"
93 #"Using non-secure ports towards SDNC"
99 controller_api_get_A1_policy_type 404 OSC ricsim_g1_1 1
101 sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
104 controller_api_get_A1_policy_ids 200 OSC ricsim_g1_1 1
105 controller_api_get_A1_policy_ids 200 STD ricsim_g2_1
107 controller_api_get_A1_policy_type 200 OSC ricsim_g1_1 1
108 controller_api_get_A1_policy_type 200 OSC ricsim_g1_1 1 testdata/OSC/sim_1.json
109 controller_api_get_A1_policy_type 404 OSC ricsim_g1_1 99
112 if [ $FLAVOUR == "ONAP" ] && [[ "$SDNC_FEATURE_LEVEL" != *"TRANS_RESP_CODE"* ]]; then
113 deviation "SDNC does not return original response code from sim"
116 controller_api_put_A1_policy $RESP OSC ricsim_g1_1 1 4000 testdata/OSC/pi1_template.json
117 controller_api_put_A1_policy 404 OSC ricsim_g1_1 5 1001 testdata/OSC/pi1_template.json
120 if [ $FLAVOUR == "ONAP" ] && [[ "$SDNC_FEATURE_LEVEL" != *"TRANS_RESP_CODE"* ]]; then
121 deviation "SDNC does not return original response code from sim"
124 controller_api_put_A1_policy $RESP STD ricsim_g2_1 5000 testdata/STD/pi1_template.json
126 controller_api_get_A1_policy_ids 200 OSC ricsim_g1_1 1 4000
127 controller_api_get_A1_policy_ids 200 STD ricsim_g2_1 5000
129 controller_api_get_A1_policy_status 200 OSC ricsim_g1_1 1 4000
130 controller_api_get_A1_policy_status 200 STD ricsim_g2_1 5000
131 if [[ $TEST_ENV_PROFILE =~ ^ORAN-[A-H] ]] || [[ $TEST_ENV_PROFILE =~ ^ONAP-[A-L] ]]; then
138 controller_api_get_A1_policy_status 200 OSC ricsim_g1_1 1 4000 "$VAL" "$VAL2"
139 controller_api_get_A1_policy_status 200 STD ricsim_g2_1 5000 "UNDEFINED"
142 if [ $FLAVOUR == "ONAP" ] && [[ "$SDNC_FEATURE_LEVEL" != *"TRANS_RESP_CODE"* ]]; then
143 deviation "SDNC does not return original response code from sim"
146 controller_api_delete_A1_policy $RESP OSC ricsim_g1_1 1 4000
149 if [ $FLAVOUR == "ONAP" ] && [[ "$SDNC_FEATURE_LEVEL" != *"TRANS_RESP_CODE"* ]]; then
150 deviation "SDNC does not return original response code from sim"
153 controller_api_delete_A1_policy $RESP STD ricsim_g2_1 5000
157 store_logs "NB_"$__nb_httpx"_SB_"$__sb_httpx
163 #### TEST COMPLETE ####
167 auto_clean_environment