summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGary Wu <gary.i.wu@huawei.com>2019-02-11 17:14:17 +0000
committerGerrit Code Review <gerrit@onap.org>2019-02-11 17:14:17 +0000
commit847602ef419dff6e7a98c7e3068515882409b8c5 (patch)
tree622fb4e3f89e82af52ff8cd7cde714a149eb1c49
parent9e9f7222bd9d79785bbdfefc330c6b4a4c90b6b2 (diff)
parent8f0afd8a099200fb7001ded306dceb015a63517b (diff)
Merge "Updated Test and Setup files for PM Mapper"
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml13
-rwxr-xr-xplans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh18
-rw-r--r--plans/dcaegen2-pmmapper/pmmapper/setup.sh13
-rw-r--r--tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot29
4 files changed, 62 insertions, 11 deletions
diff --git a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml
index af987f79..ee1649be 100644
--- a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml
+++ b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml
@@ -1,7 +1,7 @@
version: '2.1'
services:
datarouter-prov:
- image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov
+ image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov:2.0.0-SNAPSHOT
container_name: datarouter-prov
hostname: dmaap-dr-prov
ports:
@@ -22,7 +22,7 @@ services:
retries: 5
datarouter-node:
- image: nexus3.onap.org:10001/onap/dmaap/datarouter-node
+ image: nexus3.onap.org:10001/onap/dmaap/datarouter-node:2.0.0-SNAPSHOT
container_name: datarouter-node
hostname: dmaap-dr-node
ports:
@@ -59,3 +59,12 @@ services:
image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest
environment:
CONSUL_HOST:
+
+ buscontroller:
+ container_name: buscontroller
+ image: nexus3.onap.org:10001/onap/dmaap/buscontroller
+ ports:
+ - "18080:8080"
+ - "18443:8443"
+ extra_hosts:
+ - "dmaap-dr-prov: dr-prov-ip" \ No newline at end of file
diff --git a/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh b/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh
new file mode 100755
index 00000000..ffb1686c
--- /dev/null
+++ b/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh
@@ -0,0 +1,18 @@
+#!/bin/bash
+
+# $1 is the IP address of the buscontroller
+# INITIALIZE: dmaap object
+JSON=/tmp/prov.dmaap
+cat << EOF > $JSON
+{
+"version": "1",
+"topicNsRoot": "org.onap.dmaap",
+"drProvUrl": "https://dmaap-dr-prov:8443",
+"dmaapName": "onapCSIT",
+"bridgeAdminTopic": "MM_AGENT_PROV"
+
+}
+EOF
+
+echo "Initializing /dmaap endpoint"
+curl -v -X POST -d @${JSON} -H "Content-Type: application/json" http://$1:8080/webapi/dmaap \ No newline at end of file
diff --git a/plans/dcaegen2-pmmapper/pmmapper/setup.sh b/plans/dcaegen2-pmmapper/pmmapper/setup.sh
index 326b4ac5..5d8cce62 100644
--- a/plans/dcaegen2-pmmapper/pmmapper/setup.sh
+++ b/plans/dcaegen2-pmmapper/pmmapper/setup.sh
@@ -70,6 +70,10 @@ sed -i -e '/CONSUL_HOST:/ s/:.*/: '$CONSUL_IP'/' docker-compose.yml
MARIADB=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' mariadb )
sed -i 's/datarouter-mariadb/'$MARIADB'/g' $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/prov_data/provserver.properties
docker-compose up -d
+DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
+docker kill buscontroller
+sed -i 's/dr-prov-ip/'$DR_PROV_IP'/g' docker-compose.yml
+docker-compose up -d
# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
for i in {1..10}; do
@@ -104,9 +108,10 @@ docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/i
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"
docker exec datarouter-prov /bin/sh -c "echo '${DR_NODE_IP}' dmaap-dr-node >> /etc/hosts"
docker exec datarouter-node /bin/sh -c "echo '${DR_PROV_IP}' dmaap-dr-prov >> /etc/hosts"
-curl -v -X POST -H "Content-Type:application/vnd.att-dr.feed" -H "X-ATT-DR-ON-BEHALF-OF:dradmin" --data-ascii @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/createFeed.json --post301 --location-trusted -k https://${DR_PROV_IP}:8443
-sleep 5
-curl -k https://$DR_PROV_IP:8443/internal/prov
+
+# Bus Controller Configuration
+DMAAPBC_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' buscontroller)
+$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/dmaapbc.sh ${DMAAPBC_IP}
# Consul Configuration for PM Mapper
cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json
@@ -115,4 +120,4 @@ curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service
curl 'http://'$CONSUL_IP':8500/v1/kv/pmmapper?dc=dc1' -X PUT -H 'Accept: application/^Con' -H 'Content-Type: application/json' -H 'X-Requested-With: XMLHttpRequest' --data @$WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/config.json
#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} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}"
+ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DMAAPBC_IP:${DMAAPBC_IP} -v DMAAP_MR_IP:${DMAAP_MR_IP} -v CBS_IP:${CBS_IP} -v DR_SUBSCIBER_IP:${DR_SUBSCIBER_IP}" \ No newline at end of file
diff --git a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
index f65ef2b4..ccfa4968 100644
--- a/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
+++ b/tests/dcaegen2-pmmapper/pmmapper/pmmapper.robot
@@ -1,14 +1,19 @@
*** Settings ***
Documentation Testing PM Mapper functionality
-Library RequestsLibrary
-Library OperatingSystem
+Resource ../../common.robot
Library Collections
+Library json
+Library OperatingSystem
+Library RequestsLibrary
+Library HttpLibrary.HTTP
+Library String
Library Process
*** Variables ***
-${GLOBAL_APPLICATION_ID} robot-ves
-${CLI_EXEC_CLI} curl http://${CBS_IP}:10000/service_component/pmmapper
+${BC_URL} http://${DMAAPBC_IP}:8080/webapi
+${CLI_EXEC_CLI} curl http://${CBS_IP}:10000/service_component/pmmapper
+${FEED1_DATA} { "feedName":"feed1", "feedVersion": "csit", "feedDescription":"generated for CSIT", "owner":"dgl", "asprClassification": "unclassified" }
*** Test Cases ***
@@ -18,4 +23,18 @@ Verify pmmapper configuration in consul through CBS
[Documentation] Verify pmmapper configuraiton in consul through CBS
${cli_cmd_output}= Run Process ${CLI_EXEC_CLI} shell=yes
Log ${cli_cmd_output.stdout}
- Should Contain ${cli_cmd_output.stdout} pm-mapper-filter \ No newline at end of file
+ Should Contain ${cli_cmd_output.stdout} pm-mapper-filter
+
+Create DR Feed through Bus Controller
+ [Tags] PM_MAPPER_02
+ [Documentation] Create Feed on Data Router through Bus Controller
+ ${resp}= PostCall ${BC_URL}/feeds ${FEED1_DATA}
+ Should Be Equal As Integers ${resp.status_code} 200
+
+*** Keywords ***
+
+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} \ No newline at end of file