econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [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 | git pull |
| 11 | cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-prov/src/main/resources/docker-compose/ |
| 12 | |
| 13 | # start DMaaP DR containers with docker compose and configuration from docker-compose.yml |
| 14 | docker login -u docker -p docker nexus3.onap.org:10001 |
| 15 | docker-compose up -d |
| 16 | |
| 17 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mysql |
| 18 | for i in {1..50}; do |
| 19 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 20 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
| 21 | [ $(docker inspect --format '{{ .State.Running }}' mysql) ] |
| 22 | then |
| 23 | echo "DR Service Running" |
| 24 | break |
| 25 | else |
| 26 | echo sleep $i |
| 27 | sleep $i |
| 28 | fi |
| 29 | done |
| 30 | |
| 31 | DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov) |
| 32 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 33 | |
| 34 | echo DR_PROV_IP=${DR_PROV_IP} |
| 35 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 36 | |
| 37 | echo "Sleep 15 seconds to allow startup script to execute on datarouter-prov container" |
| 38 | sleep 15 |
| 39 | |
| 40 | docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=node.datarouternew.com\|$DR_GATEWAY_IP" |
| 41 | docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=prov.datarouternew.com\|$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}" |