diff options
author | Gary Wu <gary.i.wu@huawei.com> | 2019-02-07 15:07:59 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2019-02-07 15:07:59 +0000 |
commit | 9dbe72e59635e35f131cd7b760cd16ad959c0b68 (patch) | |
tree | c56b8be7998573c3d8f170bf3ac6f8490437c7da /plans/dcaegen2-pmmapper | |
parent | e17c08e9b5535465ef9abec0d66e88b7a1355a60 (diff) | |
parent | 47b64d74a1383b8fa140283966648cab87322673 (diff) |
Merge "CSIT Tests for PM Mapper"
Diffstat (limited to 'plans/dcaegen2-pmmapper')
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json | 7 | ||||
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/assets/config.json | 1 | ||||
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml | 61 | ||||
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/setup.sh | 118 | ||||
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/teardown.sh | 10 | ||||
-rw-r--r-- | plans/dcaegen2-pmmapper/pmmapper/testplan.txt | 3 |
6 files changed, 200 insertions, 0 deletions
diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json b/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json new file mode 100644 index 00000000..a29956fb --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json @@ -0,0 +1,7 @@ +{ + "ID": "cbs", + "Name": "config_binding_service", + "Tags": ["cbs"], + "Address": "ipaddress", + "Port": 10000 +}
\ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/pmmapper/assets/config.json b/plans/dcaegen2-pmmapper/pmmapper/assets/config.json new file mode 100644 index 00000000..2fe128ba --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/assets/config.json @@ -0,0 +1 @@ +{"pm-mapper-filter": "{ \"filters\":[]}", "3GPP.schema.file": "{\"3GPP_Schema\":\"./etc/3GPP_relaxed_schema.xsd\"}", "streams_subscribes": {}, "streams_publishes": {"pm_mapper_handle_out": {"type": "message_router", "aaf_password": null, "dmaap_info": {"topic_url": "https://we-are-message-router.us:3905/events/some-topic", "client_role": null, "location": null, "client_id": null}, "aaf_username": null}}, "streams_subscribes.pm_mapper_handle_out.message_router_topic": "unauthenticated.PM_VES_OUTPUT", "streams_subscribes.pm_mapper_handle_in.feed_id": "1", "services_calls": {}}
\ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml new file mode 100644 index 00000000..af987f79 --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml @@ -0,0 +1,61 @@ +version: '2.1' +services: + datarouter-prov: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-prov + container_name: datarouter-prov + hostname: dmaap-dr-prov + ports: + - "443:8443" + - "8443:8443" + - "8080:8080" + volumes: + - ../prov_data/provserver.properties:/opt/app/datartr/etc/provserver.properties + - ../prov_data/addSubscriber.txt:/opt/app/datartr/addSubscriber.txt + - ../prov_data/addFeed3.txt:/opt/app/datartr/addFeed3.txt + depends_on: + mariadb_container: + condition: service_healthy + healthcheck: + test: ["CMD", "curl", "-f", "http://dmaap-dr-prov:8080/internal/prov"] + interval: 10s + timeout: 10s + retries: 5 + + datarouter-node: + image: nexus3.onap.org:10001/onap/dmaap/datarouter-node + container_name: datarouter-node + hostname: dmaap-dr-node + ports: + - "9443:8443" + - "9090:8080" + volumes: + - ../node_data/node.properties:/opt/app/datartr/etc/node.properties + depends_on: + datarouter-prov: + condition: service_healthy + + mariadb_container: + image: mariadb:10.2.14 + container_name: mariadb + ports: + - "3306:3306" + environment: + MYSQL_ROOT_PASSWORD: datarouter + MYSQL_DATABASE: datarouter + MYSQL_USER: datarouter + MYSQL_PASSWORD: datarouter + healthcheck: + test: ["CMD", "mysqladmin" ,"ping", "-h", "localhost", "--silent"] + interval: 10s + timeout: 30s + retries: 5 + + consul: + container_name: consul + image: nexus3.onap.org:10001/consul:latest + + cbs: + container_name: cbs + image: nexus3.onap.org:10001/onap/org.onap.dcaegen2.platform.configbinding.app-app:latest + environment: + CONSUL_HOST: diff --git a/plans/dcaegen2-pmmapper/pmmapper/setup.sh b/plans/dcaegen2-pmmapper/pmmapper/setup.sh new file mode 100644 index 00000000..326b4ac5 --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/setup.sh @@ -0,0 +1,118 @@ +#!/bin/bash +# Place the scripts in run order: +source ${SCRIPTS}/common_functions.sh + +# Clone DMaaP Message Router repo +mkdir -p $WORKSPACE/archives/dmaapmr +cd $WORKSPACE/archives/dmaapmr +git clone --depth 1 http://gerrit.onap.org/r/dmaap/messagerouter/messageservice -b master +sed -i 's/enableCadi: false/enableCadi: "false"/g' /$WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose/docker-compose.yml +cd $WORKSPACE/archives/dmaapmr/messageservice/src/main/resources/docker-compose +cp $WORKSPACE/archives/dmaapmr/messageservice/bundleconfig-local/etc/appprops/MsgRtrApi.properties /var/tmp/ + +# start DMaaP MR containers with docker compose and configuration from docker-compose.yml +docker login -u docker -p docker nexus3.onap.org:10001 +docker-compose up -d + +ZOOKEEPER=$(docker ps -a -q --filter="name=zookeeper_1") +KAFKA=$(docker ps -a -q --filter="name=kafka_1") +DMAAP=$(docker ps -a -q --filter="name=dmaap_1") + +# Wait for initialization of Docker contaienr for DMaaP MR, Kafka and Zookeeper +for i in {1..10}; do +if [ $(docker inspect --format '{{ .State.Running }}' $KAFKA) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' $ZOOKEEPER) ] && \ +[ $(docker inspect --format '{{ .State.Running }}' $DMAAP) ] +then + echo "DMaaP Service Running" + break +else + echo sleep $i + sleep $i +fi +done + +# Get IP address of DMAAP, KAFKA, Zookeeper +KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) +ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) +DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) + +sleep 2 +# Shutdown DMAAP Container +docker kill $DMAAP + +# Initial docker-compose up and down is for populating kafka and zookeeper IPs in /var/tmp/MsgRtrApi.properites +sed -i -e '/config.zk.servers=/ s/=.*/='$ZOOKEEPER_IP'/' /var/tmp/MsgRtrApi.properties +sed -i -e '/kafka.metadata.broker.list=/ s/=.*/='$KAFKA_IP':9092/' /var/tmp/MsgRtrApi.properties + +# Start DMaaP MR containers with docker compose and configuration from docker-compose.yml +docker login -u docker -p docker nexus3.onap.org:10001 +docker-compose up -d +sleep 5 + +# 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 $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources +mkdir docker-compose +cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose +cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/composefile/docker-compose-e2e.yml $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources/docker-compose/docker-compose.yml + +docker login -u docker -p docker nexus3.onap.org:10001 +docker-compose up -d +echo "Disregard the message ERROR: for datarouter-node Container 1234456 is unhealthy, this is expected behaiour at this stage" +docker kill datarouter-prov +docker kill datarouter-node +docker kill cbs +CONSUL_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' consul ) +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 + +# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb +for i in {1..10}; 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 + +sleep 5 + +# Get IP address of datarrouger-prov, datarouter-node, fileconsumer-node. +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) + +# Get IP address of DMAAP, KAFKA, Zookeeper, ConfigBindingService +DMAAP_MR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $DMAAP) +KAFKA_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $KAFKA) +ZOOKEEPER_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ZOOKEEPER) +CBS_IP=$(docker inspect '--format={{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' cbs) + +# Data Router Configuration: +# Create default feed on data router +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" +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 + +# Consul Configuration for PM Mapper +cp $WORKSPACE/plans/dcaegen2-pmmapper/pmmapper/assets/cbs.json /tmp/cbs.json +sed -i 's/ipaddress/'${CBS_IP}'/g' /tmp/cbs.json +curl --request PUT --data @/tmp/cbs.json http://$CONSUL_IP:8500/v1/agent/service/register +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}" diff --git a/plans/dcaegen2-pmmapper/pmmapper/teardown.sh b/plans/dcaegen2-pmmapper/pmmapper/teardown.sh new file mode 100644 index 00000000..5b910121 --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/teardown.sh @@ -0,0 +1,10 @@ +#!/bin/bash +echo "Starting teardown script" +kill-instance.sh $DMAAP +kill-instance.sh $KAFKA +kill-instance.sh $ZOOKEEPER +kill-instance.sh datarouter-node +kill-instance.sh datarouter-prov +kill-instance.sh mariadb +kill-instance.sh cbs +kill-instance.sh consul
\ No newline at end of file diff --git a/plans/dcaegen2-pmmapper/pmmapper/testplan.txt b/plans/dcaegen2-pmmapper/pmmapper/testplan.txt new file mode 100644 index 00000000..f874b4df --- /dev/null +++ b/plans/dcaegen2-pmmapper/pmmapper/testplan.txt @@ -0,0 +1,3 @@ +# Test suites are relative paths under [integration/csit.git]/tests/. +# Place the suites in run order. +dcaegen2-pmmapper/pmmapper |