Build steps explained
diff --git a/BUILD.md b/BUILD.md
new file mode 100644
index 0000000..5c38717
--- /dev/null
+++ b/BUILD.md
@@ -0,0 +1,100 @@
+# How to Build and Develop Voltha
+
+There are many ways to build and develop Voltha:
+
+* Use the provided Vagrant environment. This mode is by far the most reliable, and the only one officially supported.
+* Use your native MAC OS or Linux environments. These are not supported, although we provide guidance in a best effort manner and contributions/patches are graciously accepted from the community.
+
+## Build and Develop on the Vagrant Box
+
+### Prerequisites
+
+* Git client
+* Working installation of Vagrant
+
+### Build
+
+```
+git clone git@bitbucket.org:corddesign/voltha.git
+cd voltha
+make vagrant
+vagrant ssh # the rest to be executed inside the vagrant VM
+cd /voltha
+make
+```
+
+The above has generated a new Docker image '''cord/voltha''' inside the VM:
+
+```
+docker images
+```
+
+### Run in stand-alone (solo) mode
+
+The simplest way to run the image (in the foreground):
+
+```
+docker run -ti cord/voltha
+```
+
+## Building natively on MAC OS X
+
+For advanced developers this may provide a more comfortable developer
+environment (e.g., by allowing IDE-assisted debugging), but setting it up
+can be a bit more challenging.
+
+### Prerequisites
+
+* git installed
+* Docker-for-Mac installed
+* Python 2.7
+* virtualenv
+* brew (or macports if you prefer)
+
+### Installing Voltha dependencies
+
+The steps that may work (see list of workarounds in case it does not):
+
+```
+git clone git@bitbucket.org:corddesign/voltha.git
+cd voltha
+make venv
+```
+
+Potential issues and workaround:
+
+1. Missing virtualenv binary. Resolution: install virtualenv.
+
+ ```
+ brew install pyenv-virtualenv
+ ```
+
+1. 'make venv' exits with error 'openssl/opensslv.h': file not found.
+ Resolution: install openssl-dev and add a CFLAGS to make venv:
+
+ ```
+ brew install openssl
+ ```
+
+ Note the version that it installed. For example, '1.0.2h_1'.
+ Rerun ```make venv``` as:
+
+ ```
+ env CFLAGS="-I /usr/local/Cellar/openssl/1.0.2h_1/include" make venv
+ ```
+
+### Building Docker Images and Running Voltha
+
+These steps are not different from the Vagrant path:
+
+```
+make
+```
+
+Then you shall be able to see the created image and run the container:
+
+```
+docker run -ti cord/voltha
+```
+
+
diff --git a/Dockerfile b/Dockerfile
index eb55b2f..11b2251 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,5 +1,26 @@
+#!/usr/bin/env python
+#
+# Copyright 2016 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
FROM alpine:3.1
+MAINTAINER Zsolt Haraszti <zharaszt@ciena.com>
+MAINTAINER Ali Al-Shabibi <ali.al-shabibi@onlab.us>
+MAINTAINER Nathan Knuth <nathan.knuth@tibitcom.com>
+
# Update to have latest images
RUN apk add --update python py-pip
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..7759355
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,44 @@
+#
+# Copyright 2016 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+VENVDIR := venv
+
+.PHONY: venv
+
+default: build
+
+help:
+ @echo "Usage: make [<target>]"
+ @echo "where available targets are:"
+ @echo
+ @echo "build : Build the Voltha docker image (default target)"
+ @echo "fetch : Pre-fetch artifacts for subsequent local builds"
+ @echo "help : Print this help"
+ @echo "venv : Rebuild local Python virtualenv from scratch"
+ @echo
+
+venv:
+ rm -fr ${VENVDIR}
+ @virtualenv ${VENVDIR}
+ @. ${VENVDIR}/bin/activate && \
+ if ! pip install -r requirements.txt; \
+ then \
+ echo "On MAC OS X, if the installation failed with an error \n'<openssl/opensslv.h>': file not found,"; \
+ echo "see the BUILD.md file for a workaround"; \
+ fi
+
+
+
diff --git a/requirements.txt b/requirements.txt
index 720b413..d3f010f 100755
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,4 +1,3 @@
-requests
argparse==1.2.1
colorama>=0.2.5
decorator>=3.4.0
@@ -10,7 +9,9 @@
pyflakes>=1.0.0
pylint>=1.5.2
pyOpenSSL>=0.13
+python-consul>=0.6.1
PyYAML>=3.10
+requests
scapy>=2.3.2
simplejson>=3.8.1
six>=1.10.0
diff --git a/voltha/voltha.py b/voltha/voltha.py
index a2edbef..1036efe 100755
--- a/voltha/voltha.py
+++ b/voltha/voltha.py
@@ -1,34 +1,47 @@
#!/usr/bin/env python
-#--------------------------------------------------------------------------#
-# Copyright (C) 2016 by Zsolt Haraszti, Nathan Knuth, and Ali Al-Shabibi #
-# All rights reserved. #
-# #
-# _ ______ __ ________ _____ #
-# | | / / __ \/ / /_ __/ / / / | #
-# | | / / / / / / / / / /_/ / /| | #
-# | |/ / /_/ / /___/ / / __ / ___ | #
-# |___/\____/_____/_/ /_/ /_/_/ |_| #
-# #
-#--------------------------------------------------------------------------#
-# PROPRIETARY NOTICE #
-# This Software consists of confidential information. #
-# Trade secret law and copyright law protect this Software. #
-# The above notice of copyright on this Software does not indicate #
-# any actual or intended publication of such Software. #
-#--------------------------------------------------------------------------#
+#
+# Copyright 2016 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
""" virtual OLT Hardware Abstraction """
import argparse
+def parse_args():
+
+ parser = argparse.ArgumentParser()
+ parser.add_argument('-i', '--interface', dest='interface', action='store', default='eth0',
+ help='ETH interface to send (default: eth0)')
+ parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
+ help='verbose print out')
+
+ return parser.parse_args()
+
+
def main():
- if (args.verbose):
+
+ args = parse_args()
+
+ if args.verbose:
vType = '*verbose*'
vHint = ''
else:
vType = '*regular*'
vHint = '(hint: try --verbose)'
-
+
print 'Hello, I am {} VOLTHA {}'.format(vType, vHint)
print ' _ ______ __ ________ _____ '
print '| | / / __ \/ / /_ __/ / / / |'
@@ -37,14 +50,6 @@
print '|___/\____/_____/_/ /_/ /_/_/ |_|'
print ''
+
if __name__ == '__main__':
- parser = argparse.ArgumentParser()
- parser.add_argument('-i', '--interface', dest='interface', action='store', default='eth0',
- help='ETH interface to send (default: eth0)')
- parser.add_argument('-v', '--verbose', dest='verbose', action='store_true', default=False,
- help='verbose print out')
-
- args = parser.parse_args()
-
main()
-