blob: 226ad08cdfc18c0b79ee8dd7851ef72158417539 [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070014# sourcing this file is needed to make local development and integration testing work
Nathan Knuthedc88da2016-09-17 00:28:05 -070015export VOLTHA_BASE=$PWD
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070016
Zsolt Haraszti41612482016-09-21 12:26:20 -070017# load local python virtualenv if exists, otherwise create it
18VENVDIR="venv-$(uname -s | tr '[:upper:]' '[:lower:]')"
19if [ ! -e "$VENVDIR/.built" ]; then
20 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
21 echo "Initializing OS-appropriate virtual env."
22 echo "This will take a few minutes."
23 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
24 make venv
25fi
26. $VENVDIR/bin/activate
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070027
Zsolt Harasztieb435072016-09-23 17:10:49 -070028# add top-level voltha dir to pythonpath
Zsolt Haraszti89a27302016-12-08 16:53:06 -080029export PYTHONPATH=$VOLTHA_BASE/$VENVDIR/lib/python2.7/site-packages:$PYTHONPATH:$VOLTHA_BASE:$VOLTHA_BASE/voltha/protos/third_party
Zsolt Harasztieb435072016-09-23 17:10:49 -070030
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070031# assign DOCKER_HOST_IP to be the main ip address of this host
Zsolt Haraszti023ea7c2016-10-16 19:30:34 -070032export DOCKER_HOST_IP=$(python common/utils/nethelpers.py)
Zsolt Harasztie060a7d2016-09-16 11:08:24 -070033
Zsolt Haraszti61732d42016-09-16 15:06:30 -070034# to avoid permission issues, create a dir for fluentd logs
Zsolt Haraszticfd15e52016-09-22 23:18:17 -070035# of if it exists make sure we can write to it
Zsolt Haraszti61732d42016-09-16 15:06:30 -070036mkdir -p /tmp/fluentd
Zsolt Haraszticfd15e52016-09-22 23:18:17 -070037if ! touch /tmp/fluentd/.check_write_permission; then
38 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
39 echo "You don't have write privileges for the log directory"
40 echo "/tmp/fluentd. This will cause issues when running the"
41 echo "fluentd container with docker-compose. We suggest you"
42 echo "fox your write permission before proceeding."
43 echo "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
44else
45 rm -f /tmp/fluentd/.check_write_permission
46fi
Zsolt Haraszti61732d42016-09-16 15:06:30 -070047