blob: 84f93599a033ff34530104f53fdc5a020dc6a2cb [file] [log] [blame]
Zsolt Harasztie060a7d2016-09-16 11:08:24 -07001# sourcing this file is needed to make local development and integration testing work
Nathan Knuthedc88da2016-09-17 00:28:05 -07002export VOLTHA_BASE=$PWD
Zsolt Harasztie060a7d2016-09-16 11:08:24 -07003
Zsolt Haraszti41612482016-09-21 12:26:20 -07004# load local python virtualenv if exists, otherwise create it
5VENVDIR="venv-$(uname -s | tr '[:upper:]' '[:lower:]')"
6if [ ! -e "$VENVDIR/.built" ]; then
7 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
8 echo "Initializing OS-appropriate virtual env."
9 echo "This will take a few minutes."
10 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
11 make venv
12fi
13. $VENVDIR/bin/activate
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070014
Zsolt Harasztieb435072016-09-23 17:10:49 -070015# add top-level voltha dir to pythonpath
Zsolt Haraszti5cd64702016-09-27 13:48:35 -070016export PYTHONPATH=$PYTHONPATH:$VOLTHA_BASE/voltha:$VOLTHA_BASE/voltha/protos/third_party
Zsolt Harasztieb435072016-09-23 17:10:49 -070017
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070018# assign DOCKER_HOST_IP to be the main ip address of this host
19export DOCKER_HOST_IP=$(python voltha/nethelpers.py)
20
Zsolt Haraszti61732d42016-09-16 15:06:30 -070021# to avoid permission issues, create a dir for fluentd logs
Zsolt Haraszticfd15e52016-09-22 23:18:17 -070022# of if it exists make sure we can write to it
Zsolt Haraszti61732d42016-09-16 15:06:30 -070023mkdir -p /tmp/fluentd
Zsolt Haraszticfd15e52016-09-22 23:18:17 -070024if ! touch /tmp/fluentd/.check_write_permission; then
25 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
26 echo "You don't have write privileges for the log directory"
27 echo "/tmp/fluentd. This will cause issues when running the"
28 echo "fluentd container with docker-compose. We suggest you"
29 echo "fox your write permission before proceeding."
30 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
31else
32 rm -f /tmp/fluentd/.check_write_permission
33fi
Zsolt Haraszti61732d42016-09-16 15:06:30 -070034