Move disable logic out of openolt_grpc into openolt_indications
Change-Id: Ib2c79a7bb0a6f6140501c325ef77d84f719ec364
diff --git a/voltha/adapters/openolt/openolt_grpc.py b/voltha/adapters/openolt/openolt_grpc.py
index e1299db..f04fa70 100644
--- a/voltha/adapters/openolt/openolt_grpc.py
+++ b/voltha/adapters/openolt/openolt_grpc.py
@@ -66,18 +66,6 @@
else:
self.log.debug("openolt grpc rx indication", indication=ind)
- if self.device.admin_state is "down":
- if ind.HasField('intf_oper_ind') \
- and (ind.intf_oper_ind.type == "nni"):
- self.log.warn('olt is admin down, allow nni ind',
- admin_state=self.device.admin_state,
- indications=ind)
- else:
- self.log.warn('olt is admin down, ignore indication',
- admin_state=self.admin_state,
- indications=ind)
- continue
-
topic = 'openolt.ind-{}'.format(
self.device.host_and_port.split(':')[0])
kafka_send_pb(topic, ind)
diff --git a/voltha/adapters/openolt/openolt_indications.py b/voltha/adapters/openolt/openolt_indications.py
index 4873984..75f905d 100644
--- a/voltha/adapters/openolt/openolt_indications.py
+++ b/voltha/adapters/openolt/openolt_indications.py
@@ -54,6 +54,18 @@
self.log.debug("received openolt indication", ind=ind)
+ if self.device.admin_state is "down":
+ if ind.HasField('intf_oper_ind') \
+ and (ind.intf_oper_ind.type == "nni"):
+ self.log.warn('olt is admin down, allow nni ind',
+ admin_state=self.device.admin_state,
+ indications=ind)
+ else:
+ self.log.warn('olt is admin down, ignore indication',
+ admin_state=self.device.admin_state,
+ indications=ind)
+ return
+
# indication handlers run in the main event loop
if ind.HasField('olt_ind'):
reactor.callFromThread(self.device.olt_indication, ind.olt_ind)