blob: 3076bb145be14abe51daabde0bbb65597004b2c5 [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
elinuxhenrik3efd7752022-04-07 07:48:46 +020020TC_ONELINE_DESCR="Testing southbound proxy for Dmaap Adapter"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010021
22#App names to include in the test when running docker, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010023DOCKER_INCLUDED_IMAGES="CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010024
25#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXA007b6452021-11-29 08:03:38 +010026KUBE_INCLUDED_IMAGES=" CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010027#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
BjornMagnussonXAe60d04e2021-12-27 13:38:01 +010036SUPPORTED_PROFILES="ORAN-E-RELEASE ORAN-F-RELEASE"
BjornMagnussonXA663566c2021-11-08 10:25:07 +010037#Supported run modes
38SUPPORTED_RUNMODES="DOCKER KUBE"
39
40. ../common/testcase_common.sh $@
BjornMagnussonXA663566c2021-11-08 10:25:07 +010041
42setup_testenvironment
43
44#### TEST BEGIN ####
45
46#Local vars in test script
47##########################
48
49FLAT_A1_EI="1"
50NUM_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
BjornMagnussonXA007b6452021-11-29 08:03:38 +010075if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
76 ics_equal json:data-producer/v1/info-producers 1 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +010077else
BjornMagnussonXA007b6452021-11-29 08:03:38 +010078 ics_equal json:ei-producer/v1/eiproducers 1 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +010079fi
80
BjornMagnussonXA007b6452021-11-29 08:03:38 +010081ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
82ics_api_idc_get_type_ids 200 ExampleInformationType
BjornMagnussonXA663566c2021-11-08 10:25:07 +010083
84
BjornMagnussonXA007b6452021-11-29 08:03:38 +010085ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer
BjornMagnussonXA663566c2021-11-08 10:25:07 +010086
87for ((i=1; i<=$NUM_JOBS; i++))
88do
BjornMagnussonXA007b6452021-11-29 08:03:38 +010089 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/job-template.json
BjornMagnussonXA663566c2021-11-08 10:25:07 +010090done
91
92for ((i=1; i<=$NUM_JOBS; i++))
93do
BjornMagnussonXA007b6452021-11-29 08:03:38 +010094 ics_api_a1_get_job_status 200 joby$i ENABLED 30
BjornMagnussonXA663566c2021-11-08 10:25:07 +010095done
96
97
98# Adapter data
99mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
100mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
101
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100102cr_equal 0 received_callbacks $(($NUM_JOBS*2)) 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100103
104for ((i=1; i<=$NUM_JOBS; i++))
105do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100106 cr_equal 0 received_callbacks?id=joby-data$i 2
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100107done
108
109for ((i=1; i<=$NUM_JOBS; i++))
110do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100111 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
112 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100113done
114
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100115cr_contains_str 0 remote_hosts $HTTP_PROXY_APP_NAME
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100116
117#### TEST COMPLETE ####
118
119store_logs END
120
121print_result
122
elinuxhenrik3efd7752022-04-07 07:48:46 +0200123auto_clean_environment