BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
| 4 | # Copyright (C) 2020 Nordix Foundation. All rights reserved. |
| 5 | # ======================================================================== |
| 6 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | # you may not use this file except in compliance with the License. |
| 8 | # You may obtain a copy of the License at |
| 9 | # |
| 10 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | # |
| 12 | # Unless required by applicable law or agreed to in writing, software |
| 13 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | # See the License for the specific language governing permissions and |
| 16 | # limitations under the License. |
| 17 | # ============LICENSE_END================================================= |
| 18 | # |
| 19 | |
BjornMagnussonXA | a549157 | 2021-05-04 09:21:24 +0200 | [diff] [blame] | 20 | TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm recepie - all components - CHERRY release" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 21 | |
| 22 | #App names to include in the test when running docker, space separated list |
| 23 | DOCKER_INCLUDED_IMAGES="" # Not used - KUBE only test script |
| 24 | |
| 25 | #App names to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 26 | KUBE_INCLUDED_IMAGES=" MR CR PRODSTUB KUBEPROXY" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 27 | #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list |
| 28 | KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC" |
| 29 | |
| 30 | #Supported test environment profiles |
BjornMagnussonXA | a549157 | 2021-05-04 09:21:24 +0200 | [diff] [blame] | 31 | SUPPORTED_PROFILES="ORAN-CHERRY" |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 32 | #Supported run modes |
| 33 | SUPPORTED_RUNMODES="KUBE" |
| 34 | |
| 35 | . ../common/testcase_common.sh $@ |
| 36 | . ../common/agent_api_functions.sh |
| 37 | . ../common/ricsimulator_api_functions.sh |
| 38 | . ../common/ecs_api_functions.sh |
| 39 | . ../common/prodstub_api_functions.sh |
| 40 | . ../common/cr_api_functions.sh |
| 41 | . ../common/rapp_catalogue_api_functions.sh |
| 42 | . ../common/mr_api_functions.sh |
| 43 | . ../common/control_panel_api_functions.sh |
| 44 | . ../common/controller_api_functions.sh |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 45 | . ../common/kube_proxy_api_functions.sh |
| 46 | |
| 47 | setup_testenvironment |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 48 | |
| 49 | #### TEST BEGIN #### |
| 50 | |
| 51 | use_mr_http #MR only supports http? |
| 52 | use_cr_https |
| 53 | use_agent_rest_https |
| 54 | use_sdnc_https |
| 55 | use_simulator_https |
| 56 | use_ecs_rest_https |
| 57 | use_prod_stub_https |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame] | 58 | if [ $ECS_VERSION == "V1-1" ]; then |
| 59 | use_rapp_catalogue_http # https not yet supported |
| 60 | else |
| 61 | use_rapp_catalogue_https |
| 62 | fi |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 63 | |
| 64 | echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED" |
| 65 | |
| 66 | use_control_panel_https |
| 67 | |
| 68 | if [ "$PMS_VERSION" == "V1" ]; then |
| 69 | echo "PMS VERSION 2 (V2) is required" |
| 70 | exit 1 |
| 71 | fi |
| 72 | |
| 73 | clean_environment |
| 74 | |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 75 | if [ $RUNMODE == "KUBE" ]; then |
| 76 | start_kube_proxy |
| 77 | fi |
| 78 | |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 79 | STD_NUM_RICS=2 |
| 80 | OSC_NUM_RICS=2 |
| 81 | |
| 82 | start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0 |
| 83 | echo " RIC MAPPING a1-sim-osc-0 : ric1" |
| 84 | echo " RIC MAPPING a1-sim-osc-1 : ric2" |
| 85 | |
| 86 | start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3 |
| 87 | echo " RIC MAPPING a1-sim-std-0 : ric3" |
| 88 | echo " RIC MAPPING a1-sim-std-1 : ric4" |
| 89 | |
| 90 | start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0 |
| 91 | echo " RIC MAPPING a1-sim-std2-0 : ric5" |
| 92 | echo " RIC MAPPING a1-sim-std2-1 : ric6" |
| 93 | |
| 94 | start_mr |
| 95 | |
| 96 | start_control_panel |
| 97 | |
| 98 | start_sdnc |
| 99 | |
| 100 | start_policy_agent |
| 101 | |
| 102 | start_cr |
| 103 | |
| 104 | start_prod_stub |
| 105 | |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame] | 106 | start_ecs NOPROXY |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 107 | |
| 108 | set_ecs_trace |
| 109 | |
| 110 | start_rapp_catalogue |
| 111 | |
| 112 | set_agent_trace |
| 113 | |
| 114 | #### Test RAPP Catalogue #### |
| 115 | |
| 116 | rapp_cat_api_get_services 200 EMPTY |
| 117 | |
| 118 | rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app" |
| 119 | |
| 120 | rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app" |
| 121 | |
| 122 | #Check the number of services |
| 123 | rc_equal json:services 1 |
| 124 | |
| 125 | api_get_status 200 |
| 126 | |
| 127 | #### Test Policy Management Service #### |
| 128 | |
| 129 | # Print the A1 version for STD 1.1.X |
| 130 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 131 | do |
| 132 | sim_print "a1-sim-std-"$i interface |
| 133 | done |
| 134 | |
| 135 | # Print the A1 version for STD 2.0.X |
| 136 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 137 | do |
| 138 | sim_print "a1-sim-std2-"$i interface |
| 139 | done |
| 140 | |
| 141 | # Print the A1 version for OSC 2.1.X |
| 142 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 143 | do |
| 144 | sim_print "a1-sim-osc-"$i interface |
| 145 | done |
| 146 | |
| 147 | |
| 148 | # Load the polictypes in STD 2 |
| 149 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 150 | do |
| 151 | sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json |
| 152 | sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json |
| 153 | done |
| 154 | |
| 155 | # Load the polictypes in OSC |
| 156 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 157 | do |
| 158 | sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json |
| 159 | sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json |
| 160 | done |
| 161 | |
| 162 | # Check that all rics are synced in |
| 163 | api_equal json:rics 6 300 |
| 164 | |
| 165 | #Check the number of schemas and the individual schemas |
| 166 | api_equal json:policy-types 5 300 |
| 167 | |
| 168 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 169 | do |
| 170 | ricid=$((3+$i)) |
| 171 | api_equal json:policy-types?ric_id=ric$ricid 1 120 |
| 172 | done |
| 173 | |
| 174 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 175 | do |
| 176 | ricid=$((5+$i)) |
| 177 | api_equal json:policy-types?ric_id=ric$ricid 2 120 |
| 178 | done |
| 179 | |
| 180 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 181 | do |
| 182 | ricid=$((1+$i)) |
| 183 | api_equal json:policy-types?ric_id=ric$ricid 2 120 |
| 184 | done |
| 185 | |
| 186 | #Check the schemas in STD 2 |
| 187 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 188 | do |
| 189 | ricid=$((5+$i)) |
| 190 | api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json |
| 191 | api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json |
| 192 | done |
| 193 | |
| 194 | # Check the schemas in OSC |
| 195 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 196 | do |
| 197 | api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json |
| 198 | api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json |
| 199 | done |
| 200 | |
| 201 | api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_PATH/ER-app" |
| 202 | |
| 203 | # Create policies in STD |
| 204 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 205 | do |
| 206 | ricid=$((3+$i)) |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 207 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 208 | api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1 |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 209 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 210 | api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD/pi1_template.json 1 |
| 211 | done |
| 212 | |
| 213 | #Create policies in STD 2 |
| 214 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 215 | do |
| 216 | ricid=$((5+$i)) |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 217 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 218 | api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos_template.json 1 |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 219 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 220 | api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"std2" testdata/STD2/pi_qos2_template.json 1 |
| 221 | done |
| 222 | |
| 223 | # Create policies in OSC |
| 224 | for ((i=0; i<$OSC_NUM_RICS; i++)) |
| 225 | do |
| 226 | ricid=$((1+$i)) |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 227 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 228 | api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi1_template.json 1 |
BjornMagnussonXA | be9a07f | 2021-02-25 10:51:46 +0100 | [diff] [blame] | 229 | generate_policy_uuid |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 230 | api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_PATH/"osc" testdata/OSC/pi2_template.json 1 |
| 231 | done |
| 232 | |
| 233 | |
| 234 | # Check the number of policies in STD and STD2 |
| 235 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 236 | do |
| 237 | sim_equal "a1-sim-std-"$i num_instances 2 |
| 238 | sim_equal "a1-sim-std2-"$i num_instances 2 |
| 239 | done |
| 240 | |
| 241 | # Check the number of policies in OSC |
| 242 | for ((i=0; i<$STD_NUM_RICS; i++)) |
| 243 | do |
| 244 | sim_equal "a1-sim-osc-"$i num_instances 2 |
| 245 | done |
| 246 | |
| 247 | echo "ADD EVENT/STATUS CHECK" |
| 248 | echo "ADD MR CHECK" |
| 249 | |
| 250 | FLAT_A1_EI="1" |
| 251 | |
| 252 | ecs_api_admin_reset |
| 253 | |
| 254 | CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK" |
| 255 | CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK" |
| 256 | TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery" |
| 257 | TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery" |
| 258 | |
| 259 | STATUS1="$CR_SERVICE_PATH/job1-status" |
| 260 | STATUS2="$CR_SERVICE_PATH/job2-status" |
| 261 | |
| 262 | prodstub_arm_producer 200 prod-a |
| 263 | prodstub_arm_type 200 prod-a type1 |
| 264 | prodstub_arm_job_create 200 prod-a job1 |
| 265 | prodstub_arm_job_create 200 prod-a job2 |
| 266 | |
| 267 | |
| 268 | ### ecs status |
| 269 | ecs_api_service_status 200 |
| 270 | |
| 271 | ## Setup prod-a |
| 272 | ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json |
| 273 | |
| 274 | ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json |
| 275 | |
| 276 | ecs_api_edp_get_producer_status 200 prod-a ENABLED |
| 277 | |
| 278 | |
| 279 | ## Create a job for prod-a |
| 280 | ## job1 - prod-a |
| 281 | if [ -z "$FLAT_A1_EI" ]; then |
| 282 | ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json |
| 283 | else |
| 284 | ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json |
| 285 | fi |
| 286 | |
| 287 | # Check the job data in the producer |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame] | 288 | if [ $ECS_VERSION == "V1-1" ]; then |
| 289 | prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json |
| 290 | else |
| 291 | prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json |
| 292 | fi |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 293 | |
| 294 | ## Create a second job for prod-a |
| 295 | ## job2 - prod-a |
| 296 | if [ -z "$FLAT_A1_EI" ]; then |
| 297 | ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json |
| 298 | else |
| 299 | ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json |
| 300 | fi |
| 301 | |
| 302 | # Check the job data in the producer |
BjornMagnussonXA | c963b73 | 2021-01-20 14:24:13 +0100 | [diff] [blame] | 303 | if [ $ECS_VERSION == "V1-1" ]; then |
| 304 | prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json |
| 305 | else |
| 306 | prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json |
| 307 | fi |
BjornMagnussonXA | e0b665e | 2021-01-08 22:19:18 +0100 | [diff] [blame] | 308 | |
| 309 | echo "ADD EVENT/STATUS CHECK" |
| 310 | |
| 311 | check_policy_agent_logs |
| 312 | check_ecs_logs |
| 313 | check_sdnc_logs |
| 314 | |
| 315 | #### TEST COMPLETE #### |
| 316 | |
| 317 | store_logs END |
| 318 | |
| 319 | print_result |