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
10 # http://www.apache.org/licenses/LICENSE-2.0
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=================================================
20 TC_ONELINE_DESCR="App test DMAAP Meditor and DMAAP Adapter with 100 jobs,types and topics"
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR KAFKAPC HTTPPROXY"
25 #App names to include in the test when running kubernetes, space separated list
26 KUBE_INCLUDED_IMAGES=" ICS DMAAPMED DMAAPADP KUBEPROXY MR DMAAPMR CR KAFKAPC HTTPPROXY"
28 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
29 KUBE_PRESTARTED_IMAGES=""
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
34 CONDITIONALLY_IGNORED_IMAGES=""
36 #Supported test environment profiles
37 SUPPORTED_PROFILES="ORAN-E-RELEASE ORAN-F-RELEASE ORAN-G-RELEASE ORAN-H-RELEASE"
39 SUPPORTED_RUNMODES="DOCKER KUBE"
41 . ../common/testcase_common.sh $@
47 #Local vars in test script
48 ##########################
50 NUM_CR=1 # Number of callback receivers, max 1
51 ## Note: The number jobs must be a multiple of the number of CRs in order to calculate the number of expected event in each CR
52 NUM_JOBS=100 # Mediator and adapter gets same number of jobs for every type
53 if [ $NUM_CR -gt 1 ]; then
54 __log_conf_fail_general "Max number of callback receivers is one in this test"
70 start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE
78 for ((i=1; i<=$NUM_JOBS; i++))
80 kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text$i" "text/plain"
82 kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text$i"
86 adp_config_data='{"types": ['
87 for ((i=1; i<=$NUM_JOBS; i++))
90 adp_config_data=$adp_config_data','
92 adp_config_data=$adp_config_data'{"id": "ADPKafkaType'$i'","kafkaInputTopic": "unauthenticated.dmaapadp_kafka.text'$i'","useHttpProxy": false}'
93 adp_med_type_list="$adp_med_type_list ADPKafkaType$i "
95 adp_config_data=$adp_config_data']}'
96 echo $adp_config_data > tmp/adp_config_data.json
98 start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE_TEMPLATE tmp/adp_config_data.json
102 if [[ "$DMAAP_MED_FEATURE_LEVEL" == *"KAFKATYPES"* ]]; then
103 for ((i=1; i<=$NUM_JOBS; i++))
105 kafkapc_api_create_topic 201 "unauthenticated.dmaapmed_kafka.text$i" "text/plain"
107 kafkapc_api_start_sending 200 "unauthenticated.dmaapmed_kafka.text$i"
111 med_config_data='{"types": ['
112 for ((i=1; i<=$NUM_JOBS; i++))
114 if [ $i -ne 1 ]; then
115 med_config_data=$med_config_data','
117 med_config_data=$med_config_data'{"id": "MEDKafkaType'$i'","kafkaInputTopic": "unauthenticated.dmaapmed_kafka.text'$i'"}'
118 adp_med_type_list="$adp_med_type_list MEDKafkaType$i "
120 med_config_data=$med_config_data']}'
121 echo $med_config_data > tmp/med_config_data.json
123 start_dmaapmed NOPROXY tmp/med_config_data.json
125 ics_equal json:data-producer/v1/info-producers 2 60
128 ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
129 if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"GENERATED_PROD_NAME"* ]]; then
130 if [ $RUNMODE == "KUBE" ]; then
131 __NAME="https:__$DMAAP_ADP_APP_NAME.$KUBE_NONRTRIC_NAMESPACE:$DMAAP_ADP_EXTERNAL_SECURE_PORT"
133 __NAME="https:__$DMAAP_ADP_APP_NAME:$DMAAP_ADP_INTERNAL_SECURE_PORT"
135 ics_api_edp_get_producer_ids_2 200 NOTYPE $__NAME DMaaP_Mediator_Producer
137 ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
140 ics_api_idc_get_type_ids 200 $adp_med_type_list
143 # Create jobs for adapter kafka - CR stores data as MD5 hash
144 start_timer "Create adapter (kafka) jobs: $NUM_JOBS"
145 for ((i=1; i<=$NUM_JOBS; i++))
147 # Max buffer timeout for is about 160 sec for Adator jobs"
148 adp_timeout=$(($i*1000))
149 if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"FILTERSPEC"* ]]; then
150 deviation "It is possible to give filter without filtertype without error indication"
151 if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"FILTERSCHEMA"* ]]; then
152 adp_config_data='{"filterType": "regexp", "filter":"Message*","maxConcurrency": 1,"bufferTimeout": {"maxSize": 100,"maxTimeMilliseconds": '$adp_timeout'}}'
154 adp_config_data='{"filterType": "regexp", "filter":"Message*","maxConcurrency": 1,"bufferTimeout": {"maxSize": 100,"maxTimeMiliseconds": '$adp_timeout'}}'
157 if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"FILTERSCHEMA"* ]]; then
158 adp_config_data='{"filter":"Message*","maxConcurrency": 1,"bufferTimeout": {"maxSize": 100,"maxTimeMilliseconds": '$adp_timeout'}}'
160 adp_config_data='{"filter":"Message*","maxConcurrency": 1,"bufferTimeout": {"maxSize": 100,"maxTimeMiliseconds": '$adp_timeout'}}'
163 echo $adp_config_data > tmp/adp_config_data.json
165 cr_index=$(($i%$NUM_CR))
166 service_text="CR_SERVICE_TEXT_PATH_"$cr_index
167 service_app="CR_SERVICE_APP_PATH_"$cr_index
168 ics_api_idc_put_job 201 job-adp-kafka-$i "ADPKafkaType$i" ${!service_text}/job-adp-kafka-data$i"?storeas=md5" info-owner-adp-kafka-$i ${!service_app}/callbacks-null tmp/adp_config_data.json
173 if [[ "$DMAAP_MED_FEATURE_LEVEL" == *"KAFKATYPES"* ]]; then
174 # Create jobs for mediator kafka - CR stores data as MD5 hash
175 start_timer "Create mediator (kafka) jobs: $NUM_JOBS"
176 for ((i=1; i<=$NUM_JOBS; i++))
178 med_timeout=$(($i*5000))
179 if [[ "$DMAAP_MED_FEATURE_LEVEL" == *"FILTERSCHEMA"* ]]; then
180 med_config_data='{"bufferTimeout": {"maxSize": 100,"maxTimeMilliseconds": '$med_timeout'}}'
182 med_config_data='{"bufferTimeout": {"maxSize": 100,"maxTimeMiliseconds": '$med_timeout'}}'
184 echo $med_config_data > tmp/med_config_data.json
185 cr_index=$(($i%$NUM_CR))
186 service_text="CR_SERVICE_TEXT_PATH_"$cr_index
187 service_app="CR_SERVICE_APP_PATH_"$cr_index
188 ics_api_idc_put_job 201 job-med-kafka-$i "MEDKafkaType$i" ${!service_text}/job-med-kafka-data$i"?storeas=md5" info-owner-med-kafka-$i ${!service_app}/callbacks-null tmp/med_config_data.json
194 for ((i=1; i<=$NUM_JOBS; i++))
196 ics_api_a1_get_job_status 200 job-adp-kafka-$i ENABLED 30
197 if [[ "$DMAAP_MED_FEATURE_LEVEL" == *"KAFKATYPES"* ]]; then
198 ics_api_a1_get_job_status 200 job-med-kafka-$i ENABLED 30
203 EXPECTED_DATA_DELIV=0 #Total delivered msg per CR
204 EXPECTED_BATCHES_DELIV=0 #Total delivered batches per CR
205 DATA_DELIV_JOBS=0 #Total delivered msg per job per CR
209 start_timer "Data delivery adapter kafka, 2 strings per job (short buffer timeouts)"
210 # Send small text via message-router to adapter
211 for ((i=1; i<=$NUM_JOBS; i++))
213 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text"$i "text/plain" 'Message-------1'$i
214 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text"$i "text/plain" 'Discard-------3'$i #Should be filtered out
215 kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text"$i "text/plain" 'Message-------3'$i
217 for ((i=1; i<=$NUM_JOBS; i++))
219 kafkapc_equal topics/unauthenticated.dmaapadp_kafka.text$i/counters/sent 3 30
222 # Wait for data recetption, adapter kafka
223 EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$EXPECTED_DATA_DELIV))
224 EXPECTED_BATCHES_DELIV=$(($NUM_JOBS/$NUM_CR+$EXPECTED_BATCHES_DELIV))
226 adp_timeout=$(($NUM_JOBS*1*2+60)) #NUM_JOBS*MIN_BUFFERTIMEOUT*2+60_SEC_DELAY
227 for ((i=0; i<$NUM_CR; i++))
229 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV $adp_timeout
230 cr_greater_or_equal $i received_callback_batches $EXPECTED_BATCHES_DELIV
234 # Check received data callbacks from adapter
235 for ((i=1; i<=$NUM_JOBS; i++))
237 cr_index=$(($i%$NUM_CR))
238 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------1'$i
239 cr_api_check_single_genric_event_md5 200 $cr_index job-adp-kafka-data$i 'Message-------3'$i
242 if [[ "$DMAAP_MED_FEATURE_LEVEL" == *"KAFKATYPES"* ]]; then
244 PREV_DATA_DELIV=$(cr_read 0 received_callbacks)
245 PREV_BATCHES_DELIV=$(cr_read 0 received_callback_batches)
246 start_timer "Data delivery mediator kafka, 2 strings per job (long buffer timeouts)"
247 # Send small text via message-router to mediator
248 for ((i=1; i<=$NUM_JOBS; i++))
250 kafkapc_api_post_msg 200 "unauthenticated.dmaapmed_kafka.text$i" "text/plain" 'Message-------0'$i
251 kafkapc_api_post_msg 200 "unauthenticated.dmaapmed_kafka.text$i" "text/plain" 'Message-------2'$i
253 for ((i=1; i<=$NUM_JOBS; i++))
255 kafkapc_equal topics/unauthenticated.dmaapmed_kafka.text$i/counters/sent 2 30
258 # Wait for data recetption, adapter kafka
260 EXPECTED_DATA_DELIV=$(($NUM_JOBS*2/$NUM_CR+$PREV_DATA_DELIV))
261 EXPECTED_BATCHES_DELIV=$(($NUM_JOBS/$NUM_CR+$PREV_BATCHES_DELIV))
263 med_timeout=$(($NUM_JOBS*5*2+60)) #NUM_JOBS*MIN_BUFFERTIMEOUT*2+60_SEC_DELAY
264 for ((i=0; i<$NUM_CR; i++))
266 cr_equal $i received_callbacks $EXPECTED_DATA_DELIV $med_timeout
267 cr_greater_or_equal $i received_callback_batches $EXPECTED_BATCHES_DELIV
272 # Check received data callbacks from mediator
273 for ((i=1; i<=$NUM_JOBS; i++))
275 cr_index=$(($i%$NUM_CR))
276 cr_api_check_single_genric_event_md5 200 $cr_index job-med-kafka-data$i 'Message-------0'$i
277 cr_api_check_single_genric_event_md5 200 $cr_index job-med-kafka-data$i 'Message-------2'$i
281 #### TEST COMPLETE ####
287 auto_clean_environment