blob: 3e02a0d7407344e85e3d328535a2c14f51918104 [file] [log] [blame]
econwar92924972018-07-31 13:46:27 +00001#!/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
econward5340482018-08-08 14:05:22 +000010cd datarouter
econwar92924972018-07-31 13:46:27 +000011git pull
12cd $WORKSPACE/archives/dmaapdr/datarouter/datarouter-prov/src/main/resources/docker-compose/
13
14# start DMaaP DR containers with docker compose and configuration from docker-compose.yml
econwar6d5e8082018-08-08 17:17:18 +000015docker login -u docker -p docker nexus3.onap.org:10003
econwar92924972018-07-31 13:46:27 +000016docker-compose up -d
17
econwar6d5e8082018-08-08 17:17:18 +000018# Wait for initialization of Docker container for datarouter-node, datarouter-prov and mariadb
econwar92924972018-07-31 13:46:27 +000019for i in {1..50}; do
20 if [ $(docker inspect --format '{{ .State.Running }}' datarouter-node) ] && \
21 [ $(docker inspect --format '{{ .State.Running }}' datarouter-prov) ] && \
econwar6d5e8082018-08-08 17:17:18 +000022 [ $(docker inspect --format '{{ .State.Running }}' mariadb) ]
econwar92924972018-07-31 13:46:27 +000023 then
24 echo "DR Service Running"
25 break
26 else
27 echo sleep $i
28 sleep $i
29 fi
30done
31
32DR_PROV_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' datarouter-prov)
33DR_GATEWAY_IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.Gateway}}{{end}}' datarouter-prov)
34
35echo DR_PROV_IP=${DR_PROV_IP}
36echo DR_GATEWAY_IP=${DR_GATEWAY_IP}
37
38echo "Sleep 15 seconds to allow startup script to execute on datarouter-prov container"
39sleep 15
40
41docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/NODES?val=node.datarouternew.com\|$DR_GATEWAY_IP"
42docker exec -i datarouter-prov sh -c "curl -k -X PUT https://$DR_PROV_IP:8443/internal/api/PROV_AUTH_ADDRESSES?val=prov.datarouternew.com\|$DR_GATEWAY_IP"
43
44#Pass any variables required by Robot test suites in ROBOT_VARIABLES
45ROBOT_VARIABLES="-v DR_PROV_IP:${DR_PROV_IP}"