blob: fa0764dbb18cac1b65df6f4171c9e76a618cc504 [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
econwar624a9bd2019-02-08 16:02:29 +000013cp $WORKSPACE/plans/dmaap-datarouter/dr-suite/docker-compose/docker-compose.yml .
Gary Wu9abb61c2018-09-27 10:38:50 -070014
Gary Wu9abb61c2018-09-27 10:38:50 -070015# 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
econwar624a9bd2019-02-08 16:02:29 +000021 if [ $(docker inspect --format '{{ .State.Running }}' subscriber-node2) ] && \
22 [ $(docker inspect --format '{{ .State.Running }}' subscriber-node) ] && \
23 [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
Gary Wu9abb61c2018-09-27 10:38:50 -070024 [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
25 [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
26 then
27 echo "DR Service Running"
28 break
29 else
30 echo sleep $i
31 sleep $i
32 fi
33done
34
Stanislav Chlebecd3c71b12018-12-03 18:06:21 +010035# Wait for healthy container datarouter-prov
36for i in {1..10}; do
37 if [ "$(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)" = 'healthy' ]
38 then
39 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
40 echo "DR Service Running, datarouter-prov container is healthy"
41 break
42 else
43 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
44 echo sleep $i
45 sleep $i
46 if [ $i = 10 ]
47 then
48 echo datarouter-prov container is not in healthy state - the test is not made, teardown...
49 cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
50 docker-compose down -v
51 exit 1
52 fi
53 fi
54done
55
econwar624a9bd2019-02-08 16:02:29 +000056DR_PROV_IP=`get-instance-ip.sh datarouter-prov`
57DR_NODE_IP=`get-instance-ip.sh datarouter-node`
58DR_SUB_IP=`get-instance-ip.sh subscriber-node`
59DR_SUB2_IP=`get-instance-ip.sh subscriber-node2`
Gary Wu9abb61c2018-09-27 10:38:50 -070060DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
61
62echo DR_PROV_IP=${DR_PROV_IP}
63echo DR_NODE_IP=${DR_NODE_IP}
econwar624a9bd2019-02-08 16:02:29 +000064echo DR_SUB_IP=${DR_SUB_IP}
65echo DR_SUB2_IP=${DR_SUB2_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -070066echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
67
Gary Wu9abb61c2018-09-27 10:38:50 -070068docker 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"
69
70#Pass any variables required by Robot test suites in ROBOT_VARIABLES
econwar624a9bd2019-02-08 16:02:29 +000071ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP} -v DR_SUB_IP:${DR_SUB_IP} -v DR_SUB2_IP:${DR_SUB2_IP}"