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-HONOLULU ORAN-CHERRY ORAN-DAWN"
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"
88 rapp_cat_api_get_services 200 EMPTY
90 rapp_cat_api_put_service 201 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
92 rapp_cat_api_get_services 200 "Emergency-response-app" v1 "Emergency-response-app" "Emergency-response-app"
96 # Print the A1 version for STD 2.X
97 for ((i=1; i<=$STD_NUM_RICS; i++))
99 sim_print $RIC_SIM_PREFIX"_g3_"$i interface
101 # Load the polictypes in std
102 for ((i=1; i<=$STD_NUM_RICS; i++))
104 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS_0_2_0 demo-testdata/STD2/sim_qos.json
105 sim_put_policy_type 201 $RIC_SIM_PREFIX"_g3_"$i STD_QOS2_0.1.0 demo-testdata/STD2/sim_qos2.json
108 #Check the number of schemas and the individual schemas in STD
109 api_equal json:policy-types 2 120
111 for ((i=1; i<=$STD_NUM_RICS; i++))
113 api_equal json:policy-types?ric_id=$RIC_SIM_PREFIX"_g3_"$i 2 120
116 # Check the schemas in STD
117 for ((i=1; i<=$STD_NUM_RICS; i++))
119 api_get_policy_type 200 STD_QOS_0_2_0 demo-testdata/STD2/qos-agent-modified.json
120 api_get_policy_type 200 'STD_QOS2_0.1.0' demo-testdata/STD2/qos2-agent-modified.json
123 #Check the number of types
124 api_equal json:policy-types 2 120
126 api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
128 # Create policies in STD
129 for ((i=1; i<=$STD_NUM_RICS; i++))
132 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
134 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
138 # Check the number of policies in STD
139 for ((i=1; i<=$STD_NUM_RICS; i++))
141 sim_equal $RIC_SIM_PREFIX"_g3_"$i num_instances 2
148 CB_JOB="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/job"
149 CB_SV="$PROD_STUB_HTTPX://$PROD_STUB_APP_NAME:$PROD_STUB_PORT/callbacks/supervision"
150 TARGET1="$RIC_SIM_HTTPX://ricsim_g3_1:$RIC_SIM_PORT/datadelivery"
151 TARGET2="$RIC_SIM_HTTPX://ricsim_g3_2:$RIC_SIM_PORT/datadelivery"
153 STATUS1="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job1-status"
154 STATUS2="$CR_HTTPX://$CR_APP_NAME:$CR_PORT/callbacks/job2-status"
156 prodstub_arm_producer 200 prod-a
157 prodstub_arm_type 200 prod-a type1
158 prodstub_arm_job_create 200 prod-a job1
159 prodstub_arm_job_create 200 prod-a job2
163 ecs_api_service_status 200
168 ecs_api_edp_put_producer 201 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
170 ecs_api_edp_get_producer 200 prod-a $CB_JOB/prod-a $CB_SV/prod-a type1 testdata/ecs/ei-type-1.json
172 ecs_api_edp_get_producer_status 200 prod-a ENABLED
175 ## Create a job for prod-a
177 if [ -z "$FLAT_A1_EI" ]; then
178 ecs_api_a1_put_job 201 type1 job1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
180 ecs_api_a1_put_job 201 job1 type1 $TARGET1 ricsim_g3_1 $STATUS1 testdata/ecs/job-template.json
183 # Check the job data in the producer
184 prodstub_check_jobdata 200 prod-a job1 type1 $TARGET1 ricsim_g3_1 testdata/ecs/job-template.json
187 ## Create a second job for prod-a
189 if [ -z "$FLAT_A1_EI" ]; then
190 ecs_api_a1_put_job 201 type1 job2 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
192 ecs_api_a1_put_job 201 job2 type1 $TARGET2 ricsim_g3_2 $STATUS2 testdata/ecs/job-template.json
195 # Check the job data in the producer
196 prodstub_check_jobdata 200 prod-a job2 type1 $TARGET2 ricsim_g3_2 testdata/ecs/job-template.json
201 check_policy_agent_logs
205 #### TEST COMPLETE ####