BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 1 | #!/usr/bin/env bash |
| 2 | |
| 3 | # ============LICENSE_START=============================================== |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 4 | # Copyright (C) 2020-2023 Nordix Foundation. All rights reserved. |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 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 | |
elinuxhenrik | 3efd775 | 2022-04-07 07:48:46 +0200 | [diff] [blame] | 20 | TC_ONELINE_DESCR="Testing southbound proxy for Dmaap Adapter" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 21 | |
| 22 | #App names to include in the test when running docker, space separated list |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 23 | DOCKER_INCLUDED_IMAGES="CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 24 | |
| 25 | #App names to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 26 | KUBE_INCLUDED_IMAGES=" CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP" |
BjornMagnussonXA | d54225b | 2023-04-19 14:03:49 +0200 | [diff] [blame^] | 27 | #Pre-started app (not started by script) to include in the test when running kubernetes, space separated list |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 28 | KUBE_PRESTARTED_IMAGES="" |
| 29 | |
| 30 | #Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if |
| 31 | #the image is not configured in the supplied env_file |
| 32 | #Used for images not applicable to all supported profile |
| 33 | CONDITIONALLY_IGNORED_IMAGES="" |
| 34 | |
| 35 | #Supported test environment profiles |
BjornMagnussonXA | f83c362 | 2023-02-28 10:05:51 +0100 | [diff] [blame] | 36 | SUPPORTED_PROFILES="ORAN-F-RELEASE ORAN-G-RELEASE ORAN-H-RELEASE" |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 37 | #Supported run modes |
| 38 | SUPPORTED_RUNMODES="DOCKER KUBE" |
| 39 | |
| 40 | . ../common/testcase_common.sh $@ |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 41 | |
| 42 | setup_testenvironment |
| 43 | |
| 44 | #### TEST BEGIN #### |
| 45 | |
| 46 | #Local vars in test script |
| 47 | ########################## |
| 48 | |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 49 | NUM_JOBS=10 |
| 50 | |
| 51 | clean_environment |
| 52 | |
| 53 | use_cr_https |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 54 | use_ics_rest_https |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 55 | use_mr_https |
| 56 | use_dmaapadp_https |
| 57 | |
| 58 | start_kube_proxy |
| 59 | |
| 60 | start_http_proxy |
| 61 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 62 | start_cr 1 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 63 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 64 | start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 65 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 66 | set_ics_trace |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 67 | |
| 68 | start_mr |
| 69 | |
BjornMagnussonXA | 8fbc636 | 2022-04-19 09:39:22 +0200 | [diff] [blame] | 70 | start_dmaapadp PROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE_TEMPLATE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 71 | |
| 72 | set_dmaapadp_trace |
| 73 | |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 74 | ics_equal json:data-producer/v1/info-producers 1 60 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 75 | |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 76 | ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY |
BjornMagnussonXA | a00565c | 2022-06-10 11:09:50 +0200 | [diff] [blame] | 77 | ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 78 | |
| 79 | |
BjornMagnussonXA | f81090f | 2022-08-24 09:17:44 +0200 | [diff] [blame] | 80 | if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"GENERATED_PROD_NAME"* ]]; then |
| 81 | if [ $RUNMODE == "KUBE" ]; then |
| 82 | __NAME="https:__$DMAAP_ADP_APP_NAME.$KUBE_NONRTRIC_NAMESPACE:$DMAAP_ADP_EXTERNAL_SECURE_PORT" |
| 83 | else |
| 84 | __NAME="https:__$DMAAP_ADP_APP_NAME:$DMAAP_ADP_INTERNAL_SECURE_PORT" |
| 85 | fi |
| 86 | ics_api_edp_get_producer_ids_2 200 NOTYPE $__NAME |
| 87 | else |
| 88 | ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer |
| 89 | fi |
| 90 | |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 91 | if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"FILTERSCHEMA"* ]]; then |
| 92 | _template_json=job-template1.1.json |
| 93 | else |
| 94 | _template_json=job-template1.json |
| 95 | fi |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 96 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 97 | do |
BjornMagnussonXA | 7d7cb5f | 2023-04-11 10:32:56 +0200 | [diff] [blame] | 98 | ics_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH_0/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH_0/job_status_info-ownery$i testdata/dmaap-adapter/$_template_json |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 99 | done |
| 100 | |
| 101 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 102 | do |
BjornMagnussonXA | 007b645 | 2021-11-29 08:03:38 +0100 | [diff] [blame] | 103 | ics_api_a1_get_job_status 200 joby$i ENABLED 30 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 104 | done |
| 105 | |
| 106 | |
| 107 | # Adapter data |
| 108 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}' |
| 109 | mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}' |
| 110 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 111 | cr_equal 0 received_callbacks $(($NUM_JOBS*2)) 60 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 112 | |
| 113 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 114 | do |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 115 | cr_equal 0 received_callbacks?id=joby-data$i 2 |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 116 | done |
| 117 | |
| 118 | for ((i=1; i<=$NUM_JOBS; i++)) |
| 119 | do |
BjornMagnussonXA | d54225b | 2023-04-19 14:03:49 +0200 | [diff] [blame^] | 120 | cr_api_check_single_generic_json_event 200 0 joby-data$i '{"msg":"msg-1"}' |
| 121 | cr_api_check_single_generic_json_event 200 0 joby-data$i '{"msg":"msg-3"}' |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 122 | done |
| 123 | |
BjornMagnussonXA | 79e3700 | 2021-11-22 13:36:04 +0100 | [diff] [blame] | 124 | cr_contains_str 0 remote_hosts $HTTP_PROXY_APP_NAME |
BjornMagnussonXA | 663566c | 2021-11-08 10:25:07 +0100 | [diff] [blame] | 125 | |
| 126 | #### TEST COMPLETE #### |
| 127 | |
| 128 | store_logs END |
| 129 | |
| 130 | print_result |
| 131 | |
elinuxhenrik | 3efd775 | 2022-04-07 07:48:46 +0200 | [diff] [blame] | 132 | auto_clean_environment |