aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDominic Lunanuova <dgl@research.att.com>2018-04-20 18:54:47 +0000
committerDominic Lunanuova <dgl@research.att.com>2018-04-20 18:54:58 +0000
commitdb5f9899d30b38d56fc893ec627f6e24fd4bd374 (patch)
tree1af4b450fb8846dc78e04ef5e7ec5a25af5f11cf /test
parentaedcf8ed19f09c8c7e7731864a53121cf565e052 (diff)
Added functional tests for unauthenticated MR
NOTE: because these tests are all related, this commit also addresses DMAAP-294,495, 297, 301 and 302. Change-Id: I862f459e34517c838413728e6193e53a5ab20bc3 Signed-off-by: Dominic Lunanuova <dgl@research.att.com> Issue-ID: DMAAP-293
Diffstat (limited to 'test')
-rwxr-xr-xtest/csit/plans/dmaap-buscontroller/mock_downstream/setup.sh3
-rwxr-xr-xtest/csit/plans/dmaap-buscontroller/with_mr/setup.sh52
-rw-r--r--test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh5
-rwxr-xr-xtest/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh17
-rwxr-xr-xtest/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh9
-rw-r--r--test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot71
6 files changed, 117 insertions, 40 deletions
diff --git a/test/csit/plans/dmaap-buscontroller/mock_downstream/setup.sh b/test/csit/plans/dmaap-buscontroller/mock_downstream/setup.sh
index a19454be5..d5c77b0bd 100755
--- a/test/csit/plans/dmaap-buscontroller/mock_downstream/setup.sh
+++ b/test/csit/plans/dmaap-buscontroller/mock_downstream/setup.sh
@@ -40,3 +40,6 @@ 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}
+set +x
diff --git a/test/csit/plans/dmaap-buscontroller/with_mr/setup.sh b/test/csit/plans/dmaap-buscontroller/with_mr/setup.sh
index 35534de0b..3b604fe99 100755
--- a/test/csit/plans/dmaap-buscontroller/with_mr/setup.sh
+++ b/test/csit/plans/dmaap-buscontroller/with_mr/setup.sh
@@ -20,25 +20,35 @@
#
#
-
-# Place the scripts in run order:
-source ${WORKSPACE}/test/csit/scripts/dmaap-message-router/dmaap-mr-launch.sh
-dmaap_mr_launch
-MRC_IP=${IP}
-
-source ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/start-mock.sh
-#start_mock "aaf"
-AAF_IP=${IP}
-start_mock "drps"
-DRPS_IP=${IP}
-
-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}"
+if [ "$USE_EXISTING_DMAAP" = "Y" ]
+then
+ ROBOT_VARIABLES="-v AAF_IP:0.0.0 -v MRC_IP:172.18.0.3 -v DRPS_IP:0.0.0.0 -v DMAAPBC_IP:172.17.0.4"
+else
+
+ # Place the scripts in run order:
+ source ${WORKSPACE}/test/csit/scripts/dmaap-message-router/dmaap-mr-launch.sh
+ dmaap_mr_launch
+ MRC_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}
+ DRPS_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}
+ set +x
+fi
diff --git a/test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh b/test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh
index 0474dded6..f35b02259 100644
--- a/test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh
+++ b/test/csit/plans/dmaap-buscontroller/with_mr/teardown.sh
@@ -21,8 +21,9 @@
#
source ${WORKSPACE}/test/csit/scripts/dmaap-message-router/dmaap-mr-teardown.sh
+if [ "$KEEP_DMAAP" != "Y" ]
+then
dmaap_mr_teardown
-kill-instance.sh aaf-mock
-kill-instance.sh drps-mock
kill-instance.sh dmaapbc
+fi
diff --git a/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh b/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
index 7ec7345d5..96ac40f18 100755
--- a/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
+++ b/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh
@@ -17,6 +17,7 @@ cat << EOF > $JSON
}
EOF
+echo "Initializing /dmaap endpoint"
curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap
@@ -33,20 +34,28 @@ cat << EOF > $JSON
}
EOF
+echo "Initializing /dcaeLocations endpoint"
curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dcaeLocations
# INITIALIZE: MR object in 1 site
+# since MR is currently deployed via docker-compose, its IP doesn't seem
+# to be routable from DBCL. Fortunately, the MR port is mapped from the docker bridge IP address.
+# Found this article for how to deterine the docker bridge IP so using it as a workaround.
+# https://stackoverflow.com/questions/22944631/how-to-get-the-ip-address-of-the-docker-host-from-inside-a-docker-container
+# Used the following snippet found buried in a comment to an answer and then modified for only 1 value.
+DOCKER_HOST=$(ip -4 addr show docker0 | grep -Po 'inet \K[\d.]+' | head -1 )
+# Perhaps there is a better way...
JSON=/tmp/$$.mrc
cat << EOF > $JSON
{
"dcaeLocationName": "csit-sanfrancisco",
- "fqdn": "$3",
- "hosts" : [ "$3", "$3", "$3" ],
- "protocol" : "https",
- "port": "3094"
+ "fqdn": "$DOCKER_HOST",
+ "topicProtocol" : "http",
+ "topicPort": "3904"
}
EOF
+echo "Initializing /mr_clusters endpoint"
curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/mr_clusters
diff --git a/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh b/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
index 72c443850..688ce7d45 100755
--- a/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
+++ b/test/csit/scripts/dmaap-buscontroller/dmaapbc-launch.sh
@@ -4,13 +4,13 @@
# sets global var IP with assigned IP address
function dmaapbc_launch() {
- TAG=onap/dmaap/buscontroller
+ TAG="nexus3.onap.org:10001/onap/dmaap/buscontroller"
CONTAINER_NAME=dmaapbc
IP=""
cd ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller
- TMP_CFG=/tmp/docker-databys-controller.conf
+ 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
IP=`get-instance-ip.sh ${CONTAINER_NAME}`
@@ -22,9 +22,4 @@ function dmaapbc_launch() {
sleep $i
done
- set -x
- ${WORKSPACE}/test/csit/scripts/dmaap-buscontroller/dmaapbc-init.sh ${IP}
- set +x
-
-
}
diff --git a/test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot b/test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot
index f69538dc6..d68b9ed17 100644
--- a/test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot
+++ b/test/csit/tests/dmaap-buscontroller/single-mr-suite/test1.robot
@@ -4,14 +4,25 @@ Library Collections
Library json
Library OperatingSystem
Library RequestsLibrary
-
+Library HttpLibrary.HTTP
+Library String
*** Variables ***
${MESSAGE} Hello, world!
${DBC_URI} webapi
-${TOPIC1} singleMRtopic1
-${TOPIC1_DATA} { "topicName":"singleMRtopic1", "topicDescription":"generated for CSIT", "owner":"dgl"}
+${DBC_URL} http://${DMAAPBC_IP}:8080/${DBC_URI}
+${TOPIC_NS} org.onap.dmaap.onapCSIT
+${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} }
+${TOPIC1_DATA} { "topicName":"singleMRtopic1", "topicDescription":"generated for CSIT", "owner":"dgl"}
+${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} }
@@ -22,11 +33,54 @@ Url Test
${resp}= Get Request sanity /
Should Be Equal As Integers ${resp.status_code} 200
-Create Topic Test
- [Documentation] Check POST ${DBC_URI}/topics endpoint
- ${resp}= PostCall http://${DMAAPBC_IP}:8080/${DBC_URI}/topics ${TOPIC1_DATA}
+(DMAAP-293)
+ [Documentation] Create Topic w no clients POST ${DBC_URI}/topics endpoint
+ ${resp}= PostCall ${DBC_URL}/topics ${TOPIC1_DATA}
+ Should Be Equal As Integers ${resp.status_code} 201
+
+(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}
@@ -43,3 +97,8 @@ PostCall
${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}