Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | source ${SCRIPTS}/common_functions.sh |
| 4 | |
| 5 | # Clone DMaaP Data Router repo |
| 6 | mkdir -p $WORKSPACE/archives/dmaapdr |
| 7 | cd $WORKSPACE/archives/dmaapdr |
| 8 | |
| 9 | git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master |
| 10 | cd datarouter |
| 11 | git pull |
Conor Ward | 18eb8c4 | 2018-10-19 14:21:17 +0100 | [diff] [blame] | 12 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 13 | |
| 14 | sed -i 's/10003/10001/g' docker-compose.yml |
| 15 | # start DMaaP DR containers with docker compose and configuration from docker-compose.yml |
| 16 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 17 | docker-compose up -d |
| 18 | |
| 19 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
Conor Ward | 18eb8c4 | 2018-10-19 14:21:17 +0100 | [diff] [blame] | 20 | for i in {1..10}; do |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 21 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 22 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 23 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
| 24 | then |
| 25 | echo "DR Service Running" |
| 26 | break |
| 27 | else |
| 28 | echo sleep $i |
| 29 | sleep $i |
| 30 | fi |
| 31 | done |
| 32 | |
| 33 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 34 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
| 35 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 36 | |
| 37 | echo DR_PROV_IP=${DR_PROV_IP} |
| 38 | echo DR_NODE_IP=${DR_NODE_IP} |
| 39 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 40 | |
Gary Wu | 9abb61c | 2018-09-27 10:38:50 -0700 | [diff] [blame] | 41 | 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" |
| 42 | |
| 43 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 44 | ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}" |