418d3b1a5efeafd44f37606efedbd109e460fb6c
[nonrtric.git] / test / auto-test / FTC2003.sh
1 #!/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
20 TC_ONELINE_DESCR="Testing southbound proxy for Dmaap Adapter"
21
22 #App names to include in the test when running docker, space separated list
23 DOCKER_INCLUDED_IMAGES="CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
24
25 #App names to include in the test when running kubernetes, space separated list
26 KUBE_INCLUDED_IMAGES=" CR MR ICS HTTPPROXY KUBEPROXY DMAAPADP"
27 #Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
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
36 SUPPORTED_PROFILES="ORAN-E-RELEASE ORAN-F-RELEASE ORAN-G-RELEASE"
37 #Supported run modes
38 SUPPORTED_RUNMODES="DOCKER KUBE"
39
40 . ../common/testcase_common.sh $@
41
42 setup_testenvironment
43
44 #### TEST BEGIN ####
45
46 #Local vars in test script
47 ##########################
48
49 FLAT_A1_EI="1"
50 NUM_JOBS=10
51
52 clean_environment
53
54 use_cr_https
55 use_ics_rest_https
56 use_mr_https
57 use_dmaapadp_https
58
59 start_kube_proxy
60
61 start_http_proxy
62
63 start_cr 1
64
65 start_ics NOPROXY $SIM_GROUP/$ICS_COMPOSE_DIR/$ICS_CONFIG_FILE
66
67 set_ics_trace
68
69 start_mr
70
71 start_dmaapadp PROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE_TEMPLATE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
72
73 set_dmaapadp_trace
74
75 if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
76     ics_equal json:data-producer/v1/info-producers 1 60
77 else
78     ics_equal json:ei-producer/v1/eiproducers 1 60
79 fi
80
81 ics_api_idc_get_job_ids 200 NOTYPE NOWNER EMPTY
82 ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka
83
84
85 if [[ "$DMAAP_ADP_FEATURE_LEVEL" == *"GENERATED_PROD_NAME"* ]]; then
86     if [ $RUNMODE == "KUBE" ]; then
87         __NAME="https:__$DMAAP_ADP_APP_NAME.$KUBE_NONRTRIC_NAMESPACE:$DMAAP_ADP_EXTERNAL_SECURE_PORT"
88     else
89         __NAME="https:__$DMAAP_ADP_APP_NAME:$DMAAP_ADP_INTERNAL_SECURE_PORT"
90     fi
91     ics_api_edp_get_producer_ids_2 200 NOTYPE $__NAME
92 else
93     ics_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer
94 fi
95
96
97 for ((i=1; i<=$NUM_JOBS; i++))
98 do
99     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-template1.json
100 done
101
102 for ((i=1; i<=$NUM_JOBS; i++))
103 do
104     ics_api_a1_get_job_status 200 joby$i ENABLED 30
105 done
106
107
108 # Adapter data
109 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
110 mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
111
112 cr_equal 0 received_callbacks $(($NUM_JOBS*2)) 60
113
114 for ((i=1; i<=$NUM_JOBS; i++))
115 do
116     cr_equal 0 received_callbacks?id=joby-data$i 2
117 done
118
119 for ((i=1; i<=$NUM_JOBS; i++))
120 do
121     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
122     cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
123 done
124
125 cr_contains_str 0 remote_hosts $HTTP_PROXY_APP_NAME
126
127 #### TEST COMPLETE ####
128
129 store_logs          END
130
131 print_result
132
133 auto_clean_environment