blob: 22d727a74e92107e273b805d1d0a42fe933f702e [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
Stanislav Chlebecd3c71b12018-12-03 18:06:21 +010033# Wait for healthy container datarouter-prov
34for i in {1..10}; do
35 if [ "$(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)" = 'healthy' ]
36 then
37 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
38 echo "DR Service Running, datarouter-prov container is healthy"
39 break
40 else
41 echo datarouter-prov.State.Health.Status is $(docker inspect --format '{{ .State.Health.Status }}' datarouter-prov)
42 echo sleep $i
43 sleep $i
44 if [ $i = 10 ]
45 then
46 echo datarouter-prov container is not in healthy state - the test is not made, teardown...
47 cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-docker-compose/src/main/resources
48 docker-compose down -v
49 exit 1
50 fi
51 fi
52done
53
Gary Wu9abb61c2018-09-27 10:38:50 -070054DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
55DR_NODE_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-node)
56DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
57
58echo DR_PROV_IP=${DR_PROV_IP}
59echo DR_NODE_IP=${DR_NODE_IP}
60echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
61
Gary Wu9abb61c2018-09-27 10:38:50 -070062docker 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"
63
64#Pass any variables required by Robot test suites in ROBOT_VARIABLES
65ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP} -v DR_NODE_IP:${DR_NODE_IP}"