blob: 398eb7cda23a8680823cb6a77f259428b8cd8566 [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 .
efiacor87e2e552019-03-25 11:40:55 +000014cp $WORKSPACE/plans/dmaap-datarouter/dr-suite/docker-compose/provserver.properties ./prov_data/provserver.properties
15cp $WORKSPACE/plans/dmaap-datarouter/dr-suite/docker-compose/node.properties ./node_data/node.properties
Gary Wu9abb61c2018-09-27 10:38:50 -070016
Gary Wu9abb61c2018-09-27 10:38:50 -070017# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
18docker login -u docker -p docker nexus3.onap.org:10001
19docker-compose up -d
20
21# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
Conor Ward18eb8c42018-10-19 14:21:17 +010022for i in {1..10}; do
econwar624a9bd2019-02-08 16:02:29 +000023 if [ $(docker inspect --format '{{ .State.Running }}' subscriber-node2) ] && \
24 [ $(docker inspect --format '{{ .State.Running }}' subscriber-node) ] && \
25 [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
Gary Wu9abb61c2018-09-27 10:38:50 -070026 [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
27 [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
28 then
29 echo "DR Service Running"
30 break
31 else
32 echo sleep $i
33 sleep $i
34 fi
35done
36
Stanislav Chlebecd3c71b12018-12-03 18:06:21 +010037# Wait for healthy container datarouter-prov
38for i in {1..10}; do
39 if [ "$(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)" = 'healthy' ]
40 then
41 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
42 echo "DR Service Running, datarouter-prov container is healthy"
43 break
44 else
45 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
46 echo sleep $i
47 sleep $i
48 if [ $i = 10 ]
49 then
50 echo datarouter-prov container is not in healthy state - the test is not made, teardown...
51 cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
efiacor87e2e552019-03-25 11:40:55 +000052 docker-compose rm -sf
Stanislav Chlebecd3c71b12018-12-03 18:06:21 +010053 exit 1
54 fi
55 fi
56done
57
econwar624a9bd2019-02-08 16:02:29 +000058DR_PROV_IP=`get-instance-ip.sh datarouter-prov`
59DR_NODE_IP=`get-instance-ip.sh datarouter-node`
60DR_SUB_IP=`get-instance-ip.sh subscriber-node`
61DR_SUB2_IP=`get-instance-ip.sh subscriber-node2`
Gary Wu9abb61c2018-09-27 10:38:50 -070062DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
63
64echo DR_PROV_IP=${DR_PROV_IP}
65echo DR_NODE_IP=${DR_NODE_IP}
econwar624a9bd2019-02-08 16:02:29 +000066echo DR_SUB_IP=${DR_SUB_IP}
67echo DR_SUB2_IP=${DR_SUB2_IP}
Gary Wu9abb61c2018-09-27 10:38:50 -070068echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
69
Gary Wu9abb61c2018-09-27 10:38:50 -070070docker 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"
71
72#Pass any variables required by Robot test suites in ROBOT_VARIABLES
econwar624a9bd2019-02-08 16:02:29 +000073ROBOT_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}"