+# PA_ADAPTER used for switch between REST and DMAAP
+PA_ADAPTER_TYPE="REST"
+PA_ADAPTER=$PA_PATH
+
+# Make curl retries towards the agent for http response codes set in this env var, space separated list of codes
+AGENT_RETRY_CODES=""
+
+###########################
+### Policy Agents functions
+###########################
+
+# All calls to the agent will be directed to the agent REST interface from now on
+# args: -
+# (Function for test scripts)
+use_agent_rest_http() {
+ echo -e $BOLD"Agent protocol setting"$EBOLD
+ echo -e " Using $BOLD http $EBOLD and $BOLD REST $EBOLD towards the agent"
+ PA_HTTPX="http"
+ PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_PORT
+
+ PA_ADAPTER_TYPE="REST"
+ PA_ADAPTER=$PA_PATH
+ echo ""
+}
+
+# All calls to the agent will be directed to the agent REST interface from now on
+# args: -
+# (Function for test scripts)
+use_agent_rest_https() {
+ echo -e $BOLD"Agent protocol setting"$EBOLD
+ echo -e " Using $BOLD https $EBOLD and $BOLD REST $EBOLD towards the agent"
+ PA_HTTPX="https"
+ PA_PATH=$PA_HTTPX"://"$PA_HOST_NAME":"$POLICY_AGENT_EXTERNAL_SECURE_PORT
+
+ PA_ADAPTER_TYPE="REST"
+ PA_ADAPTER=$PA_PATH
+ echo ""
+}
+
+# All calls to the agent will be directed to the agent dmaap interface over http from now on
+# args: -
+# (Function for test scripts)
+use_agent_dmaap_http() {
+ echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+ echo -e " Using $BOLD http $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+ PA_ADAPTER_TYPE="MR-HTTP"
+ echo ""
+}
+
+# All calls to the agent will be directed to the agent dmaap interface over https from now on
+# args: -
+# (Function for test scripts)
+use_agent_dmaap_https() {
+ echo -e $BOLD"Agent dmaap protocol setting"$EBOLD
+ echo -e " Using $BOLD https $EBOLD and $BOLD DMAAP $EBOLD towards the agent"
+ echo -e $YELLOW" Setting http instead of https - MR only uses http"$EYELLOW
+ PA_ADAPTER_TYPE="MR-HTTPS"
+ echo ""
+}
+
+# Start the policy agent
+# args: (docker) PROXY|NOPROXY <config-file>
+# args: (kube) PROXY|NOPROXY <config-file> [ <data-file>]
+# (Function for test scripts)
+start_policy_agent() {
+ echo -e $BOLD"Starting $POLICY_AGENT_DISPLAY_NAME"$EBOLD
+
+ if [ $RUNMODE == "KUBE" ]; then
+
+ # Check if app shall be fully managed by the test script
+ __check_included_image "PA"
+ retcode_i=$?
+
+ # Check if app shall only be used by the testscipt
+ __check_prestarted_image "PA"
+ retcode_p=$?
+
+ if [ $retcode_i -ne 0 ] && [ $retcode_p -ne 0 ]; then
+ echo -e $RED"The $POLICY_AGENT_APP_NAME app is not included as managed nor prestarted in this test script"$ERED
+ echo -e $RED"The $POLICY_AGENT_APP_NAME will not be started"$ERED
+ exit
+ fi
+ if [ $retcode_i -eq 0 ] && [ $retcode_p -eq 0 ]; then
+ echo -e $RED"The $POLICY_AGENT_APP_NAME app is included both as managed and prestarted in this test script"$ERED
+ echo -e $RED"The $POLICY_AGENT_APP_NAME will not be started"$ERED
+ exit