Major rework of gRPC handling (do not merge yet)

Includes the following chages:

* Refactored proto files
  - separation of logical devices vs devices
  - common flow related message types moved to openflow_13
  - most RPC is defined in voltha.proto now
* Expanded RPC definitions to cover now most of what we
  need (a few device provisioning RPCs are still missing)
* Reworked RPC handlers to work with new config tree
* Implemented test cases for all existing RPCs, tested via
  chameleon's REST service
* Did away wih the OrderedDict internal representation
  in the config nodes (3x performance boost on bulk
  add, and negligible penalty in other ops)
* Refactored transacton merge handling to align with
  new structures

Change-Id: I3740ec13b8296943b307782e86e6b596af78140e
diff --git a/grpc_client/grpc_client.py b/grpc_client/grpc_client.py
index 36618be..74933cd 100644
--- a/grpc_client/grpc_client.py
+++ b/grpc_client/grpc_client.py
@@ -30,7 +30,7 @@
 from grpc._channel import _Rendezvous
 from structlog import get_logger
 from twisted.internet import reactor
-from twisted.internet.defer import inlineCallbacks
+from twisted.internet.defer import inlineCallbacks, returnValue
 from werkzeug.exceptions import ServiceUnavailable
 
 from common.utils.asleep import asleep
@@ -251,7 +251,8 @@
             log.debug('test-import', modname=modname)
             _ = __import__(modname)
 
-    def invoke(self, stub, method_name, request):
+    @inlineCallbacks
+    def invoke(self, stub, method_name, request, retry=1):
         """
         Invoke a gRPC call to the remote server and return the response.
         :param stub: Reference to the *_pb2 service stub
@@ -265,16 +266,22 @@
 
         try:
             response = getattr(stub(self.channel), method_name)(request)
-            return response
+            returnValue(response)
 
         except grpc._channel._Rendezvous, e:
             if e.code() == grpc.StatusCode.UNAVAILABLE:
                 e = ServiceUnavailable()
+
+                if self.connected:
+                    self.connected = False
+                    yield self.connect()
+                    if retry > 0:
+                        response = yield self.invoke(stub, method_name,
+                                                     request,
+                                                     retry=retry - 1)
+                        returnValue(response)
+
             else:
                 log.exception(e)
 
-            if self.connected :
-                self.connected = False
-                reactor.callLater(0, self.connect)
-
             raise e