Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | |
| 2 | #!/bin/bash |
| 3 | |
| 4 | #!/bin/bash |
| 5 | |
| 6 | # script to launch DMaaP DR docker containers |
| 7 | # sets global var IP with assigned IP address of DR Prov |
| 8 | |
| 9 | function dmaap_dr_launch() { |
| 10 | IP="" |
| 11 | |
| 12 | |
| 13 | # This next section was copied from scripts/dmaap-datarouter/dr-suite/setup.sh |
| 14 | # and slightly modified... |
| 15 | |
| 16 | # Clone DMaaP Data Router repo |
| 17 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 18 | cd $WORKSPACE/archives/dmaapdr |
| 19 | |
| 20 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 21 | cd datarouter |
| 22 | git pull |
Dominic Lunanuova | 52fda04 | 2018-10-23 17:09:17 +0000 | [diff] [blame^] | 23 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 24 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 25 | # start DMaaP DR containers with docker compose and configuration from docker-compose.yml |
| 26 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 27 | docker-compose up -d |
| 28 | |
| 29 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
| 30 | for i in {1..50}; do |
| 31 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 32 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 33 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 34 | then |
| 35 | echo "DR Service Running" |
| 36 | break |
| 37 | else |
| 38 | echo sleep $i |
| 39 | sleep $i |
| 40 | fi |
| 41 | done |
| 42 | |
| 43 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 44 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 45 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 46 | |
| 47 | echo DR_PROV_IP=${DR_PROV_IP} |
| 48 | echo DR_NODE_IP=${DR_NODE_IP} |
| 49 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 50 | |
| 51 | 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" |
| 52 | 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" |
| 53 | |
| 54 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 55 | ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}" |
| 56 | |
| 57 | IP=${DR_GATEWAY_IP} |
| 58 | } |