.output.*
.sdnc*
.timer*
+.pid*
TC_ONELINE_DESCR="Sanity test, create service and then create,update and delete a policy using http/https and Agent REST/DMAAP with/without SDNC controller"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
echo "########### A1 Policy Management ###########"
echo "############################################"
- api_put_policy 201 "serv1" ricsim_g1_1 1 5000 testdata/OSC/pi1_template.json
- api_put_policy 200 "serv1" ricsim_g1_1 1 5000 testdata/OSC/pi1_template.json
+ api_put_policy 201 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+ api_put_policy 200 "serv1" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
- api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 testdata/STD/pi1_template.json
- api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 testdata/STD/pi1_template.json
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
+ api_put_policy 200 "serv1" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
api_delete_policy 204 5000
TC_ONELINE_DESCR="Basic use case, register service, create/update policy, delete policy, de-register service using both STD and OSC interface while mixing REST and Dmaap"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
api_put_service 201 "service1" 3600 "$CR_PATH/1"
-api_put_policy 201 "service1" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 1
use_agent_dmaap
-api_put_policy 201 "service1" ricsim_g1_1 1 3000 testdata/OSC/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
use_agent_rest_http
-api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 testdata/STD/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 1
use_agent_dmaap
-api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 testdata/STD/pi1_template.json 1
+api_put_policy 201 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
#Update policies
use_agent_rest_http
-api_put_service 200 "service1" 3600 "$CR_PATH/callbacks/1"
+api_put_service 200 "service1" 3600 "$CR_PATH/1"
-api_put_policy 200 "service1" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
use_agent_dmaap
-api_put_policy 200 "service1" ricsim_g1_1 1 3000 testdata/OSC/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g1_1 1 3000 NOTRANSIENT testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 2
use_agent_rest_http
-api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 testdata/STD/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 2100 NOTRANSIENT testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
use_agent_dmaap
-api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 testdata/STD/pi1_template.json 1
+api_put_policy 200 "service1" ricsim_g2_1 NOTYPE 3100 NOTRANSIENT testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 2
TC_ONELINE_DESCR="Full agent API walk through using agent REST/DMAAP and with/without SDNC A1 Controller"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
deviation "TR10 - agent allows policy creation on unregistered service (orig problem) - test combo $interface and $__httpx"
#Kept until decison
- #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json
+ #api_put_policy 400 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
#Allow 201 for now
- api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json
+ api_put_policy 201 "unregistered-service" ricsim_g1_1 1 2000 NOTRANSIENT testdata/OSC/pi1_template.json
+
+ api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 true testdata/OSC/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g1_1 1 5000 false testdata/OSC/pi1_template.json
- api_put_policy 201 "service10" ricsim_g1_1 1 5000 testdata/OSC/pi1_template.json
- api_put_policy 200 "service10" ricsim_g1_1 1 5000 testdata/OSC/pi1_template.json
+ api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 NOTRANSIENT testdata/STD/pi1_template.json
- api_put_policy 201 "service10" ricsim_g2_1 NOTYPE 5100 testdata/STD/pi1_template.json
- api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 true testdata/STD/pi1_template.json
+ api_put_policy 200 "service10" ricsim_g2_1 NOTYPE 5100 false testdata/STD/pi1_template.json
VAL='NOT IN EFFECT'
api_get_policy_status 200 5000 OSC "$VAL" "false"
TC_ONELINE_DESCR="Testing of service registration timeouts and keepalive"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDMC SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
api_put_services_keepalive 404 "service3"
api_put_services_keepalive 404 "service4"
+# Policy delete after timeout
+api_put_service 201 "service10" 600 "$CR_PATH/service10"
+
+sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
+
+api_equal json:rics 1 60
+
+api_equal json:policy_schemas 1 120
+
+api_equal json:policy_types 1
+
+api_equal json:policies 0
+
+api_put_policy 201 "service10" ricsim_g1_1 1 5000 NOTRANSIENT testdata/OSC/pi1_template.json
+
+api_equal json:policies 1
+
+sim_equal ricsim_g1_1 num_instances 1
+
+api_put_policy 201 "service10" ricsim_g1_1 1 5001 true testdata/OSC/pi1_template.json
+
+api_equal json:policies 2
+
+sim_equal ricsim_g1_1 num_instances 2
+
+sim_post_delete_instances 200 ricsim_g1_1
+
+#Wait for recreate of non transient policy
+api_equal json:policies 1 180
+
+sim_equal ricsim_g1_1 num_instances 1
+
+api_put_service 200 "service10" 10 "$CR_PATH/service10"
+
+#Wait for service expiry
+api_equal json:policies 0 120
+
+sim_equal ricsim_g1_1 num_instances 0
+
+
api_get_service_ids 200
deviation "TR18 Agents sends callback with empty body"
TC_ONELINE_DESCR="Sample tests of the SDNC A1 controller restconf API using http/https (no agent)"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="PA CP SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/controller_api_functions.sh
. ../common/ricsimulator_api_functions.sh
TC_ONELINE_DESCR="Resync 10000 policies using OSC interface over REST"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulator
- api_put_service 201 "rapp1" 3600 "$CR_PATH/callbacks/1"
+ api_put_service 201 "serv1" 3600 "$CR_PATH/1"
START_ID=2000
NUM_POLICIES=10000
if [[ $interface == *"BATCH"* ]]; then
- api_put_policy_batch 201 "rapp1" ricsim_g1_1 1 $START_ID testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
else
- api_put_policy 201 "rapp1" ricsim_g1_1 1 $START_ID testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
fi
sim_equal ricsim_g1_1 num_instances 10000
START_ID=$(($START_ID+$NUM_POLICIES))
if [[ $interface == *"BATCH"* ]]; then
- api_put_policy_batch 201 "rapp1" ricsim_g2_1 NOTYPE $START_ID testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
else
- api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE $START_ID testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
fi
sim_equal ricsim_g2_1 num_instances 10000
api_equal json:policies 19995
+ check_policy_agent_logs
+
+ store_logs "${__httpx}__${interface}"
+
done
done
-check_policy_agent_logs
-
#### TEST COMPLETE ####
-store_logs END
print_result
+++ /dev/null
-#!/bin/bash
-
-# ============LICENSE_START===============================================
-# Copyright (C) 2020 Nordix Foundation. All rights reserved.
-# ========================================================================
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-# ============LICENSE_END=================================================
-#
-
-TC_ONELINE_DESCR="Resync 10000 policies using OSC interface over REST+SNDC"
-
-. ../common/testcase_common.sh $@
-. ../common/agent_api_functions.sh
-. ../common/ricsimulator_api_functions.sh
-
-#### TEST BEGIN ####
-
-#Local vars in test script
-##########################
-# Path to callback receiver
-CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
-
-clean_containers
-
-start_ric_simulators ricsim_g1 4 OSC_2.1.0
-
-start_mr
-
-start_cr
-
-start_sdnc
-
-start_consul_cbs
-
-prepare_consul_config SDNC ".consul_config.json"
-consul_config_app ".consul_config.json"
-
-start_control_panel
-
-
-start_policy_agent
-
-use_agent_rest_http
-
-api_get_status 200
-
-sim_print ricsim_g1_1 interface
-
-sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
-
-api_equal json:policy_types 1 120 #Wait for the agent to refresh types from the simulator
-
-api_put_service 201 "rapp1" 3600 "$CR_PATH/callbacks/1"
-
-api_put_policy 201 "rapp1" ricsim_g1_1 1 2000 testdata/OSC/pi1_template.json 10000
-
-sim_equal ricsim_g1_1 num_instances 10000
-
-sim_post_delete_instances 200 ricsim_g1_1
-
-sim_equal ricsim_g1_1 num_instances 0
-
-sim_equal ricsim_g1_1 num_instances 10000 300
-
-api_delete_policy 204 2435
-
-api_delete_policy 204 8693
-
-sim_post_delete_instances 200 ricsim_g1_1
-
-sim_post_delete_instances 200 ricsim_g1_1
-
-sim_equal ricsim_g1_1 num_instances 9998 300
-
-
-check_policy_agent_logs
-
-#### TEST COMPLETE ####
-
-store_logs END
-
-print_result
-
-auto_clean_containers
\ No newline at end of file
TC_ONELINE_DESCR="Resync of RIC via changes in the consul config"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
--- /dev/null
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+TC_ONELINE_DESCR="Change supported policy types and reconfigure rics"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
+. ../common/testcase_common.sh $@
+. ../common/agent_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+
+#### TEST BEGIN ####
+
+#Local vars in test script
+##########################
+# Path to callback receiver
+CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
+NUM_RICS=10
+NUM_RICS_2=$(($NUM_RICS-2))
+
+# Tested variants of REST/SDNC config
+TESTED_VARIANTS="REST REST+SDNC"
+
+for interface in $TESTED_VARIANTS ; do
+
+ echo "#####################################################################"
+ echo "#####################################################################"
+ echo "### Testing agent: "$interface
+ echo "#####################################################################"
+ echo "#####################################################################"
+
+
+ # Clean container and start all needed containers #
+ clean_containers
+
+ #Start simulators and prepare two configs
+
+ start_ric_simulators ricsim_g1 $NUM_RICS_2 OSC_2.1.0
+
+ start_cr
+
+ start_mr
+
+ start_consul_cbs
+
+ if [[ $interface = *"SDNC"* ]]; then
+ start_sdnc
+ prepare_consul_config SDNC ".consul_config_2.json"
+ else
+ prepare_consul_config NOSDNC ".consul_config_2.json"
+ fi
+
+ consul_config_app ".consul_config_2.json"
+
+
+ # Create 2nd config and save for later
+ start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
+
+ if [[ $interface = *"SDNC"* ]]; then
+ start_sdnc
+ prepare_consul_config SDNC ".consul_config_all.json"
+ else
+ prepare_consul_config NOSDNC ".consul_config_all.json"
+ fi
+
+ start_policy_agent
+
+ set_agent_debug
+
+ api_get_status 200
+
+ for ((i=1; i<=${NUM_RICS}; i++))
+ do
+ sim_print ricsim_g1_$i interface
+ done
+
+ # All sims running but 2 are not configured in consul
+ api_equal json:rics 8 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:NOTYPE:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:NOTYPE:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:NOTYPE:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:NOTYPE:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:NOTYPE:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:NOTYPE:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:NOTYPE:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:NOTYPE:???? "
+
+
+ sim_put_policy_type 201 ricsim_g1_1 1 testdata/OSC/sim_1.json
+ sim_put_policy_type 201 ricsim_g1_2 1 testdata/OSC/sim_1.json
+ sim_put_policy_type 201 ricsim_g1_3 1 testdata/OSC/sim_1.json
+ sim_put_policy_type 201 ricsim_g1_4 1 testdata/OSC/sim_1.json
+ sim_put_policy_type 201 ricsim_g1_5 1 testdata/OSC/sim_1.json
+
+ sim_put_policy_type 201 ricsim_g1_2 2 testdata/OSC/sim_2.json
+ sim_put_policy_type 201 ricsim_g1_3 2 testdata/OSC/sim_2.json
+ sim_put_policy_type 201 ricsim_g1_4 2 testdata/OSC/sim_2.json
+ sim_put_policy_type 201 ricsim_g1_5 2 testdata/OSC/sim_2.json
+ sim_put_policy_type 201 ricsim_g1_6 2 testdata/OSC/sim_2.json
+
+ sim_put_policy_type 201 ricsim_g1_3 3 testdata/OSC/sim_3.json
+ sim_put_policy_type 201 ricsim_g1_4 3 testdata/OSC/sim_3.json
+ sim_put_policy_type 201 ricsim_g1_5 3 testdata/OSC/sim_3.json
+ sim_put_policy_type 201 ricsim_g1_6 3 testdata/OSC/sim_3.json
+ sim_put_policy_type 201 ricsim_g1_7 3 testdata/OSC/sim_3.json
+
+ sim_put_policy_type 201 ricsim_g1_4 4 testdata/OSC/sim_4.json
+ sim_put_policy_type 201 ricsim_g1_5 4 testdata/OSC/sim_4.json
+ sim_put_policy_type 201 ricsim_g1_6 4 testdata/OSC/sim_4.json
+ sim_put_policy_type 201 ricsim_g1_7 4 testdata/OSC/sim_4.json
+ sim_put_policy_type 201 ricsim_g1_8 4 testdata/OSC/sim_4.json
+
+ sim_put_policy_type 201 ricsim_g1_5 5 testdata/OSC/sim_5.json
+ sim_put_policy_type 201 ricsim_g1_6 5 testdata/OSC/sim_5.json
+ sim_put_policy_type 201 ricsim_g1_7 5 testdata/OSC/sim_5.json
+ sim_put_policy_type 201 ricsim_g1_8 5 testdata/OSC/sim_5.json
+ sim_put_policy_type 201 ricsim_g1_9 5 testdata/OSC/sim_5.json
+
+ api_equal json:policy_types 5 120
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
+
+
+ #Load config with all rics
+ consul_config_app ".consul_config_all.json"
+
+ api_equal json:rics 10 120
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
+ ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
+ ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
+
+
+ #No policy type in sim #10
+
+ api_equal json:policy_types 5
+
+ api_put_service 201 "serv1" 3600 "$CR_PATH/serv1"
+
+ api_put_policy 201 "serv1" ricsim_g1_9 5 2000 NOTRANSIENT testdata/OSC/pi5_template.json 1
+
+ api_equal json:policy_ids 1
+
+ sim_equal ricsim_g1_9 num_instances 1
+
+
+ # Load config with reduced number of rics
+ consul_config_app ".consul_config_2.json"
+
+ api_equal json:rics 8 120
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? "
+
+ sleep 120
+
+ api_equal json:policy_ids 0
+
+ api_get_policy_types 404 ricsim_g1_9
+
+ sim_equal ricsim_g1_9 num_instances 1
+
+ api_delete_policy 404 2000
+
+ # Load config with all rics
+ consul_config_app ".consul_config_all.json"
+
+ api_equal json:rics 10 120
+
+ echo "Check the number of types in the agent for each ric"
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 4 120
+ api_equal json:policy_types?ric=ricsim_g1_5 5 120
+ api_equal json:policy_types?ric=ricsim_g1_6 4 120
+ api_equal json:policy_types?ric=ricsim_g1_7 3 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3,4:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,4,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,4,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,4,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
+ ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
+ ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
+
+ sleep 120
+
+ api_equal json:policy_ids 0
+
+ sim_equal ricsim_g1_9 num_instances 0
+
+
+ sim_delete_policy_type 204 ricsim_g1_4 4
+ sim_delete_policy_type 204 ricsim_g1_5 4
+ sim_delete_policy_type 204 ricsim_g1_6 4
+ sim_delete_policy_type 204 ricsim_g1_7 4
+
+ sleep 120
+
+ api_equal json:policy_types?ric=ricsim_g1_1 1 120
+ api_equal json:policy_types?ric=ricsim_g1_2 2 120
+ api_equal json:policy_types?ric=ricsim_g1_3 3 120
+ api_equal json:policy_types?ric=ricsim_g1_4 3 120
+ api_equal json:policy_types?ric=ricsim_g1_5 4 120
+ api_equal json:policy_types?ric=ricsim_g1_6 3 120
+ api_equal json:policy_types?ric=ricsim_g1_7 2 120
+ api_equal json:policy_types?ric=ricsim_g1_8 2 120
+ api_equal json:policy_types?ric=ricsim_g1_9 1 120
+ api_equal json:policy_types?ric=ricsim_g1_10 0 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:4,5:???? \
+ ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
+ ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
+
+ sim_delete_policy_type 204 ricsim_g1_8 4
+
+ api_equal json:policy_types?ric=ricsim_g1_8 1 120
+
+ api_get_rics 200 NOTYPE "ricsim_g1_1:me1_ricsim_g1_1,me2_ricsim_g1_1:1:???? \
+ ricsim_g1_2:me1_ricsim_g1_2,me2_ricsim_g1_2:1,2:???? \
+ ricsim_g1_3:me1_ricsim_g1_3,me2_ricsim_g1_3:1,2,3:???? \
+ ricsim_g1_4:me1_ricsim_g1_4,me2_ricsim_g1_4:1,2,3:???? \
+ ricsim_g1_5:me1_ricsim_g1_5,me2_ricsim_g1_5:1,2,3,5:???? \
+ ricsim_g1_6:me1_ricsim_g1_6,me2_ricsim_g1_6:2,3,5:???? \
+ ricsim_g1_7:me1_ricsim_g1_7,me2_ricsim_g1_7:3,5:???? \
+ ricsim_g1_8:me1_ricsim_g1_8,me2_ricsim_g1_8:5:???? \
+ ricsim_g1_9:me1_ricsim_g1_9,me2_ricsim_g1_9:5:???? \
+ ricsim_g1_10:me1_ricsim_g1_10,me2_ricsim_g1_10:NOTYPE:???? "
+
+
+
+ check_policy_agent_logs
+ store_logs ${interface}
+done
+
+
+
+
+
+#### TEST COMPLETE ####
+
+
+print_result
+
+auto_clean_containers
\ No newline at end of file
TC_ONELINE_DESCR="Create 10000 policies in sequence using http/https and Agent REST/DMAAP with/without SDNC controller"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
api_equal json:policy_types 2 120 #Wait for the agent to refresh types from the simulators
- api_put_service 201 "rapp1" 3600 "$CR_PATH/callbacks/1"
+ api_put_service 201 "serv1" 3600 "$CR_PATH/1"
start_timer "Create polices in OSC via agent REST and $interface using "$__httpx
- api_put_policy 201 "rapp1" ricsim_g1_1 1 $START_ID testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent REST and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $NUM_POLICIES
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent REST and $interface using "$__httpx
- api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE $START_ID testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent REST and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $NUM_POLICIES
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
- api_put_policy 201 "rapp1" ricsim_g1_1 1 $START_ID testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent DMAAP, one by one, and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $((2*$NUM_POLICIES))
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
- api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE $START_ID testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent DMAAP, one by one, and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $((2*$NUM_POLICIES))
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
- api_put_policy_batch 201 "rapp1" ricsim_g1_1 1 $START_ID testdata/OSC/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g1_1 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES
print_timer "Create polices in OSC via agent DMAAP in batch and $interface using "$__httpx
sim_equal ricsim_g1_1 num_instances $((3*$NUM_POLICIES))
START_ID=$(($START_ID+$NUM_POLICIES))
start_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
- api_put_policy_batch 201 "rapp1" ricsim_g2_1 NOTYPE $START_ID testdata/STD/pi1_template.json $NUM_POLICIES
+ api_put_policy_batch 201 "serv1" ricsim_g2_1 NOTYPE $START_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_POLICIES
print_timer "Create polices in STD via agent DMAAP in batch and $interface using "$__httpx
sim_equal ricsim_g2_1 num_instances $((3*$NUM_POLICIES))
# ============LICENSE_END=================================================
#
-TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h. Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http"
+TC_ONELINE_DESCR="Repeatedly create and delete policies in each RICs for 24h (or configured number of days). Via agent REST/DMAAP/DMAAP_BATCH and SDNC using http or https"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
# Number of policy instances per RIC
NUM_INSTANCES=5
+DAYS=3
+
clean_containers
+# use http or https for all apis
+HTTPX=https
+
+if [ $HTTPX == "http" ]; then
+ use_agent_rest_http
+ use_sdnc_http
+ use_simulator_http
+else
+ use_agent_rest_https
+ use_sdnc_https
+ use_simulator_https
+fi
+
start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
start_ric_simulators ricsim_g2 $NUM_RICS STD_1.1.3
start_policy_agent
-use_agent_rest_http
api_get_status 200
echo "Register a service"
api_put_service 201 "serv1" 0 "$CR_PATH/1"
-TEST_DURATION=$((24*3600))
+TEST_DURATION=$((24*3600*$DAYS))
TEST_START=$SECONDS
-AGENT_INTERFACES="REST DMAAP DMAAP-BATCH"
+AGENT_INTERFACES="REST REST_PARALLEL DMAAP DMAAP-BATCH"
MR_MESSAGES=0
echo "## Testing using agent interface: $interface ##"
echo "############################################"
- if [ $interface == "REST" ]; then
- use_agent_rest_http
+ if [ $interface == "REST" ] || [ $interface == "REST_PARALLEL" ]; then
+ if [ $HTTPX == "http" ]; then
+ use_agent_rest_http
+ else
+ use_agent_rest_https
+ fi
else
use_agent_dmaap
fi
echo "Create $NUM_INSTANCES instances in each OSC RIC"
INSTANCE_ID=200000
INSTANCES=0
+ if [ $interface == "REST_PARALLEL" ]; then
+ api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES 3
+ fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
- api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID testdata/OSC/pi1_template.json $NUM_INSTANCES
- else
- api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID testdata/OSC/pi1_template.json $NUM_INSTANCES
+ api_put_policy_batch 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
+ elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
+ api_put_policy 201 "serv1" ricsim_g1_$i 1 $INSTANCE_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_INSTANCES
fi
- if [ $interface != "REST" ]; then
+ if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
fi
sim_equal ricsim_g1_$i num_instances $NUM_INSTANCES
api_equal json:policy_ids $INSTANCES
echo "Create $NUM_INSTANCES instances in each STD RIC"
+ if [ $interface == "REST_PARALLEL" ]; then
+ api_put_policy_parallel 201 "serv1" ricsim_g2_ $NUM_RICS NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES 3
+ fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
- api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID testdata/STD/pi1_template.json $NUM_INSTANCES
- else
- api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID testdata/STD/pi1_template.json $NUM_INSTANCES
+ api_put_policy_batch 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
+ elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
+ api_put_policy 201 "serv1" ricsim_g2_$i NOTYPE $INSTANCE_ID NOTRANSIENT testdata/STD/pi1_template.json $NUM_INSTANCES
fi
- if [ $interface != "REST" ]; then
+ if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
fi
sim_equal ricsim_g2_$i num_instances $NUM_INSTANCES
echo "Delete all instances in each OSC RIC"
INSTANCE_ID=200000
+ if [ $interface == "REST_PARALLEL" ]; then
+ api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
+ fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
- else
+ elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
fi
- if [ $interface != "REST" ]; then
+ if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
fi
INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
echo "Delete all instances in each STD RIC"
+ if [ $interface == "REST_PARALLEL" ]; then
+ api_delete_policy_parallel 204 $NUM_RICS $INSTANCE_ID $NUM_INSTANCES 3
+ fi
for ((i=1; i<=$NUM_RICS; i++))
do
if [ $interface == "DMAAP-BATCH" ]; then
api_delete_policy_batch 204 $INSTANCE_ID $NUM_INSTANCES
- else
+ elif [ $interface == "DMAAP" ] || [ $interface == "REST" ]; then
api_delete_policy 204 $INSTANCE_ID $NUM_INSTANCES
fi
- if [ $interface != "REST" ]; then
+ if [ $interface == "DMAAP" ] || [ $interface == "DMAAP-BATCH" ]; then
MR_MESSAGES=$(($MR_MESSAGES+$NUM_INSTANCES))
fi
INSTANCES=$(($INSTANCES-$NUM_INSTANCES))
--- /dev/null
+#!/bin/bash
+
+# ============LICENSE_START===============================================
+# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+TC_ONELINE_DESCR="Create/delete policies in parallel over a number of ric using a number of child process"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
+. ../common/testcase_common.sh $@
+. ../common/agent_api_functions.sh
+. ../common/ricsimulator_api_functions.sh
+
+#### TEST BEGIN ####
+
+#Local vars in test script
+##########################
+# Path to callback receiver
+CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
+# Tested variants of REST/DMAAP/SDNC config
+TESTED_VARIANTS="REST REST+SDNC"
+
+#Test agent and simulator protocol versions (others are http only)
+TESTED_PROTOCOLS="HTTP HTTPS"
+
+NUM_RICS=20
+NUM_POLICIES_PER_RIC=500
+
+for __httpx in $TESTED_PROTOCOLS ; do
+ for interface in $TESTED_VARIANTS ; do
+
+ echo "#####################################################################"
+ echo "#####################################################################"
+ echo "### Testing agent: "$interface" and "$__httpx
+ echo "#####################################################################"
+ echo "#####################################################################"
+
+
+ # Clean container and start all needed containers #
+ clean_containers
+
+ if [ $__httpx == "HTTPS" ]; then
+ echo "Using secure ports towards simulators and sdnc"
+ use_simulator_https
+ use_sdnc_https
+ else
+ echo "Using non-secure ports towards simulators and sdnc"
+ use_simulator_http
+ use_sdnc_http
+ fi
+
+ start_ric_simulators ricsim_g1 $NUM_RICS OSC_2.1.0
+
+ start_consul_cbs
+
+ if [[ $interface = *"SDNC"* ]]; then
+ start_sdnc
+ prepare_consul_config SDNC ".consul_config.json"
+ else
+ prepare_consul_config NOSDNC ".consul_config.json"
+ fi
+
+ consul_config_app ".consul_config.json"
+
+ start_mr # Not used, but removes error messages from the agent log
+
+ start_policy_agent
+
+ set_agent_debug
+
+ if [ $__httpx == "HTTPS" ]; then
+ echo "Using secure ports towards the agent"
+ use_agent_rest_https
+ else
+ echo "Using non-secure ports towards the agent"
+ use_agent_rest_http
+ fi
+
+ api_get_status 200
+
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ sim_print ricsim_g1_$i interface
+ done
+
+ echo "Load policy type in group 1 simulators"
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ sim_put_policy_type 201 ricsim_g1_$i 1 testdata/OSC/sim_1.json
+ done
+
+
+ api_equal json:policy_types 1 120 #Wait for the agent to refresh types from the simulator
+
+ api_put_service 201 "serv1" 600 "$CR_PATH/1"
+
+ echo "Check the number of types in the agent for each ric is 1"
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ api_equal json:policy_types?ric=ricsim_g1_$i 1 120
+ done
+
+ START_ID=2000
+
+ start_timer "Create $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
+
+ api_put_policy_parallel 201 "serv1" ricsim_g1_ $NUM_RICS 1 $START_ID NOTRANSIENT testdata/OSC/pi1_template.json $NUM_POLICIES_PER_RIC 7
+
+ print_timer "Create $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
+
+ INSTANCES=$(($NUM_RICS*$NUM_POLICIES_PER_RIC))
+ api_equal json:policies $INSTANCES
+
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ sim_equal ricsim_g1_$i num_instances $NUM_POLICIES_PER_RIC
+ done
+
+ start_timer "Delete $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
+
+ api_delete_policy_parallel 204 $NUM_RICS $START_ID $NUM_POLICIES_PER_RIC 7
+
+ print_timer "Delete $((NUM_POLICIES_PER_RIC*$NUM_RICS)) polices over $interface using "$__httpx
+
+ api_equal json:policies 0
+
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ sim_equal ricsim_g1_$i num_instances 0
+ done
+
+ for ((i=1; i<=$NUM_RICS; i++))
+ do
+ if [ $interface == "REST+SDNC" ]; then
+ sim_contains_str ricsim_g1_$i remote_hosts "a1-controller"
+ else
+ sim_contains_str ricsim_g1_$i remote_hosts "policy-agent"
+ fi
+ done
+
+ check_policy_agent_logs
+
+ store_logs "${__httpx}__${interface}"
+
+ done
+
+done
+
+
+#### TEST COMPLETE ####
+
+print_result
+
+auto_clean_containers
\ No newline at end of file
TC_ONELINE_DESCR="Testing of the health check app"
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC_ONAP"
+
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
. ../common/ricsimulator_api_functions.sh
api_put_service 201 "rapp1" 3600 "$CR_PATH/1"
-api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 testdata/OSC/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_1 1 2010 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_2 1 2020 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_3 1 2030 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_4 1 2040 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_5 1 2050 NOTRANSIENT testdata/OSC/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g1_6 1 2060 NOTRANSIENT testdata/OSC/pi1_template.json 1
sim_equal ricsim_g1_1 num_instances 1
sim_equal ricsim_g1_2 num_instances 1
sim_equal ricsim_g1_5 num_instances 1
sim_equal ricsim_g1_6 num_instances 1
-api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 testdata/STD/pi1_template.json 1
-api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 testdata/STD/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g2_1 NOTYPE 2110 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g2_2 NOTYPE 2120 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g2_3 NOTYPE 2130 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g2_4 NOTYPE 2140 NOTRANSIENT testdata/STD/pi1_template.json 1
+api_put_policy 201 "rapp1" ricsim_g2_5 NOTYPE 2150 NOTRANSIENT testdata/STD/pi1_template.json 1
sim_equal ricsim_g2_1 num_instances 1
sim_equal ricsim_g2_2 num_instances 1
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "3",
+ "description": "Type 3 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "groupId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "groupId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type3_1.0.0",
+ "description": "Type 3 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "groupId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "groupId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+}
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "4",
+ "description": "Type 4 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type4_1.0.0",
+ "description": "Type 4 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+}
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "5",
+ "description": "Type 5 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "sliceId": {
+ "type": "string"
+ },
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "sliceId",
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type5_1.0.0",
+ "description": "Type 5 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "sliceId": {
+ "type": "string"
+ },
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "sliceId",
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+}
--- /dev/null
+{
+ "scope": {
+ "groupId": "groupXXX"
+ },
+ "qosObjective": {
+ "priorityLevel": XXX
+ }
+ }
\ No newline at end of file
--- /dev/null
+{
+ "scope": {
+ "cellId": "cellXXX"
+ },
+ "qosObjective": {
+ "priorityLevel": XXX
+ }
+ }
\ No newline at end of file
--- /dev/null
+{
+ "scope": {
+ "sliceId": "sliceXXX",
+ "cellId": "cellXXX"
+ },
+ "qosObjective": {
+ "priorityLevel": XXX
+ }
+ }
\ No newline at end of file
--- /dev/null
+{
+ "name": "pt3",
+ "description": "pt3 policy type",
+ "policy_type_id": 3,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type3_1.0.0",
+ "description": "Type 3 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "groupId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "groupId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
+}
--- /dev/null
+{
+ "name": "pt4",
+ "description": "pt4 policy type",
+ "policy_type_id": 4,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type4_1.0.0",
+ "description": "Type 4 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
+}
--- /dev/null
+{
+ "name": "pt5",
+ "description": "pt5 policy type",
+ "policy_type_id": 5,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type5_1.0.0",
+ "description": "Type 5 policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "sliceId": {
+ "type": "string"
+ },
+ "cellId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "sliceId",
+ "cellId"
+ ]
+ },
+ "qosObjective": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjective"
+ ]
+ }
+}
}
# API Test function: PUT /policy
-# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <template-file> [<count>]
+# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]
# (Function for test scripts)
api_put_policy() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 6 ] || [ $# -gt 7 ]; then
- __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <template-file> [<count>]" $@
+ if [ $# -lt 7 ] || [ $# -gt 8 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]" $@
return 1
fi
count=0
max=1
- if [ $# -eq 7 ]; then
- max=$7
+ if [ $# -eq 8 ]; then
+ max=$8
fi
pid=$5
- file=$6
+ file=$7
while [ $count -lt $max ]; do
query="/policy?id=$pid&ric=$ric&service=$2"
- if [ $4 == "NOTYPE" ]; then
- query="/policy?id=$pid&ric=$ric&service=$2"
- else
- query="/policy?id=$pid&ric=$ric&service=$2&type=$4"
+ if [ $4 != "NOTYPE" ]; then
+ query=$query"&type=$4"
+ fi
+
+ if [ $6 != NOTRANSIENT ]; then
+ query=$query"&transient=$6"
fi
file=".p.json"
- sed 's/XXX/'${pid}'/g' $6 > $file
+ sed 's/XXX/'${pid}'/g' $7 > $file
res="$(__do_curl_to_agent PUT $query $file)"
status=${res:${#res}-3}
echo -ne " Creating "$count"("$max")${SAMELINE}"
-
if [ $status -ne $1 ]; then
let pid=$pid+1
echo " Created "$count"?("$max")"
}
# API Test function: PUT /policy to run in batch
-# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <template-file> [<count>]
+# args: <response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]
# (Function for test scripts)
api_put_policy_batch() {
echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
((RES_TEST++))
- if [ $# -lt 6 ] || [ $# -gt 7 ]; then
- __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <template-file> [<count>]" $@
+ if [ $# -lt 7 ] || [ $# -gt 8 ]; then
+ __print_err "<response-code> <service-name> <ric-id> <policytype-id> <policy-id> <transient> <template-file> [<count>]" $@
return 1
fi
count=0
max=1
- if [ $# -eq 7 ]; then
- max=$7
+ if [ $# -eq 8 ]; then
+ max=$8
fi
pid=$5
- file=$6
+ file=$7
ARR=""
while [ $count -lt $max ]; do
query="/policy?id=$pid&ric=$ric&service=$2"
- if [ $4 == "NOTYPE" ]; then
- query="/policy?id=$pid&ric=$ric&service=$2"
- else
- query="/policy?id=$pid&ric=$ric&service=$2&type=$4"
+ if [ $4 != "NOTYPE" ]; then
+ query=$query"&type=$4"
+ fi
+
+ if [ $6 != NOTRANSIENT ]; then
+ query=$query"&transient=$6"
fi
file=".p.json"
- sed 's/XXX/'${pid}'/g' $6 > $file
+ sed 's/XXX/'${pid}'/g' $7 > $file
res="$(__do_curl_to_agent PUT_BATCH $query $file)"
status=${res:${#res}-3}
echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
return 0
}
+# API Test function: PUT /policy to run in i parallel for a number of rics
+# args: <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>
+# (Function for test scripts)
+api_put_policy_parallel() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -ne 10 ]; then
+ __print_err " <response-code> <service-name> <ric-id-base> <number-of-rics> <policytype-id> <policy-start-id> <transient> <template-file> <count-per-ric> <number-of-threads>" $@
+ return 1
+ fi
+ resp_code=$1; shift;
+ serv=$1; shift
+ ric_base=$1; shift;
+ num_rics=$1; shift;
+ type=$1; shift;
+ start_id=$1; shift;
+ transient=$1; shift;
+ template=$1; shift;
+ count=$1; shift;
+ pids=$1; shift;
+
+ if [ $ADAPTER != $RESTBASE ] && [ $ADAPTER != $RESTBASE_SECURE ]; then
+ echo " Info - api_put_policy_parallel uses only the agent REST interface - create over dmaap in parallel is not supported"
+ echo " Info - will execute over agent REST"
+ fi
+
+ if [ $serv == "NOSERVICE" ]; then
+ serv=""
+ fi
+ query="/policy?service=$serv"
+
+ if [ $type != "NOTYPE" ]; then
+ query=$query"&type=$type"
+ fi
+
+ if [ $transient != NOTRANSIENT ]; then
+ query=$query"&transient=$transient"
+ fi
+
+ urlbase=${ADAPTER}${query}
+
+ for ((i=1; i<=$pids; i++))
+ do
+ echo "" > ".pid${i}.res.txt"
+ echo $resp_code $urlbase $ric_base $num_rics $start_id $template $count $pids $i > ".pid${i}.txt"
+ echo $i
+ done | xargs -n 1 -I{} -P $pids bash -c '{
+ arg=$(echo {})
+ echo " Parallel process $arg started"
+ tmp=$(< ".pid${arg}.txt")
+ python3 ../common/create_policies_process.py $tmp > .pid${arg}.res.txt
+ }'
+ msg=""
+ for ((i=1; i<=$pids; i++))
+ do
+ file=".pid${i}.res.txt"
+ tmp=$(< $file)
+ if [ -z "$tmp" ]; then
+ echo " Process $i : unknown result (result file empty"
+ msg="failed"
+ else
+ res=${tmp:0:1}
+ if [ $res == "0" ]; then
+ echo " Process $i : OK"
+ else
+ echo " Process $i : failed - "${tmp:1}
+ msg="failed"
+ fi
+ fi
+ done
+ if [ -z $msg ]; then
+ echo " $(($count*$num_rics)) policies created/updated"
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+ fi
+
+ echo -e $RED" FAIL. One of more processes failed to execute" $ERED
+ ((RES_FAIL++))
+ return 1
+}
# API Test function: DELETE /policy
# args: <response-code> <policy-id> [count]
return 0
}
+# API Test function: DELETE /policy to run in i parallel for a number of rics
+# args: <response-code> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>
+# (Function for test scripts)
+api_delete_policy_parallel() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -ne 5 ]; then
+ __print_err " <response-code> <ric-id-base> <number-of-rics> <policy-start-id> <count-per-ric> <number-of-threads>" $@
+ return 1
+ fi
+ resp_code=$1; shift;
+ num_rics=$1; shift;
+ start_id=$1; shift;
+ count=$1; shift;
+ pids=$1; shift;
+
+ if [ $ADAPTER != $RESTBASE ] && [ $ADAPTER != $RESTBASE_SECURE ]; then
+ echo " Info - api_delete_policy_parallel uses only the agent REST interface - create over dmaap in parallel is not supported"
+ echo " Info - will execute over agent REST"
+ fi
+
+ query="/policy"
+
+ urlbase=${ADAPTER}${query}
+
+ for ((i=1; i<=$pids; i++))
+ do
+ echo "" > ".pid${i}.del.res.txt"
+ echo $resp_code $urlbase $num_rics $start_id $count $pids $i > ".pid${i}.del.txt"
+ echo $i
+ done | xargs -n 1 -I{} -P $pids bash -c '{
+ arg=$(echo {})
+ echo " Parallel process $arg started"
+ tmp=$(< ".pid${arg}.del.txt")
+ python3 ../common/delete_policies_process.py $tmp > .pid${arg}.del.res.txt
+ }'
+ msg=""
+ for ((i=1; i<=$pids; i++))
+ do
+ file=".pid${i}.del.res.txt"
+ tmp=$(< $file)
+ if [ -z "$tmp" ]; then
+ echo " Process $i : unknown result (result file empty"
+ msg="failed"
+ else
+ res=${tmp:0:1}
+ if [ $res == "0" ]; then
+ echo " Process $i : OK"
+ else
+ echo " Process $i : failed - "${tmp:1}
+ msg="failed"
+ fi
+ fi
+ done
+ if [ -z $msg ]; then
+ echo " $(($count*$num_rics)) deleted"
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+ fi
+
+ echo -e $RED" FAIL. One of more processes failed to execute" $ERED
+ ((RES_FAIL++))
+ return 1
+}
+
# API Test function: GET /policy_ids
# args: <response-code> <ric-id>|NORIC <service-id>|NOSERVICE <type-id>|NOTYPE ([<policy-instance-id]*|NOID)
# (Function for test scripts)
body=$(echo "$3" | sed 's/"/\\"/g')
json='{"input":{"near-rt-ric-url":"'$2'","body":"'"$body"'"}}'
fi
- echo "$json" > .sndc.payload.json
+ echo "$json" > .sdnc.payload.json
echo " FILE: $json" >> $HTTPLOG
- curlString="curl -skw %{http_code} -X POST $SDNC_HTTPX://$SDNC_USER:$SDNC_PWD@localhost:$SDNC_LOCAL_PORT$SDNC_API_URL$1 -H accept:application/json -H Content-Type:application/json --data-binary @.sndc.payload.json"
+ curlString="curl -skw %{http_code} -X POST $SDNC_HTTPX://$SDNC_USER:$SDNC_PWD@localhost:$SDNC_LOCAL_PORT$SDNC_API_URL$1 -H accept:application/json -H Content-Type:application/json --data-binary @.sdnc.payload.json"
echo " CMD: "$curlString >> $HTTPLOG
res=$($curlString)
retcode=$?
--- /dev/null
+# ============LICENSE_START===============================================
+# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+# This script create/update policies spread over a number rics
+# Intended for parallel processing
+# Returns a string with result, either "0" for ok, or "1<fault description>"
+
+import os
+import json
+import sys
+import requests
+
+# disable warning about unverified https requests
+from requests.packages import urllib3
+
+urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+
+#arg responsecode baseurl ric_base num_rics startid templatepath count pids pid_id
+try:
+ if len(sys.argv) != 10:
+ print("1Expected 9 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl ric_base num_rics startid templatepath count pids pid_id")
+ sys.exit()
+
+ responsecode=int(sys.argv[1])
+ baseurl=sys.argv[2]
+ ric_base=sys.argv[3]
+ num_rics=int(sys.argv[4])
+ start=int(sys.argv[5])
+ templatepath=sys.argv[6]
+ count=int(sys.argv[7])
+ pids=int(sys.argv[8])
+ pid_id=int(sys.argv[9])
+
+ with open(templatepath, 'r') as file:
+ template = file.read()
+
+ start=start
+ stop=count*num_rics+start
+
+ for i in range(start,stop):
+ if (i%pids == (pid_id-1)):
+ payload=template.replace("XXX",str(i))
+ ric_id=(i%num_rics)+1
+ ric=ric_base+str(ric_id)
+ url=baseurl+"&id="+str(i)+"&ric="+str(ric)
+ try:
+ headers = {'Content-type': 'application/json'}
+ resp=requests.put(url, json.dumps(json.loads(payload)), headers=headers, verify=False, timeout=90)
+ except Exception as e1:
+ print("1Put failed for id:"+str(i)+ ", "+str(e1))
+ sys.exit()
+ if (resp.status_code != responsecode):
+ print("1Put failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+ sys.exit()
+
+ print("0")
+ sys.exit()
+
+except Exception as e:
+ print("1"+str(e))
+sys.exit()
\ No newline at end of file
--- /dev/null
+# ============LICENSE_START===============================================
+# Copyright (C) 2020 Nordix Foundation. All rights reserved.
+# ========================================================================
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+# ============LICENSE_END=================================================
+#
+
+# This script delete policies spread over a number rics
+# Intended for parallel processing
+# Returns a string with result, either "0" for ok, or "1<fault description>"
+
+import os
+import json
+import sys
+import requests
+
+# disable warning about unverified https requests
+from requests.packages import urllib3
+
+urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
+
+#arg responsecode baseurl num_rics startid count pids pid_id
+
+try:
+ if len(sys.argv) != 8:
+ print("1Expected 7 args, got "+str(len(sys.argv)-1)+ ". Args: responsecode baseurl num_rics startid count pids pid_id")
+ sys.exit()
+
+ responsecode=int(sys.argv[1])
+ baseurl=sys.argv[2]
+ num_rics=int(sys.argv[3])
+ start=int(sys.argv[4])
+ count=int(sys.argv[5])
+ pids=int(sys.argv[6])
+ pid_id=int(sys.argv[7])
+
+ stop=count*num_rics+start
+ for i in range(start,stop):
+ if (i%pids == (pid_id-1)):
+ url=str(baseurl+"?id="+str(i))
+ try:
+ resp=requests.delete(url, verify=False, timeout=90)
+ except Exception as e1:
+ print("1Delete failed for id:"+str(i)+ ", "+str(e1))
+ sys.exit()
+ if (resp.status_code != responsecode):
+ print("1Delete failed for id:"+str(i)+ ", expected response code: "+responsecode+", got: "+str(resp.status_code))
+ sys.exit()
+
+ print("0")
+ sys.exit()
+
+except Exception as e:
+ print("1"+str(e))
+sys.exit()
\ No newline at end of file
# SDNC A1 Controller local image and tag
SDNC_A1_CONTROLLER_LOCAL_IMAGE="o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
+SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG="1.7.5-SNAPSHOT"
# SDNC A1 Controller remote image and tag
SDNC_A1_CONTROLLER_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-a1-controller"
-SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="1.7.4"
+SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG="1.7.5"
#SDNC DB remote image and tag
exit 1
fi
+tmp=$(which docker-compose)
+if [ $? -ne 0 ] || [ -z tmp ]; then
+ echo -e $RED"docker-compose is required to run the test environment, pls install"$ERED
+ exit 1
+fi
+
# Just resetting any previous echo formatting...
echo -ne $EBOLD
# Var to hold 'auto' in case containers shall be stopped when test case ends
AUTO_CLEAN=""
+# Var to hold the app names to use local image for when running 'remote' or 'remote-remove'
+USE_LOCAL_IMAGES=""
+
# Set a description string for the test case
if [ -z "$TC_ONELINE_DESCR" ]; then
TC_ONELINE_DESCR="<no-description>"
echo "-------------------------------------------------------------------------------------------------"
echo "----------------------------------- Test case setup -----------------------------------"
+START_ARG=$1
+paramerror=0
+if [ $# -lt 1 ]; then
+ paramerror=1
+fi
+if [ $paramerror -eq 0 ]; then
+ if [ "$1" != "remote" ] && [ "$1" != "remote-remove" ] && [ "$1" != "local" ]; then
+ paramerror=1
+ else
+ shift;
+ fi
+fi
+if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "auto-clean" ]; then
+ AUTO_CLEAN="auto"
+ shift;
+ fi
+fi
+if [ $paramerror -eq 0 ]; then
+ if [ "$1" == "-use-local-image" ]; then
+ USE_LOCAL_IMAGES=${@:2}
+ while [ $# -gt 0 ]; do
+ shift;
+ done
+ fi
+fi
+
+if [ $paramerror -eq 0 ] && [ $# -gt 0 ]; then
+ paramerror=1
+fi
+
+if [ $paramerror -eq 1 ]; then
+ echo -e $RED"Expected arg: local|remote|remote-remove [auto-clean] [-use-local-image <app-nam> [<app-name>]]"$ERED
+ exit 1
+fi
+
echo -e $BOLD"Checking configured image setting for this test case"$EBOLD
#Temp var to check for image variable name errors
#echo " Configured image for ${1} (script start arg=${2}): "$image":"$tag
}
+
+#Check if app local image shall override remote image
+check_image_local_override() {
+ for im in $USE_LOCAL_IMAGES; do
+ if [ "$1" == "$im" ]; then
+ return 1
+ fi
+ done
+ return 0
+}
+
+#Check if app uses image excluded from this test run
+check_excluded_image() {
+ for im in $EXCLUDED_IMAGES; do
+ if [ "$1" == "$im" ]; then
+ return 1
+ fi
+ done
+ return 0
+}
+
# Check that image env setting are available
echo ""
-if [ $# -lt 1 ] || [ $# -gt 2 ]; then
- echo "Expected arg: local|remote|remote-remove [auto-clean]"
- exit 1
-elif [ $1 == "local" ]; then
+
+if [ $START_ARG == "local" ]; then
#Local agent image
- __check_image_var " Policy Agent" $1 "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
+ __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
#Local Control Panel image
- __check_image_var " Control Panel" $1 "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
+ __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
#Local SNDC image
- __check_image_var " SDNC A1 Controller" $1 "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
#Local ric sim image
- __check_image_var " RIC Simulator" $1 "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG"
+ __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG"
-elif [ $1 == "remote" ] || [ $1 == "remote-remove" ]; then
+elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
- #Remote agent image
- __check_image_var " Policy Agent" $1 "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG"
+ check_image_local_override 'PA'
+ if [ $? -eq 0 ]; then
+ #Remote agent image
+ __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG"
+ else
+ #Local agent image
+ __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_LOCAL_IMAGE" "POLICY_AGENT_LOCAL_IMAGE_TAG"
+ fi
- #Remote Control Panel image
- __check_image_var " Control Panel" $1 "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG"
+ check_image_local_override 'CP'
+ if [ $? -eq 0 ]; then
+ #Remote Control Panel image
+ __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG"
+ else
+ #Local Control Panel image
+ __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE" "CONTROL_PANEL_LOCAL_IMAGE_TAG"
+ fi
- #Remote SDNC image
- __check_image_var " SDNC A1 Controller" $1 "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG"
+ check_image_local_override 'SDNC'
+ if [ $? -eq 0 ]; then
+ #Remote SDNC image
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG"
+ else
+ #Local SNDC image
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG"
+ fi
- #Remote ric sim image
- __check_image_var " RIC Simulator" $1 "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG"
+ check_image_local_override 'RICSIM'
+ if [ $? -eq 0 ]; then
+ #Remote ric sim image
+ __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG"
+ else
+ #Local ric sim image
+ __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_LOCAL_IMAGE" "RIC_SIM_LOCAL_IMAGE_TAG"
+ fi
else
- echo "Expected arg: local|remote|remote-remove [auto-clean]"
+ #Should never get here....
+ echo "Unknow args: "$@
exit 1
fi
-if [ $# -eq 2 ]; then
- if [ $2 == "auto-clean" ]; then
- echo "Stting automatic cleaning of container when test case ends"
- AUTO_CLEAN="auto"
- else
- echo "Expected arg: local|remote|remote-remove [auto-clean]"
- exit 1
- fi
-fi
# These images are not built as part of this project official images, just check that env vars are set correctly
-__check_image_var " Message Router" $1 "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG"
-__check_image_var " Callback Receiver" $1 "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG"
-__check_image_var " Consul" $1 "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG"
-__check_image_var " CBS" $1 "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG"
-__check_image_var " SDNC DB" $1 "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG"
-__check_image_var " SDNC ONAP A1 Adapter" $1 "SDNC_ONAP_A1_ADAPTER_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG"
-__check_image_var " SDNC ONAP DB" $1 "SDNC_ONAP_DB_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE_TAG"
+__check_image_var " Message Router" $START_ARG "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG"
+__check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG"
+__check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG"
+__check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG"
+__check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG"
+check_excluded_image 'SDNC_ONAP'
+if [ $? -eq 0 ]; then
+ __check_image_var " SDNC ONAP A1 Adapter" $START_ARG "SDNC_ONAP_A1_ADAPTER_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE" "SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG"
+ __check_image_var " SDNC ONAP DB" $START_ARG "SDNC_ONAP_DB_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE" "SDNC_ONAP_DB_REMOTE_IMAGE_TAG"
+fi
#Errors in image setting - exit
if [ $IMAGE_ERR -ne 0 ]; then
fi
#Print a tables of the image settings
-echo -e $BOLD"Images configured for start arg: "$1 $EBOLD
+echo -e $BOLD"Images configured for start arg: "$START $EBOLD
column -t -s $'\t' $image_list_file
echo ""
echo -e $BOLD"Pulling configured images, if needed"$EBOLD
-app="Policy Agent"; __check_and_pull_image $1 "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
-app="Non-RT RIC Control Panel"; __check_and_pull_image $1 "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
-app="SDNC A1 Controller"; __check_and_pull_image $1 "$app" $SDNC_APP_NAME $SDNC_A1_CONTROLLER_IMAGE
-app="Near-RT RIC Simulator"; __check_and_pull_image $1 "$app" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE $RIC_SIM_IMAGE
+START_ARG_MOD=$START_ARG
+check_image_local_override 'PA'
+if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
+fi
+app="Policy Agent"; __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
-app="Consul"; __check_and_pull_image $1 "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
-app="CBS"; __check_and_pull_image $1 "$app" $CBS_APP_NAME $CBS_IMAGE
-app="SDNC DB"; __check_and_pull_image $1 "$app" $SDNC_APP_NAME $SDNC_DB_IMAGE
+START_ARG_MOD=$START_ARG
+check_image_local_override 'CP'
+if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
+fi
+app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
-echo -e $YELLOW"SDNC ONAP image is skipped"$EYELLOW
-#app="SDNC ONAP A1 Adapter"; __check_and_pull_image $1 "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_A1_ADAPTER_IMAGE
-#app="SDNC ONAP DB"; __check_and_pull_image $1 "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_DB_IMAGE
+START_ARG_MOD=$START_ARG
+check_image_local_override 'RICSIM'
+if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
+fi
+app="Near-RT RIC Simulator"; __check_and_pull_image $START_ARG_MOD "$app" $RIC_SIM_PREFIX"_"$RIC_SIM_BASE $RIC_SIM_IMAGE
+app="Consul"; __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
+app="CBS"; __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
+check_excluded_image 'SDNC'
+if [ $? -eq 0 ]; then
+ START_ARG_MOD=$START_ARG
+ check_image_local_override 'SDNC'
+ if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
+ fi
+ app="SDNC A1 Controller"; __check_and_pull_image $START_ARG_MOD "$app" $SDNC_APP_NAME $SDNC_A1_CONTROLLER_IMAGE
+ app="SDNC DB"; __check_and_pull_image $START_ARG "$app" $SDNC_APP_NAME $SDNC_DB_IMAGE
+else
+ echo -e $YELLOW" Excluding SDNC image and related DB image from image check/pull"$EYELLOW
+fi
+check_excluded_image 'SDNC_ONAP'
+if [ $? -eq 0 ]; then
+ app="SDNC ONAP A1 Adapter"; __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_A1_ADAPTER_IMAGE
+ app="SDNC ONAP DB"; __check_and_pull_image $START_ARG "$app" $SDNC_ONAP_APP_NAME $SDNC_ONAP_DB_IMAGE
+else
+ echo -e $YELLOW" Excluding ONAP SDNC image and related DB image from image check/pull"$EYELLOW
+fi
# MR stub image not checked, will be built by this script - only local image
# CR stub image not checked, will be built by this script - only local image
echo ""
echo "#################################################################################################"
echo -e $RED"One or more images could not be pulled or containers using the images could not be stopped/removed"$ERED
+ echo -e $RED"Or local image, overriding remote image, does not exist"$ERED
echo "#################################################################################################"
echo ""
exit 1
echo -e " Application\tRepository\tTag\tCreated Since\tSize" > $docker_tmp_file
echo -e " Policy Agent\t$(docker images --format $format_string $POLICY_AGENT_IMAGE)" >> $docker_tmp_file
echo -e " Control Panel\t$(docker images --format $format_string $CONTROL_PANEL_IMAGE)" >> $docker_tmp_file
-echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >> $docker_tmp_file
echo -e " RIC Simulator\t$(docker images --format $format_string $RIC_SIM_IMAGE)" >> $docker_tmp_file
echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >> $docker_tmp_file
echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >> $docker_tmp_file
echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >> $docker_tmp_file
echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >> $docker_tmp_file
-echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >> $docker_tmp_file
-echo -e " SDNC ONAP A1 Adapter\t$(docker images --format $format_string $SDNC_ONAP_A1_ADAPTER_IMAGE)" >> $docker_tmp_file
-echo -e " SDNC ONAP DB\t$(docker images --format $format_string $SDNC_ONAP_DB_IMAGE)" >> $docker_tmp_file
+check_excluded_image 'SDNC'
+if [ $? -eq 0 ]; then
+ echo -e " SDNC A1 Controller\t$(docker images --format $format_string $SDNC_A1_CONTROLLER_IMAGE)" >> $docker_tmp_file
+ echo -e " SDNC DB\t$(docker images --format $format_string $SDNC_DB_IMAGE)" >> $docker_tmp_file
+fi
+check_excluded_image 'SDNC_ONAP'
+if [ $? -eq 0 ]; then
+ echo -e " SDNC ONAP A1 Adapter\t$(docker images --format $format_string $SDNC_ONAP_A1_ADAPTER_IMAGE)" >> $docker_tmp_file
+ echo -e " SDNC ONAP DB\t$(docker images --format $format_string $SDNC_ONAP_DB_IMAGE)" >> $docker_tmp_file
+fi
column -t -s $'\t' $docker_tmp_file
echo ""
+ if [ $RES_DEVIATION -gt 0 ]; then
+ echo "Test case deviations"
+ echo "===================================="
+ cat $DEVIATION_FILE
+ fi
+ echo ""
+ echo "Timer measurement in the test script"
+ echo "===================================="
+ column -t -s $'\t' $TIMER_MEASUREMENTS
+ echo ""
+
total=$((RES_PASS+RES_FAIL))
if [ $RES_TEST -eq 0 ]; then
echo -e "\033[1mNo tests seem to have been executed. Check the script....\033[0m"
fi
fi
- if [ $RES_DEVIATION -gt 0 ]; then
- echo "Test case deviations"
- echo "===================================="
- cat $DEVIATION_FILE
- fi
- echo ""
- echo "Timer measurement in the test script"
- echo "===================================="
- column -t -s $'\t' $TIMER_MEASUREMENTS
- echo ""
-
echo "++++ Number of tests: "$RES_TEST
echo "++++ Number of passed tests: "$RES_PASS
echo "++++ Number of failed tests: "$RES_FAIL
echo -ne " $APP: $CONTR - ${GREEN}stopping${EGREEN}${SAMELINE}"
docker stop $(docker ps -qa --filter name=${CONTR}) &> /dev/null
echo -ne " $APP: $CONTR - ${GREEN}stopped${EGREEN}${SAMELINE}"
- docker rm $(docker ps -qa --filter name=${CONTR}) &> /dev/null
+ docker rm --force $(docker ps -qa --filter name=${CONTR}) &> /dev/null
echo -e " $APP: $CONTR - ${GREEN}stopped removed${EGREEN}"
done
echo ""
+
+ echo -e $BOLD" Removing docker network"$EBOLD
+ TMP=$(docker network ls -q --filter name=$DOCKER_SIM_NWNAME)
+ if [ "$TMP" == $DOCKER_SIM_NWNAME ]; then
+ docker network rm $DOCKER_SIM_NWNAME
+ if [ $? -ne 0 ]; then
+ echo -e $RED" Cannot remove docker network. Manually remove or disconnect containers from $DOCKER_SIM_NWNAME"$ERED
+ exit 1
+ fi
+ fi
+
+ echo -e $BOLD" Removing all unused docker neworks"$EBOLD
+ docker network prune --force #&> /dev/null
+
+ echo -e $BOLD" Removing all unused docker volumes"$EBOLD
+ docker volume prune --force #&> /dev/null
+
+ echo -e $BOLD" Removing all dangling/untagged docker images"$EBOLD
+ docker rmi --force $(docker images -q -f dangling=true) &> /dev/null
+ echo ""
}
# Function stop and remove all container in the end of the test script, if the arg 'auto-clean' is given at test script start
pa_st=false
echo -ne " Waiting for container ${appname} service status...${SAMELINE}"
- for i in {1..20}; do
+ TSTART=$SECONDS
+ for i in {1..50}; do
if [ $4 == "https" ]; then
result="$(__do_curl "-k https://localhost:"${localport}${url})"
else
result="...response text too long, omitted"
fi
echo -ne " Waiting for container $BOLD${appname}$EBOLD service status, result: $result${SAMELINE}"
- echo -ne " Container $BOLD${appname}$EBOLD$GREEN is alive$EGREEN, responds to service status:$GREEN $result $EGREEN"
+ echo -ne " Container $BOLD${appname}$EBOLD$GREEN is alive$EGREEN, responds to service status:$GREEN $result $EGREEN after $(($SECONDS-$TSTART)) seconds"
pa_st=true
break
else
- #echo " Retrying in $i seconds"
- echo -ne " Waiting for container ${appname} service status...retrying in $i seconds${SAMELINE}"
- sleep $i
+ TS_TMP=$SECONDS
+ while [ $(($TS_TMP+$i)) -gt $SECONDS ]; do
+ echo -ne " Waiting for container ${appname} service status...retrying in $(($TS_TMP+$i-$SECONDS)) seconds ${SAMELINE}"
+ sleep 1
+ done
fi
done
echo -e $BOLD"Starting SDNC A1 Controller"$EBOLD
+ check_excluded_image 'SDNC'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The image for SDNC and the related DB has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"SDNC will not be started"$ERED
+ exit
+ fi
+
__start_container sdnc NODOCKERARGS $SDNC_APP_NAME $SDNC_EXTERNAL_PORT $SDNC_ALIVE_URL "http"
}
echo -e $BOLD"Starting SDNC ONAP A1 Adapter"$EBOLD
+ check_excluded_image 'SDNC_ONAP'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The image for SDNC ONAP and the related DB has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"SDNC ONAP will not be started"$ERED
+ exit
+ fi
+
__start_container sdnc_onap NODOCKERARGS $SDNC_ONAP_APP_NAME $SDNC_ONAP_EXTERNAL_PORT $SDNC_ONAP_ALIVE_URL "http"
}
fi
echo -e $BOLD"Storing all container logs, Policy Agent app log and consul config using prefix: "$1$EBOLD
+ docker stats --no-stream > $TESTLOGS/$ATC/$1_docker_stats.log 2>&1
docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_consul.log 2>&1
docker logs $CBS_APP_NAME > $TESTLOGS/$ATC/$1_cbs.log 2>&1
docker logs $POLICY_AGENT_APP_NAME > $TESTLOGS/$ATC/$1_policy-agent.log 2>&1
environment:
- MYSQL_ROOT_PASSWORD=openECOMP1.0
- SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
- dns:
- - ${DNS_IP_ADDR-10.0.100.1}
logging:
driver: "json-file"
options:
max-size: "30m"
max-file: "5"
- extra_hosts:
- aaf.osaaf.org: 10.12.6.214
+
environment:
- MYSQL_ROOT_PASSWORD=openECOMP1.0
- SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
- dns:
- - ${DNS_IP_ADDR-10.0.100.1}
logging:
driver: "json-file"
options:
max-size: "30m"
max-file: "5"
- extra_hosts:
- aaf.osaaf.org: 10.12.6.214
+
// Presents a web page on localhost:9999/mon
var LOCALHOST="http://127.0.0.1:"
-var LOCALHOSTSECURE="https://127.0.0.1:"
-//This var may switch between LOCALHOST and LOCALHOSTSECURE
-var SIM_LOCALHOST=LOCALHOST
var MRSTUB_PORT="3905"
var AGENT_PORT="8081"
var CR_PORT="8090"
var http = require('http');
-var https = require('https');
var express = require('express');
var app = express();
var fieldSize=32;
-
+var flagstore={}
//I am alive
app.get("/",function(req, res){
})
//Get parameter valuue from other server
-function getSimCtr(httpx, url, index, cb) {
+function getSimCtr(url, index, cb) {
var data = '';
- var http_type=http
- if (httpx=="https") {
- http_type=https
- }
- console.log("URL: "+ url + " - " + httpx)
+
+ console.log("URL: "+ url + " - ")
try {
- http_type.get(url, (resp) => {
+ http.get(url, (resp) => {
// A chunk of data has been recieved.
resp.on('data', (chunk) => {
data += chunk;
return s;
}
+//Function to check if the previous call has returned, if so return true, if not return false
+//For preventing multiple calls to slow containers.
+function checkFunctionFlag(flag) {
+ if (flagstore.hasOwnProperty(flag)) {
+ if (flagstore[flag] == 0) {
+ flagstore[flag]=1
+ return true
+ } else if (flagstore[flag] > 10) {
+ //Reset flag after ten attempts
+ console.log("Force release flag "+flag)
+ flagstore[flag]=1
+ return true
+ } else {
+ //Previous call not returned
+ console.log("Flag not available "+flag)
+ flagstore[flag]=flagstore[flag]+1
+ return false
+ }
+ } else {
+ flagstore[flag]=1
+ return true
+ }
+}
+//Clear flag for parameter
+function clearFlag(flag) {
+ flagstore[flag]=0
+}
+
//Status variables, for parameters values fetched from other simulators
var mr1="", mr2="", mr3="", mr4="", mr5="", mr6="";
var refreshInterval=4000
-//Ignore self signed cert
-process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = 0;
-
-var sim_http_type="http"
-
function fetchAllMetrics() {
setTimeout(() => {
//Get metric values from the simulators
for(var index=0;index<simnames.length;index++) {
- try {
- if (index == 0) {
- // Check is simulator are running on http or https - no response assumes http
- getSimCtr("https",LOCALHOSTSECURE+simports[index]+"/", index, function(data, index) {
- if (data=="OK") {
- console.log("Found https simulator - assuming all simulators using https" )
- sim_http_type="https"
- SIM_LOCALHOST=LOCALHOSTSECURE
- } else {
- console.log("No https simulator found - assuming all simulators using http" )
- sim_http_type="http"
- SIM_LOCALHOST=LOCALHOST
- }
- });
- }
- } catch(err) {
- console.log("No https simulator found - assuming all simulators using http" )
- sim_http_type="http"
- SIM_LOCALHOST=LOCALHOST
+ if (checkFunctionFlag("simvar1_"+index)) {
+ getSimCtr(LOCALHOST+simports[index]+"/counter/num_instances", index, function(data, index) {
+ simvar1[index] = data;
+ clearFlag("simvar1_"+index)
+ });
+ }
+ if (checkFunctionFlag("simvar2_"+index)) {
+ getSimCtr(LOCALHOST+simports[index]+"/counter/num_types", index, function(data,index) {
+ simvar2[index] = data;
+ clearFlag("simvar2_"+index)
+ });
}
- getSimCtr(sim_http_type, SIM_LOCALHOST+simports[index]+"/counter/num_instances", index, function(data, index) {
- simvar1[index] = data;
+ if (checkFunctionFlag("simvar3_"+index)) {
+ getSimCtr(LOCALHOST+simports[index]+"/policytypes", index, function(data,index) {
+ data=data.replace(/\[/g,'');
+ data=data.replace(/\]/g,'');
+ data=data.replace(/ /g,'');
+ data=data.replace(/\"/g,'');
+ simvar3[index] = data;
+ clearFlag("simvar3_"+index)
+ });
+ }
+ if (checkFunctionFlag("simvar4_"+index)) {
+ getSimCtr(LOCALHOST+simports[index]+"/counter/interface", index, function(data,index) {
+ simvar4[index] = data;
+ clearFlag("simvar4_"+index)
+ });
+ }
+ if (checkFunctionFlag("simvar5_"+index)) {
+ getSimCtr(LOCALHOST+simports[index]+"/counter/remote_hosts", index, function(data,index) {
+ simvar5[index] = data;
+ clearFlag("simvar5_"+index)
+ });
+ }
+ }
+
+ //MR - get metrics values from the MR stub
+ if (checkFunctionFlag("mr1")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_submitted", 0, function(data, index) {
+ mr1 = data;
+ clearFlag("mr1")
});
- getSimCtr(sim_http_type, SIM_LOCALHOST+simports[index]+"/counter/num_types", index, function(data,index) {
- simvar2[index] = data;
+ }
+ if (checkFunctionFlag("mr2")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/requests_fetched", 0, function(data, index) {
+ mr2 = data;
+ clearFlag("mr2")
});
- getSimCtr(sim_http_type, SIM_LOCALHOST+simports[index]+"/policytypes", index, function(data,index) {
- data=data.replace(/\[/g,'');
- data=data.replace(/\]/g,'');
- data=data.replace(/ /g,'');
- data=data.replace(/\"/g,'');
- simvar3[index] = data;
+ }
+ if (checkFunctionFlag("mr3")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_requests", 0, function(data, index) {
+ mr3 = data;
+ clearFlag("mr3")
});
- getSimCtr(sim_http_type, SIM_LOCALHOST+simports[index]+"/counter/interface", index, function(data,index) {
- simvar4[index] = data;
+ }
+ if (checkFunctionFlag("mr4")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_submitted", 0, function(data, index) {
+ mr4 = data;
+ clearFlag("mr4")
});
- getSimCtr(sim_http_type, SIM_LOCALHOST+simports[index]+"/counter/remote_hosts", index, function(data,index) {
- simvar5[index] = data;
+ }
+ if (checkFunctionFlag("mr5")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/responses_fetched", 0, function(data, index) {
+ mr5 = data;
+ clearFlag("mr5")
+ });
+ }
+ if (checkFunctionFlag("mr6")) {
+ getSimCtr(LOCALHOST+MRSTUB_PORT+"/counter/current_responses", 0, function(data, index) {
+ mr6 = data;
+ clearFlag("mr6")
});
}
-
- //MR - get metrics values from the MR stub
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/requests_submitted", 0, function(data, index) {
- mr1 = data;
- });
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/requests_fetched", 0, function(data, index) {
- mr2 = data;
- });
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/current_requests", 0, function(data, index) {
- mr3 = data;
- });
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/responses_submitted", 0, function(data, index) {
- mr4 = data;
- });
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/responses_fetched", 0, function(data, index) {
- mr5 = data;
- });
- getSimCtr("http", LOCALHOST+MRSTUB_PORT+"/counter/current_responses", 0, function(data, index) {
- mr6 = data;
- });
//CR - get metrics values from the callbackreceiver
- getSimCtr("http", LOCALHOST+CR_PORT+"/counter/received_callbacks", 0, function(data, index) {
- cr1 = data;
- });
- getSimCtr("http", LOCALHOST+CR_PORT+"/counter/fetched_callbacks", 0, function(data, index) {
- cr2 = data;
- });
- getSimCtr("http", LOCALHOST+CR_PORT+"/counter/current_messages", 0, function(data, index) {
- cr3 = data;
- });
-
- //Agent - get metrics from the agent
- getSimCtr("http", LOCALHOST+AGENT_PORT+"/status", 0, function(data, index) {
- ag1 = data;
- });
- getSimCtr("http", LOCALHOST+AGENT_PORT+"/services", 0, function(data, index) {
- ag2="";
- try {
- var jd=JSON.parse(data);
- for(var key in jd) {
- if (ag2.length > 1) {
- ag2=ag2+", "
+ if (checkFunctionFlag("cr1")) {
+ getSimCtr(LOCALHOST+CR_PORT+"/counter/received_callbacks", 0, function(data, index) {
+ cr1 = data;
+ clearFlag("cr1")
+ });
+ }
+ if (checkFunctionFlag("cr2")) {
+ getSimCtr(LOCALHOST+CR_PORT+"/counter/fetched_callbacks", 0, function(data, index) {
+ cr2 = data;
+ clearFlag("cr2")
+ });
+ }
+ if (checkFunctionFlag("cr3")) {
+ getSimCtr(LOCALHOST+CR_PORT+"/counter/current_messages", 0, function(data, index) {
+ cr3 = data;
+ clearFlag("cr3")
+ });
+ }
+ //Agent - more get metrics from the agent
+ if (checkFunctionFlag("ag1")) {
+ getSimCtr(LOCALHOST+AGENT_PORT+"/status", 0, function(data, index) {
+ ag1 = data;
+ clearFlag("ag1")
+ });
+ }
+ if (checkFunctionFlag("ag2")) {
+ getSimCtr(LOCALHOST+AGENT_PORT+"/services", 0, function(data, index) {
+ ag2="";
+ try {
+ var jd=JSON.parse(data);
+ for(var key in jd) {
+ if (ag2.length > 1) {
+ ag2=ag2+", "
+ }
+ ag2=ag2+(jd[key]["serviceName"]).trim()
}
- ag2=ag2+(jd[key]["serviceName"]).trim()
}
- }
- catch (err) {
- ag2=data
- }
- });
- getSimCtr("http", LOCALHOST+AGENT_PORT+"/policy_types", 0, function(data, index) {
- ag3="";
- try {
- var jd=JSON.parse(data);
- for(var key in jd) {
- if (ag3.length > 0) {
- ag3=ag3+", "
+ catch (err) {
+ ag2=data
+ }
+ clearFlag("ag2")
+ });
+ }
+ if (checkFunctionFlag("ag3")) {
+ getSimCtr(LOCALHOST+AGENT_PORT+"/policy_types", 0, function(data, index) {
+ ag3="";
+ try {
+ var jd=JSON.parse(data);
+ for(var key in jd) {
+ if (ag3.length > 0) {
+ ag3=ag3+", "
+ }
+ ag3=ag3+jd[key].trim()
}
- ag3=ag3+jd[key].trim()
}
- }
- catch (err) {
- ag3=""
- }
- });
- getSimCtr("http", LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, index) {
- ag4=""
- try {
- var jd=JSON.parse(data);
- ag4=""+jd.length
- }
- catch (err) {
+ catch (err) {
+ ag3=""
+ }
+ clearFlag("ag3")
+ });
+ }
+ if (checkFunctionFlag("ag4")) {
+ getSimCtr(LOCALHOST+AGENT_PORT+"/policy_ids", 0, function(data, index) {
ag4=""
- }
- });
-
+ try {
+ var jd=JSON.parse(data);
+ ag4=""+jd.length
+ }
+ catch (err) {
+ ag4=""
+ }
+ clearFlag("ag4")
+ });
+ }
fetchAllMetrics();