blob: 54f3e4d42ef569079cc7a275796b49145347e365 [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
22# There should be 2 simulator of 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
28KUBE_INCLUDED_IMAGES=" MR CR PRODSTUB KUBEPROXY"
29#Prestarted app (not started by script) to include in the test when running kubernetes, space separated list
BjornMagnussonXA663566c2021-11-08 10:25:07 +010030KUBE_PRESTARTED_IMAGES=" PA RICSIM CP ECS RC SDNC DMAAPMED DMAAPADP"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020031
32#Supported test environment profiles
33SUPPORTED_PROFILES="ORAN-E-RELEASE"
34#Supported run modes
35SUPPORTED_RUNMODES="KUBE"
36
37. ../common/testcase_common.sh $@
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020038
39setup_testenvironment
40
41#### TEST BEGIN ####
42
43use_mr_http #MR only supports http?
44use_cr_https
45use_agent_rest_https
46use_sdnc_https
47use_simulator_https
48use_ecs_rest_https
49use_prod_stub_https
BjornMagnussonXA663566c2021-11-08 10:25:07 +010050
BjornMagnussonXAfec823b2021-08-03 14:14:05 +020051if [ $ECS_VERSION == "V1-1" ]; then
52 use_rapp_catalogue_http # https not yet supported
53else
54 ########################################use_rapp_catalogue_https
55 use_rapp_catalogue_http
56fi
57
58echo -e "$RED CHECK WHY RC HTTPS DOES NOT WORK $ERED"
59
60###############################use_control_panel_https
61use_control_panel_http
62
63if [ "$PMS_VERSION" == "V1" ]; then
64 echo "PMS VERSION 2 (V2) is required"
65 exit 1
66fi
67
68clean_environment
69
70pms_kube_pvc_reset
71
72ecs_kube_pvc_reset
73
74start_kube_proxy
75
76STD_NUM_RICS=2
77OSC_NUM_RICS=2
78
79start_ric_simulators a1-sim-osc $STD_NUM_RICS OSC_2.1.0
80echo " RIC MAPPING a1-sim-osc-0 : ric1"
81echo " RIC MAPPING a1-sim-osc-1 : ric2"
82
83start_ric_simulators a1-sim-std $STD_NUM_RICS STD_1.1.3
84echo " RIC MAPPING a1-sim-std-0 : ric3"
85echo " RIC MAPPING a1-sim-std-1 : ric4"
86
87start_ric_simulators a1-sim-std2 $STD_NUM_RICS STD_2.0.0
88echo " RIC MAPPING a1-sim-std2-0 : ric5"
89echo " RIC MAPPING a1-sim-std2-1 : ric6"
90
91start_mr
92
93start_control_panel
94
95start_sdnc
96
97start_policy_agent
98
BjornMagnussonXA79e37002021-11-22 13:36:04 +010099start_cr 1
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200100
101start_prod_stub
102
103start_ecs NOPROXY
104
105set_ecs_trace
106
107start_rapp_catalogue
108
109set_agent_trace
110
111#### Test RAPP Catalogue ####
112
113rapp_cat_api_get_services 200 EMPTY
114
115rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
116
117rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
118
119#Check the number of services
120rc_equal json:services 1
121
122api_get_status 200
123
124#### Test Policy Management Service ####
125
126# Print the A1 version for STD 1.1.X
127for ((i=0; i<$STD_NUM_RICS; i++))
128do
129 sim_print "a1-sim-std-"$i interface
130done
131
132# Print the A1 version for STD 2.0.X
133for ((i=0; i<$STD_NUM_RICS; i++))
134do
135 sim_print "a1-sim-std2-"$i interface
136done
137
138# Print the A1 version for OSC 2.1.X
139for ((i=0; i<$OSC_NUM_RICS; i++))
140do
141 sim_print "a1-sim-osc-"$i interface
142done
143
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100144# Check the number of policies in STD and STD2
145for ((i=0; i<$STD_NUM_RICS; i++))
146do
147 sim_equal "a1-sim-std-"$i num_instances 0
148 sim_equal "a1-sim-std2-"$i num_instances 0
149done
150
151# Check the number of policies in OSC
152for ((i=0; i<$STD_NUM_RICS; i++))
153do
154 sim_equal "a1-sim-osc-"$i num_instances 0
155done
156
157#Check the number of schemas
158api_equal json:policy-types 1
159
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200160# Load the polictypes in STD 2
161for ((i=0; i<$STD_NUM_RICS; i++))
162do
163 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS_0_2_0 testdata/STD2/sim_qos.json
164 sim_put_policy_type 201 "a1-sim-std2-"$i STD_QOS2_0.1.0 testdata/STD2/sim_qos2.json
165done
166
167# Load the polictypes in OSC
168for ((i=0; i<$OSC_NUM_RICS; i++))
169do
170 sim_put_policy_type 201 "a1-sim-osc-"$i 1 testdata/OSC/sim_1.json
171 sim_put_policy_type 201 "a1-sim-osc-"$i 2 testdata/OSC/sim_2.json
172done
173
174# Check that all rics are synced in
175api_equal json:rics 6 300
176
177#Check the number of schemas and the individual schemas
178api_equal json:policy-types 5 300
179
180for ((i=0; i<$STD_NUM_RICS; i++))
181do
182 ricid=$((3+$i))
183 api_equal json:policy-types?ric_id=ric$ricid 1 120
184done
185
186for ((i=0; i<$STD_NUM_RICS; i++))
187do
188 ricid=$((5+$i))
189 api_equal json:policy-types?ric_id=ric$ricid 2 120
190done
191
192for ((i=0; i<$OSC_NUM_RICS; i++))
193do
194 ricid=$((1+$i))
195 api_equal json:policy-types?ric_id=ric$ricid 2 120
196done
197
198#Check the schemas in STD 2
199for ((i=0; i<$OSC_NUM_RICS; i++))
200do
201 ricid=$((5+$i))
202 api_get_policy_type 200 STD_QOS_0_2_0 testdata/STD2/qos-agent-modified.json
203 api_get_policy_type 200 STD_QOS2_0.1.0 testdata/STD2/qos2-agent-modified.json
204done
205
206# Check the schemas in OSC
207for ((i=0; i<$OSC_NUM_RICS; i++))
208do
209 api_get_policy_type 200 1 testdata/OSC/1-agent-modified.json
210 api_get_policy_type 200 2 testdata/OSC/2-agent-modified.json
211done
212
213if [ "$PMS_VERSION" == "V2" ]; then
214
215 api_equal json:policy-types 5 120
216
217 api_equal json:policies 0
218
219 api_equal json:policy-instances 0
220else
221
222 api_equal json:policy_schemas 5 120
223
224 api_equal json:policy_types 5
225
226 api_equal json:policies 0
227
228 api_equal json:policy_ids 0
229fi
230
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100231api_put_service 201 "Emergency-response-app" 0 "$CR_SERVICE_APP_PATH_0/ER-app"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200232
233# Create policies in STD
234for ((i=0; i<$STD_NUM_RICS; i++))
235do
236 ricid=$((3+$i))
237 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100238 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 +0200239 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100240 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 +0200241done
242
243#Create policies in STD 2
244for ((i=0; i<$STD_NUM_RICS; i++))
245do
246 ricid=$((5+$i))
247 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100248 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 +0200249 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100250 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 +0200251done
252
253# Create policies in OSC
254for ((i=0; i<$OSC_NUM_RICS; i++))
255do
256 ricid=$((1+$i))
257 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100258 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 +0200259 generate_policy_uuid
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100260 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 +0200261done
262
263
264# Check the number of policies in STD and STD2
265for ((i=0; i<$STD_NUM_RICS; i++))
266do
267 sim_equal "a1-sim-std-"$i num_instances 2
268 sim_equal "a1-sim-std2-"$i num_instances 2
269done
270
271# Check the number of policies in OSC
272for ((i=0; i<$STD_NUM_RICS; i++))
273do
274 sim_equal "a1-sim-osc-"$i num_instances 2
275done
276
277stop_policy_agent
278
279start_stopped_policy_agent
280
281# Check PMS state after restart
282
283sleep_wait 200
284
285if [ "$PMS_VERSION" == "V2" ]; then
286
287 api_equal json:policy-types 5 120
288
289 api_equal json:policies 12
290
291 api_equal json:policy-instances 12
292else
293
294 api_equal json:policy_schemas 5 120
295
296 api_equal json:policy_types 5
297
298 api_equal json:policies 12
299
300 api_equal json:policy_ids 12
301fi
302
303# Check the number of policies in STD and STD2
304for ((i=0; i<$STD_NUM_RICS; i++))
305do
306 sim_equal "a1-sim-std-"$i num_instances 2
307 sim_equal "a1-sim-std2-"$i num_instances 2
308done
309
310# Check the number of policies in OSC
311for ((i=0; i<$STD_NUM_RICS; i++))
312do
313 sim_equal "a1-sim-osc-"$i num_instances 2
314done
315
316
317echo "ADD EVENT/STATUS CHECK"
318echo "ADD MR CHECK"
319
320FLAT_A1_EI="1"
321
322ecs_api_admin_reset
323
324CB_JOB="$PROD_STUB_SERVICE_PATH$PROD_STUB_JOB_CALLBACK"
325CB_SV="$PROD_STUB_SERVICE_PATH$PROD_STUB_SUPERVISION_CALLBACK"
326TARGET1="$RIC_SIM_HTTPX://a1-sim-std2-0.a1-sim:$RIC_SIM_PORT/datadelivery"
327TARGET2="$RIC_SIM_HTTPX://a1-sim-std2-1.a1-sim:$RIC_SIM_PORT/datadelivery"
328
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100329STATUS1="$CR_SERVICE_APP_PATH_0/job1-status"
330STATUS2="$CR_SERVICE_APP_PATH_0/job2-status"
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200331
332prodstub_arm_producer 200 prod-a
333prodstub_arm_type 200 prod-a type1
334prodstub_arm_job_create 200 prod-a job1
335prodstub_arm_job_create 200 prod-a job2
336
337
338### ecs status
339ecs_api_service_status 200
340
341## Setup prod-a
342if [ $ECS_VERSION == "V1-1" ]; then
343 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
344
345 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
346else
347 ecs_api_edp_put_type_2 201 type1 testdata/ecs/ei-type-1.json
348 ecs_api_edp_get_type_2 200 type1
349 ecs_api_edp_get_type_ids 200 type1
350
351 ecs_api_edp_put_producer_2 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
352 ecs_api_edp_put_producer_2 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1
353fi
354
355ecs_api_edp_get_producer_status 200 prod-a ENABLED
356
357
358## Create a job for prod-a
359## job1 - prod-a
360if [ -z "$FLAT_A1_EI" ]; then
361 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
362else
363 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
364fi
365
366# Check the job data in the producer
367if [ $ECS_VERSION == "V1-1" ]; then
368 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
369else
370 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
371 prodstub_check_jobdata_3 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
372 else
373 prodstub_check_jobdata_2 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
374 fi
375fi
376
377## Create a second job for prod-a
378## job2 - prod-a
379if [ -z "$FLAT_A1_EI" ]; then
380 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
381else
382 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
383fi
384
385# Check the job data in the producer
386if [ $ECS_VERSION == "V1-1" ]; then
387 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
388else
389 if [[ "$ECS_FEATURE_LEVEL" == *"INFO-TYPES"* ]]; then
390 prodstub_check_jobdata_3 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
391 else
392 prodstub_check_jobdata_2 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
393 fi
394fi
395
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100396# Dmaap mediator and adapter
397start_dmaapadp NOPROXY $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_CONFIG_FILE $SIM_GROUP/$DMAAP_ADP_COMPOSE_DIR/$DMAAP_ADP_DATA_FILE
398
399start_dmaapmed NOPROXY $SIM_GROUP/$DMAAP_MED_COMPOSE_DIR/$DMAAP_MED_DATA_FILE
400
401ecs_equal json:ei-producer/v1/eiproducers 2 60
402
403ecs_api_idc_get_type_ids 200 ExampleInformationType STD_Fault_Messages
404
405ecs_api_edp_get_producer_ids_2 200 NOTYPE DmaapGenericInfoProducer DMaaP_Mediator_Producer
406
407NUM_JOBS=5
408
409for ((i=1; i<=$NUM_JOBS; i++))
410do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100411 ecs_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 +0100412done
413
414for ((i=1; i<=$NUM_JOBS; i++))
415do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100416 ecs_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 +0100417done
418
419for ((i=1; i<=$NUM_JOBS; i++))
420do
421 ecs_api_a1_get_job_status 200 jobx$i ENABLED 30
422done
423
424mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-0"}'
425mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-1"}'
426mr_api_send_json "/events/unauthenticated.dmaapmed.json" '{"msg":"msg-2"}'
427mr_api_send_json "/events/unauthenticated.dmaapadp.json" '{"msg":"msg-3"}'
428
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100429cr_equal 0 received_callbacks $(($NUM_JOBS*2*2)) 60
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100430for ((i=1; i<=$NUM_JOBS; i++))
431do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100432 cr_equal 0 received_callbacks?id=jobx-data$i 2
433 cr_equal 0 received_callbacks?id=joby-data$i 2
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100434done
435
436for ((i=1; i<=$NUM_JOBS; i++))
437do
BjornMagnussonXA79e37002021-11-22 13:36:04 +0100438 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-0"}'
439 cr_api_check_single_genric_json_event 200 0 jobx-data$i '{"msg":"msg-2"}'
440 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-1"}'
441 cr_api_check_single_genric_json_event 200 0 joby-data$i '{"msg":"msg-3"}'
BjornMagnussonXA663566c2021-11-08 10:25:07 +0100442done
443
444
BjornMagnussonXAfec823b2021-08-03 14:14:05 +0200445stop_ecs
446
447start_stopped_ecs
448
449# Check ECS status after restart
450
451if [ -z "$FLAT_A1_EI" ]; then
452 ecs_api_a1_get_job_status 200 type1 job1 DISABLED
453 ecs_api_a1_get_job_status 200 type1 job2 DISABLED
454else
455 ecs_api_a1_get_job_status 200 job1 DISABLED
456 ecs_api_a1_get_job_status 200 job2 DISABLED
457fi
458
459check_policy_agent_logs
460check_ecs_logs
461check_sdnc_logs
462
463#### TEST COMPLETE ####
464
465store_logs END
466
467print_result