Merge branch 'master' of bitbucket.org:corddesign/voltha
diff --git a/compose/TODOS.md b/compose/TODOS.md
index 46ce3cb..a47e6ac 100644
--- a/compose/TODOS.md
+++ b/compose/TODOS.md
@@ -1,4 +1,4 @@
-= Next Steps Planned
+## Next Steps Planned
 
 - [Z] Adding health-check to voltha (and consul)
 - [Z] Adding membership tracking
@@ -25,12 +25,12 @@
 - Mock adapter
 
 
-= Next hackaton
+## Next hackaton
 
 - [?] Flash out internal APIs
 
 
-= Architectural questions
+## Architectural questions
 
 - Place a set of internal queues between the layers, or just use
   direct Twisted async calls
diff --git a/compose/docker-compose-system-test.yml b/compose/docker-compose-system-test.yml
index 1f4f745..d06aea3 100644
--- a/compose/docker-compose-system-test.yml
+++ b/compose/docker-compose-system-test.yml
@@ -11,12 +11,17 @@
     - "8400:8400"
     - "8500:8500"
     - "8600:53/udp"
+    environment:
+      SERVICE_53_IGNORE: "yes"
+      SERVICE_8300_IGNORE: "yes"
+      SERVICE_8400_IGNORE: "yes"
+      SERVICE_8500_NAME: "consul-rest"
   #
   # Registrator
   #
   registrator:
     image: gliderlabs/registrator:latest
-    command: -ip=10.0.2.15 -retry-attempts 100 consul://consul:8500
+    command: -ip=10.0.2.15 -retry-attempts 100 -internal consul://consul:8500
     links:
     - consul
     volumes:
@@ -35,12 +40,25 @@
   #
   voltha:
     image: cord/voltha
-    command: /voltha/main.py -v --consul=consul:8500 --fluentd=fluentd:24224
+    command: [
+      "/voltha/main.py",
+      "-v",
+      "--consul=consul:8500",
+      "--fluentd=fluentd:24224",
+      "--rest-port=8880"
+    ]
+    ports:
+    - 8880
     depends_on:
     - consul
     links:
     - consul
     - fluentd
+    environment:
+      SERVICE_8880_NAME: "voltha-rest"
+      SERVICE_8880_CHECK_HTTP: "/health"
+      SERVICE_8880_CHECK_INTERVAL: "5s"
+      SERVICE_8880_CHECK_TIMEOUT: "1s"
   #
   # Test container to see services available
   #
diff --git a/voltha/nethelpers.py b/voltha/nethelpers.py
new file mode 100644
index 0000000..09f73c1
--- /dev/null
+++ b/voltha/nethelpers.py
@@ -0,0 +1,41 @@
+#
+# 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.
+#
+
+"""
+Some network related convenience functions
+"""
+
+from netifaces import AF_INET
+
+import netifaces as ni
+
+
+def get_my_primary_interface():
+    gateways = ni.gateways()
+    assert 'default' in gateways, \
+           "No default gateway on host/container, cannot determine primary interface"
+    default_gw_index = gateways['default'].keys()[0]
+    # gateways[default_gw_index] has the format (example):
+    # [('10.15.32.1', 'en0', True)]
+    interface_name = gateways[default_gw_index][0][1]
+    return interface_name
+
+
+def get_my_primary_local_ipv4(iface_name=None):
+    iface_name = get_my_primary_interface() if iface_name is None else iface_name
+    addresses = ni.ifaddresses(iface_name)
+    ipv4 = addresses[AF_INET][0]['addr']
+    return ipv4