Add Publish to Feed Test Case

Change-Id: I5926771744ce870690388c9dcaf7bbbd1f21862d
Signed-off-by: Conor Ward <conor.ward@ericsson.com>
Issue-ID: DMAAP-564
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh b/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
index 3e02a0d..d72fe1f 100755
--- a/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
+++ b/test/csit/plans/dmaap-datarouter/dr-suite/setup.sh
@@ -30,16 +30,15 @@
 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}
 
-echo "Sleep 15 seconds to allow startup script to execute on datarouter-prov container"
-sleep 15
-
 docker exec -i datarouter-prov sh -c "curl -k  -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=node.datarouternew.com\|$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=prov.datarouternew.com\|$DR_GATEWAY_IP"
 
 #Pass any variables required by Robot test suites in ROBOT_VARIABLES
-ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP}"
+ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"
diff --git a/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh b/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh
index 546bea6..e5a7f25 100755
--- a/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh
+++ b/test/csit/plans/dmaap-datarouter/dr-suite/teardown.sh
@@ -1,5 +1,4 @@
 #!/bin/bash
 
-kill-instance.sh datarouter-node
-kill-instance.sh datarouter-prov
-kill-instance.sh mariadb
+cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-prov/src/main/resources/docker-compose/
+docker-compose down -v
diff --git a/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot b/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot
index b5092f8..12d5875 100755
--- a/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot
+++ b/test/csit/tests/dmaap-datarouter/dr-suite/dr-suite.robot
@@ -10,12 +10,14 @@
 ${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": ["${DR_PROV_IP}"],  "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": ["${DR_PROV_IP}"],  "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
@@ -36,6 +38,16 @@
     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
@@ -87,7 +99,7 @@
 
 PutCall
     [Arguments]      ${url}              ${data}            ${content_type}        ${user}
-    ${headers}=      Create Dictionary   X-ATT-DR-ON-BEHALF-OF=${user}    Content-Type=${content_type}
+    ${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}