Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 1 | # 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 Haraszti | e060a7d | 2016-09-16 11:08:24 -0700 | [diff] [blame] | 14 | # sourcing this file is needed to make local development and integration testing work |
Nathan Knuth | edc88da | 2016-09-17 00:28:05 -0700 | [diff] [blame] | 15 | export VOLTHA_BASE=$PWD |
Zsolt Haraszti | e060a7d | 2016-09-16 11:08:24 -0700 | [diff] [blame] | 16 | |
Zsolt Haraszti | 4161248 | 2016-09-21 12:26:20 -0700 | [diff] [blame] | 17 | # load local python virtualenv if exists, otherwise create it |
| 18 | VENVDIR="venv-$(uname -s | tr '[:upper:]' '[:lower:]')" |
| 19 | if [ ! -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 |
| 25 | fi |
| 26 | . $VENVDIR/bin/activate |
Zsolt Haraszti | e060a7d | 2016-09-16 11:08:24 -0700 | [diff] [blame] | 27 | |
Zsolt Haraszti | eb43507 | 2016-09-23 17:10:49 -0700 | [diff] [blame] | 28 | # add top-level voltha dir to pythonpath |
Zsolt Haraszti | 89a2730 | 2016-12-08 16:53:06 -0800 | [diff] [blame] | 29 | export PYTHONPATH=$VOLTHA_BASE/$VENVDIR/lib/python2.7/site-packages:$PYTHONPATH:$VOLTHA_BASE:$VOLTHA_BASE/voltha/protos/third_party |
Zsolt Haraszti | eb43507 | 2016-09-23 17:10:49 -0700 | [diff] [blame] | 30 | |
Zsolt Haraszti | e060a7d | 2016-09-16 11:08:24 -0700 | [diff] [blame] | 31 | # assign DOCKER_HOST_IP to be the main ip address of this host |
Zsolt Haraszti | 023ea7c | 2016-10-16 19:30:34 -0700 | [diff] [blame] | 32 | export DOCKER_HOST_IP=$(python common/utils/nethelpers.py) |
Zsolt Haraszti | e060a7d | 2016-09-16 11:08:24 -0700 | [diff] [blame] | 33 | |
Zsolt Haraszti | 61732d4 | 2016-09-16 15:06:30 -0700 | [diff] [blame] | 34 | # to avoid permission issues, create a dir for fluentd logs |
Zsolt Haraszti | cfd15e5 | 2016-09-22 23:18:17 -0700 | [diff] [blame] | 35 | # of if it exists make sure we can write to it |
Zsolt Haraszti | 61732d4 | 2016-09-16 15:06:30 -0700 | [diff] [blame] | 36 | mkdir -p /tmp/fluentd |
Zsolt Haraszti | cfd15e5 | 2016-09-22 23:18:17 -0700 | [diff] [blame] | 37 | if ! 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 "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~" |
| 44 | else |
| 45 | rm -f /tmp/fluentd/.check_write_permission |
| 46 | fi |
Zsolt Haraszti | 61732d4 | 2016-09-16 15:06:30 -0700 | [diff] [blame] | 47 | |