[3200] fix for stability issue in ofagent connection manager
Change-Id: I8993eaafb7363fa9433c55b4cdec0c93450472d8
diff --git a/ofagent/connection_mgr.py b/ofagent/connection_mgr.py
index 9ccf115..11bc0c0 100644
--- a/ofagent/connection_mgr.py
+++ b/ofagent/connection_mgr.py
@@ -24,6 +24,8 @@
from common.utils.consulhelpers import get_endpoint_from_consul
from structlog import get_logger
import grpc
+from grpc import StatusCode
+from grpc._channel import _Rendezvous
from ofagent.protos import third_party
from protos import voltha_pb2
from grpc_client import GrpcClient
@@ -131,6 +133,10 @@
device.datapath_id))
returnValue(devices)
+ except _Rendezvous, e:
+ if e.code() == StatusCode.UNAVAILABLE:
+ os.system("kill -15 {}".format(os.getpid()))
+
except Exception as e:
log.error('Failure to retrieve devices from '
'voltha: {}'.format(repr(e)))