blob: 6e22ced1be949e079a5d6570ff7f16093ae63c1b [file] [log] [blame]
BjornMagnussonXA663566c2021-11-08 10:25:07 +01001#!/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
20TC_ONELINE_DESCR="Testing southbound proxy for Dmaap Adaptor"
21
22#App names to include in the test when running docker, space separated list
23DOCKER_INCLUDED_IMAGES="CR MR ECS HTTPPROXY KUBEPROXY DMAAPADP"
24
25#App names to include in the test when running kubernetes, space separated list
26KUBE_INCLUDED_IMAGES=" CR MR ECS HTTPPROXY KUBEPROXY DMAAPADP"
27#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
28KUBE_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
33CONDITIONALLY_IGNORED_IMAGES=""
34
35#Supported test environment profiles
36SUPPORTED_PROFILES="ORAN-E-RELEASE"
37#Supported run modes
38SUPPORTED_RUNMODES="DOCKER KUBE"
39
40. ../common/testcase_common.sh $@
41. ../common/ecs_api_functions.sh
42. ../common/cr_api_functions.sh
43. ../common/mr_api_functions.sh
44. ../common/http_proxy_api_functions.sh
45. ../common/kube_proxy_api_functions.sh
46. ../common/dmaapadp_api_functions.sh
47
48setup_testenvironment
49
50#### TEST BEGIN ####
51
52#Local vars in test script
53##########################
54
55FLAT_A1_EI="1"
56NUM_JOBS=10
57
58clean_environment
59
60use_cr_https
61use_ecs_rest_https
62use_mr_https
63use_dmaapadp_https
64
65start_kube_proxy
66
67start_http_proxy
68
69start_cr
70
71start_ecs NOPROXY $SIM_GROUP/$ECS_COMPOSE_DIR/$ECS_CONFIG_FILE
72
73set_ecs_trace
74
75start_mr
76
77start_dmaapadp PROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
78
79set_dmaapadp_trace
80
81if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
82 ecs_equal json:data-producer/v1/info-producers 1 60
83else
84 ecs_equal json:ei-producer/v1/eiproducers 1 60
85fi
86
87ecs_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
88ecs_api_idc_get_type_ids 200 ExampleInformationType
89
90
91ecs_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer
92
93for ((i=1; i<=$NUM_JOBS; i++))
94do
95 ecs_api_idc_put_job 201 joby$i ExampleInformationType $CR_SERVICE_MR_PATH/joby-data$i info-ownery$i $CR_SERVICE_MR_PATH/job_status_info-ownery$i testdata/dmaap-adapter/job-template.json
96done
97
98for ((i=1; i<=$NUM_JOBS; i++))
99do
100 ecs_api_a1_get_job_status 200 joby$i ENABLED 30
101done
102
103
104# Adapter data
105mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
106mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
107
108cr_equal received_callbacks $(($NUM_JOBS*2)) 60
109
110for ((i=1; i<=$NUM_JOBS; i++))
111do
112 cr_equal received_callbacks?id=joby-data$i 2
113done
114
115for ((i=1; i<=$NUM_JOBS; i++))
116do
117 cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-1"}'
118 cr_api_check_single_genric_json_event 200 joby-data$i '{"msg":"msg-3"}'
119done
120
121cr_contains_str remote_hosts $HTTP_PROXY_APP_NAME
122
123#### TEST COMPLETE ####
124
125store_logs END
126
127print_result
128
129auto_clean_environment