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 | 26b89ec | 2018-06-19 09:52:01 +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 |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 15 | for i in {1..10}; do |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 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 |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 41 | for i in {1..10}; do |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 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 | |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 49 | docker stop prh |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 50 | docker cp prh:/config/prh_endpoints.json ${WORKDIR} |
| 51 | 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] | 52 | 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] | 53 | docker cp ${WORKDIR}/prh_endpoints.json prh:/config/ |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 54 | docker start prh |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 55 | |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 56 | # #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 57 | ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100" |
Mariusz Wagner | cfd26b9 | 2018-06-13 14:30:27 +0200 | [diff] [blame] | 58 | |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 59 | pip install docker==2.7.0 |