blob: dedf15b00b4e9d857592ad42f76332658457dd94 [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001#!/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
10cd datarouter
11git pull
Conor Ward18eb8c42018-10-19 14:21:17 +010012cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
Gary Wu9abb61c2018-09-27 10:38:50 -070013
14sed -i 's/10003/10001/g' docker-compose.yml
15# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
16docker login -u docker -p docker nexus3.onap.org:10001
17docker-compose up -d
18
19# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
Conor Ward18eb8c42018-10-19 14:21:17 +010020for i in {1..10}; do
Gary Wu9abb61c2018-09-27 10:38:50 -070021 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
31done
32
33DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
34DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
35DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
36
37echo DR_PROV_IP=${DR_PROV_IP}
38echo DR_NODE_IP=${DR_NODE_IP}
39echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
40
Gary Wu9abb61c2018-09-27 10:38:50 -070041docker 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
44ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"