wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | |
| 3 | source ${SCRIPTS}/common_functions.sh |
| 4 | |
| 5 | export PRH_SERVICE="prh" |
| 6 | export DMAAP_SIMULATOR="dmaap_simulator" |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 7 | export AAI_SIMULATOR="aai_simulator" |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 8 | |
Mariusz Wagner | df3a25a | 2018-05-28 10:05:08 +0200 | [diff] [blame] | 9 | cd ${WORKSPACE}/test/csit/tests/dcaegen2/prh_testcases/resources/ |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 10 | |
| 11 | docker login -u docker -p docker nexus3.onap.org:10003 |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 12 | docker-compose up -d --build |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 13 | |
| 14 | # Wait for initialization of Docker containers |
| 15 | for i in {1..50}; do |
| 16 | if [ $(docker inspect --format '{{ .State.Running }}' ${PRH_SERVICE}) ] && \ |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 17 | [ $(docker inspect --format '{{ .State.Running }}' ${DMAAP_SIMULATOR}) ] && \ |
| 18 | [ $(docker inspect --format '{{ .State.Running }}' ${AAI_SIMULATOR}) ] |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 19 | then |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 20 | echo "dmaap_simulator, aai_simulator and prh services are running" |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 21 | break |
| 22 | else |
| 23 | echo sleep ${i} |
| 24 | sleep ${i} |
| 25 | fi |
| 26 | done |
| 27 | |
| 28 | PRH_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${PRH_SERVICE}) |
| 29 | DMAAP_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${DMAAP_SIMULATOR}) |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 30 | AAI_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${AAI_SIMULATOR}) |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 31 | |
| 32 | bypass_ip_adress ${PRH_IP} |
| 33 | bypass_ip_adress ${DMAAP_SIMULATOR_IP} |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 34 | bypass_ip_adress ${AAI_SIMULATOR_IP} |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 35 | |
| 36 | echo PRH_IP=${PRH_IP} |
| 37 | echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP} |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 38 | echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP} |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 39 | |
| 40 | # Wait for initialization of docker services |
| 41 | for i in {1..50}; do |
| 42 | curl -sS -m 1 localhost:2222 && \ |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 43 | curl -sS -m 1 localhost:3333 && \ |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 44 | curl -sS -m 1 localhost:8100/heartbeat && break |
| 45 | echo sleep ${i} |
| 46 | sleep ${i} |
| 47 | done |
| 48 | |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 49 | docker cp prh:/config/prh_endpoints.json ${WORKDIR} |
| 50 | sed -i -e 's/"dmaapHostName":.*/"dmaapHostName": "'${DMAAP_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 51 | sed -i -e 's/"aaiHost":.*/"aaiHost": "'${AAI_SIMULATOR_IP}'",/g' ${WORKDIR}/prh_endpoints.json |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 52 | docker cp ${WORKDIR}/prh_endpoints.json prh:/config/ |
| 53 | |
| 54 | #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame^] | 55 | ROBOT_VARIABLES="-v DMAAP_SIMULATOR:localhost:2222 -v AAI_SIMULATOR:localhost:3333 -v PRH:localhost:8100" |