blob: c54cb4fff413dc4c46180c075b05df54a1b407b6 [file] [log] [blame]
BjornMagnussonXAfec823b2021-08-03 14:14:05 +02001#!/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
BjornMagnussonXA663566c2021-11-08 10:25:07 +010020TC_ONELINE_DESCR="Sanity test of Non-RT RIC Helm chats - all components - E-RELEASE"
21# This script requires the helm charts for nonrtric, a1simulator and a1controller are installed
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010022# There should be 2 simulator of each A1 interface version started
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020023
24#App names to include in the test when running docker, space separated list
25DOCKER_INCLUDED_IMAGES="" # Not used - KUBE only test script
26
27#App names to include in the test when running kubernetes, space separated list
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010028KUBE_INCLUDED_IMAGES=" MR DMAAPMR CR PRODSTUB KUBEPROXY KAFKAPC"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020029#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010030KUBE_PRESTARTED_IMAGES=" A1PMS RICSIM CP ICS RC SDNC DMAAPMED DMAAPADP"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020031
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +010032#Ignore image in DOCKER_INCLUDED_IMAGES, KUBE_INCLUDED_IMAGES if
33#the image is not configured in the supplied env_file
34#Used for images not applicable to all supported profile
35CONDITIONALLY_IGNORED_IMAGES=""
36
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020037#Supported test environment profiles
38SUPPORTED_PROFILES="ORAN-E-RELEASE"
39#Supported run modes
40SUPPORTED_RUNMODES="KUBE"
41
42. ../common/testcase_common.sh $@
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020043
44setup_testenvironment
45
46#### TEST BEGIN ####
47
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010048use_mr_https
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020049use_cr_https
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010050use_a1pms_rest_https
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020051use_sdnc_https
52use_simulator_https
BjornMagnussonXA007b6452021-11-29 08:03:38 +010053use_ics_rest_https
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020054use_prod_stub_https
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010055use_dmaapmed_https
BjornMagnussonXA663566c2021-11-08 10:25:07 +010056
BjornMagnussonXA007b6452021-11-29 08:03:38 +010057if [ $ICS_VERSION == "V1-1" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020058 use_rapp_catalogue_http # https not yet supported
59else
60 ########################################use_rapp_catalogue_https
61 use_rapp_catalogue_http
62fi
63
64echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
65
66###############################use_control_panel_https
67use_control_panel_http
68
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010069if [ "$A1PMS_VERSION" == "V1" ]; then
70 echo "A1PMS VERSION 2 (V2) is required"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020071 exit 1
72fi
73
74clean_environment
75
BjornMagnussonXA007b6452021-11-29 08:03:38 +010076ics_kube_pvc_reset
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020077
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +010078a1pms_kube_pvc_reset
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010079
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020080start_kube_proxy
81
82STD_NUM_RICS=2
83OSC_NUM_RICS=2
84
85start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
86echo " RIC MAPPING a1-sim-osc-0 : ric1"
87echo " RIC MAPPING a1-sim-osc-1 : ric2"
88
89start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
90echo " RIC MAPPING a1-sim-std-0 : ric3"
91echo " RIC MAPPING a1-sim-std-1 : ric4"
92
93start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
94echo " RIC MAPPING a1-sim-std2-0 : ric5"
95echo " RIC MAPPING a1-sim-std2-1 : ric6"
96
BjornMagnussonXAdfdca182021-12-10 10:43:32 +010097start_mr "$MR_READ_TOPIC" "/events" "users/policy-agent" \
98 "$MR_WRITE_TOPIC" "/events" "users/mr-stub" \
99 "unauthenticated.dmaapmed.json" "/events" "dmaapmediatorproducer/STD_Fault_Messages" \
100 "unauthenticated.dmaapadp.json" "/events" "dmaapadapterproducer/msgs"
101
102start_kafkapc
103
104kafkapc_api_create_topic 201 "unauthenticated.dmaapadp_kafka.text" "text/plain"
105
106kafkapc_api_start_sending 200 "unauthenticated.dmaapadp_kafka.text"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200107
108start_control_panel
109
110start_sdnc
111
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100112start_a1pms
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200113
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100114start_cr 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200115
116start_prod_stub
117
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100118start_ics NOPROXY
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200119
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100120set_ics_trace
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200121
122start_rapp_catalogue
123
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100124set_a1pms_trace
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200125
126#### Test RAPP Catalogue ####
127
128rapp_cat_api_get_services 200 EMPTY
129
130rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
131
132rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
133
134#Check the number of services
135rc_equal json:services 1
136
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100137a1_a1pms_api_get_status 200
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200138
139#### Test Policy Management Service ####
140
141# Print the A1 version for STD 1.1.X
142for ((i=0; i<$STD_NUM_RICS; i++))
143do
144 sim_print "a1-sim-std-"$i interface
145done
146
147# Print the A1 version for STD 2.0.X
148for ((i=0; i<$STD_NUM_RICS; i++))
149do
150 sim_print "a1-sim-std2-"$i interface
151done
152
153# Print the A1 version for OSC 2.1.X
154for ((i=0; i<$OSC_NUM_RICS; i++))
155do
156 sim_print "a1-sim-osc-"$i interface
157done
158
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100159# Check the number of policies in STD and STD2
160for ((i=0; i<$STD_NUM_RICS; i++))
161do
162 sim_equal "a1-sim-std-"$i num_instances 0
163 sim_equal "a1-sim-std2-"$i num_instances 0
164done
165
166# Check the number of policies in OSC
167for ((i=0; i<$STD_NUM_RICS; i++))
168do
169 sim_equal "a1-sim-osc-"$i num_instances 0
170done
171
172#Check the number of schemas
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100173a1pms_equal json:policy-types 1
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100174
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200175# Load the polictypes in STD 2
176for ((i=0; i<$STD_NUM_RICS; i++))
177do
178 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
179 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
180done
181
182# Load the polictypes in OSC
183for ((i=0; i<$OSC_NUM_RICS; i++))
184do
185 sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
186 sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
187done
188
189# Check that all rics are synced in
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100190a1pms_equal json:rics 6 300
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200191
192#Check the number of schemas and the individual schemas
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100193a1pms_equal json:policy-types 5 300
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200194
195for ((i=0; i<$STD_NUM_RICS; i++))
196do
197 ricid=$((3+$i))
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100198 a1pms_equal json:policy-types?ric_id=ric$ricid 1 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200199done
200
201for ((i=0; i<$STD_NUM_RICS; i++))
202do
203 ricid=$((5+$i))
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100204 a1pms_equal json:policy-types?ric_id=ric$ricid 2 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200205done
206
207for ((i=0; i<$OSC_NUM_RICS; i++))
208do
209 ricid=$((1+$i))
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100210 a1pms_equal json:policy-types?ric_id=ric$ricid 2 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200211done
212
213#Check the schemas in STD 2
214for ((i=0; i<$OSC_NUM_RICS; i++))
215do
216 ricid=$((5+$i))
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100217 a1_a1pms_api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-a1pms-modified.json
218 a1_a1pms_api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-a1pms-modified.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200219done
220
221# Check the schemas in OSC
222for ((i=0; i<$OSC_NUM_RICS; i++))
223do
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100224 a1_a1pms_api_get_policy_type 200 1 testdata/OSC/1-a1pms-modified.json
225 a1_a1pms_api_get_policy_type 200 2 testdata/OSC/2-a1pms-modified.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200226done
227
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100228if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200229
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100230 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200231
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100232 a1pms_equal json:policies 0
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200233
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100234 a1pms_equal json:policy-instances 0
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200235else
236
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100237 a1pms_equal json:policy_schemas 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200238
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100239 a1pms_equal json:policy_types 5
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200240
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100241 a1pms_equal json:policies 0
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200242
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100243 a1pms_equal json:policy_ids 0
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200244fi
245
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100246a1pms_api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/ER-app"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200247
248# Create policies in STD
249for ((i=0; i<$STD_NUM_RICS; i++))
250do
251 ricid=$((3+$i))
252 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100253 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD/pi1_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200254 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100255 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid NOTYPE $((1200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD/pi1_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200256done
257
258#Create policies in STD 2
259for ((i=0; i<$STD_NUM_RICS; i++))
260do
261 ricid=$((5+$i))
262 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100263 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS_0_2_0 $((2100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD2/pi_qos_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200264 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100265 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid STD_QOS2_0.1.0 $((2200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"std2" testdata/STD2/pi_qos2_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200266done
267
268# Create policies in OSC
269for ((i=0; i<$OSC_NUM_RICS; i++))
270do
271 ricid=$((1+$i))
272 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100273 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid 1 $((3100+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"osc" testdata/OSC/pi1_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200274 generate_policy_uuid
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100275 a1pms_api_put_policy 201 "Emergency-response-app" ric$ricid 2 $((3200+$i)) NOTRANSIENT $CR_SERVICE_APP_PATH_0/"osc" testdata/OSC/pi2_template.json 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200276done
277
278
279# Check the number of policies in STD and STD2
280for ((i=0; i<$STD_NUM_RICS; i++))
281do
282 sim_equal "a1-sim-std-"$i num_instances 2
283 sim_equal "a1-sim-std2-"$i num_instances 2
284done
285
286# Check the number of policies in OSC
287for ((i=0; i<$STD_NUM_RICS; i++))
288do
289 sim_equal "a1-sim-osc-"$i num_instances 2
290done
291
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100292stop_a1pms
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200293
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100294start_stopped_a1pms
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200295
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100296# Check A1PMS state after restart
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200297
298sleep_wait 200
299
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100300if [ "$A1PMS_VERSION" == "V2" ]; then
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200301
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100302 a1pms_equal json:policy-types 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200303
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100304 a1pms_equal json:policies 12
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200305
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100306 a1pms_equal json:policy-instances 12
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200307else
308
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100309 a1pms_equal json:policy_schemas 5 120
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200310
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100311 a1pms_equal json:policy_types 5
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200312
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100313 a1pms_equal json:policies 12
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200314
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100315 a1pms_equal json:policy_ids 12
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200316fi
317
318# Check the number of policies in STD and STD2
319for ((i=0; i<$STD_NUM_RICS; i++))
320do
321 sim_equal "a1-sim-std-"$i num_instances 2
322 sim_equal "a1-sim-std2-"$i num_instances 2
323done
324
325# Check the number of policies in OSC
326for ((i=0; i<$STD_NUM_RICS; i++))
327do
328 sim_equal "a1-sim-osc-"$i num_instances 2
329done
330
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100331cr_api_reset 0 # Reset CR to count new events
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200332
333echo "ADD EVENT/STATUS CHECK"
334echo "ADD MR CHECK"
335
336FLAT_A1_EI="1"
337
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100338ics_api_admin_reset
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200339
340CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
341CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
342TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
343TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
344
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100345STATUS1="$CR_SERVICE_APP_PATH_0/job1-status"
346STATUS2="$CR_SERVICE_APP_PATH_0/job2-status"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200347
348prodstub_arm_producer 200 prod-a
349prodstub_arm_type 200 prod-a type1
350prodstub_arm_job_create 200 prod-a job1
351prodstub_arm_job_create 200 prod-a job2
352
353
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100354### ics status
355ics_api_service_status 200
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200356
357## Setup prod-a
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100358if [ $ICS_VERSION == "V1-1" ]; then
359 ics_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200360
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100361 ics_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ics/ei-type-1.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200362else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100363 ics_api_edp_put_type_2 201 type1 testdata/ics/ei-type-1.json
364 ics_api_edp_get_type_2 200 type1
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100365
366 ics_api_edp_get_type_ids 200 type1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200367
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100368 ics_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
369 ics_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200370fi
371
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100372ics_api_edp_get_producer_status 200 prod-a ENABLED
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200373
374
375## Create a job for prod-a
376## job1 - prod-a
377if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100378 ics_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200379else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100380 ics_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200381fi
382
383# Check the job data in the producer
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100384if [ $ICS_VERSION == "V1-1" ]; then
385 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200386else
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100387 if [[ "$ICS_FEATURE3LEVEL" == *"INFO-TYPES"* ]]; then
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100388 prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200389 else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100390 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200391 fi
392fi
393
394## Create a second job for prod-a
395## job2 - prod-a
396if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100397 ics_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200398else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100399 ics_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200400fi
401
402# Check the job data in the producer
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100403if [ $ICS_VERSION == "V1-1" ]; then
404 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200405else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100406 if [[ "$ICS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
407 prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200408 else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100409 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ics/job-template.json
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200410 fi
411fi
412
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100413# Dmaap mediator and adapter
414start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
415
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100416start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_HOST_DATA_FILE
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100417
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100418ics_equal json:data-producer/v1/info-producers 3 120
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100419
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100420ics_equal json:data-producer/v1/info-types 4 30
421
422ics_api_idc_get_type_ids 200 ExampleInformationType ExampleInformationTypeKafka STD_Fault_Messages type1
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100423
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100424ics_api_edp_get_producer_ids_2 200 NOTYPE prod-a DmaapGenericInfoProducer DMaaP_Mediator_Producer
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100425
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100426NUM_JOBS=1
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100427
428for ((i=1; i<=$NUM_JOBS; i++))
429do
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100430 ics_api_idc_put_job 201 jobx$i STD_Fault_Messages $CR_SERVICE_MR_PATH_0/jobx-data$i info-ownerx$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerx$i testdata/dmaap-adapter/job-template.json
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100431done
432
433for ((i=1; i<=$NUM_JOBS; i++))
434do
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100435 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
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100436 ics_api_idc_put_job 201 jobz$i ExampleInformationTypeKafka $CR_SERVICE_MR_PATH_0/jobz-data$i info-ownerz$i $CR_SERVICE_MR_PATH_0/job_status_info-ownerz$i testdata/dmaap-adapter/job-template-1-kafka.json
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100437done
438
439for ((i=1; i<=$NUM_JOBS; i++))
440do
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100441 ics_api_a1_get_job_status 200 jobx$i ENABLED 30
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100442 ics_api_a1_get_job_status 200 joby$i ENABLED 30
443 ics_api_a1_get_job_status 200 jobz$i ENABLED 30
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100444done
445
BjornMagnussonXA8fbb2262022-01-24 15:20:15 +0100446sleep_wait 30 # Wait for mediator to listening to kafka
447
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100448mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
449mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
450mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
451mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100452kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------4'
453kafkapc_api_post_msg 200 "unauthenticated.dmaapadp_kafka.text" "text/plain" 'Message-------6'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100454
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100455
456cr_equal 0 received_callbacks $(($NUM_JOBS*2*3)) 200
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100457for ((i=1; i<=$NUM_JOBS; i++))
458do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100459 cr_equal 0 received_callbacks?id=jobx-data$i 2
460 cr_equal 0 received_callbacks?id=joby-data$i 2
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100461 cr_equal 0 received_callbacks?id=jobz-data$i 2
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100462done
463
464for ((i=1; i<=$NUM_JOBS; i++))
465do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100466 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-0"}'
467 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
468 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
469 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
BjornMagnussonXAdfdca182021-12-10 10:43:32 +0100470 cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------4'
471 cr_api_check_single_genric_json_event 200 0 jobz-data$i 'Message-------6'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100472done
473
474
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100475stop_ics
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200476
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100477start_stopped_ics
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200478
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100479# Check ICS status after restart
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200480
481if [ -z "$FLAT_A1_EI" ]; then
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100482 ics_api_a1_get_job_status 200 type1 job1 DISABLED
483 ics_api_a1_get_job_status 200 type1 job2 DISABLED
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200484else
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100485 ics_api_a1_get_job_status 200 job1 DISABLED
486 ics_api_a1_get_job_status 200 job2 DISABLED
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200487fi
488
BjornMagnussonXAd2aeca82022-03-07 11:04:55 +0100489check_a1pms_logs
BjornMagnussonXA007b6452021-11-29 08:03:38 +0100490check_ics_logs
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200491check_sdnc_logs
492
493#### TEST COMPLETE ####
494
495store_logs END
496
497print_result