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="ONAP Use case REQ-626"
23 #App names to include in the test when running docker, space separated list
24 DOCKER_INCLUDED_IMAGES="CP CR MR DMAAPMR A1PMS RICSIM SDNC NGW KUBEPROXY"
26 #App names to include in the test when running kubernetes, space separated list
27 KUBE_INCLUDED_IMAGES="CP CR MR DMAAPMR A1PMS RICSIM SDNC 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"
39 SUPPORTED_RUNMODES="DOCKER KUBE"
41 . ../common/testcase_common.sh $@
47 #Local vars in test script
48 ##########################
52 if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then
53 deviation "SDNC does not support NB https"
59 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
65 notificationurl=$CR_SERVICE_APP_PATH_0"/test"
67 sim_generate_policy_uuid
69 # Tested variants of REST/DMAAP/SDNC config
72 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
73 TESTED_VARIANTS="REST REST+SDNC"
75 TESTED_VARIANTS="REST DMAAP REST+SDNC DMAAP+SDNC"
78 for interface in $TESTED_VARIANTS ; do
80 echo "#####################################################################"
81 echo "#####################################################################"
82 echo "### Testing a1pms: $interface using https"
83 echo "#####################################################################"
84 echo "#####################################################################"
90 if [[ $interface = *"DMAAP"* ]]; then
99 start_ric_simulators $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
101 start_ric_simulators $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
103 start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
105 if [[ "$A1PMS_FEATURE_LEVEL" == *"NO-DMAAP"* ]]; then
108 start_mr "$MR_READ_TOPIC" "/events" "users/policy-agent" \
109 "$MR_WRITE_TOPIC" "/events" "users/mr-stub"
112 start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE
114 if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then
115 start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE
120 if [[ $interface = *"SDNC"* ]]; then
122 controller_api_wait_for_status_ok 200 ricsim_g1_1
123 prepare_a1pms_config SDNC ".a1pms_config.json"
125 prepare_a1pms_config NOSDNC ".a1pms_config.json"
128 start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE
132 if [ $RUNMODE == "KUBE" ]; then
133 a1pms_load_config ".a1pms_config.json"
135 #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config
136 if [ $__httpx == "HTTPS" ]; then
141 a1pms_api_put_configuration 200 ".a1pms_config.json"
142 if [ $__httpx == "HTTPS" ]; then
143 if [[ $interface = *"DMAAP"* ]]; then
144 use_a1pms_dmaap_https
149 if [[ $interface = *"DMAAP"* ]]; then
157 # Check that all rics are synced in
158 a1pms_equal json:rics 3 300
160 a1pms_api_get_status 200
162 # Print the A1 version for OSC
163 for ((i=1; i<=$OSC_NUM_RICS; i++))
165 sim_print $RIC_SIM_PREFIX"_g1_"$i interface
169 # Print the A1 version for STD 1.X
170 for ((i=1; i<=$STD_NUM_RICS; i++))
172 sim_print $RIC_SIM_PREFIX"_g2_"$i interface
175 # Print the A1 version for STD 2.X
176 for ((i=1; i<=$STD_NUM_RICS; i++))
178 sim_print $RIC_SIM_PREFIX"_g3_"$i interface
181 #################################################################
182 ## REQ: Synchronize A1 Policy Information in RAN
183 #################################################################
185 # Load the policytypes in osc
186 for ((i=1; i<=$OSC_NUM_RICS; i++))
188 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 demo-testdata/OSC/sim_qos.json
189 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 demo-testdata/OSC/sim_tsa.json
192 #Check the number of schemas and the individual schemas in OSC
193 a1pms_equal json:policy-types 3 300
195 for ((i=1; i<=$OSC_NUM_RICS; i++))
197 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g1_"$i 2 120
200 # Check the schemas in OSC
201 for ((i=1; i<=$OSC_NUM_RICS; i++))
203 a1pms_api_get_policy_type 200 100 demo-testdata/OSC/qos-a1pms-modified.json
204 a1pms_api_get_policy_type 200 20008 demo-testdata/OSC/tsa-a1pms-modified.json
208 # Load the policytypes in std
209 for ((i=1; i<=$STD_NUM_RICS; i++))
211 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
212 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
215 #Check the number of schemas and the individual schemas in STD
216 a1pms_equal json:policy-types 5 120
218 for ((i=1; i<=$STD_NUM_RICS; i++))
220 a1pms_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
223 # Check the schemas in STD
224 for ((i=1; i<=$STD_NUM_RICS; i++))
226 a1pms_api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-a1pms-modified.json
227 a1pms_api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-a1pms-modified.json
230 #Check the number of types
231 a1pms_equal json:policy-types 5 120
233 #################################################################
234 ## REQ: A1 Policy Type / Instance Operations
235 #################################################################
240 a1pms_api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/1"
242 # Create policies in OSC
243 for ((i=1; i<=$OSC_NUM_RICS; i++))
245 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/piqos_template.json 1
246 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT $notificationurl demo-testdata/OSC/pitsa_template.json 1
250 # Check the number of policies in OSC
251 for ((i=1; i<=$OSC_NUM_RICS; i++))
253 sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 2
257 # Create policies in STD
258 for ((i=1; i<=$STD_NUM_RICS; i++))
260 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT $notificationurl demo-testdata/STD/pi1_template.json 1
261 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 $((2300+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
262 a1pms_api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i 'STD_QOS2_0.1.0' $((2400+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
266 # Check the number of policies in STD
267 for ((i=1; i<=$STD_NUM_RICS; i++))
269 sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
270 sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
273 #################################################################
274 ## REQ: A1 Policy Instance Status Operations
275 #################################################################
278 for ((i=1; i<=$STD_NUM_RICS; i++))
280 a1pms_api_get_policy_status 200 $((2100+$i)) STD "UNDEFINED"
281 a1pms_api_get_policy_status 200 $((2300+$i)) STD2 EMPTY EMPTY
282 a1pms_api_get_policy_status 200 $((2400+$i)) STD2 EMPTY EMPTY
287 for ((i=1; i<=$OSC_NUM_RICS; i++))
289 a1pms_api_get_policy_status 200 $((3000+$i)) OSC "$VAL" "false"
290 a1pms_api_get_policy_status 200 $((4000+$i)) OSC "$VAL" "false"
293 # Note: Status callback is not tested since this callback (http POST) is made from the
294 # ricsim directly to the receiver of the status, i.e. the status does NOT
299 if [[ $interface = *"SDNC"* ]]; then
303 #### TEST COMPLETE ####
305 store_logs "https__${interface}"
311 auto_clean_environment