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 | |
Mariusz Wagner | 3cbe547 | 2018-07-30 14:19:50 +0200 | [diff] [blame] | 11 | docker login -u docker -p docker nexus3.onap.org:10001 |
Mariusz Wagner | 7a1e0c8 | 2018-07-31 09:32:05 +0200 | [diff] [blame^] | 12 | pip uninstall -y docker-py |
| 13 | pip uninstall -y docker |
| 14 | pip install -U docker |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame] | 15 | docker-compose up -d --build |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 16 | |
| 17 | # Wait for initialization of Docker containers |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 18 | for i in {1..10}; do |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 19 | if [ $(docker inspect --format '{{ .State.Running }}' ${PRH_SERVICE}) ] && \ |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame] | 20 | [ $(docker inspect --format '{{ .State.Running }}' ${DMAAP_SIMULATOR}) ] && \ |
| 21 | [ $(docker inspect --format '{{ .State.Running }}' ${AAI_SIMULATOR}) ] |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 22 | then |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame] | 23 | echo "dmaap_simulator, aai_simulator and prh services are running" |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 24 | break |
| 25 | else |
| 26 | echo sleep ${i} |
| 27 | sleep ${i} |
| 28 | fi |
| 29 | done |
| 30 | |
| 31 | PRH_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${PRH_SERVICE}) |
| 32 | 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] | 33 | AAI_SIMULATOR_IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ${AAI_SIMULATOR}) |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 34 | |
| 35 | bypass_ip_adress ${PRH_IP} |
| 36 | bypass_ip_adress ${DMAAP_SIMULATOR_IP} |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame] | 37 | bypass_ip_adress ${AAI_SIMULATOR_IP} |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 38 | |
| 39 | echo PRH_IP=${PRH_IP} |
| 40 | echo DMAAP_SIMULATOR_IP=${DMAAP_SIMULATOR_IP} |
Mariusz Wagner | 4a6ece4 | 2018-06-05 15:54:27 +0200 | [diff] [blame] | 41 | echo AAI_SIMULATOR_IP=${AAI_SIMULATOR_IP} |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 42 | |
Mariusz Wagner | 7a1e0c8 | 2018-07-31 09:32:05 +0200 | [diff] [blame^] | 43 | # Wait for initialization of PRH services |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 44 | for i in {1..10}; do |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 45 | curl -sS -m 1 localhost:8100/heartbeat && break |
| 46 | echo sleep ${i} |
| 47 | sleep ${i} |
| 48 | done |
| 49 | |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 50 | docker stop prh |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 51 | docker cp prh:/config/prh_endpoints.json ${WORKDIR} |
| 52 | 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] | 53 | 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] | 54 | docker cp ${WORKDIR}/prh_endpoints.json prh:/config/ |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 55 | docker start prh |
wejs | 060bc42 | 2018-05-25 13:58:11 +0200 | [diff] [blame] | 56 | |
Mariusz Wagner | 60be36d | 2018-07-05 11:32:51 +0200 | [diff] [blame] | 57 | # #Pass any variables required by Robot test suites in ROBOT_VARIABLES |
| 58 | ROBOT_VARIABLES="-v DMAAP_SIMULATOR:${DMAAP_SIMULATOR_IP}:2222 -v AAI_SIMULATOR:${AAI_SIMULATOR_IP}:3333 -v PRH:${PRH_IP}:8100" |