openolt_grpc sends olt indication on kafka on loosing grpc connection
Change-Id: I1b6691656491ac3da091c518c5135de44998ea08
diff --git a/KNOWN_ISSSUES.md b/KNOWN_ISSSUES.md
index e54fe04..be0c54a 100644
--- a/KNOWN_ISSSUES.md
+++ b/KNOWN_ISSSUES.md
@@ -1,5 +1,5 @@
-## `matching-onu-port-label-invalid` error
+### `matching-onu-port-label-invalid` error
This happens after olt is rebooted.
```
@@ -26,9 +26,13 @@
}
```
-## `rx-in-invalid-state` error message in mib_sync.on_set_response
+### `rx-in-invalid-state` error message in mib_sync.on_set_response
This happens after olt is rebooted.
```
64988 20190419T230147.166 ERROR MainThread mib_sync.on_set_response {'instance_id': 'vcore-0_1555714355', 'vcore_id': '0001', ' state': 'uploading', 'event': 'rx-in-invalid-state', 'device_id': '0001f9e07f8ee9e3'}
```
+
+### Eapol flow not added after olt reboot
+
+20190419T234544.680 DEBUG MainThread openolt_flow_mgr.add_eapol_flow {'instance_id': 'vcore-0_1555716854', 'ip': '10.90.0.122:9191', 'event': 'flow-exists--not-re-adding', 'vcore_id': '0001'}
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 343f128..356d0dc 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -172,6 +172,7 @@
def post_down(self, event):
self.log.debug('post_down')
self.flow_mgr.reset_flows()
+ self.go_state_init()
def olt_indication(self, olt_indication):
if olt_indication.oper_state == "up":
diff --git a/voltha/adapters/openolt/openolt_grpc.py b/voltha/adapters/openolt/openolt_grpc.py
index f04fa70..52f5f06 100644
--- a/voltha/adapters/openolt/openolt_grpc.py
+++ b/voltha/adapters/openolt/openolt_grpc.py
@@ -17,7 +17,6 @@
import structlog
import grpc
import threading
-from twisted.internet import reactor
from voltha.northbound.kafka.kafka_proxy import kafka_send_pb
from voltha.adapters.openolt.protos import openolt_pb2_grpc, openolt_pb2
@@ -54,14 +53,18 @@
self.indications = self.stub.EnableIndication(openolt_pb2.Empty())
+ topic = 'openolt.ind-{}'.format(
+ self.device.host_and_port.split(':')[0])
+
while True:
try:
# get the next indication from olt
ind = next(self.indications)
except Exception as e:
self.log.warn('openolt grpc connection lost', error=e)
- reactor.callFromThread(self.device.go_state_down)
- reactor.callFromThread(self.device.go_state_init)
+ ind = openolt_pb2.Indication()
+ ind.olt_ind.oper_state = 'down'
+ kafka_send_pb(topic, ind)
break
else:
self.log.debug("openolt grpc rx indication", indication=ind)