Updated some function test cases with https

Change-Id: Ic4f75e47db5b23e66024967a974c4c807ff4f07e

Issue-ID: NONRTRIC-268

Signed-off-by: BjornMagnussonXA <bjorn.magnusson@est.tech>
Change-Id: Ibb1e8a09bbd6e7e1d0a388e4cfd89cac6bff0093
diff --git a/test/common/README.md b/test/common/README.md
index 9f8af39..73ced4b 100644
--- a/test/common/README.md
+++ b/test/common/README.md
@@ -250,6 +250,19 @@
 |--|
 | None |
 
+#### Function: use_cr_http ####
+Use http for getting event from CR.  The admin API is not affected. This is the default.
+| arg list |
+|--|
+| None |
+
+#### Function: use_cr_https ####
+Use https for getting event from CR. The admin API is not affected.
+Note: Not yet used as callback event is not fully implemented/deciced.
+| arg list |
+|--|
+| None |
+
 #### Function: start_policy_agent ####
 Start the Policy Agent container. If the test script is configured to use a stand alone Policy Agent (for example other container or stand alone app) the script will prompt for starting the stand alone Policy Agent.
 | arg list |
@@ -274,8 +287,14 @@
 |--|
 | None |
 
-#### Function: use_agent_dmaap ####
-Send and recieve all API calls to the Policy Agent over Dmaap via the MR.
+#### Function: use_agent_dmaap_http ####
+Send and recieve all API calls to the Policy Agent over Dmaap via the MR over http.
+| arg list |
+|--|
+| None |
+
+#### Function: use_agent_dmaap_https ####
+Send and recieve all API calls to the Policy Agent over Dmaap via the MR over https.
 | arg list |
 |--|
 | None |
diff --git a/test/common/agent_api_functions.sh b/test/common/agent_api_functions.sh
index 1e1077b..2091d65 100644
--- a/test/common/agent_api_functions.sh
+++ b/test/common/agent_api_functions.sh
@@ -76,7 +76,7 @@
 			if [ $# -ne 2 ]; then
 				paramError=1
 			fi
-			if ! [ $ADAPTER == $DMAAPBASE ]; then
+			if [ $ADAPTER == $RESTBASE ] || [ $ADAPTER == $RESTBASE_SECURE ]; then
 				paramError=1
 			fi
 		else
@@ -143,7 +143,7 @@
 			#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 -X POST${timeout}${httpcode}${content}${url}${file}"
+			curlString="curl -k -X POST${timeout}${httpcode}${content}${url}${file}"
 			echo " CMD: "$curlString >> $HTTPLOG
 			res=$($curlString)
 			retcode=$?
@@ -169,7 +169,7 @@
 				cid=$2
 			fi
 			url=" "${ADAPTER}"/receive-response?correlationid="${cid}
-			curlString="curl -X GET"${timeout}${httpcode}${url}
+			curlString="curl -k -X GET"${timeout}${httpcode}${url}
 			echo " CMD: "$curlString >> $HTTPLOG
 			res=$($curlString)
 			retcode=$?
diff --git a/test/common/test_env.sh b/test/common/test_env.sh
index ee48e8b..391b596 100755
--- a/test/common/test_env.sh
+++ b/test/common/test_env.sh
@@ -175,6 +175,7 @@
 
 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
+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
diff --git a/test/common/testcase_common.sh b/test/common/testcase_common.sh
index d694ef1..a69df91 100755
--- a/test/common/testcase_common.sh
+++ b/test/common/testcase_common.sh
@@ -75,6 +75,10 @@
 export MR_PORT=$MR_INTERNAL_PORT
 export MR_LOCAL_PORT=$MR_EXTERNAL_PORT #When agent is running outside the docker net
 
+export CR_HTTPX="http"
+export CR_PORT=$CR_INTERNAL_PORT
+export CR_LOCAL_PORT=$CR_EXTERNAL_PORT #When CR is running outside the docker net
+
 export SDNC_HTTPX="http"
 export SDNC_PORT=$SDNC_INTERNAL_PORT
 export SDNC_LOCAL_PORT=$SDNC_EXTERNAL_PORT #When agent is running outside the docker net
@@ -1517,6 +1521,22 @@
 
 }
 
+use_cr_http() {
+	echo -e $BOLD"Using http between test script and CR"$EBOLD
+	export CR_HTTPX="http"
+	export CR_PORT=$CR_INTERNAL_PORT
+	export CR_LOCAL_PORT=$CR_EXTERNAL_PORT
+	echo ""
+}
+
+use_cr_https() {
+	echo -e $BOLD"Using https between test script and CR"$EBOLD
+	export CR_HTTPX="https"
+	export CR_PORT=$CR_INTERNAL_SECURE_PORT
+	export CR_LOCAL_PORT=$CR_EXTERNAL_SECURE_PORT
+	echo ""
+}
+
 ###########################
 ### Policy Agents functions
 ###########################
@@ -1567,16 +1587,25 @@
 	return 0
 }
 
-# All calls to the agent will be directed to the agent dmaap interface from now on
+# 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() {
-	echo -e $BOLD"Agent using DMAAP interface"$EBOLD
+use_agent_dmaap_http() {
+	echo -e $BOLD"Agent using DMAAP http interface"$EBOLD
 	export ADAPTER=$DMAAPBASE
 	echo ""
 	return 0
 }
 
+# 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 using DMAAP https interface"$EBOLD
+	export ADAPTER=$DMAAPBASE_SECURE
+	echo ""
+	return 0
+}
 
 # Turn on debug level tracing in the agent
 # args: -