BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
rohithrajneesh | 927c17e | 2023-12-01 14:26:03 +0000 | [diff] [blame] | 4 | # Copyright (C) 2020-2023 Nordix Foundation. All rights reserved. |
| 5 | # Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved. |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 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 |
| 10 | # |
| 11 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 12 | # |
| 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================================================= |
| 19 | # |
| 20 | |
| 21 | |
| 22 | TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy using http/https and A1PMS REST with/without SDNC controller" |
| 23 | |
| 24 | #App names to include in the test when running docker, space separated list |
| 25 | DOCKER_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM SDNC NGW KUBEPROXY" |
| 26 | |
| 27 | #App names to include in the test when running kubernetes, space separated list |
| 28 | KUBE_INCLUDED_IMAGES="CP CR A1PMS RICSIM RICMEDIATORSIM SDNC NGW KUBEPROXY " |
BjornMagnussonXA | d54225b | 2023-04-19 14:03:49 +0200 | [diff] [blame] | 29 | #Pre-started app (not started by script) to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 30 | KUBE_PRESTARTED_IMAGES="" |
| 31 | |
| 32 | #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if |
| 33 | #the image is not configured in the supplied env_file |
| 34 | #Used for images not applicable to all supported profile |
| 35 | CONDITIONALLY_IGNORED_IMAGES="NGW " |
| 36 | |
| 37 | #Supported test environment profiles |
raviteja.karumuri | b71c749 | 2024-06-25 15:06:15 +0100 | [diff] [blame^] | 38 | SUPPORTED_PROFILES="ORAN-I-RELEASE ORAN-J-RELEASE" |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 39 | #Supported run modes |
| 40 | SUPPORTED_RUNMODES="DOCKER KUBE" |
| 41 | |
| 42 | . ../common/testcase_common.sh $@ |
| 43 | |
| 44 | setup_testenvironment |
| 45 | |
| 46 | #### TEST BEGIN #### |
| 47 | |
| 48 | sim_generate_policy_uuid |
| 49 | |
| 50 | # Tested variants of REST/DMAAP/SDNC config |
| 51 | TESTED_VARIANTS="REST REST+SDNC" |
| 52 | |
| 53 | #Test a1pms and simulator protocol versions (others are http only) |
| 54 | TESTED_PROTOCOLS="HTTP HTTPS" |
| 55 | for __httpx in $TESTED_PROTOCOLS ; do |
| 56 | for interface in $TESTED_VARIANTS ; do |
| 57 | |
| 58 | echo "#####################################################################" |
| 59 | echo "#####################################################################" |
| 60 | echo "### Testing a1pms: $interface using $__httpx" |
| 61 | echo "#####################################################################" |
| 62 | echo "#####################################################################" |
| 63 | |
| 64 | clean_environment |
| 65 | |
| 66 | start_kube_proxy |
| 67 | |
| 68 | if [ $__httpx == "HTTPS" ]; then |
| 69 | use_a1pms_rest_https |
| 70 | use_ricmediator_simulator_http |
| 71 | else |
| 72 | use_a1pms_rest_http |
| 73 | use_ricmediator_simulator_http |
| 74 | fi |
| 75 | |
| 76 | start_a1pms NORPOXY $SIM_GROUP/$A1PMS_COMPOSE_DIR/$A1PMS_CONFIG_FILE |
| 77 | |
| 78 | set_a1pms_trace |
| 79 | |
| 80 | # Create service to be able to receive events when rics becomes available |
| 81 | # Must use rest towards the a1pms since dmaap is not configured yet |
| 82 | a1pms_api_put_service 201 "ric-registration" 0 "$CR_SERVICE_APP_PATH_0/ric-registration" |
| 83 | |
| 84 | if [ $__httpx == "HTTPS" ]; then |
| 85 | use_cr_https |
| 86 | use_simulator_https |
| 87 | use_ricmediator_simulator_http |
| 88 | if [[ $interface = *"SDNC"* ]]; then |
| 89 | if [[ "$SDNC_FEATURE_LEVEL" == *"NO_NB_HTTPS"* ]]; then |
| 90 | deviation "SDNC does not support NB https" |
| 91 | use_sdnc_http |
| 92 | else |
| 93 | use_sdnc_https |
| 94 | fi |
| 95 | fi |
| 96 | use_a1pms_rest_https |
| 97 | else |
| 98 | use_cr_http |
| 99 | use_simulator_http |
| 100 | use_ricmediator_simulator_http |
| 101 | if [[ $interface = *"SDNC"* ]]; then |
| 102 | use_sdnc_http |
| 103 | fi |
| 104 | if [[ $interface = *"DMAAP"* ]]; then |
| 105 | use_a1pms_dmaap_http |
| 106 | else |
| 107 | use_a1pms_rest_http |
| 108 | fi |
| 109 | fi |
| 110 | |
| 111 | start_ric_simulators ricsim_g1 1 OSC_2.1.0 |
| 112 | start_ric_simulators ricsim_g2 1 STD_1.1.3 |
| 113 | start_ric_simulators ricsim_g3 1 STD_2.0.0 |
| 114 | start_ricmediator_simulators ricsim_g4 1 NONE |
| 115 | |
| 116 | start_cr 1 |
| 117 | |
| 118 | start_control_panel $SIM_GROUP/$CONTROL_PANEL_COMPOSE_DIR/$CONTROL_PANEL_CONFIG_FILE |
| 119 | |
| 120 | if [ ! -z "$NRT_GATEWAY_APP_NAME" ]; then |
| 121 | start_gateway $SIM_GROUP/$NRT_GATEWAY_COMPOSE_DIR/$NRT_GATEWAY_CONFIG_FILE |
| 122 | fi |
| 123 | |
| 124 | |
| 125 | if [[ $interface = *"SDNC"* ]]; then |
| 126 | start_sdnc |
| 127 | controller_api_wait_for_status_ok 200 ricsim_g1_1 |
| 128 | prepare_a1pms_config SDNC ".a1pms_config.json" |
| 129 | else |
| 130 | prepare_a1pms_config NOSDNC ".a1pms_config.json" |
| 131 | fi |
| 132 | |
| 133 | if [ $RUNMODE == "KUBE" ]; then |
| 134 | a1pms_load_config ".a1pms_config.json" |
| 135 | else |
BjornMagnussonXA | d54225b | 2023-04-19 14:03:49 +0200 | [diff] [blame] | 136 | #Temporary switch to http/https if dmaap use. Otherwise it is not possible to push config |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 137 | if [ $__httpx == "HTTPS" ]; then |
| 138 | use_a1pms_rest_https |
| 139 | else |
| 140 | use_a1pms_rest_http |
| 141 | fi |
| 142 | a1pms_api_put_configuration 200 ".a1pms_config.json" |
| 143 | if [ $__httpx == "HTTPS" ]; then |
| 144 | use_a1pms_rest_https |
| 145 | else |
| 146 | use_a1pms_rest_http |
| 147 | fi |
| 148 | fi |
| 149 | |
| 150 | sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json |
| 151 | |
| 152 | sim_put_policy_type 201 ricsim_g3_1 STD_QOS_0_2_0 testdata/STD2/sim_qos.json |
| 153 | |
rohithrajneesh | 927c17e | 2023-12-01 14:26:03 +0000 | [diff] [blame] | 154 | ricmediatorsim_put_policy_type 201 ricsim_g4_1 1 testdata/STD2/sim_qos.json |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 155 | |
| 156 | a1pms_equal json:rics 4 300 |
| 157 | |
| 158 | a1pms_equal json:policy-types 3 120 |
| 159 | |
| 160 | a1pms_equal json:policies 0 |
| 161 | |
| 162 | a1pms_equal json:policy-instances 0 |
| 163 | |
| 164 | cr_equal 0 received_callbacks 4 120 |
| 165 | |
| 166 | cr_api_check_all_sync_events 200 0 ric-registration ricsim_g1_1 ricsim_g2_1 ricsim_g3_1 ricsim_g4_1 |
| 167 | |
| 168 | echo "############################################" |
| 169 | echo "############## Health check ################" |
| 170 | echo "############################################" |
| 171 | |
BjornMagnussonXA | d54225b | 2023-04-19 14:03:49 +0200 | [diff] [blame] | 172 | sleep_wait 120 "Let A1PMS configuration take effect" |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 173 | |
| 174 | a1pms_api_get_status 200 |
| 175 | |
| 176 | echo "############################################" |
| 177 | echo "##### Service registry and supervision #####" |
| 178 | echo "############################################" |
| 179 | |
| 180 | a1pms_api_put_service 201 "serv1" 1000 "$CR_SERVICE_APP_PATH_0/1" |
| 181 | |
| 182 | a1pms_api_get_service_ids 200 "serv1" "ric-registration" |
| 183 | |
| 184 | a1pms_api_put_services_keepalive 200 "serv1" |
| 185 | |
| 186 | echo "############################################" |
| 187 | echo "############## RIC Repository ##############" |
| 188 | echo "############################################" |
| 189 | |
| 190 | a1pms_api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:AVAILABLE ricsim_g2_1:me1_ricsim_g2_1,me2_ricsim_g2_1:EMPTYTYPE:AVAILABLE ricsim_g3_1:me1_ricsim_g3_1,me2_ricsim_g3_1:STD_QOS_0_2_0:AVAILABLE ricsim_g4_1:me1_ricsim_g4_1,me2_ricsim_g4_1:1:AVAILABLE " |
| 191 | |
| 192 | echo "############################################" |
| 193 | echo "########### A1 Policy Management ###########" |
| 194 | echo "############################################" |
| 195 | |
| 196 | notificationurl=$CR_SERVICE_APP_PATH_0"/test" |
| 197 | a1pms_api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json |
| 198 | a1pms_api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json |
| 199 | a1pms_api_put_policy 201 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json |
| 200 | a1pms_api_put_policy 200 "serv1" ricsim_g3_1 STD_QOS_0_2_0 5200 true $notificationurl testdata/STD2/pi_qos_template.json |
| 201 | a1pms_api_put_policy 201 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json |
| 202 | a1pms_api_put_policy 200 "serv1" ricsim_g4_1 1 5300 NOTRANSIENT $notificationurl testdata/OSC/pi1_template.json |
| 203 | |
| 204 | a1pms_api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json |
| 205 | a1pms_api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT $notificationurl testdata/STD/pi1_template.json |
| 206 | |
| 207 | a1pms_equal json:policies 4 |
| 208 | |
| 209 | a1pms_api_delete_policy 204 5000 |
| 210 | |
| 211 | a1pms_api_delete_policy 204 5100 |
| 212 | |
| 213 | a1pms_api_delete_policy 204 5200 |
| 214 | |
| 215 | a1pms_api_delete_policy 204 5300 |
| 216 | |
| 217 | a1pms_equal json:policies 0 |
| 218 | |
| 219 | a1pms_equal json:policy-instances 0 |
| 220 | |
| 221 | cr_equal 0 received_callbacks 4 |
| 222 | |
| 223 | if [[ $interface = *"SDNC"* ]]; then |
| 224 | sim_contains_str ricsim_g2_1 remote_hosts $SDNC_APP_NAME |
| 225 | sim_contains_str ricsim_g3_1 remote_hosts $SDNC_APP_NAME |
| 226 | else |
| 227 | sim_contains_str ricsim_g2_1 remote_hosts $A1PMS_APP_NAME |
| 228 | sim_contains_str ricsim_g3_1 remote_hosts $A1PMS_APP_NAME |
| 229 | fi |
| 230 | |
| 231 | check_a1pms_logs |
| 232 | |
| 233 | |
| 234 | if [[ $interface = *"SDNC"* ]]; then |
| 235 | check_sdnc_logs |
| 236 | fi |
| 237 | |
| 238 | store_logs "${__httpx}__${interface}" |
| 239 | |
| 240 | done |
| 241 | |
| 242 | done |
| 243 | |
| 244 | #### TEST COMPLETE #### |
| 245 | |
| 246 | |
| 247 | print_result |
| 248 | |
| 249 | auto_clean_environment |