blob: 2d3ecc00a89bd8d65be223f685479c32cd0394f3 [file] [log] [blame]
BjornMagnussonXA663566c2021-11-08 10:25:07 +01001#!/usr/bin/env bash
2
3# ============LICENSE_START===============================================
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +02004# Copyright (C) 2020-2023 Nordix Foundation. All rights reserved.
rohithrajneesh927c17e2023-12-01 14:26:03 +00005# Copyright (C) 2023 OpenInfra Foundation Europe. All rights reserved.
BjornMagnussonXA663566c2021-11-08 10:25:07 +01006# ========================================================================
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
elinuxhenrik3efd7752022-04-07 07:48:46 +020021TC_ONELINE_DESCR="Testing southbound proxy for Dmaap Adapter"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010022
23#App names to include in the test when running docker, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010024DOCKER_INCLUDED_IMAGES="CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010025
26#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010027KUBE_INCLUDED_IMAGES=" CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
BjornMagnussonXAd54225b2023-04-19 14:03:49 +020028#Pre-started app (not started by script) to include in the test when running kubernetes, space separated list
BjornMagnussonXA663566c2021-11-08 10:25:07 +010029KUBE_PRESTARTED_IMAGES=""
30
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
34CONDITIONALLY_IGNORED_IMAGES=""
35
36#Supported test environment profiles
raviteja.karumurib71c7492024-06-25 15:06:15 +010037SUPPORTED_PROFILES="ORAN-G-RELEASE ORAN-H-RELEASE ORAN-I-RELEASE ORAN-J-RELEASE"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010038#Supported run modes
39SUPPORTED_RUNMODES="DOCKER KUBE"
40
41. ../common/testcase_common.sh $@
BjornMagnussonXA663566c2021-11-08 10:25:07 +010042
43setup_testenvironment
44
45#### TEST BEGIN ####
46
47#Local vars in test script
48##########################
49
BjornMagnussonXA663566c2021-11-08 10:25:07 +010050NUM_JOBS=10
51
52clean_environment
53
54use_cr_https
BjornMagnussonXA007b6452021-11-29 08:03:38 +010055use_ics_rest_https
BjornMagnussonXA663566c2021-11-08 10:25:07 +010056use_mr_https
57use_dmaapadp_https
58
59start_kube_proxy
60
61start_http_proxy
62
BjornMagnussonXA79e37002021-11-22 13:36:04 +010063start_cr 1
BjornMagnussonXA663566c2021-11-08 10:25:07 +010064
BjornMagnussonXA007b6452021-11-29 08:03:38 +010065start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE
BjornMagnussonXA663566c2021-11-08 10:25:07 +010066
BjornMagnussonXA007b6452021-11-29 08:03:38 +010067set_ics_trace
BjornMagnussonXA663566c2021-11-08 10:25:07 +010068
69start_mr
70
BjornMagnussonXA8fbc6362022-04-19 09:39:22 +020071start_dmaapadp PROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE_TEMPLATE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
BjornMagnussonXA663566c2021-11-08 10:25:07 +010072
73set_dmaapadp_trace
74
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020075ics_equal json:data-producer/v1/info-producers 1 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +010076
BjornMagnussonXA007b6452021-11-29 08:03:38 +010077ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
BjornMagnussonXAa00565c2022-06-10 11:09:50 +020078ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka
BjornMagnussonXA663566c2021-11-08 10:25:07 +010079
80
BjornMagnussonXAf81090f2022-08-24 09:17:44 +020081if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"GENERATED_PROD_NAME"* ]]; then
82 if [ $RUNMODE == "KUBE" ]; then
83 __NAME="https:__$DMAAP_ADP_APP_NAME.$KUBE_NONRTRIC_NAMESPACE:$DMAAP_ADP_EXTERNAL_SECURE_PORT"
84 else
85 __NAME="https:__$DMAAP_ADP_APP_NAME:$DMAAP_ADP_INTERNAL_SECURE_PORT"
86 fi
87 ics_api_edp_get_producer_ids_2 200 NOTYPE $__NAME
88else
89 ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer
90fi
91
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020092if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"FILTERSCHEMA"* ]]; then
93 _template_json=job-template1.1.json
94else
95 _template_json=job-template1.json
96fi
BjornMagnussonXA663566c2021-11-08 10:25:07 +010097for ((i=1; i<=$NUM_JOBS; i++))
98do
BjornMagnussonXA7d7cb5f2023-04-11 10:32:56 +020099 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
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100100done
101
102for ((i=1; i<=$NUM_JOBS; i++))
103do
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100104 ics_api_a1_get_job_status 200 joby$i ENABLED 30
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100105done
106
107
108# Adapter data
109mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
110mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
111
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100112cr_equal 0 received_callbacks $(($NUM_JOBS*2)) 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100113
114for ((i=1; i<=$NUM_JOBS; i++))
115do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100116 cr_equal 0 received_callbacks?id=joby-data$i 2
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100117done
118
119for ((i=1; i<=$NUM_JOBS; i++))
120do
BjornMagnussonXAd54225b2023-04-19 14:03:49 +0200121 cr_api_check_single_generic_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
122 cr_api_check_single_generic_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100123done
124
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100125cr_contains_str 0 remote_hosts $HTTP_PROXY_APP_NAME
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100126
127#### TEST COMPLETE ####
128
129store_logs END
130
131print_result
132
elinuxhenrik3efd7752022-04-07 07:48:46 +0200133auto_clean_environment