blob: bba1b73dfbe84f7175ddd93c5ddf8af5b269b87d [file] [log] [blame]
Gary Wu9abb61c2018-09-27 10:38:50 -07001
2#!/bin/bash
3
4#!/bin/bash
5
6# script to launch DMaaP DR docker containers
7# sets global var IP with assigned IP address of DR Prov
8
9function dmaap_dr_launch() {
10 IP=""
11
12
13 # This next section was copied from scripts/dmaap-datarouter/dr-suite/setup.sh
14 # and slightly modified...
15
16 # Clone DMaaP Data Router repo
17 mkdir -p $WORKSPACE/archives/dmaapdr
18 cd $WORKSPACE/archives/dmaapdr
19
20 git clone --depth 1 https://gerrit.onap.org/r/dmaap/datarouter -b master
21 cd datarouter
22 git pull
Dominic Lunanuova52fda042018-10-23 17:09:17 +000023 cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
Gary Wu9abb61c2018-09-27 10:38:50 -070024
Gary Wu9abb61c2018-09-27 10:38:50 -070025 # start DMaaP DR containers with docker compose and configuration from docker-compose.yml
26 docker login -u docker -p docker nexus3.onap.org:10001
27 docker-compose up -d
28
29 # Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
30 for i in {1..50}; do
31 if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
32 [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
33 [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
34 then
35 echo "DR Service Running"
36 break
37 else
38 echo sleep $i
39 sleep $i
40 fi
41 done
42
43 DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
44 DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
45 DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
46
47 echo DR_PROV_IP=${DR_PROV_IP}
48 echo DR_NODE_IP=${DR_NODE_IP}
49 echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
50
51 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"
52 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"
53
54 #Pass any variables required by Robot test suites in ROBOT_VARIABLES
55 ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"
56
57 IP=${DR_GATEWAY_IP}
58}