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="Preparation demo setup - policy management and enrichment information"
22 #App names to include in the test, space separated list
23 INCLUDED_IMAGES="CBS CONSUL CP CR MR PA RICSIM SDNC ECS PRODSTUB RC"
25 #SUPPORTED TEST ENV FILE
26 SUPPORTED_PROFILES="ONAP-MASTER ORAN-CHERRY"
28 . ../common/testcase_common.sh $@
29 . ../common/agent_api_functions.sh
30 . ../common/ricsimulator_api_functions.sh
31 . ../common/ecs_api_functions.sh
32 . ../common/prodstub_api_functions.sh
33 . ../common/cr_api_functions.sh
34 . ../common/rapp_catalogue_api_functions.sh
38 #Local vars in test script
39 ##########################
47 use_rapp_catalogue_http # https not yet supported
49 if [ "$PMS_VERSION" == "V2" ]; then
50 notificationurl=$CR_PATH"/test"
52 echo "PMS VERSION 2 (V2) is required"
60 start_ric_simulators $RIC_SIM_PREFIX"_g3" $STD_NUM_RICS STD_2.0.0
62 start_mr #Just to prevent errors in the agent log...
70 prepare_consul_config SDNC ".consul_config.json"
71 consul_config_app ".consul_config.json"
90 rapp_cat_api_get_services 200 EMPTY
92 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
94 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
98 # Print the A1 version for STD 2.X
99 for ((i=1; i<=$STD_NUM_RICS; i++))
101 sim_print $RIC_SIM_PREFIX"_g3_"$i interface
103 # Load the polictypes in std
104 for ((i=1; i<=$STD_NUM_RICS; i++))
106 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
107 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
110 #Check the number of schemas and the individual schemas in STD
111 api_equal json:policy-types 2 120
113 for ((i=1; i<=$STD_NUM_RICS; i++))
115 api_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
118 # Check the schemas in STD
119 for ((i=1; i<=$STD_NUM_RICS; i++))
121 api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-agent-modified.json
122 api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-agent-modified.json
125 #Check the number of types
126 api_equal json:policy-types 2 120
128 api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
130 # Create policies in STD
131 for ((i=1; i<=$STD_NUM_RICS; i++))
134 api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 $((2300+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
136 api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g3_"$i 'STD_QOS2_0.1.0' $((2400+$i)) NOTRANSIENT $notificationurl demo-testdata/STD2/pi1_template.json 1
140 # Check the number of policies in STD
141 for ((i=1; i<=$STD_NUM_RICS; i++))
143 sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
150 CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
151 CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
152 TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
153 TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
155 STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
156 STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
158 prodstub_arm_producer 200 prod-a
159 prodstub_arm_type 200 prod-a type1
160 prodstub_arm_job_create 200 prod-a job1
161 prodstub_arm_job_create 200 prod-a job2
165 ecs_api_service_status 200
170 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
172 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
174 ecs_api_edp_get_producer_status 200 prod-a ENABLED
177 ## Create a job for prod-a
179 if [ -z "$FLAT_A1_EI" ]; then
180 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
182 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
185 # Check the job data in the producer
186 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
189 ## Create a second job for prod-a
191 if [ -z "$FLAT_A1_EI" ]; then
192 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
194 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
197 # Check the job data in the producer
198 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
203 check_policy_agent_logs
207 #### TEST COMPLETE ####