blob: e5debfc2b3b717e0d3cd401a696fb743a5114c2b [file] [log] [blame]
econwar92924972018-07-31 13:46:27 +00001#!/bin/bash
2
3source ${SCRIPTS}/common_functions.sh
4
5# Clone DMaaP Data Router repo
6mkdir -p $WORKSPACE/archives/dmaapdr
7cd $WORKSPACE/archives/dmaapdr
8
9git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
econward5340482018-08-08 14:05:22 +000010cd datarouter
econwar92924972018-07-31 13:46:27 +000011git pull
edepaul31568802018-08-29 10:43:42 +010012cd $WORKSPACE/archives/dmaapdr/datarouter/docker-compose/
econwar92924972018-07-31 13:46:27 +000013
Dominic Lunanuovaf118f2e2018-09-04 23:14:13 +000014sed -i 's/10003/10001/g' docker-compose.yml
econwar92924972018-07-31 13:46:27 +000015# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
Dominic Lunanuovaf118f2e2018-09-04 23:14:13 +000016docker login -u docker -p docker nexus3.onap.org:10001
econwar92924972018-07-31 13:46:27 +000017docker-compose up -d
18
econwar6d5e8082018-08-08 17:17:18 +000019# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
econwar92924972018-07-31 13:46:27 +000020for i in {1..50}; do
21 if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
22 [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
econwar6d5e8082018-08-08 17:17:18 +000023 [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
econwar92924972018-07-31 13:46:27 +000024 then
25 echo "DR Service Running"
26 break
27 else
28 echo sleep $i
29 sleep $i
30 fi
31done
32
33DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
econwar18088d82018-08-09 14:21:29 +000034DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
econwar92924972018-07-31 13:46:27 +000035DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
36
37echo DR_PROV_IP=${DR_PROV_IP}
econwar18088d82018-08-09 14:21:29 +000038echo DR_NODE_IP=${DR_NODE_IP}
econwar92924972018-07-31 13:46:27 +000039echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
40
edepaul31568802018-08-29 10:43:42 +010041docker 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"
42docker 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"
econwar92924972018-07-31 13:46:27 +000043
44#Pass any variables required by Robot test suites in ROBOT_VARIABLES
econwar18088d82018-08-09 14:21:29 +000045ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"