Integrate with DR docker

addresses CLONED Jiras: 441, 443, 444, 445

Change-Id: If20f5773427e4a82b62745efd804049228d629ae
Signed-off-by: Dominic Lunanuova <dgl@research.att.com>
Issue-ID: DMAAP-437
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/setup.sh b/test/csit/plans/dmaap-buscontroller/with_dr/setup.sh
new file mode 100755
index 0000000..7cefa72
--- /dev/null
+++ b/test/csit/plans/dmaap-buscontroller/with_dr/setup.sh
@@ -0,0 +1,57 @@
+#!/bin/bash
+# 
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+# 
+#
+
+source ${SCRIPTS}/common_functions.sh
+
+
+if [ "$USE_EXISTING_DMAAP" = "Y" ]
+then
+	ROBOT_VARIABLES="-v AAF_IP:0.0.0 -v MRC_IP:0.0.0.0 -v DRPS_IP:172.17.0.3 -v DMAAPBC_IP:172.17.0.4"
+else
+
+	# Place the scripts in run order:
+	source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dr-launch.sh
+	dmaap_dr_launch
+	DRPS_IP=${IP}
+
+	#source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/start-mock.sh
+	#start_mock "aaf" 
+	#AAF_IP=${IP}
+	AAF_IP=0.0.0.0
+	#start_mock "drps" 
+	#DRPS_IP=${IP}
+	MRC_IP=0.0.0.0
+
+	source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh 
+	dmaapbc_launch $AAF_IP $MRC_IP $DRPS_IP
+	DMAAPBC_IP=${IP}
+
+
+	echo "AAF_IP=$AAF_IP MRC_IP=$MRC_IP DRPS_IP=$DRPS_IP DMAAPBC_IP=$DMAAPBC_IP"
+
+	# Pass any variables required by Robot test suites in ROBOT_VARIABLES
+	ROBOT_VARIABLES="-v AAF_IP:${AAF_IP} -v MRC_IP:${MRC_IP} -v DRPS_IP:${DRPS_IP} -v DMAAPBC_IP:${DMAAPBC_IP}"
+	set -x
+	${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh ${DMAAPBC_IP} ${DRPS_IP} ${MRC_IP} https
+	set +x
+fi
+
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh b/test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh
new file mode 100755
index 0000000..23ae60a
--- /dev/null
+++ b/test/csit/plans/dmaap-buscontroller/with_dr/teardown.sh
@@ -0,0 +1,26 @@
+#!/bin/bash
+#
+# ============LICENSE_START=======================================================
+# org.onap.dmaap
+# ================================================================================
+# Copyright (C) 2018 AT&T Intellectual Property. 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=========================================================
+
+if [ "$KEEP_DMAAP" != "Y" ]
+then
+kill-instance.sh dmaapbc
+cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+docker-compose down -v
+fi
diff --git a/test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt b/test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt
new file mode 100755
index 0000000..04c6838
--- /dev/null
+++ b/test/csit/plans/dmaap-buscontroller/with_dr/testplan.txt
@@ -0,0 +1,2 @@
+# Place the suites in run order.
+dmaap-buscontroller/with_dr
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh b/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
index 7317793..e5debfc 100755
--- a/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
+++ b/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
@@ -11,8 +11,9 @@
 git pull
 cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
 
+sed -i 's/10003/10001/g' docker-compose.yml
 # start DMaaP DR containers with docker compose and configuration from docker-compose.yml
-docker login -u docker -p docker nexus3.onap.org:10003
+docker login -u docker -p docker nexus3.onap.org:10001
 docker-compose up -d
 
 # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
diff --git a/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh b/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
index c7cf03e..804603f 100755
--- a/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
+++ b/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
@@ -25,7 +25,7 @@
 {
 	"version": "1",
 	"topicNsRoot": "org.onap.dmaap",
-	"drProvUrl": "http://${2}:${DRPORT}",
+	"drProvUrl": "${PROTO}://dmaap-dr-prov:${DRPORT}",
 	"dmaapName": "onapCSIT",
 	"bridgeAdminTopic": "MM_AGENT_PROV"
 
diff --git a/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh b/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
index 688ce7d..317c17f 100755
--- a/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
+++ b/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
@@ -12,7 +12,16 @@
 
 	TMP_CFG=/tmp/docker-databus-controller.conf
 	. ./onapCSIT.env > $TMP_CFG
-	docker run -d --name $CONTAINER_NAME -v $TMP_CFG:/opt/app/config/conf $TAG
+	ADDHOSTS=""
+	if [ ! -z "$2" ]
+	then
+		ADDHOSTS="$ADDHOSTS --add-host=message-router:$2"
+	fi
+	if [ ! -z "$3" ]
+	then
+		ADDHOSTS="$ADDHOSTS --add-host=dmaap-dr-prov:$3"
+	fi
+	docker run -d $ADDHOSTS --name $CONTAINER_NAME -v $TMP_CFG:/opt/app/config/conf $TAG
 	IP=`get-instance-ip.sh ${CONTAINER_NAME}`
 
 	# Wait for initialization
diff --git a/test/csit/scripts/dmaap-buscontroller/dr-launch.sh b/test/csit/scripts/dmaap-buscontroller/dr-launch.sh
new file mode 100644
index 0000000..abc0aae
--- /dev/null
+++ b/test/csit/scripts/dmaap-buscontroller/dr-launch.sh
@@ -0,0 +1,59 @@
+
+#!/bin/bash
+
+#!/bin/bash
+
+# script to launch DMaaP DR  docker containers
+# sets global var IP with assigned IP address of DR Prov
+
+function dmaap_dr_launch() {
+        IP=""
+
+
+	# This next section was copied from scripts/dmaap-datarouter/dr-suite/setup.sh
+	# and slightly modified...
+
+	# Clone DMaaP Data Router repo
+	mkdir -p $WORKSPACE/archives/dmaapdr
+	cd $WORKSPACE/archives/dmaapdr
+
+	git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
+	cd datarouter
+	git pull
+	cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
+
+	sed -i 's/10003/10001/g' docker-compose.yml
+	# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
+	docker login -u docker -p docker nexus3.onap.org:10001
+	docker-compose up -d
+
+	# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
+	for i in {1..50}; do
+	    if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
+		[ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
+		[ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
+	    then
+		echo "DR Service Running"
+		break
+	    else
+		echo sleep $i
+		sleep $i
+	    fi
+	done
+
+	DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
+	DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
+	DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
+
+	echo DR_PROV_IP=${DR_PROV_IP}
+	echo DR_NODE_IP=${DR_NODE_IP}
+	echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
+
+	docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=dmaap-dr-node\|$DR_GATEWAY_IP"
+	docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=dmaap-dr-prov\|$DR_GATEWAY_IP"
+
+	#Pass any variables required by Robot test suites in ROBOT_VARIABLES
+	ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"
+
+        IP=${DR_GATEWAY_IP}
+}
diff --git a/test/csit/tests/dmaap-buscontroller/with_dr/orig b/test/csit/tests/dmaap-buscontroller/with_dr/orig
new file mode 100755
index 0000000..fcac202
--- /dev/null
+++ b/test/csit/tests/dmaap-buscontroller/with_dr/orig
@@ -0,0 +1,116 @@
+*** Settings ***
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           requests
+Library           Collections
+Library           String
+
+*** Variables ***
+${TARGET_URL}                   https://${DR_PROV_IP}:8443
+${TARGET_URL_FEED}              https://${DR_PROV_IP}:8443/feed/1
+${TARGET_URL_SUBSCRIBE}         https://${DR_PROV_IP}:8443/subscribe/1
+${TARGET_URL_SUBSCRIPTION}      https://${DR_PROV_IP}:8443/subs/1
+${TARGET_URL_PUBLISH}           https://${DR_NODE_IP}:8443/publish/1/csit_test
+${CREATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "CSIT_Test", "business_description": "CSIT_Test", "suspend": false, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${UPDATE_FEED_DATA}             {"name": "CSIT_Test", "version": "m1.0", "description": "UPDATED-CSIT_Test", "business_description": "CSIT_Test", "suspend": true, "deleted": false, "changeowner": true, "authorization": {"classification": "unclassified", "endpoint_addrs": [],  "endpoint_ids": [{"password": "rs873m", "id": "rs873m"}]}}
+${SUBSCRIBE_DATA}               {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"rs873m", "password":"rs873m", "use100":true}, "metadataOnly":false, "suspend":false, "groupid":29, "subscriber":"sg481n"}
+${UPDATE_SUBSCRIPTION_DATA}     {"delivery":{ "url":"https://${DR_PROV_IP}:8080/",  "user":"sg481n", "password":"sg481n", "use100":true}, "metadataOnly":false, "suspend":true, "groupid":29, "subscriber":"sg481n"}
+${FEED_CONTENT_TYPE}            application/vnd.att-dr.feed
+${SUBSCRIBE_CONTENT_TYPE}       application/vnd.att-dr.subscription
+${PUBLISH_FEED_CONTENT_TYPE}    application/octet-stream
+
+*** Test Cases ***
+Run Feed Creation
+    [Documentation]                 Feed Creation
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL}         ${CREATE_FEED_DATA}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Subscribe to Feed
+    [Documentation]                 Subscribe to Feed
+    [Timeout]                       1 minute
+    ${resp}=                        PostCall                         ${TARGET_URL_SUBSCRIBE}    ${SUBSCRIBE_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIBE}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              201
+    log                             'JSON Response Code:'${resp}
+
+Run Publish Feed
+    [Documentation]                 Publish to Feed
+    [Timeout]                       1 minute
+    Sleep                           10s                              Behaviour was noticed where feed was not created in time for publish to be sent
+    ${resp}=                        PutCall                          ${TARGET_URL_PUBLISH}    ${CREATE_FEED_DATA}      ${PUBLISH_FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_PUBLISH}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Update Subscription
+    [Documentation]                 Update Subscription to suspend and change delivery credentials
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_SUBSCRIPTION}    ${UPDATE_SUBSCRIPTION_DATA}      ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${TARGET_URL_SUBSCRIPTION}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_SUBSCRIPTION}    ${SUBSCRIBE_CONTENT_TYPE}    sg481n
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "password":"sg481n","user":"sg481n"
+    log                             'JSON Response Code:'${resp}
+
+Run Update Feed
+    [Documentation]                 Update Feed description and suspend
+    [Timeout]                       1 minute
+    ${resp}=                        PutCall                          ${TARGET_URL_FEED}    ${UPDATE_FEED_DATA}      ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${TARGET_URL_FEED}
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              200
+    log                             'JSON Response Code:'${resp}
+    ${resp}=                        GetCall                          ${TARGET_URL_FEED}    ${FEED_CONTENT_TYPE}    rs873m
+    log                             ${resp.text}
+    Should Contain                  ${resp.text}                     "UPDATED-CSIT_Test"
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Subscription
+    [Documentation]                 Delete Subscription
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_SUBSCRIPTION}    sg481n
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+Run Delete Feed
+    [Documentation]                 Delete Feed
+    [Timeout]                       1 minute
+    ${resp}=                        DeleteCall                       ${TARGET_URL_FEED}    rs873m
+    log                             ${resp.text}
+    Should Be Equal As Strings      ${resp.status_code}              204
+    log                             'JSON Response Code:'${resp}
+
+*** Keywords ***
+PostCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+PutCall
+    [Arguments]      ${url}              ${data}            ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}    Authorization=Basic cnM4NzNtOnJzODczbQ==
+    ${resp}=         Evaluate            requests.put('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+GetCall
+    [Arguments]      ${url}              ${content_type}        ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${resp}=         Evaluate            requests.get('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
+
+DeleteCall
+    [Arguments]      ${url}              ${user}
+    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}
+    ${resp}=         Evaluate            requests.delete('${url}', headers=${headers},verify=False)    requests
+    [Return]         ${resp}
diff --git a/test/csit/tests/dmaap-buscontroller/with_dr/test1.robot b/test/csit/tests/dmaap-buscontroller/with_dr/test1.robot
new file mode 100644
index 0000000..a3aef42
--- /dev/null
+++ b/test/csit/tests/dmaap-buscontroller/with_dr/test1.robot
@@ -0,0 +1,143 @@
+*** Settings ***
+Resource          ../../common.robot
+Library           Collections
+Library           json
+Library           OperatingSystem
+Library           RequestsLibrary
+Library           HttpLibrary.HTTP
+Library           String
+
+
+*** Variables ***
+${MESSAGE}    Hello, world!
+${DBC_URI}    webapi
+${DBC_URL}    http://${DMAAPBC_IP}:8080/${DBC_URI}
+${LOC}          csit-sanfrancisco
+${PUB_CORE}     "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.pub", "action": [ "pub", "view" ] 
+${SUB_CORE}     "dcaeLocationName": "${LOC}", "clientRole": "org.onap.dmaap.client.sub", "action": [ "sub", "view" ] 
+${PUB}          { ${PUB_CORE} }
+${SUB}          { ${SUB_CORE} }
+${FEED1_DATA}  { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
+${FEED2_DATA}  { "feedName":"feed2", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
+${PUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "pub2", "userpwd": "topSecret123", "feedId": "2" }
+${SUB2_DATA}   { "dcaeLocationName": "${LOC}", "username": "sub2", "userpwd": "someSecret123", "deliveryURL": "https://${DMAAPBC_IP}:8443/webapi/noURI", "feedId": "2" }
+${TOPIC2_DATA}  { "topicName":"singleMRtopic2", "topicDescription":"generated for CSIT", "owner":"dgl", "clients": [ ${PUB}, ${SUB}] }
+${TOPIC3_DATA}  { "topicName":"singleMRtopic3", "topicDescription":"generated for CSIT", "owner":"dgl"}
+#${PUB3_DATA}    { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${PUB_CORE} }
+#${SUB3_DATA}    { "fqtn": "${TOPIC_NS}.singleMRtopic3", ${SUB_CORE} }
+
+
+
+*** Test Cases ***
+Url Test
+    [Documentation]    Check if www.onap.org can be reached
+    Create Session     sanity          http://onap.readthedocs.io
+    ${resp}=           Get Request   sanity    /  
+    Should Be Equal As Integers  ${resp.status_code}  200
+
+(DMAAP-441c1)
+    [Documentation]        Create Feed w no clients POST ${DBC_URI}/feeds endpoint
+    ${resp}=         PostCall    ${DBC_URL}/feeds    ${FEED1_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  200   
+
+(DMAAP-441c2)
+    [Documentation]        Create Feed w clients POST ${DBC_URI}/feeds endpoint
+    ${resp}=         PostCall    ${DBC_URL}/feeds    ${FEED2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  200   
+
+(DMAAP-441c3)
+    [Documentation]        Add Publisher to existing feed
+    ${resp}=         PostCall    ${DBC_URL}/dr_pubs    ${PUB2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  201   
+    ${tmp}=          Get Json Value      ${resp.text}           /pubId
+    ${tmp}=          Remove String       ${tmp}         \"
+    Set Suite Variable          ${pubId}    ${tmp}
+
+(DMAAP-441c4)
+    [Documentation]        Add Subscriber to existing feed
+    ${resp}=         PostCall    ${DBC_URL}/dr_subs    ${SUB2_DATA}
+    Should Be Equal As Integers  ${resp.status_code}  201   
+    ${tmp}=          Get Json Value      ${resp.text}           /subId
+    ${tmp}=          Remove String       ${tmp}         \"
+    Set Suite Variable          ${subId}    ${tmp}
+
+(DMAAP-443)
+    [Documentation]        List existing feeds
+    Create Session     get          ${DBC_URL}
+    ${resp}=         Get Request    get       /feeds
+    Should Be Equal As Integers  ${resp.status_code}  200
+
+(DMAAP-444)
+    [Documentation]        Delete existing subscriber
+    ${resp}=         DelCall    ${DBC_URL}/dr_subs/${subId}
+    Should Be Equal As Integers  ${resp.status_code}  204
+
+(DMAAP-445)
+    [Documentation]        Delete existing publisher
+    ${resp}=         DelCall    ${DBC_URL}/dr_pubs/${pubId}
+    Should Be Equal As Integers  ${resp.status_code}  204
+
+#(DMAAP-294)
+#    [Documentation]        Create Topic w pub and sub clients POST ${DBC_URI}/topics endpoint
+#    ${resp}=         PostCall    ${DBC_URL}/topics    ${TOPIC2_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  201
+#
+#(DMAAP-295)
+#    [Documentation]        Create Topic w no clients and then add a client POST ${DBC_URI}/mr_clients endpoint
+#    ${resp}=         PostCall    ${DBC_URL}/topics    ${TOPIC3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  201   
+#    ${resp}=         PostCall    ${DBC_URL}/mr_clients    ${PUB3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  200   
+#    ${resp}=         PostCall    ${DBC_URL}/mr_clients    ${SUB3_DATA}
+#    Should Be Equal As Integers  ${resp.status_code}  200   
+#
+#(DMAAP-297)
+#    [Documentation]    Query for all topics and specific topic
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics  
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#
+#(DMAAP-301)
+#    [Documentation]    Delete a subscriber
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#	${tmp}=            Get Json Value      ${resp.text}           /clients/1/mrClientId
+#	${clientId}=       Remove String       ${tmp}         \"
+#    ${resp}=           DelCall   ${DBC_URL}/mr_clients/${clientId}
+#    Should Be Equal As Integers  ${resp.status_code}  204
+#
+#(DMAAP-302)
+#    [Documentation]    Delete a publisher
+#    Create Session     get          ${DBC_URL}
+#    ${resp}=           Get Request   get    /topics/${TOPIC_NS}.singleMRtopic3
+#    Should Be Equal As Integers  ${resp.status_code}  200
+#	${tmp}=            Get Json Value      ${resp.text}           /clients/0/mrClientId
+#	${clientId}=       Remove String       ${tmp}         \"
+#    ${resp}=           DelCall   ${DBC_URL}/mr_clients/${clientId}
+#    Should Be Equal As Integers  ${resp.status_code}  204
+
+
+*** Keywords ***
+CheckDir
+    [Arguments]                 ${path}
+    Directory Should Exist      ${path}
+
+CheckUrl
+    [Arguments]                  ${session}   ${path}     ${expect}
+    ${resp}=                     Get  Request          ${session} ${path} 
+    Should Be Equal As Integers  ${resp.status_code}  ${expect}
+
+PostCall
+    [Arguments]    ${url}           ${data}
+    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
+    ${resp}=       Evaluate    requests.post('${url}',data='${data}', headers=${headers},verify=False)    requests
+    [Return]       ${resp}
+
+DelCall
+    [Arguments]    ${url}           
+    ${headers}=    Create Dictionary    Accept=application/json    Content-Type=application/json
+    ${resp}=       Evaluate    requests.delete('${url}', headers=${headers},verify=False)    requests
+    [Return]       ${resp}