--- /dev/null
+#!/usr/bin/env 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="Preparation demo setup - populating a number of ric simulators with types and instances"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="ECS"
+
+. ../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"
+use_cr_http
+use_agent_rest_http
+use_sdnc_http
+use_simulator_http
+
+clean_containers
+
+OSC_NUM_RICS=6
+STD_NUM_RICS=5
+
+start_ric_simulators $RIC_SIM_PREFIX"_g1" $OSC_NUM_RICS OSC_2.1.0
+
+start_ric_simulators $RIC_SIM_PREFIX"_g2" $STD_NUM_RICS STD_1.1.3
+
+start_mr #Just to prevent errors in the agent log...
+
+start_control_panel
+
+CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
+use_cr_http
+
+start_sdnc
+
+start_consul_cbs
+
+prepare_consul_config SDNC ".consul_config.json"
+consul_config_app ".consul_config.json"
+
+start_policy_agent
+
+api_get_status 200
+
+# Print the A1 version for OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_print $RIC_SIM_PREFIX"_g1_"$i interface
+done
+
+
+# Print the A1 version for STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ sim_print $RIC_SIM_PREFIX"_g2_"$i interface
+done
+
+
+# Load the polictypes in osc
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 100 demo-testdata/OSC/sim_qos.json
+ sim_put_policy_type 201 $RIC_SIM_PREFIX"_g1_"$i 20008 demo-testdata/OSC/sim_tsa.json
+done
+
+
+#Check the number of schemas and the individual schemas in OSC
+api_equal json:policy_types 3 120
+
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ api_equal json:policy_types?ric=$RIC_SIM_PREFIX"_g1_"$i 2 120
+done
+
+# Check the schemas in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ api_get_policy_schema 200 100 demo-testdata/OSC/qos-agent-modified.json
+ api_get_policy_schema 200 20008 demo-testdata/OSC/tsa-agent-modified.json
+done
+
+
+# Create policies
+use_agent_rest_http
+
+api_put_service 201 "Emergency-response-app" 0 "$CR_PATH/1"
+
+# Create policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ generate_uuid
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 100 $((3000+$i)) NOTRANSIENT demo-testdata/OSC/piqos_template.json 1
+ generate_uuid
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g1_"$i 20008 $((4000+$i)) NOTRANSIENT demo-testdata/OSC/pitsa_template.json 1
+done
+
+
+# Check the number of policies in OSC
+for ((i=1; i<=$OSC_NUM_RICS; i++))
+do
+ sim_equal $RIC_SIM_PREFIX"_g1_"$i num_instances 2
+done
+
+
+# Create policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ generate_uuid
+ api_put_policy 201 "Emergency-response-app" $RIC_SIM_PREFIX"_g2_"$i NOTYPE $((2100+$i)) NOTRANSIENT demo-testdata/STD/pi1_template.json 1
+done
+
+
+# Check the number of policies in STD
+for ((i=1; i<=$STD_NUM_RICS; i++))
+do
+ sim_equal $RIC_SIM_PREFIX"_g2_"$i num_instances 1
+done
+
+check_policy_agent_logs
+
+#### TEST COMPLETE ####
+
+store_logs END
+
+print_result
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
echo "#####################################################################"
echo "#####################################################################"
- #Local vars in test script
- ##########################
if [ $__httpx == "HTTPS" ]; then
- # Path to callback receiver
CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
use_cr_https
+ use_simulator_https
+ use_mr_https
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_https
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_https
+ else
+ use_agent_rest_https
+ fi
else
- # Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
use_cr_http
+ use_simulator_http
+ use_mr_http
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_http
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_http
+ else
+ use_agent_rest_http
+ fi
fi
# Clean container and start all needed containers #
clean_containers
- if [ $__httpx == "HTTPS" ]; then
- #"Using secure ports towards simulators"
- use_simulator_https
- else
- #"Using non-secure ports towards simulators"
- use_simulator_http
- fi
-
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
start_mr
- if [ $__httpx == "HTTPS" ]; then
- #echo "Using secure ports between agent and MR"
- use_mr_https
- else
- #"Using non-secure ports between agent and MR"
- use_mr_http
- fi
-
start_cr
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
-
- start_sdnc
-
- if [ $__httpx == "HTTPS" ]; then
- # "Using secure ports towards SDNC"
- use_sdnc_https
- else
- #"Using non-secure ports towards SDNC"
- use_sdnc_http
- fi
- fi
-
start_consul_cbs
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"SDNC"* ]]; then
+ start_sdnc
prepare_consul_config SDNC ".consul_config.json"
else
prepare_consul_config NOSDNC ".consul_config.json"
set_agent_debug
- if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
- if [ $__httpx == "HTTPS" ]; then
- echo "Using secure ports towards dmaap"
- use_agent_dmaap_https
- else
- echo "Using non-secure ports towards dmaap"
- use_agent_dmaap_http
- fi
- else
- 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
- fi
-
-
cr_equal received_callbacks 0
mr_equal requests_submitted 0
cr_equal received_callbacks 0
- if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"DMAAP"* ]]; then
VAL=11 # Number of Agent API calls over DMAAP
mr_equal requests_fetched $VAL
mr_equal responses_submitted $VAL
mr_equal requests_submitted 0
fi
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"SDNC"* ]]; then
sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
else
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"
+EXCLUDED_IMAGES="SDNC ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
##########################
# Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
use_cr_http
+use_simulator_http
+use_mr_http
+use_agent_rest_http
+
clean_containers
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
echo "#####################################################################"
echo "#####################################################################"
- #Local vars in test script
- ##########################
-
if [ $__httpx == "HTTPS" ]; then
- # Path to callback receiver
CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
use_cr_https
+ use_simulator_https
+ use_mr_https
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_https
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_https
+ else
+ use_agent_rest_https
+ fi
else
- # Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
use_cr_http
+ use_simulator_http
+ use_mr_http
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_http
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_http
+ else
+ use_agent_rest_http
+ fi
fi
# Clean container and start all needed containers #
clean_containers
- if [ $__httpx == "HTTPS" ]; then
- #"Using secure ports towards simulators"
- use_simulator_https
- else
- #"Using non-secure ports towards simulators"
- use_simulator_http
- fi
-
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
start_mr
- if [ $__httpx == "HTTPS" ]; then
- #echo "Using secure ports between agent and MR"
- use_mr_https
- else
- #"Using non-secure ports between agent and MR"
- use_mr_http
- fi
-
start_cr
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
-
- start_sdnc
-
- if [ $__httpx == "HTTPS" ]; then
- # "Using secure ports towards SDNC"
- use_sdnc_https
- else
- #"Using non-secure ports towards SDNC"
- use_sdnc_http
- fi
- fi
-
start_consul_cbs
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"SDNC"* ]]; then
+ start_sdnc
prepare_consul_config SDNC ".consul_config.json"
else
prepare_consul_config NOSDNC ".consul_config.json"
set_agent_debug
- if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
- if [ $__httpx == "HTTPS" ]; then
- echo "Using secure ports towards dmaap"
- use_agent_dmaap_https
- else
- echo "Using non-secure ports towards dmaap"
- use_agent_dmaap_http
- fi
- else
- if [ $__httpx == "HTTPS" ]; then
- #"Using secure ports towards the agent"
- use_agent_rest_https
- else
- #"Using non-secure ports towards the agent"
- use_agent_rest_http
- fi
- fi
-
-
cr_equal received_callbacks 0
mr_equal requests_submitted 0
api_equal json:policy_ids 0
-
-
echo "############################################"
echo "############## Health check ################"
echo "############################################"
cr_equal received_callbacks 0
- if [ $interface == "DMAAP" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"DMAAP"* ]]; then
mr_greater requests_submitted 0
VAL=$(mr_read requests_submitted)
mr_equal requests_fetched $VAL
mr_equal requests_submitted 0
fi
- if [ $interface == "REST+SDNC" ] || [ $interface == "DMAAP+SDNC" ]; then
+ if [[ $interface = *"SDNC"* ]]; then
sim_contains_str ricsim_g1_1 remote_hosts "a1-controller"
sim_contains_str ricsim_g2_1 remote_hosts "a1-controller"
else
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"
+EXCLUDED_IMAGES="SDNC ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
##########################
# Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
+
use_cr_http
+use_simulator_http
+use_mr_http
+use_agent_rest_http
#### TEST BEGIN ####
set_agent_debug
-use_agent_rest_http
-
#Verify no callbacks or dmaap messages has been sent
cr_equal received_callbacks 0
mr_equal requests_submitted 0
api_get_service_ids 200
deviation "TR18 Agents sends callback with empty body"
-cr_equal received_callbacks 0
+cr_equal received_callbacks 4
mr_equal requests_submitted 0
check_policy_agent_logs
--- /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="Experimental ECS test case"
+
+#App names to exclude checking pulling images for, space separated list
+EXCLUDED_IMAGES="SDNC PA CP CR MR RICSIM CONSUL CBS"
+
+. ../common/testcase_common.sh $@
+. ../common/ecs_api_functions.sh
+
+#### TEST BEGIN ####
+
+clean_containers
+
+use_ecs_rest_https
+
+use_ecs_rest_https
+
+start_ecs
+
+set_ecs_debug
+
+
+
+
+ecs_api_a1_get_job_ids 200
+ecs_api_a1_get_type 200
+ecs_api_a1_get_type_ids 200
+ecs_api_a1_get_job_status 200
+ecs_api_a1_get_job 200
+ecs_api_a1_delete_job 200
+ecs_api_a1_put_job 200
+ecs_api_edp_get_type_ids 200
+ecs_api_edp_get_producer_status 200
+ecs_api_edp_get_producer_ids 200 NOID
+ecs_api_edp_get_type 200
+ecs_api_edp_get_producer 200
+ecs_api_edp_delete_producer 200
+ecs_api_edp_put_producer 200
+ecs_api_edp_get_producer_jobs 200
+ecs_api_sim_post_job_delete_error 200
+ecs_api_sim_get_producer_supervision 200
+ecs_api_sim_post_job_deleted 200
+ecs_api_get_producer_supervision_error 200
+ecs_api_sim_get_job_created_error 200
+ecs_api_sim_get_job_created 200
+ecs_api_service_status 200
+
+
+
+store_logs END
+
+#### TEST COMPLETE ####
+
+
+print_result
+
+auto_clean_containers
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"
+EXCLUDED_IMAGES="PA CP ECS"
. ../common/testcase_common.sh $@
. ../common/controller_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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
echo "#####################################################################"
echo "#####################################################################"
- #Local vars in test script
- ##########################
-
if [ $__httpx == "HTTPS" ]; then
- # Path to callback receiver
CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
use_cr_https
+ use_simulator_https
+ use_mr_https
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_https
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_https
+ else
+ use_agent_rest_https
+ fi
else
- # Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
use_cr_http
+ use_simulator_http
+ use_mr_http
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_http
+ fi
+ if [[ $interface = *"DMAAP"* ]]; then
+ use_agent_dmaap_http
+ else
+ use_agent_rest_http
+ fi
fi
# Clean container and start all needed containers #
clean_containers
- if [ $__httpx == "HTTPS" ]; then
- #echo "Using secure ports between agent and MR"
- use_mr_https
- echo "Using secure ports towards simulators"
- use_simulator_https
- else
- #"Using non-secure ports between agent and MR"
- use_mr_http
- echo "Using non-secure ports towards simulators"
- use_simulator_http
- fi
-
start_ric_simulators ricsim_g1 4 OSC_2.1.0
start_ric_simulators ricsim_g2 4 STD_1.1.3
if [[ $interface = *"SDNC"* ]]; then
start_sdnc
- if [ $__httpx == "HTTPS" ]; then
- # "Using secure ports towards SDNC"
- use_sdnc_https
- else
- #"Using non-secure ports towards SDNC"
- use_sdnc_http
- fi
- prepare_consul_config SDNC ".consul_config.json"
+ prepare_consul_config SDNC ".consul_config.json"
else
prepare_consul_config NOSDNC ".consul_config.json"
fi
set_agent_debug
- if [[ $interface == *"DMAAP"* ]]; then
- if [ $__httpx == "HTTPS" ]; then
- echo "Using secure ports towards dmaap"
- use_agent_dmaap_https
- else
- echo "Using non-secure ports towards dmaap"
- use_agent_dmaap_http
- fi
- else
- 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
- fi
-
api_get_status 200
sim_print ricsim_g1_1 interface
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
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"
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
+ sleep_wait 120
api_equal json:policy_ids 0
api_get_policy_types 404 ricsim_g1_9
- sim_equal ricsim_g1_9 num_instances 1
+ sim_equal ricsim_g1_9 num_instances 0
api_delete_policy 404 2000
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
+ sleep_wait 120
api_equal json:policy_ids 0
sim_delete_policy_type 204 ricsim_g1_6 4
sim_delete_policy_type 204 ricsim_g1_7 4
- sleep 120
+ sleep_wait 120
api_equal json:policy_types?ric=ricsim_g1_1 1 120
api_equal json:policy_types?ric=ricsim_g1_2 2 120
check_policy_agent_logs
store_logs ${interface}
+
done
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
echo "#####################################################################"
echo "#####################################################################"
- #Local vars in test script
- ##########################
-
if [ $__httpx == "HTTPS" ]; then
# Path to callback receiver
CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
use_cr_https
+ use_simulator_https
+ use_mr_https
+ use_agent_rest_https
else
# Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
use_cr_http
+ use_simulator_http
+ use_mr_http
+ use_agent_rest_http
fi
# Policy instance start id
clean_containers
- if [ $__httpx == "HTTPS" ]; then
- #"Using secure ports towards simulators"
- use_simulator_https
- else
- #"Using non-secure ports towards simulators"
- use_simulator_http
- fi
-
start_ric_simulators ricsim_g1 1 OSC_2.1.0
start_ric_simulators ricsim_g2 1 STD_1.1.3
start_mr
- if [ $__httpx == "HTTPS" ]; then
- #echo "Using secure ports between agent and MR"
- use_mr_https
- else
- #"Using non-secure ports between agent and MR"
- use_mr_http
- fi
-
start_cr
- if [ $interface == "SDNC" ]; then
-
+ if [[ $interface == "SDNC" ]]; then
start_sdnc
-
- if [ $__httpx == "HTTPS" ]; then
- # "Using secure ports towards SDNC"
- use_sdnc_https
- else
- #"Using non-secure ports towards SDNC"
- use_sdnc_http
- fi
- fi
-
- start_consul_cbs
-
- if [ $interface == "SDNC" ]; then
prepare_consul_config SDNC ".consul_config.json"
else
prepare_consul_config NOSDNC ".consul_config.json"
fi
+ start_consul_cbs
+
consul_config_app ".consul_config.json"
start_control_panel
set_agent_debug
- if [ $__httpx == "HTTPS" ]; then
- # "Using secure ports towards the agent"
- use_agent_rest_https
- else
- # "Using non-secure ports towards the agent"
- use_agent_rest_http
- fi
-
-
cr_equal received_callbacks 0
mr_equal requests_submitted 0
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
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"
+EXCLUDED_IMAGES="ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
echo "#####################################################################"
echo "#####################################################################"
- #Local vars in test script
- ##########################
-
if [ $__httpx == "HTTPS" ]; then
- # Path to callback receiver
CR_PATH="https://$CR_APP_NAME:$CR_EXTERNAL_SECURE_PORT/callbacks"
use_cr_https
+ use_simulator_https
+ use_mr_https
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_https
+ fi
+ use_agent_rest_https
else
- # Path to callback receiver
CR_PATH="http://$CR_APP_NAME:$CR_EXTERNAL_PORT/callbacks"
use_cr_http
+ use_simulator_http
+ use_mr_http
+ if [[ $interface = *"SDNC"* ]]; then
+ use_sdnc_http
+ fi
+ use_agent_rest_http
fi
# 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
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++))
TC_ONELINE_DESCR="Preparation for test of the Control Panel and the Health Check app - populating a number of ric simulators with types and instances"
#App names to exclude checking pulling images for, space separated list
-EXCLUDED_IMAGES="SDNC SDNC_ONAP"
+EXCLUDED_IMAGES="SDNC ECS"
. ../common/testcase_common.sh $@
. ../common/agent_api_functions.sh
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "2",
+ "description": "Hello World policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file
--- /dev/null
+{
+ "threshold": XXX
+}
\ No newline at end of file
--- /dev/null
+{
+ "scope": {
+ "ueId": "0x349d230330ea60XXX",
+ "qosId": "4"
+ },
+ "qosObjectives": {
+ "priorityLevel": 30
+ }
+ }
\ No newline at end of file
--- /dev/null
+{
+ "threshold": XXX
+}
\ No newline at end of file
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "100",
+ "description": "Quality of Service policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "ueId": {
+ "type": "string"
+ },
+ "qosId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "ueId",
+ "qosId"
+ ]
+ },
+ "qosObjectives": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjectives"
+ ]
+ }
--- /dev/null
+{
+ "name": "hwpolicy",
+ "description": "Hellow World policy type",
+ "policy_type_id": 2,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "HW Policy",
+ "description": "Hello World policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
+ }
\ No newline at end of file
--- /dev/null
+{
+ "name": "pt1",
+ "description": "pt1 policy type",
+ "policy_type_id": 100,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "OSC_Type1_1.0.0",
+ "description": "Quality of Service policy type",
+ "type": "object",
+ "properties": {
+ "scope": {
+ "type": "object",
+ "properties": {
+ "ueId": {
+ "type": "string"
+ },
+ "qosId": {
+ "type": "string"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "ueId",
+ "qosId"
+ ]
+ },
+ "qosObjectives": {
+ "type": "object",
+ "properties": {
+ "priorityLevel": {
+ "type": "number"
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "priorityLevel"
+ ]
+ }
+ },
+ "additionalProperties": false,
+ "required": [
+ "scope", "qosObjectives"
+ ]
+ }
+}
--- /dev/null
+{
+ "name": "tsapolicy",
+ "description": "tsa parameters",
+ "policy_type_id": 20008,
+ "create_schema": {
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "TS Policy",
+ "description": "Traffic Steering - High prio traffic - policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
+}
\ No newline at end of file
--- /dev/null
+{
+ "$schema": "http://json-schema.org/draft-07/schema#",
+ "title": "20008",
+ "description": "Traffic Steering - High prio traffic - policy type",
+ "type": "object",
+ "properties": {
+ "threshold": {
+ "type": "integer",
+ "default": 0
+ }
+ },
+ "additionalProperties": false
+ }
\ No newline at end of file
--- /dev/null
+{
+ "scope": {
+ "ueId": "ueXXX",
+ "qosId": "qosXXX"
+ },
+ "qosObjectives": {
+ "priorityLevel": XXX
+ }
+}
\ No newline at end of file
| parameter | description |
| --------- | ----------- |
-| `SDNC|SDNC_ONAP|NOSDNC` | Configure based on a1-controller (SNDC), a1-adapter (SDNC_ONAP) or without a controller/adapter (NOSDNC) |
+| `SDNC|NOSDNC` | Configure based on a1-controller (SNDC) or without a controller/adapter (NOSDNC) |
| `<output-file>` | The path to the json output file containing the prepared config. This file is used in 'consul_config_app' |
#### Function: start_consul_cbs ####
|--|
| None |
-#### Function: start_sdnc_onap ####
-Start the SDNC A1 Adapter container and its database container
-| arg list |
-|--|
-| None |
-
-#### Function: config_sdnc_onap ####
-Configure the SDNC A1 adapter - Not implemented
-| arg list |
-|--|
-| None |
-
#### Function: start_mr ####
Start the Message Router stub interface container
| arg list |
### API functiond towards the Policy Agent
-# Generic function to query the agent via the REST or DMAAP interface.
-# Used by all other agent api test functions
-# If operation prefix is '_BATCH' the the send and get response is split in two sequences,
-# one for sending the requests and one for receiving the response
-# but only when using the DMAAP interface
-# REST or DMAAP is controlled of the base url of $ADAPTER
-# arg: (GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (RESPONSE <correlation-id>)
-# (Not for test scripts)
-__do_curl_to_agent() {
- echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
- paramError=0
-
- if [ $# -lt 2 ] || [ $# -gt 3 ]; then
- paramError=1
- else
- timeout=""
- oper=""
- file=''
- httpcode=" -sw %{http_code}"
- accept=''
- content=''
- batch=0
- if [[ $1 == *"_BATCH" ]]; then
- batch=1
- fi
- if [ $# -gt 2 ]; then
- content=" -H Content-Type:application/json"
- fi
- if [ $1 == "GET" ] || [ $1 == "GET_BATCH" ]; then
- oper="GET"
- if [ $# -ne 2 ]; then
- paramError=1
- fi
- elif [ $1 == "PUT" ] || [ $1 == "PUT_BATCH" ]; then
- oper="PUT"
- if [ $# -eq 3 ]; then
- file=" --data-binary @$3"
- fi
- accept=" -H accept:application/json"
- elif [ $1 == "POST" ] || [ $1 == "POST_BATCH" ]; then
- oper="POST"
- accept=" -H accept:*/*"
- if [ $# -ne 2 ]; then
- paramError=1
- fi
- elif [ $1 == "DELETE" ] || [ $1 == "DELETE_BATCH" ]; then
- oper="DELETE"
- if [ $# -ne 2 ]; then
- paramError=1
- fi
- elif [ $1 == "RESPONSE" ]; then
- oper="RESPONSE"
- if [ $# -ne 2 ]; then
- paramError=1
- fi
- if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
- paramError=1
- fi
- else
- paramError=1
- fi
- fi
-
- if [ $paramError -eq 1 ]; then
- ((RES_CONF_FAIL++))
- echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG
- echo "-Expected: (GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (RESPONSE <correlation-id>) [<file>]" >> $HTTPLOG
- echo "-Returning response 000" >> $HTTPLOG
- echo "-000"
- return 1
- fi
-
- if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
- url=" "${ADAPTER}${2}
- oper=" -X "$oper
- curlString="curl -k "${oper}${timeout}${httpcode}${accept}${content}${url}${file}
- echo " CMD: "$curlString >> $HTTPLOG
- if [ $# -eq 3 ]; then
- echo " FILE: $(<$3)" >> $HTTPLOG
- fi
-
- # Do retry for configured response codes, otherwise only one attempt
- maxretries=5
- while [ $maxretries -ge 0 ]; do
-
- let maxretries=maxretries-1
- res=$($curlString)
- retcode=$?
- if [ $retcode -ne 0 ]; then
- echo " RETCODE: "$retcode >> $HTTPLOG
- echo "000"
- return 1
- fi
- retry=0
- echo " RESP: "$res >> $HTTPLOG
- status=${res:${#res}-3}
- if [ ! -z "${AGENT_RETRY_CODES}" ]; then
- for retrycode in $AGENT_RETRY_CODES; do
- if [ $retrycode -eq $status ]; then
- echo -e $RED" Retrying (according to set codes for retry), got status $status....."$ERED >> $HTTPLOG
- sleep 1
- retry=1
- fi
- done
- fi
- if [ $retry -eq 0 ]; then
- maxretries=-1
- fi
- done
- echo $res
- return 0
- else
- if [ $oper != "RESPONSE" ]; then
- requestUrl=$2
- if [ $1 == "PUT" ] && [ $# -eq 3 ]; then
- payload="$(cat $3 | tr -d '\n' | tr -d ' ' )"
- echo "payload: "$payload >> $HTTPLOG
- file=" --data-binary "$payload
- fi
- #urlencode the request url since it will be carried by send-request url
- requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$2")
- url=" "${ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper}
- curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
- echo " CMD: "$curlString >> $HTTPLOG
- res=$($curlString)
- retcode=$?
- if [ $retcode -ne 0 ]; then
- echo " RETCODE: "$retcode >> $HTTPLOG
- echo "000"
- return 1
- fi
- echo " RESP: "$res >> $HTTPLOG
- status=${res:${#res}-3}
- if [ $status -ne 200 ]; then
- echo "000"
- return 1
- fi
- cid=${res:0:${#res}-3}
- if [[ $batch -eq 1 ]]; then
- echo $cid"200"
- return 0
- fi
- fi
- if [ $oper == "RESPONSE" ] || [ $batch -eq 0 ]; then
- if [ $oper == "RESPONSE" ]; then
- cid=$2
- fi
- url=" "${ADAPTER}"/receive-response?correlationid="${cid}
- curlString="curl -k -X GET"${timeout}${httpcode}${url}
- echo " CMD: "$curlString >> $HTTPLOG
- res=$($curlString)
- retcode=$?
- if [ $retcode -ne 0 ]; then
- echo " RETCODE: "$retcode >> $HTTPLOG
- echo "000"
- return 1
- fi
- echo " RESP: "$res >> $HTTPLOG
- status=${res:${#res}-3}
- TS=$SECONDS
- # wait of the reply from the agent...
- while [ $status -eq 204 ]; do
- if [ $(($SECONDS - $TS)) -gt 90 ]; then
- echo " RETCODE: (timeout after 90s)" >> $HTTPLOG
- echo "000"
- return 1
- fi
- sleep 0.01
- echo " CMD: "$curlString >> $HTTPLOG
- res=$($curlString)
- if [ $retcode -ne 0 ]; then
- echo " RETCODE: "$retcode >> $HTTPLOG
- echo "000"
- return 1
- fi
- echo " RESP: "$res >> $HTTPLOG
- status=${res:${#res}-3}
- done
- if [ $status -eq 200 ]; then
- body=${res:0:${#res}-3}
- echo $body
- return 0
- fi
- echo "Status not 200, returning response 000" >> $HTTPLOG
- echo "0000"
- return 1
- fi
- fi
-}
-
+. ../common/api_curl.sh
#########################################################
#### Test case functions A1 Policy management service
fi
query="/policies"$queryparams
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
fi
query="/policy?id=$UUID$2"
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
file=".p.json"
sed 's/XXX/'${pid}'/g' $7 > $file
- res="$(__do_curl_to_agent PUT $query $file)"
+ res="$(__do_curl_to_api PA PUT $query $file)"
status=${res:${#res}-3}
- echo -ne " Creating "$count"("$max")${SAMELINE}"
+ echo -ne " Executing "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- echo " Created "$count"?("$max")"
+ echo " Executed "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
let pid=$pid+1
let count=$count+1
- echo -ne " Created "$count"("$max")${SAMELINE}"
+ echo -ne " Executed "$count"("$max")${SAMELINE}"
done
echo ""
file=".p.json"
sed 's/XXX/'${pid}'/g' $7 > $file
- res="$(__do_curl_to_agent PUT_BATCH $query $file)"
+ res="$(__do_curl_to_api PA PUT_BATCH $query $file)"
status=${res:${#res}-3}
- echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne 200 ]; then
echo " Requested(batch) "$count"?("$max")"
count=0
for cid in $ARR; do
- res="$(__do_curl_to_agent RESPONSE $cid)"
+ res="$(__do_curl_to_api PA RESPONSE $cid)"
status=${res:${#res}-3}
- echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- echo " Created(batch) "$count"?("$max")"
+ echo " Requested(batch) "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
fi
let count=$count+1
- echo -ne " Created(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
done
echo ""
fi
done
if [ -z $msg ]; then
- echo " $(($count*$num_rics)) policies created/updated"
+ echo " $(($count*$num_rics)) policy request(s) executed"
((RES_PASS++))
echo -e $GREEN" PASS"$EGREEN
return 0
while [ $count -lt $max ]; do
query="/policy?id="$UUID$pid
- res="$(__do_curl_to_agent DELETE $query)"
+ res="$(__do_curl_to_api PA DELETE $query)"
status=${res:${#res}-3}
- echo -ne " Deleting "$count"("$max")${SAMELINE}"
+ echo -ne " Executing "$count"("$max")${SAMELINE}"
if [ $status -ne $1 ]; then
- echo " Deleted "$count"?("$max")"
+ echo " Executed "$count"?("$max")"
echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
((RES_FAIL++))
__check_stop_at_error
fi
let pid=$pid+1
let count=$count+1
- echo -ne " Deleted "$count"("$max")${SAMELINE}"
+ echo -ne " Executed "$count"("$max")${SAMELINE}"
done
echo ""
ARR=""
while [ $count -lt $max ]; do
query="/policy?id="$UUID$pid
- res="$(__do_curl_to_agent DELETE_BATCH $query)"
+ res="$(__do_curl_to_api PA DELETE_BATCH $query)"
status=${res:${#res}-3}
- echo -ne " Requested(batch) "$count"("$max")${SAMELINE}"
+ echo -ne " Requesting(batch) "$count"("$max")${SAMELINE}"
if [ $status -ne 200 ]; then
echo " Requested(batch) "$count"?("$max")"
count=0
for cid in $ARR; do
- res="$(__do_curl_to_agent RESPONSE $cid)"
+ res="$(__do_curl_to_api PA RESPONSE $cid)"
status=${res:${#res}-3}
echo -ne " Deleted(batch) "$count"("$max")${SAMELINE}"
fi
done
if [ -z $msg ]; then
- echo " $(($count*$num_rics)) deleted"
+ echo " $(($count*$num_rics)) policy request(s) executed"
((RES_PASS++))
echo -e $GREEN" PASS"$EGREEN
return 0
fi
query="/policy_ids"$queryparams
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
fi
query="/policy_schema?id=$2"
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query=$query"?ric="$2
fi
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query="/policy_status?id="$UUID$2
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query="/policy_types?ric=$2"
fi
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
return 1
fi
query="/status"
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query="/ric?managedElementId="$2
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query="/rics?policyType="$2
fi
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
file=".tmp.json"
echo "$json" > $file
- res="$(__do_curl_to_agent PUT $query $file)"
+ res="$(__do_curl_to_api PA PUT $query $file)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
query="/services?name="$2
fi
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
fi
query="/services"
- res="$(__do_curl_to_agent GET $query)"
+ res="$(__do_curl_to_api PA GET $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
fi
query="/services?name="$2
- res="$(__do_curl_to_agent DELETE $query)"
+ res="$(__do_curl_to_api PA DELETE $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
fi
query="/services/keepalive?name="$2
- res="$(__do_curl_to_agent PUT $query)"
+ res="$(__do_curl_to_api PA PUT $query)"
status=${res:${#res}-3}
if [ $status -ne $1 ]; then
--- /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=================================================
+#
+
+# Generic function to query the agent/ECS via the REST or DMAAP interface.
+# Used by all other agent/ECS api test functions
+# If operation prefix is '_BATCH' the the send and get response is split in two sequences,
+# one for sending the requests and one for receiving the response
+# but only when using the DMAAP interface
+# REST or DMAAP is controlled of the base url of $ADAPTER
+# arg: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)
+# (Not for test scripts)
+__do_curl_to_api() {
+ echo "(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ paramError=0
+
+ if [ $# -gt 0 ]; then
+ if [ $1 == "PA" ]; then
+ __ADAPTER=$ADAPTER
+ __RESTBASE=$RESTBASE
+ __RESTBASE_SECURE=$RESTBASE_SECURE
+ __RETRY_CODES=$AGENT_RETRY_CODES
+ elif [ $1 == "ECS" ]; then
+ __ADAPTER=$ECS_ADAPTER
+ __RESTBASE=$ECS_RESTBASE
+ __RESTBASE_SECURE=$ECS_RESTBASE_SECURE
+ __RETRY_CODES=$ECS_RETRY_CODES
+ else
+ paramError=1
+ fi
+ fi
+ if [ $# -lt 3 ] || [ $# -gt 4 ]; then
+ paramError=1
+ else
+ timeout=""
+ oper=""
+ file=''
+ httpcode=" -sw %{http_code}"
+ accept=''
+ content=''
+ batch=0
+ if [[ $2 == *"_BATCH" ]]; then
+ batch=1
+ fi
+ if [ $# -gt 3 ]; then
+ content=" -H Content-Type:application/json"
+ fi
+ if [ $2 == "GET" ] || [ $2 == "GET_BATCH" ]; then
+ oper="GET"
+ if [ $# -ne 3 ]; then
+ paramError=1
+ fi
+ elif [ $2 == "PUT" ] || [ $2 == "PUT_BATCH" ]; then
+ oper="PUT"
+ if [ $# -eq 4 ]; then
+ file=" --data-binary @$4"
+ fi
+ accept=" -H accept:application/json"
+ elif [ $2 == "POST" ] || [ $2 == "POST_BATCH" ]; then
+ oper="POST"
+ accept=" -H accept:*/*"
+ if [ $# -ne 3 ]; then
+ paramError=1
+ fi
+ elif [ $2 == "DELETE" ] || [ $2 == "DELETE_BATCH" ]; then
+ oper="DELETE"
+ if [ $# -ne 3 ]; then
+ paramError=1
+ fi
+ elif [ $2 == "RESPONSE" ]; then
+ oper="RESPONSE"
+ if [ $# -ne 3 ]; then
+ paramError=1
+ fi
+ if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+ paramError=1
+ fi
+ else
+ paramError=1
+ fi
+ fi
+
+ if [ $paramError -eq 1 ]; then
+ ((RES_CONF_FAIL++))
+ echo "-Incorrect number of parameters to __do_curl_agent " $@ >> $HTTPLOG
+ echo "-Expected: (PA|ECS GET|PUT|POST|DELETE|GET_BATCH|PUT_BATCH|POST_BATCH|DELETE_BATCH <url> [<file>]) | (PA|ECS RESPONSE <correlation-id>)" >> $HTTPLOG
+ echo "-Returning response 000" >> $HTTPLOG
+ echo "-000"
+ return 1
+ fi
+
+ if [ $__ADAPTER == $__RESTBASE ] || [ $__ADAPTER == $__RESTBASE_SECURE ]; then
+ url=" "${__ADAPTER}${3}
+ oper=" -X "$oper
+ curlString="curl -k "${oper}${timeout}${httpcode}${accept}${content}${url}${file}
+ echo " CMD: "$curlString >> $HTTPLOG
+ if [ $# -eq 4 ]; then
+ echo " FILE: $(<$4)" >> $HTTPLOG
+ fi
+
+ # Do retry for configured response codes, otherwise only one attempt
+ maxretries=5
+ while [ $maxretries -ge 0 ]; do
+
+ let maxretries=maxretries-1
+ res=$($curlString)
+ retcode=$?
+ if [ $retcode -ne 0 ]; then
+ echo " RETCODE: "$retcode >> $HTTPLOG
+ echo "000"
+ return 1
+ fi
+ retry=0
+ echo " RESP: "$res >> $HTTPLOG
+ status=${res:${#res}-3}
+ if [ ! -z "${__RETRY_CODES}" ]; then
+ for retrycode in $__RETRY_CODES; do
+ if [ $retrycode -eq $status ]; then
+ echo -e $RED" Retrying (according to set codes for retry), got status $status....."$ERED >> $HTTPLOG
+ sleep 1
+ retry=1
+ fi
+ done
+ fi
+ if [ $retry -eq 0 ]; then
+ maxretries=-1
+ fi
+ done
+ echo $res
+ return 0
+ else
+ if [ $oper != "RESPONSE" ]; then
+ requestUrl=$3
+ if [ $2 == "PUT" ] && [ $# -eq 4 ]; then
+ payload="$(cat $4 | tr -d '\n' | tr -d ' ' )"
+ echo "payload: "$payload >> $HTTPLOG
+ file=" --data-binary "$payload
+ fi
+ #urlencode the request url since it will be carried by send-request url
+ requestUrl=$(python3 -c "from __future__ import print_function; import urllib.parse, sys; print(urllib.parse.quote(sys.argv[1]))" "$3")
+ url=" "${__ADAPTER}"/send-request?url="${requestUrl}"&operation="${oper}
+ curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
+ echo " CMD: "$curlString >> $HTTPLOG
+ res=$($curlString)
+ retcode=$?
+ if [ $retcode -ne 0 ]; then
+ echo " RETCODE: "$retcode >> $HTTPLOG
+ echo "000"
+ return 1
+ fi
+ echo " RESP: "$res >> $HTTPLOG
+ status=${res:${#res}-3}
+ if [ $status -ne 200 ]; then
+ echo "000"
+ return 1
+ fi
+ cid=${res:0:${#res}-3}
+ if [[ $batch -eq 1 ]]; then
+ echo $cid"200"
+ return 0
+ fi
+ fi
+ if [ $oper == "RESPONSE" ] || [ $batch -eq 0 ]; then
+ if [ $oper == "RESPONSE" ]; then
+ cid=$3
+ fi
+ url=" "${__ADAPTER}"/receive-response?correlationid="${cid}
+ curlString="curl -k -X GET"${timeout}${httpcode}${url}
+ echo " CMD: "$curlString >> $HTTPLOG
+ res=$($curlString)
+ retcode=$?
+ if [ $retcode -ne 0 ]; then
+ echo " RETCODE: "$retcode >> $HTTPLOG
+ echo "000"
+ return 1
+ fi
+ echo " RESP: "$res >> $HTTPLOG
+ status=${res:${#res}-3}
+ TS=$SECONDS
+ # wait of the reply from the agent/ECS...
+ while [ $status -eq 204 ]; do
+ if [ $(($SECONDS - $TS)) -gt 90 ]; then
+ echo " RETCODE: (timeout after 90s)" >> $HTTPLOG
+ echo "000"
+ return 1
+ fi
+ sleep 0.01
+ echo " CMD: "$curlString >> $HTTPLOG
+ res=$($curlString)
+ if [ $retcode -ne 0 ]; then
+ echo " RETCODE: "$retcode >> $HTTPLOG
+ echo "000"
+ return 1
+ fi
+ echo " RESP: "$res >> $HTTPLOG
+ status=${res:${#res}-3}
+ done
+ if [ $status -eq 200 ]; then
+ body=${res:0:${#res}-3}
+ echo $body
+ return 0
+ fi
+ echo "Status not 200, returning response 000" >> $HTTPLOG
+ echo "0000"
+ return 1
+ fi
+ fi
+}
\ No newline at end of file
--- /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=================================================
+#
+
+# This is a script that contains specific test functions for ECS NB/SB API
+
+. ../common/api_curl.sh
+
+############### EXPERIMENTAL #############
+
+##########################################
+###### Mainly only function skeletons ####
+##########################################
+
+##########################################
+### A1-E Enrichment Data Consumer API ####
+##########################################
+#Function prefix: ecs_api_a1
+
+# API Test function: GET /A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job_ids() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_type() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET ​/A1-EI​/v1​/eitypes
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_type_ids() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}​/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job_status() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_get_job() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: DELETE ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_delete_job() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: PUT ​/A1-EI​/v1​/eitypes​/{eiTypeId}​/eijobs​/{eiJobId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_a1_put_job() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+
+##########################################
+#### Enrichment Data Producer API ####
+##########################################
+# Function prefix: ecs_api_edp
+
+# API Test function: GET /ei-producer/v1/eitypes
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_type_ids() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer_status() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+
+# API Test function: GET /ei-producer/v1/eiproducers
+# args: <response-code> [<producer-id>]*|NOID
+# (Function for test scripts)
+ecs_api_edp_get_producer_ids() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ query="/ei-producer/v1/eiproducers"
+ res="$(__do_curl_to_api ECS GET $query)"
+ status=${res:${#res}-3}
+
+ if [ $status -ne $1 ]; then
+ echo -e $RED" FAIL. Exepected status "$1", got "$status $ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+
+ if [ $# -gt 1 ]; then
+ body=${res:0:${#res}-3}
+ targetJson="["
+
+ for pid in ${@:2} ; do
+ if [ "$targetJson" != "[" ]; then
+ targetJson=$targetJson","
+ fi
+ if [ $pid != "NOID" ]; then
+ targetJson=$targetJson"\"$pid\""
+ fi
+ done
+
+ targetJson=$targetJson"]"
+ echo "TARGET JSON: $targetJson" >> $HTTPLOG
+ res=$(python3 ../common/compare_json.py "$targetJson" "$body")
+
+ if [ $res -ne 0 ]; then
+ echo -e $RED" FAIL, returned body not correct"$ERED
+ ((RES_FAIL++))
+ __check_stop_at_error
+ return 1
+ fi
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eitypes/{eiTypeId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_type() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: DELETE /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_delete_producer() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: PUT /ei-producer/v1/eiproducers/{eiProducerId}
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_put_producer() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET /ei-producer/v1/eiproducers/{eiProducerId}/eijobs
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_edp_get_producer_jobs() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+
+##########################################
+#### Producer Simulator ####
+##########################################
+# Function prefix: ecs_api_sim
+
+# API Test function: POST ​/producer_simulator​/job_deleted_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_post_job_delete_error() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET /producer_simulator​/supervision
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_producer_supervision() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: POST /producer_simulator​/job_deleted
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_post_job_deleted() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: GET ​/producer_simulator​/supervision_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_get_producer_supervision_error() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: POST /producer_simulator​/job_created_error
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_job_created_error() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+# API Test function: POST ​/producer_simulator​/job_created
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_sim_get_job_created() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
+
+
+##########################################
+#### Service status ####
+##########################################
+# Function prefix: ecs_api_service
+
+# API Test function: GET ​/status
+# args: <response-code>
+# (Function for test scripts)
+ecs_api_service_status() {
+ echo -e $BOLD"TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ $EBOLD
+ echo "TEST(${BASH_LINENO[0]}): ${FUNCNAME[0]}" $@ >> $HTTPLOG
+ ((RES_TEST++))
+
+ if [ $# -lt 1 ]; then
+ __print_err "<response-code> [<producer-id>]*|NOID" $@
+ return 1
+ fi
+
+ ((RES_PASS++))
+ echo -e $GREEN" PASS"$EGREEN
+ return 0
+}
\ No newline at end of file
POLICY_AGENT_REMOTE_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/nonrtric-policy-agent"
POLICY_AGENT_REMOTE_IMAGE_TAG="2.1.0"
+# Local ECS image and tag
+ECS_LOCAL_IMAGE="o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_LOCAL_IMAGE_TAG="1.0.0-SNAPSHOT"
+# Remote ECS image and tag
+ECS_REMOTE_IMAGE="nexus3.o-ran-sc.org:10003/o-ran-sc/nonrtric-enrichment-coordinator-service"
+ECS_REMOTE_IMAGE_TAG="1.0.0-SNAPSHOT"
# Control Panel local image and tag
CONTROL_PANEL_LOCAL_IMAGE="o-ran-sc/nonrtric-controlpanel"
#No local image for DB, remote image always used
-# SDNC ONAP A1 Adapte remote image and tag
-SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE="nexus3.onap.org:10003/onap/sdnc-image"
-SDNC_ONAP_A1_ADAPTER_REMOTE_IMAGE_TAG="1.8-STAGING-latest"
-#No local image for the A1 adapter, remote image always used
-
-#ONAP A1 Adatper remote image and tag
-SDNC_ONAP_DB_REMOTE_IMAGE="mysql/mysql-server"
-SDNC_ONAP_DB_REMOTE_IMAGE_TAG="5.6"
-#No local image for DB, remote image always used
-
-
# Near RT RIC Simulator local image and tag
RIC_SIM_LOCAL_IMAGE="nexus3.o-ran-sc.org:10004/o-ran-sc/a1-simulator"
RIC_SIM_LOCAL_IMAGE_TAG="latest"
#CBS remote image and tag
CBS_REMOTE_IMAGE="nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app"
-CBS_REMOTE_IMAGE="onap/org.onap.dcaegen2.platform.configbinding.app-app"
CBS_REMOTE_IMAGE_TAG="2.3.0"
#No local image for CBS, remote image always used
POLICY_AGENT_LOGPATH="/var/log/policy-agent/application.log" # Path the application log in the Policy Agent container
export POLICY_AGENT_APP_NAME_ALIAS="policy-agent-container" # Alias name, name used by the control panel
+export ECS_EXTERNAL_PORT=8082 # ECS container external port (host -> container)
+export ECS_INTERNAL_PORT=8082 # ECS container internal port (container -> container)
+export ECS_EXTERNAL_SECURE_PORT=8434 # ECS container external secure port (host -> container)
+export ECS_INTERNAL_SECURE_PORT=8434 # ECS container internal secure port (container -> container)
+
+export ECS_APP_NAME="ecs" # Name for ECS container
+ECS_LOGPATH="/var/log/ecs/application.log" # Path the application log in the ECS container
+export ECS_APP_NAME_ALIAS="ecs-container" # Alias name, name used by the control panel
+
export MR_EXTERNAL_PORT=3905 # MR stub container external port (host -> container)
export MR_INTERNAL_PORT=3905 # MR stub container internal port (container -> container)
export MR_EXTERNAL_SECURE_PORT=3906 # MR stub container external secure port (host -> container)
SDNC_ALIVE_URL="/apidoc/explorer/" # Base url path for SNDC API docs (for alive check)
SDNC_KARAF_LOG="/opt/opendaylight/data/log/karaf.log" # Path to karaf log
-export SDNC_ONAP_APP_NAME="a1-adapter" # Name of the ONAP A1 Adapter container
-export SDNC_ONAP_EXTERNAL_PORT=8282 # ONAP A1 Adapter container external port (host -> container)
-export SDNC_ONAP_INTERNAL_PORT=8181 # ONAP A1 Adapter container internal port (container -> container)
-export SDNC_ONAP_EXTERNAL_SECURE_PORT=8443 # SNDC A1 Adapter container external securee port (host -> container)
-export SDNC_ONAP_INTERNAL_SECURE_PORT=8343 # SNDC A1 Adapter container internal secure port (container -> container)
-export SDNC_ONAP_DB_APP_NAME="sdnc-onap-db" # Name of the ONAP A1 Adapter DB container
-SDNC_ONAP_USER="admin" # ONAP A1 Adapter username
-SDNC_ONAP_PWD="Kp8bJ4SXszM0WXlhak3eHlcse2gAw84vaoGGmJvUy2U" # ONAP A1 Adapter PWD
-SDNC_ONAP_API_URL="/restconf/operations/A1-ADAPTER-API:" # Base url path for ONAP A1 Adapter API
-SDNC_ONAP_ALIVE_URL="/apidoc/explorer/" # Base url path for ONAP A1 Adapter API docs (for alive check)
-SDNC_ONAP_PROPERTIES_FILE="/opt/onap/ccsdk/data/properties/a1-adapter-api-dg.properties"
-SDNC_ONAP_KARAF_LOG="/opt/opendaylight/data/log/karaf.log" # Path to karaf log
-
export CONTROL_PANEL_APP_NAME="control-panel" # Name of the Control Panel container
export CONTROL_PANEL_EXTERNAL_PORT=8080 # Control Panel container external port (host -> container)
export CONTROL_PANEL_INTERNAL_PORT=8080 # Control Panel container external port (host -> container)
CONTROL_PANEL_LOGPATH="/logs/nonrtric-controlpanel.log" # Path the application log in the Control Panel container
UUID="" # UUID used as prefix to the policy id to simulate a real UUID
- # Testscript need to set the UUID to use other this empty prefix is used
+ # Testscript need to set the UUID otherwise this empty prefix is used
RESTBASE="http://localhost:"$POLICY_AGENT_EXTERNAL_PORT # Base url to the Agent NB REST interface
RESTBASE_SECURE="https://localhost:"$POLICY_AGENT_EXTERNAL_SECURE_PORT # Base url to the secure Agent NB REST interface
DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT # Base url to the Dmaap adapter, http
DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT # Base url to the Dmaap adapter, https
ADAPTER=$RESTBASE # Adapter holds the address the agent R-APP interface (REST OR DMAAP)
- # The values of this var is swiched between the two base url when needed
\ No newline at end of file
+ # The values of this var is swiched between the four base url when needed
+ECS_RESTBASE="http://localhost:"$ECS_EXTERNAL_PORT # Base url to the ECS NB REST interface
+ECS_RESTBASE_SECURE="https://localhost:"$ECS_EXTERNAL_SECURE_PORT # Base url to the secure ECS NB REST interface
+ECS_DMAAPBASE="http://localhost:"$MR_EXTERNAL_PORT # Base url to the Dmaap adapter, http
+ECS_DMAAPBASE_SECURE="https://localhost:"$MR_EXTERNAL_SECURE_PORT # Base url to the Dmaap adapter, https
+ECS_ADAPTER=$ECS_RESTBASE # Adapter holds the address the ECS R-APP interface (REST OR DMAAP)
+ # The values of this var is swiched between the four base url when needed
\ No newline at end of file
# Arg: local|remote|remote-remove [auto-clean] [--stop-at-error] [--ricsim-prefix <prefix> ] [ --env-file <environment-filename> ] [--use-local-image <app-nam> [<app-name>]*]
+# Create a test case id, ATC (Auto Test Case), from the name of the test case script.
+# FTC1.sh -> ATC == FTC1
+ATC=$(basename "${BASH_SOURCE[$i+1]}" .sh)
+
+#Create result file (containing '1' for error) for this test case
+#Will be replaced with a file containing '0' if all test cases pass
+echo "1" > "$PWD/.result$ATC.txt"
+
#Formatting for 'echo' cmd
BOLD="\033[1m"
EBOLD="\033[0m"
#Localhost constant
LOCALHOST="http://localhost:"
-# Make curl retries for http response codes set in this env var, space separated list of codes
+# Make curl retries towards ECS for http response codes set in this env var, space separated list of codes
+ECS_RETRY_CODES=""
+
+# Make curl retries towards the agent for http response codes set in this env var, space separated list of codes
AGENT_RETRY_CODES=""
# Var to contol if the agent runs in a container (normal = 0) or as application on the local machine ( = 1)
USE_LOCAL_IMAGES=""
# List of available apps to override with local image
-AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA CP SDNC RICSIM"
+AVAILABLE_LOCAL_IMAGES_OVERRIDE="PA ECS CP SDNC RICSIM"
# Use this var (STOP_AT_ERROR=1 in the test script) for debugging/trouble shooting to take all logs and exit at first FAIL test case
STOP_AT_ERROR=0
+# Function to indent cmd output with one space
+indent1() { sed 's/^/ /'; }
+
+# Function to indent cmd output with two spaces
+indent2() { sed 's/^/ /'; }
+
# Set a description string for the test case
if [ -z "$TC_ONELINE_DESCR" ]; then
TC_ONELINE_DESCR="<no-description>"
echo $tmpval > .tmp_tcsuite_ctr
fi
-# Create a test case id, ATC (Auto Test Case), from the name of the test case script.
-# FTC1.sh -> ATC == FTC1
-ATC=$(basename "${BASH_SOURCE[$i+1]}" .sh)
-
# Create the logs dir if not already created in the current dir
if [ ! -d "logs" ]; then
mkdir logs
HTTPLOG=$PWD"/.httplog_"$ATC".txt"
echo "" > $HTTPLOG
-#Create result file (containing '1' for error) for this test case
-#Will be replaced with a file containing '0' if script is ok
-
-echo "1" > "$PWD/.result$ATC.txt"
# Create a log dir for the test case
mkdir -p $TESTLOGS/$ATC
echo -e $BOLD"Sourcing env vars from: "$TEST_ENV_VAR_FILE$EBOLD
. $TEST_ENV_VAR_FILE
else
- echo -e $RED"Selected env var fle does not exist: "$TEST_ENV_VAR_FILE$ERED
+ echo -e $RED"Selected env var file does not exist: "$TEST_ENV_VAR_FILE$ERED
exit 1
fi
echo -e " Container\tImage\ttag" > $image_list_file
# Check if image env var is set and if so export the env var with image to use (used by docker compose files)
-# arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name>
+# arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>
__check_image_var() {
- if [ $# -ne 5 ]; then
- echo "Expected arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name>"
+ if [ $# -ne 6 ]; then
+ echo "Expected arg: <image name> <script start-arg> <target-variable-name> <image-variable-name> <image-tag-variable-name> <app-short-name>"
((IMAGE_ERR++))
return
fi
+ __check_excluded_image $6
+ if [ $? -ne 0 ]; then
+ echo -e "$1\t<image-excluded>\t<no-tag>" >> $image_list_file
+ # Image is excluded since the corresponding app is not used in this test
+ return
+ fi
tmp=${1}"\t"
#Create var from the input var names
image="${!4}"
#Check if app local image shall override remote image
+# Possible IDs for local image override: PA, CP, SDNC, RICSIM, ECS
__check_image_local_override() {
for im in $USE_LOCAL_IMAGES; do
if [ "$1" == "$im" ]; then
}
#Check if app uses image excluded from this test run
+# Possible IDs for image exclusion: PA, CP, SDNC, RICSIM, MR, CR, CBS, CONSUL, ECS
__check_excluded_image() {
for im in $EXCLUDED_IMAGES; do
if [ "$1" == "$im" ]; then
if [ $START_ARG == "local" ]; then
#Local agent image
- __check_image_var " Policy Agent" $START_ARG "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" PA
#Local Control Panel image
- __check_image_var " Control Panel" $START_ARG "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" CP
#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"
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
#Local ric sim image
- __check_image_var " RIC Simulator" $START_ARG "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" RICSIM
elif [ $START_ARG == "remote" ] || [ $START_ARG == "remote-remove" ]; then
__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"
+ __check_image_var " Policy Agent" $START_ARG "POLICY_AGENT_IMAGE" "POLICY_AGENT_REMOTE_IMAGE" "POLICY_AGENT_REMOTE_IMAGE_TAG" PA
else
#Local agent image
- __check_image_var " Policy Agent" $START_ARG "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" PA
fi
__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"
+ __check_image_var " Control Panel" $START_ARG "CONTROL_PANEL_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE" "CONTROL_PANEL_REMOTE_IMAGE_TAG" CP
else
#Local Control Panel image
- __check_image_var " Control Panel" $START_ARG "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" CP
fi
__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"
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE" "SDNC_A1_CONTROLLER_REMOTE_IMAGE_TAG" SDNC
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"
+ __check_image_var " SDNC A1 Controller" $START_ARG "SDNC_A1_CONTROLLER_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE" "SDNC_A1_CONTROLLER_LOCAL_IMAGE_TAG" SDNC
fi
__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"
+ __check_image_var " RIC Simulator" $START_ARG "RIC_SIM_IMAGE" "RIC_SIM_REMOTE_IMAGE" "RIC_SIM_REMOTE_IMAGE_TAG" RICSIM
else
#Local ric sim image
- __check_image_var " RIC Simulator" $START_ARG "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" RICSIM
+ fi
+
+ __check_image_local_override 'ECS'
+ if [ $? -eq 0 ]; then
+ #Remote ecs image
+ __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_REMOTE_IMAGE" "ECS_REMOTE_IMAGE_TAG" ECS
+ else
+ #Local ecs image
+ __check_image_var " ECS" $START_ARG "ECS_IMAGE" "ECS_LOCAL_IMAGE" "ECS_LOCAL_IMAGE_TAG" ECS
fi
else
# 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" $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
+__check_image_var " Message Router" $START_ARG "MRSTUB_IMAGE" "MRSTUB_LOCAL_IMAGE" "MRSTUB_LOCAL_IMAGE_TAG" MR
+__check_image_var " Callback Receiver" $START_ARG "CR_IMAGE" "CR_LOCAL_IMAGE" "CR_LOCAL_IMAGE_TAG" CR
+__check_image_var " Consul" $START_ARG "CONSUL_IMAGE" "CONSUL_REMOTE_IMAGE" "CONSUL_REMOTE_IMAGE_TAG" CONSUL
+__check_image_var " CBS" $START_ARG "CBS_IMAGE" "CBS_REMOTE_IMAGE" "CBS_REMOTE_IMAGE_TAG" CBS
+__check_image_var " SDNC DB" $START_ARG "SDNC_DB_IMAGE" "SDNC_DB_REMOTE_IMAGE" "SDNC_DB_REMOTE_IMAGE_TAG" SDNC #Uses sdnc app name
#Errors in image setting - exit
if [ $IMAGE_ERR -ne 0 ]; then
echo -ne " Removing image - ${SAMELINE}"
tmp="$(docker images -q ${4})" &> /dev/null
if [ $? -eq 0 ] && [ ! -z "$tmp" ]; then
- docker rmi $4 &> .dockererr
+ docker rmi --force $4 &> .dockererr
if [ $? -ne 0 ]; then
((IMAGE_ERR++))
echo ""
echo -e $BOLD"Pulling configured images, if needed"$EBOLD
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'PA'
-if [ $? -eq 1 ]; then
- START_ARG_MOD="local"
+__check_excluded_image 'PA'
+if [ $? -eq 0 ]; then
+ 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
+else
+ echo -e $YELLOW" Excluding PA image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'ECS'
+if [ $? -eq 0 ]; then
+ START_ARG_MOD=$START_ARG
+ __check_image_local_override 'ECS'
+ if [ $? -eq 1 ]; then
+ START_ARG_MOD="local"
+ fi
+ app="ECS"; __check_and_pull_image $START_ARG_MOD "$app" $ECS_APP_NAME $ECS_IMAGE
+else
+ echo -e $YELLOW" Excluding ECS image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'CP'
+if [ $? -eq 0 ]; then
+ 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
+else
+ echo -e $YELLOW" Excluding Non-RT RIC Control Panel image from image check/pull"$EYELLOW
fi
-app="Policy Agent"; __check_and_pull_image $START_ARG_MOD "$app" $POLICY_AGENT_APP_NAME $POLICY_AGENT_IMAGE
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'CP'
-if [ $? -eq 1 ]; then
- START_ARG_MOD="local"
+__check_excluded_image 'RICSIM'
+if [ $? -eq 0 ]; then
+ 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
+else
+ echo -e $YELLOW" Excluding Near-RT RIC Simulator image from image check/pull"$EYELLOW
fi
-app="Non-RT RIC Control Panel"; __check_and_pull_image $START_ARG_MOD "$app" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_IMAGE
-START_ARG_MOD=$START_ARG
-__check_image_local_override 'RICSIM'
-if [ $? -eq 1 ]; then
- START_ARG_MOD="local"
+
+__check_excluded_image 'CONSUL'
+if [ $? -eq 0 ]; then
+ app="Consul"; __check_and_pull_image $START_ARG "$app" $CONSUL_APP_NAME $CONSUL_IMAGE
+else
+ echo -e $YELLOW" Excluding Consul image from image check/pull"$EYELLOW
+fi
+
+__check_excluded_image 'CBS'
+if [ $? -eq 0 ]; then
+ app="CBS"; __check_and_pull_image $START_ARG "$app" $CBS_APP_NAME $CBS_IMAGE
+else
+ echo -e $YELLOW" Excluding CBS image from image check/pull"$EYELLOW
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
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
-
#Errors in image setting - exit
if [ $IMAGE_ERR -ne 0 ]; then
echo -e $BOLD"Building images needed for test"$EBOLD
curdir=$PWD
-cd $curdir
-cd ../mrstub
-echo " Building mrstub image: mrstub:latest"
-docker build -t mrstub . &> .dockererr
+__check_excluded_image 'MR'
if [ $? -eq 0 ]; then
- echo -e $GREEN" Build Ok"$EGREEN
+ cd $curdir
+ cd ../mrstub
+ echo " Building mrstub image: mrstub:latest"
+ docker build -t mrstub . &> .dockererr
+ if [ $? -eq 0 ]; then
+ echo -e $GREEN" Build Ok"$EGREEN
+ else
+ echo -e $RED" Build Failed"$ERED
+ ((RES_CONF_FAIL++))
+ cat .dockererr
+ fi
+ cd $curdir
else
- echo -e $RED" Build Failed"$ERED
- ((RES_CONF_FAIL++))
- cat .dockererr
+ echo -e $YELLOW" Excluding mrstub from image build"$EYELLOW
fi
-cd $curdir
-cd ../cr
-echo " Building Callback Receiver image: callback-receiver:latest"
-docker build -t callback-receiver . &> .dockererr
+__check_excluded_image 'CR'
if [ $? -eq 0 ]; then
- echo -e $GREEN" Build Ok"$EGREEN
+ cd ../cr
+ echo " Building Callback Receiver image: callback-receiver:latest"
+ docker build -t callback-receiver . &> .dockererr
+ if [ $? -eq 0 ]; then
+ echo -e $GREEN" Build Ok"$EGREEN
+ else
+ echo -e $RED" Build Failed"$ERED
+ ((RES_CONF_FAIL++))
+ cat .dockererr
+ fi
+ cd $curdir
else
- echo -e $RED" Build Failed"$ERED
- ((RES_CONF_FAIL++))
- cat .dockererr
+ echo -e $YELLOW" Excluding Callback Receiver from image build"$EYELLOW
fi
-cd $curdir
echo ""
echo -e $BOLD"Local docker registry images used in the this test script"$EBOLD
docker_tmp_file=.docker-images-table
-format_string="{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}"
-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 " 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
+format_string="{{.Repository}}\\t{{.Tag}}\\t{{.CreatedSince}}\\t{{.Size}}\\t{{.CreatedAt}}"
+echo -e " Application\tRepository\tTag\tCreated since\tSize\tCreated at" > $docker_tmp_file
+__check_excluded_image 'PA'
+if [ $? -eq 0 ]; then
+ echo -e " Policy Agent\t$(docker images --format $format_string $POLICY_AGENT_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'ECS'
+if [ $? -eq 0 ]; then
+ echo -e " ECS\t$(docker images --format $format_string $ECS_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'CP'
+if [ $? -eq 0 ]; then
+ echo -e " Control Panel\t$(docker images --format $format_string $CONTROL_PANEL_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'RICSIM'
+if [ $? -eq 0 ]; then
+ echo -e " RIC Simulator\t$(docker images --format $format_string $RIC_SIM_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'MR'
+if [ $? -eq 0 ]; then
+ echo -e " Message Router\t$(docker images --format $format_string $MRSTUB_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'CR'
+if [ $? -eq 0 ]; then
+ echo -e " Callback Receiver\t$(docker images --format $format_string $CR_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'CONSUL'
+if [ $? -eq 0 ]; then
+ echo -e " Consul\t$(docker images --format $format_string $CONSUL_IMAGE)" >> $docker_tmp_file
+fi
+__check_excluded_image 'CBS'
+if [ $? -eq 0 ]; then
+ echo -e " CBS\t$(docker images --format $format_string $CBS_IMAGE)" >> $docker_tmp_file
+fi
__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
return 0
}
+# Check if app name var is set. If so return the app name otherwise return "NOTSET"
+__check_app_name() {
+ if [ $# -eq 1 ]; then
+ echo $1
+ else
+ echo "NOTSET"
+ fi
+}
+
# Stop and remove all containers
# args: -
# (Function for test scripts)
echo -e $BOLD"Stopping and removing all running containers, by container name"$EBOLD
- CONTAINTER_NAMES=("Policy Agent " $POLICY_AGENT_APP_NAME\
- "Non-RT RIC Simulator(s)" $RIC_SIM_PREFIX\
- "Message Router " $MR_APP_NAME\
- "Callback Receiver " $CR_APP_NAME\
- "Control Panel " $CONTROL_PANEL_APP_NAME\
- "SDNC A1 Controller " $SDNC_APP_NAME\
- "SDNC DB " $SDNC_DB_APP_NAME\
- "SDNC ONAP A1 Adapter " $SDNC_ONAP_APP_NAME\
- "SDNC DB " $SDNC_ONAP_DB_APP_NAME\
- "CBS " $CBS_APP_NAME\
- "Consul " $CONSUL_APP_NAME)
+ CONTAINTER_NAMES=("Policy Agent " $(__check_app_name $POLICY_AGENT_APP_NAME)\
+ "ECS " $(__check_app_name $ECS_APP_NAME)\
+ "Non-RT RIC Simulator(s)" $(__check_app_name $RIC_SIM_PREFIX)\
+ "Message Router " $(__check_app_name $MR_APP_NAME)\
+ "Callback Receiver " $(__check_app_name $CR_APP_NAME)\
+ "Control Panel " $(__check_app_name $CONTROL_PANEL_APP_NAME)\
+ "SDNC A1 Controller " $(__check_app_name $SDNC_APP_NAME)\
+ "SDNC DB " $(__check_app_name $SDNC_DB_APP_NAME)\
+ "CBS " $(__check_app_name $CBS_APP_NAME)\
+ "Consul " $(__check_app_name $CONSUL_APP_NAME))
nw=0 # Calc max width of container name, to make a nice table
for (( i=1; i<${#CONTAINTER_NAMES[@]} ; i+=2 )) ; do
+
if [ ${#CONTAINTER_NAMES[i]} -gt $nw ]; then
nw=${#CONTAINTER_NAMES[i]}
fi
for (( i=0; i<${#CONTAINTER_NAMES[@]} ; i+=2 )) ; do
APP="${CONTAINTER_NAMES[i]}"
CONTR="${CONTAINTER_NAMES[i+1]}"
- for((w=${#CONTR}; w<$nw; w=w+1)); do
- CONTR="$CONTR "
- done
- 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 --force $(docker ps -qa --filter name=${CONTR}) &> /dev/null
- echo -e " $APP: $CONTR - ${GREEN}stopped removed${EGREEN}"
+ if [ $CONTR != "NOTSET" ]; then
+ for((w=${#CONTR}; w<$nw; w=w+1)); do
+ CONTR="$CONTR "
+ done
+ 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 --force $(docker ps -qa --filter name=${CONTR}) &> /dev/null
+ echo -e " $APP: $CONTR - ${GREEN}stopped removed${EGREEN}"
+ fi
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
+ docker network rm $DOCKER_SIM_NWNAME | indent2
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 "$GREEN Done$EGREEN"
+ echo ""
echo -e $BOLD" Removing all unused docker neworks"$EBOLD
- docker network prune --force #&> /dev/null
+ docker network prune --force | indent2
+ echo -e "$GREEN Done$EGREEN"
+ echo ""
echo -e $BOLD" Removing all unused docker volumes"$EBOLD
- docker volume prune --force #&> /dev/null
+ docker volume prune --force | indent2
+ echo -e "$GREEN Done$EGREEN"
+ echo ""
echo -e $BOLD" Removing all dangling/untagged docker images"$EBOLD
docker rmi --force $(docker images -q -f dangling=true) &> /dev/null
echo ""
+ echo -e "$GREEN Done$EGREEN"
+ echo ""
CONTRS=$(docker ps | awk '$1 != "CONTAINER" { n++ }; END { print n+0 }')
if [ $? -eq 0 ]; then
return 1
fi
if [ "$tmp" != $DOCKER_SIM_NWNAME ]; then
- echo -e "Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
- docker network create $DOCKER_SIM_NWNAME
+ echo -e " Creating docker network:$BOLD $DOCKER_SIM_NWNAME $EBOLD"
+ docker network create $DOCKER_SIM_NWNAME | indent2
if [ $? -ne 0 ]; then
echo -e $RED" Could not create docker network $DOCKER_SIM_NWNAME"$ERED
return 1
+ else
+ echo -e "$GREEN Done$EGREEN"
fi
else
echo -e " Docker network $DOCKER_SIM_NWNAME already exists$GREEN OK $EGREEN"
}
# Function to perpare the consul configuration according to the current simulator configuration
-# args: SDNC|SDNC_ONAP|NOSDNC <output-file>
+# args: SDNC|NOSDNC <output-file>
# (Function for test scripts)
prepare_consul_config() {
echo -e $BOLD"Prepare Consul config"$EBOLD
if [ $# != 2 ]; then
((RES_CONF_FAIL++))
- __print_err "need two args, SDNC|SDNC_ONAP|NOSDNC <output-file>" $@
+ __print_err "need two args, SDNC|NOSDNC <output-file>" $@
exit 1
fi
if [ $1 == "SDNC" ]; then
echo -e " Config$BOLD including SDNC$EBOLD configuration"
- elif [ $1 == "SDNC_ONAP" ]; then
- echo -e " Config$BOLD including SDNC ONAP$EBOLD configuration"
elif [ $1 == "NOSDNC" ]; then
- echo -e " Config$BOLD excluding SDNC or SDNC ONAP$EBOLD configuration"
+ echo -e " Config$BOLD excluding SDNC$EBOLD configuration"
else
((RES_CONF_FAIL++))
- __print_err "need two args, SDNC|SDNC_ONAP|NOSDNC <output-file>" $@
+ __print_err "need two args, SDNC|NOSDNC <output-file>" $@
exit 1
fi
config_json=$config_json"\n }"
config_json=$config_json"\n ],"
fi
- if [ $1 == "SDNC_ONAP" ]; then
- config_json=$config_json"\n \"controller\": ["
- config_json=$config_json"\n {"
- config_json=$config_json"\n \"name\": \"$SDNC_ONAP_APP_NAME\","
- if [ $AGENT_STAND_ALONE -eq 0 ]; then
- config_json=$config_json"\n \"baseUrl\": \"http://$SDNC_ONAP_APP_NAME:$SDNC_ONAP_INTERNAL_PORT\","
- else
- config_json=$config_json"\n \"baseUrl\": \"http://localhost:$SDNC_ONAP_EXTERNAL_PORT\","
- fi
- config_json=$config_json"\n \"userName\": \"$SDNC_ONAP_USER\","
- config_json=$config_json"\n \"password\": \"$SDNC_ONAP_PWD\""
- config_json=$config_json"\n }"
- config_json=$config_json"\n ],"
- fi
-
config_json=$config_json"\n \"streams_publishes\": {"
config_json=$config_json"\n \"dmaap_publisher\": {"
fi
if [ $1 == "SDNC" ]; then
config_json=$config_json"\n \"controller\": \"$SDNC_APP_NAME\","
- elif [ $1 == "SDNC_ONAP" ]; then
- config_json=$config_json"\n \"controller\": \"$SDNC_ONAP_APP_NAME\","
fi
config_json=$config_json"\n \"managedElementIds\": ["
config_json=$config_json"\n \"me1_$ric\","
start_consul_cbs() {
echo -e $BOLD"Starting Consul and CBS"$EBOLD
-
+ __check_excluded_image 'CONSUL'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Consul image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"Consul will not be started"$ERED
+ exit
+ fi
__start_container consul_cbs NODOCKERARGS "$CONSUL_APP_NAME" "$CONSUL_EXTERNAL_PORT" "/ui/dc1/kv" "http" \
"$CBS_APP_NAME" "$CBS_EXTERNAL_PORT" "/healthcheck" "http"
}
###########################
use_simulator_http() {
- echo -e "Using unsecure $BOLD http $EBOLD towards the simulators"
+ echo -e "Using $BOLD http $EBOLD towards the simulators"
export RIC_SIM_HTTPX="http"
export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
export RIC_SIM_PORT=$RIC_SIM_INTERNAL_PORT
}
use_simulator_https() {
- echo -e "Using secure $BOLD https $EBOLD towards the simulators"
+ echo -e "Using $BOLD https $EBOLD towards the simulators"
export RIC_SIM_HTTPX="https"
export RIC_SIM_LOCALHOST=$RIC_SIM_HTTPX"://localhost:"
export RIC_SIM_PORT=$RIC_SIM_INTERNAL_SECURE_PORT
echo -e $BOLD"Starting RIC Simulators"$EBOLD
+ __check_excluded_image 'RICSIM'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Near-RT RIC Simulator image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"The Near-RT RIC Simulartor(s) will not be started"$ERED
+ exit
+ fi
+
RIC1=$RIC_SIM_PREFIX"_g1"
RIC2=$RIC_SIM_PREFIX"_g2"
RIC3=$RIC_SIM_PREFIX"_g3"
start_control_panel() {
echo -e $BOLD"Starting Control Panel"$EBOLD
-
+ __check_excluded_image 'CP'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Control Panel image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"The Control Panel will not be started"$ERED
+ exit
+ fi
__start_container control_panel NODOCKERARGS $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_EXTERNAL_PORT "/" "http"
}
}
use_sdnc_http() {
- echo -e $BOLD"Using http between agent and SDNC"$EBOLD
+ echo -e "Using $BOLD http $EBOLD towards SDNC"
export SDNC_HTTPX="http"
export SDNC_PORT=$SDNC_INTERNAL_PORT
export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT
}
use_sdnc_https() {
- echo -e $BOLD"Using https between agent and SDNC"$EBOLD
+ echo -e "Using $BOLD https $EBOLD towards SDNC"
export SDNC_HTTPX="https"
export SDNC_PORT=$SDNC_INTERNAL_SECURE_PORT
export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_SECURE_PORT
echo ""
}
-#######################
-### SDNC ONAP functions
-#######################
-
-# Start the SDNC ONAP A1 Adapter
-# args: -
-# (Function for test scripts)
-start_sdnc_onap() {
-
- 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"
-
-}
-
-# Configure the SDNC ONAP A1 Adapter
-# args: -
-# (Function for test scripts)
-config_sdnc_onap() {
-
- echo -e $BOLD"Configuring SDNC ONAP A1 Adapter"$EBOLD
-
- LOCALFILE=".sdnc_onap.prop"
- REMOTEFILE="/tmp/.sdnc_onap.prop"
-
- docker cp $SDNC_ONAP_APP_NAME:$SDNC_ONAP_PROPERTIES_FILE $LOCALFILE
- if [ $? -ne 0 ]; then
- echo -e $RED"Could not copy $SDNC_ONAP_PROPERTIES_FILE from $SDNC_ONAP_APP_NAME container"$ERED
- exit 1
- fi
-
-
- #Config of the prop file shall be inserted here
-
- #Copy file to /tmp and then to final destination, a trick to get correct permission of the file.
-
- docker cp $LOCALFILE $SDNC_ONAP_APP_NAME:$REMOTEFILE
- if [ $? -ne 0 ]; then
- echo -e $RED"Could not copy local $LOCALFILE to $REMOTEFILE in $SDNC_ONAP_APP_NAME container"$ERED
- exit 1
- fi
-
- docker exec -it $SDNC_ONAP_APP_NAME cp $REMOTEFILE $SDNC_ONAP_PROPERTIES_FILE
- if [ $? -ne 0 ]; then
- echo -e $RED"Could not copy $REMOTEFILE to $SDNC_ONAP_PROPERTIES_FILE in $SDNC_ONAP_APP_NAME container"$ERED
- exit 1
- fi
-}
-
#####################
### MR stub functions
#####################
start_mr() {
echo -e $BOLD"Starting Message Router 'mrstub'"$EBOLD
+ __check_excluded_image 'MR'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Message Router image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"The Message Router will not be started"$ERED
+ exit
+ fi
export MR_CERT_MOUNT_DIR="./cert"
__start_container mr NODOCKERARGS $MR_APP_NAME $MR_EXTERNAL_PORT "/" "http"
}
use_mr_http() {
- echo -e $BOLD"Using http between agent and MR"$EBOLD
+ echo -e "Using $BOLD http $EBOLD towards MR"
export MR_HTTPX="http"
export MR_PORT=$MR_INTERNAL_PORT
export MR_LOCAL_PORT=$MR_EXTERNAL_PORT
}
use_mr_https() {
- echo -e $BOLD"Using https between agent and MR"$EBOLD
+ echo -e "Using $BOLD https $EBOLD towards MR"
export MR_HTTPX="https"
export MR_PORT=$MR_INTERNAL_SECURE_PORT
export MR_LOCAL_PORT=$MR_EXTERNAL_SECURE_PORT
start_cr() {
echo -e $BOLD"Starting Callback Receiver"$EBOLD
-
+ __check_excluded_image 'CR'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Callback Receiver image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"The Callback Receiver will not be started"$ERED
+ exit
+ fi
__start_container cr NODOCKERARGS $CR_APP_NAME $CR_EXTERNAL_PORT "/" "http"
}
use_cr_http() {
- echo -e $BOLD"Using http between test script and CR"$EBOLD
+ echo -e "Using $BOLD http $EBOLD towards CR"
export CR_HTTPX="http"
export CR_PORT=$CR_INTERNAL_PORT
export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
}
use_cr_https() {
- echo -e $BOLD"Using https between test script and CR"$EBOLD
+ echo -e "Using $BOLD https $EBOLD towards CR"
export CR_HTTPX="https"
export CR_PORT=$CR_INTERNAL_SECURE_PORT
export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
echo -e $BOLD"Starting Policy Agent"$EBOLD
if [ $AGENT_STAND_ALONE -eq 0 ]; then
+ __check_excluded_image 'PA'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The Policy Agent image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"The Policy Agent will not be started"$ERED
+ exit
+ fi
__start_container policy_agent NODOCKERARGS $POLICY_AGENT_APP_NAME $POLICY_AGENT_EXTERNAL_PORT "/status" "http"
else
echo -e $RED"The consul config produced by this test script (filename '<fullpath-to-autotest-dir>.output<file-name>"$ERED
echo -e $RED"where the file name is the file in the consul_config_app command in this script) must be pointed out by the agent "$ERED
echo -e $RED"application.yaml"$ERED
- echo -e $RED"The application jar may need to be built beforefor continuing"$ERED
+ echo -e $RED"The application jar may need to be built before continuing"$ERED
echo -e $RED"The agent shall now be running on port $POLICY_AGENT_EXTERNAL_PORT for http"$ERED
read -p "<press any key to continue>"
# args: -
# (Function for test scripts)
use_agent_rest_http() {
- echo -e $BOLD"Using agent REST interface with http"$EBOLD
+ echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
export ADAPTER=$RESTBASE
echo ""
}
# args: -
# (Function for test scripts)
use_agent_rest_https() {
- echo -e $BOLD"Using agent REST interface with https"$EBOLD
+ echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
export ADAPTER=$RESTBASE_SECURE
echo ""
return 0
# args: -
# (Function for test scripts)
use_agent_dmaap_http() {
- echo -e $BOLD"Agent using DMAAP http interface"$EBOLD
+ echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
export ADAPTER=$DMAAPBASE
echo ""
return 0
# args: -
# (Function for test scripts)
use_agent_dmaap_https() {
- echo -e $BOLD"Agent using DMAAP https interface"$EBOLD
+ echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
export ADAPTER=$DMAAPBASE_SECURE
echo ""
return 0
return
}
+###########################
+### ECS functions
+###########################
+
+# Start the ECS
+# args: -
+# (Function for test scripts)
+start_ecs() {
+
+ echo -e $BOLD"Starting ECS"$EBOLD
+ __check_excluded_image 'ECS'
+ if [ $? -eq 1 ]; then
+ echo -e $RED"The ECS image has not been checked for this test run due to arg to the test script"$ERED
+ echo -e $RED"ECS will not be started"$ERED
+ exit
+ fi
+ export ECS_CERT_MOUNT_DIR="./cert"
+ __start_container ecs NODOCKERARGS $ECS_APP_NAME $ECS_EXTERNAL_PORT "/ei-producer/v1/eiproducers" "http"
+}
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_http() {
+ echo -e "Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards ECS"
+ export ECS_ADAPTER=$ECS_RESTBASE
+ echo ""
+}
+
+# All calls to ECS will be directed to the ECS REST interface from now on
+# args: -
+# (Function for test scripts)
+use_ecs_rest_https() {
+ echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+ export ECS_ADAPTER=$ECS_RESTBASE_SECURE
+ echo ""
+ return 0
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over http from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_http() {
+ echo -e "Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards ECS"
+ export ECS_ADAPTER=$ECS_DMAAPBASE
+ echo ""
+ return 0
+}
+
+# All calls to ECS will be directed to the ECS dmaap interface over https from now on
+# args: -
+# (Function for test scripts)
+use_ecs_dmaap_https() {
+ echo -e "Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards ECS"
+ export ECS_ADAPTER=$ECS_DMAAPBASE_SECURE
+ echo ""
+ return 0
+}
+
+# Turn on debug level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_debug() {
+ echo -e $BOLD"Setting ecs debug"$EBOLD
+ curl $LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST -H 'Content-Type: application/json' -d '{"configuredLevel":"debug"}' &> /dev/null
+ if [ $? -ne 0 ]; then
+ __print_err "could not set debug mode" $@
+ return 1
+ fi
+ echo ""
+ return 0
+}
+
+# Turn on trace level tracing in ECS
+# args: -
+# (Function for test scripts)
+set_ecs_trace() {
+ echo -e $BOLD"Setting agent trace"$EBOLD
+ curl $LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST -H 'Content-Type: application/json' -d '{"configuredLevel":"trace"}' &> /dev/null
+ if [ $? -ne 0 ]; then
+ __print_err "could not set trace mode" $@
+ return 1
+ fi
+ echo ""
+ return 0
+}
+
+# Perform curl retries when making direct call to ECS for the specified http response codes
+# Speace separated list of http response codes
+# args: [<response-code>]*
+use_agent_retries() {
+ echo -e $BOLD"Do curl retries to the ECS REST inteface for these response codes:$@"$EBOLD
+ ECS_AGENT_RETRY_CODES=$@
+ echo ""
+ return
+}
+
#################
### Log functions
#################
__check_container_logs "Policy Agent" $POLICY_AGENT_APP_NAME $POLICY_AGENT_LOGPATH
}
+check_ecs_logs() {
+ __check_container_logs "ECS" $ECS_APP_NAME $ECS_LOGPATH
+}
+
check_control_panel_logs() {
__check_container_logs "Control Panel" $CONTROL_PANEL_APP_NAME $CONTROL_PANEL_LOGPATH
}
echo $dispname" is not running, no check made"
return
fi
- foundentries="$(docker exec -it $tmp grep WARN $logpath | wc -l)"
+ foundentries="$(docker exec $tmp grep WARN $logpath | wc -l)"
if [ $? -ne 0 ];then
echo " Problem to search $appname log $logpath"
else
echo -e " Found \033[1m"$foundentries"\033[0m WARN entries in $appname log $logpath"
fi
fi
- foundentries="$(docker exec -it $tmp grep ERR $logpath | wc -l)"
+ foundentries="$(docker exec $tmp grep ERR $logpath | wc -l)"
if [ $? -ne 0 ];then
echo " Problem to search $appname log $logpath"
else
__print_err "need one arg, <file-prefix>" $@
exit 1
fi
- echo -e $BOLD"Storing all container logs, Policy Agent app log and consul config using prefix: "$1$EBOLD
+ echo -e $BOLD"Storing all container logs 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
- docker logs $CONSUL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
+ docker logs $ECS_APP_NAME > $TESTLOGS/$ATC/$1_ecs.log 2>&1
+ docker logs $CONTROL_PANEL_APP_NAME > $TESTLOGS/$ATC/$1_control-panel.log 2>&1
docker logs $MR_APP_NAME > $TESTLOGS/$ATC/$1_mr.log 2>&1
docker logs $CR_APP_NAME > $TESTLOGS/$ATC/$1_cr.log 2>&1
cp .httplog_${ATC}.txt $TESTLOGS/$ATC/$1_httplog_${ATC}.txt 2>&1
- docker exec -it $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
-
- docker exec -it $SDNC_ONAP_APP_NAME cat $SDNC_ONAP_KARAF_LOG > $TESTLOGS/$ATC/$1_SDNC_ONAP_karaf.log 2>&1
+ docker exec $SDNC_APP_NAME cat $SDNC_KARAF_LOG> $TESTLOGS/$ATC/$1_SDNC_karaf.log 2>&1
rics=$(docker ps -f "name=$RIC_SIM_PREFIX" --format "{{.Names}}")
for ric in $rics; do
paramError=0
fi
fi
-if [ $# -eq 2 ]; then
- if [ $2 == "auto-clean" ]; then
- paramError=0
- fi
-fi
if [ $paramError -ne 0 ]; then
- echo "Expected arg: local|remote|remote-remove [ auto-clean ]"
+ echo "Expected arg: local|remote|remote-remove"
exit 1
fi
node_modules
-package-lock.json
\ No newline at end of file
+package-lock.json
+.dockererr
--- /dev/null
+.tmp.json
+.dockererr
\ No newline at end of file
--- /dev/null
+# 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=================================================
+#
+version: '3.0'
+networks:
+ default:
+ external:
+ name: ${DOCKER_SIM_NWNAME}
+services:
+ ecs:
+ image: ${ECS_IMAGE}
+ container_name: ${ECS_APP_NAME}
+ networks:
+ default:
+ aliases:
+ - ${ECS_APP_NAME_ALIAS}
+ ports:
+ - ${ECS_EXTERNAL_PORT}:${ECS_INTERNAL_PORT}
+ - ${ECS_EXTERNAL_SECURE_PORT}:${ECS_INTERNAL_SECURE_PORT}
+
+
+
+++ /dev/null
-.dockererr
\ No newline at end of file
+++ /dev/null
-# ==================================================================================
-# Modifications Copyright (c) 2019 Nordix Foundation.
-#
-# 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.
-# ==================================================================================
-version: '2.1'
-
-networks:
- default:
- driver: bridge
- name: ${DOCKER_SIM_NWNAME}
-
-services:
- db:
- image: ${SDNC_ONAP_DB_IMAGE}
- container_name: ${SDNC_ONAP_DB_APP_NAME}
- networks:
- - default
- ports:
- - "3306"
- environment:
- - MYSQL_ROOT_PASSWORD=openECOMP1.0
- - MYSQL_ROOT_HOST=%
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
-
- a1-controller:
- image: ${SDNC_ONAP_A1_ADAPTER_IMAGE}
- depends_on :
- - db
- container_name: ${SDNC_ONAP_APP_NAME}
- networks:
- - default
- entrypoint: ["/opt/onap/sdnc/bin/startODL.sh"]
- ports:
- - ${SDNC_ONAP_EXTERNAL_PORT}:${SDNC_ONAP_INTERNAL_PORT}
- - ${SDNC_ONAP_EXTERNAL_SECURE_PORT}:${SDNC_ONAP_INTERNAL_SECURE_PORT}
- links:
- - db:dbhost
- - db:sdnctldb01
- - db:sdnctldb02
- environment:
- - MYSQL_ROOT_PASSWORD=openECOMP1.0
- - SDNC_CONFIG_DIR=/opt/onap/sdnc/data/properties
- logging:
- driver: "json-file"
- options:
- max-size: "30m"
- max-file: "5"
-