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 |
econwar | d534048 | 2018-08-08 14:05:22 +0000 | [diff] [blame] | 10 | cd datarouter |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 11 | git pull |
edepaul | 3156880 | 2018-08-29 10:43:42 +0100 | [diff] [blame] | 12 | cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/ |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 13 | |
Dominic Lunanuova | f118f2e | 2018-09-04 23:14:13 +0000 | [diff] [blame] | 14 | sed -i 's/10003/10001/g' docker-compose.yml |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 15 | # start DMaaP DR containers with docker compose and configuration from docker-compose.yml |
Dominic Lunanuova | f118f2e | 2018-09-04 23:14:13 +0000 | [diff] [blame] | 16 | docker login -u docker -p docker nexus3.onap.org:10001 |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 17 | docker-compose up -d |
| 18 | |
econwar | 6d5e808 | 2018-08-08 17:17:18 +0000 | [diff] [blame] | 19 | # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 20 | for i in {1..50}; do |
| 21 | if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \ |
| 22 | [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \ |
econwar | 6d5e808 | 2018-08-08 17:17:18 +0000 | [diff] [blame] | 23 | [ $(docker inspect --format '{{ .State.Running }}' mariadb) ] |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 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) |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 34 | DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node) |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 35 | DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov) |
| 36 | |
| 37 | echo DR_PROV_IP=${DR_PROV_IP} |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 38 | echo DR_NODE_IP=${DR_NODE_IP} |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 39 | echo DR_GATEWAY_IP=${DR_GATEWAY_IP} |
| 40 | |
edepaul | 3156880 | 2018-08-29 10:43:42 +0100 | [diff] [blame] | 41 | 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" |
| 42 | 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" |
econwar | 9292497 | 2018-07-31 13:46:27 +0000 | [diff] [blame] | 43 | |
| 44 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
econwar | 18088d8 | 2018-08-09 14:21:29 +0000 | [diff] [blame] | 45 | ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}" |