6f72521af661f4368b4e0506da608e733523571b
[integration/csit.git] / plans / dcaegen2-collectors-hv-ves / testsuites / setup.sh
1 #!/usr/bin/env bash
2
3 set -euo pipefail
4
5 if [[ $# -eq 1 ]] && [[ $1 == "local-test-run" ]]; then
6   echo "Building locally - assuming all dependencies are installed"
7   export DOCKER_REGISTRY=""
8   export DOCKER_REGISTRY_PREFIX=""
9   export WORKSPACE=$(git rev-parse --show-toplevel)
10 else
11   echo "Default run - install all dependencies"
12
13   pip uninstall -y docker-py
14   pip install docker
15
16   COMPOSE_VERSION=1.22.0
17   COMPOSE_LOCATION='/usr/local/bin/docker-compose'
18   sudo curl -L https://github.com/docker/compose/releases/download/${COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m) -o ${COMPOSE_LOCATION}
19   sudo chmod +x ${COMPOSE_LOCATION}
20
21   export DOCKER_REGISTRY="nexus3.onap.org:10001"
22   export DOCKER_REGISTRY_PREFIX="${DOCKER_REGISTRY}/"
23 fi
24
25 echo "Removing not used docker networks"
26 docker network prune -f
27
28 export CONTAINERS_NETWORK=ves-hv-default
29 echo "Creating network for containers: ${CONTAINERS_NETWORK}"
30 docker network create ${CONTAINERS_NETWORK}
31
32 cd ssl
33 ./gen-certs.sh
34 cd ..
35
36 docker-compose up -d
37
38 mkdir -p ${WORKSPACE}/archives/containers_logs
39
40 export ROBOT_VARIABLES="--pythonpath ${WORKSPACE}/test/csit/tests/dcaegen2-collectors-hv-ves/testcases/libraries"