Health check server in the works
diff --git a/compose/TODOS.md b/compose/TODOS.md
index e69de29..46ce3cb 100644
--- a/compose/TODOS.md
+++ b/compose/TODOS.md
@@ -0,0 +1,42 @@
+= Next Steps Planned
+
+- [Z] Adding health-check to voltha (and consul)
+- [Z] Adding membership tracking
+- [Z] Adding leader election
+- [Z] Work out a load sharding mechanism
+
+- [N] Add flake8 support (make or part of build)
+- [N] Coverage support and have coverage report hooked up to make
+
+- [Z] Add documentation for the existing docker-compose based system
+- [?] Add system test for the above
+
+- [N] Move in the openflow (lexi) code base
+- [N] Move in the EOAM and/or Tibit TAL
+- [N] Decide where olt-oftest should live: keep as external package
+      or replicate
+
+- [N] make system-test:
+  - fire up a docker ensable using docker-compose
+  - optionally configure network access to device(s)
+  - make sure olt-ofagent test code is available
+  - execute relevant test(s)
+
+- Mock adapter
+
+
+= Next hackaton
+
+- [?] Flash out internal APIs
+
+
+= Architectural questions
+
+- Place a set of internal queues between the layers, or just use
+  direct Twisted async calls
+- Primary data format for internal abstract API in/out data:
+  - Type-specific Python classes with self-contained schema enforcement
+  - "JSON data" == nested Python OrederDict; schema enforcement is
+    implemented in key points in the architecture
+
+
diff --git a/voltha/coordinator.py b/voltha/coordinator.py
index e893d96..1fa2b18 100644
--- a/voltha/coordinator.py
+++ b/voltha/coordinator.py
@@ -16,6 +16,13 @@
 
 """ Consul-based coordinator services """
 
+# TODO move this to the consul.twisted async client once it is available.
+# Note:
+# We use https://github.com/cablehead/python-consul for consul client. It's master
+# branch already provides support for Twisted, but the latest released version (0.6.1)
+# was cut before twisted support was added. So keep an eye on when 0.6.2 comes out and
+# move over to the twisted interface once it's available.
+
 from consul import Consul, ConsulException
 from requests import ConnectionError
 from structlog import get_logger
@@ -30,12 +37,18 @@
     CONNECT_RETRY_INTERVAL_SEC = 1
     RETRY_BACKOFF = [0.05, 0.1, 0.2, 0.5, 1, 2, 5]
 
-    def __init__(self, internal_host_address, external_host_address, instance_id, consul='localhost:8500'):
+    def __init__(self,
+                 internal_host_address,
+                 external_host_address,
+                 instance_id,
+                 rest_port,
+                 consul='localhost:8500'):
 
         self.retries = 0
         self.instance_id = instance_id
         self.internal_host_address = internal_host_address
         self.external_host_address = external_host_address
+        self.rest_port = rest_port
 
         self.log = get_logger()
         self.log.info('initializing-coordinator')
@@ -94,6 +107,7 @@
                 kw = dict(
                     name='voltha-%s' % self.instance_id,
                     address=self.internal_host_address,
+                    port=self.rest_port
                 )
                 self.consul.agent.service.register(**kw)
                 self.log.info('registered-with-consul', **kw)
diff --git a/voltha/main.py b/voltha/main.py
index 679dbb5..188e6aa 100755
--- a/voltha/main.py
+++ b/voltha/main.py
@@ -24,17 +24,18 @@
 
 from structlog_setup import setup_logging
 from coordinator import Coordinator
-from northbound.rest.healt_check import init_site
-
+from northbound.rest.health_check import init_rest_service
+from nethelpers import get_my_primary_interface, get_my_primary_local_ipv4
 
 defs = dict(
     consul=os.environ.get('CONSUL', 'localhost:8500'),
     instance_id=os.environ.get('INSTANCE_ID', os.environ.get('HOSTNAME', '1')),
     config=os.environ.get('CONFIG', './voltha.yml'),
-    interface=os.environ.get('INTERFACE', 'eth0'),
-    internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS', 'localhost'),
-    external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS', 'localhost'),
-    fluentd=os.environ.get('FLUENTD', None)
+    interface=os.environ.get('INTERFACE', get_my_primary_interface()),
+    internal_host_address=os.environ.get('INTERNAL_HOST_ADDRESS', get_my_primary_local_ipv4()),
+    external_host_address=os.environ.get('EXTERNAL_HOST_ADDRESS', get_my_primary_local_ipv4()),
+    fluentd=os.environ.get('FLUENTD', None),
+    rest_port=os.environ.get('REST_PORT', 8880),
 )
 
 
@@ -82,6 +83,10 @@
     parser.add_argument('-N', '--no-heartbeat', dest='no_heartbeat', action='store_true', default=False,
                         help='do not emit periodic heartbeat log messages')
 
+    parser.add_argument('-R', '--rest-port', dest='rest_port', action='store', type=int,
+                        default=defs['rest_port'],
+                        help='port number for the rest service (default: %d)' % defs['rest_port'])
+
     parser.add_argument('-q', '--quiet', dest='quiet', action='store_true', default=False,
                         help="suppress debug and info logs")
 
@@ -116,9 +121,10 @@
     coordinator = Coordinator(
         internal_host_address=args.internal_host_address,
         external_host_address=args.external_host_address,
+        rest_port=args.rest_port,
         instance_id=args.instance_id,
         consul=args.consul)
-    init_site()
+    init_rest_service(args.rest_port)
     log.info('started-internal-services')
 
 
diff --git a/voltha/northbound/rest/health_check.py b/voltha/northbound/rest/health_check.py
index bd54b9d..ea5bff9 100644
--- a/voltha/northbound/rest/health_check.py
+++ b/voltha/northbound/rest/health_check.py
@@ -36,7 +36,7 @@
         return Site(self.app.resource())
 
 
-def init_site():  # TODO need to be moved to a shared file across all resources
+def init_rest_service(port):  # TODO need to be moved to a shared file across all resources
     hc = HealthCheck()
-    endpoint = endpoints.TCP4ServerEndpoint(reactor, 8880)
+    endpoint = endpoints.TCP4ServerEndpoint(reactor, port)
     endpoint.listen(hc.get_site())