+###########################
+### ECS functions
+###########################
+
+# Start the ECS
+# args: -
+# (Function for test scripts)
+start_ecs() {
+
+ echo -e $BOLD"Starting ECS"$EBOLD
+ __check_included_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 "/status" "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
+ curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"debug\"}"
+ result=$(__do_curl "$curlString")
+ if [ $? -ne 0 ]; then
+ __print_err "Could not set debug mode" $@
+ ((RES_CONF_FAIL++))
+ 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 ecs trace"$EBOLD
+ curlString="$LOCALHOST$ECS_EXTERNAL_PORT/actuator/loggers/org.oransc.enrichment -X POST -H Content-Type:application/json -d {\"configuredLevel\":\"trace\"}"
+ result=$(__do_curl "$curlString")
+ if [ $? -ne 0 ]; then
+ __print_err "Could not set trace mode" $@
+ ((RES_CONF_FAIL++))
+ 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
+}
+