blob: e4b1cd7c1a3e5551dd04563616301418bb1a6611 [file] [log] [blame]
wejs060bc422018-05-25 13:58:11 +02001#!/bin/bash
2
3source ${SCRIPTS}/common_functions.sh
4
5export PRH_SERVICE="prh"
6export DMAAP_SIMULATOR="dmaap_simulator"
Mariusz Wagner4a6ece42018-06-05 15:54:27 +02007export AAI_SIMULATOR="aai_simulator"
wejs060bc422018-05-25 13:58:11 +02008
Mariusz Wagner26b89ec2018-06-19 09:52:01 +02009cd ${WORKSPACE}/test/csit/tests/dcaegen2/prh-testcases/resources/
wejs060bc422018-05-25 13:58:11 +020010
11docker login -u docker -p docker nexus3.onap.org:10003
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020012docker-compose up -d --build
wejs060bc422018-05-25 13:58:11 +020013
14# Wait for initialization of Docker containers
Mariusz Wagner60be36d2018-07-05 11:32:51 +020015for i in {1..10}; do
wejs060bc422018-05-25 13:58:11 +020016 if [ $(docker inspect --format '{{ .State.Running }}' ${PRH_SERVICE}) ] && \
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020017 [ $(docker inspect --format '{{ .State.Running }}' ${DMAAP_SIMULATOR}) ] && \
18 [ $(docker inspect --format '{{ .State.Running }}' ${AAI_SIMULATOR}) ]
wejs060bc422018-05-25 13:58:11 +020019 then
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020020 echo "dmaap_simulator, aai_simulator and prh services are running"
wejs060bc422018-05-25 13:58:11 +020021 break
22 else
23 echo sleep ${i}
24 sleep ${i}
25 fi
26done
27
28PRH_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${PRH_SERVICE})
29DMAAP_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${DMAAP_SIMULATOR})
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020030AAI_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${AAI_SIMULATOR})
wejs060bc422018-05-25 13:58:11 +020031
32bypass_ip_adress ${PRH_IP}
33bypass_ip_adress ${DMAAP_SIMULATOR_IP}
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020034bypass_ip_adress ${AAI_SIMULATOR_IP}
wejs060bc422018-05-25 13:58:11 +020035
36echo PRH_IP=${PRH_IP}
37echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP}
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020038echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP}
wejs060bc422018-05-25 13:58:11 +020039
40# Wait for initialization of docker services
Mariusz Wagner60be36d2018-07-05 11:32:51 +020041for i in {1..10}; do
wejs060bc422018-05-25 13:58:11 +020042 curl -sS -m 1 localhost:2222 && \
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020043 curl -sS -m 1 localhost:3333 && \
wejs060bc422018-05-25 13:58:11 +020044 curl -sS -m 1 localhost:8100/heartbeat && break
45 echo sleep ${i}
46 sleep ${i}
47done
48
Mariusz Wagner60be36d2018-07-05 11:32:51 +020049docker stop prh
wejs060bc422018-05-25 13:58:11 +020050docker cp prh:/config/prh_endpoints.json ${WORKDIR}
51sed -i -e 's/"dmaapHostName":.*/"dmaapHostName": "'${DMAAP_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json
Mariusz Wagner4a6ece42018-06-05 15:54:27 +020052sed -i -e 's/"aaiHost":.*/"aaiHost": "'${AAI_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json
wejs060bc422018-05-25 13:58:11 +020053docker cp ${WORKDIR}/prh_endpoints.json prh:/config/
Mariusz Wagner60be36d2018-07-05 11:32:51 +020054docker start prh
wejs060bc422018-05-25 13:58:11 +020055
Mariusz Wagner60be36d2018-07-05 11:32:51 +020056# #Pass any variables required by Robot test suites in ROBOT_VARIABLES
57ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100"
Mariusz Wagnercfd26b92018-06-13 14:30:27 +020058
Mariusz Wagner60be36d2018-07-05 11:32:51 +020059pip install docker==2.7.0