Fix bug in previous commit
Change-Id: I5a017c2cf1feb053f39a49dc5e4b7550627ae3fd
diff --git a/KNOWN_ISSSUES.md b/KNOWN_ISSSUES.md
new file mode 100644
index 0000000..e54fe04
--- /dev/null
+++ b/KNOWN_ISSSUES.md
@@ -0,0 +1,34 @@
+
+## `matching-onu-port-label-invalid` error
+This happens after olt is rebooted.
+
+```
+20190419T230010.719 ERROR MainThread openolt_data_model.__onu_ports_down {'onu_port_id': 'PON port', 'onu_ports': [port_no: 100
+label: "PON port"
+type: PON_ONU
+admin_state: DISABLED
+device_id: "0001f2c9e5b98ce4"
+peers {
+ device_id: "00010d5c85383648"
+ port_no: 16
+}
+, port_no: 16
+label: "uni-16"
+type: ETHERNET_UNI
+admin_state: DISABLED
+device_id: "0001f2c9e5b98ce4"
+], 'vcore_id': '0001', 'error': KeyError('key id=PON port not found',), 'instance_id': 'vcore-0_1555714355', 'olt_id': '00010d5c85383648', 'onu_id': '0001f2c9e5b98ce4', 'event': 'matching-onu-port-label-invalid'}
+20190419T230010.720 DEBUG MainThread openolt_data_model.__onu_ports_down {'instance_id': 'vcore-0_1555714355', 'vcore_id': '0001', 'event': 'onu-ports-down', 'onu_port': port_no: 16
+label: "uni-16"
+type: ETHERNET_UNI
+admin_state: DISABLED
+device_id: "0001f2c9e5b98ce4"
+}
+```
+
+## `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'}
+```
diff --git a/voltha/adapters/openolt/openolt_data_model.py b/voltha/adapters/openolt/openolt_data_model.py
index 03db02a..8b30361 100644
--- a/voltha/adapters/openolt/openolt_data_model.py
+++ b/voltha/adapters/openolt/openolt_data_model.py
@@ -177,10 +177,23 @@
if onu_device:
self.log.debug("data_model onu update", intf_id=intf_id,
- onu_id=onu_id, serial_number=serial_number)
- if onu_device.oper_status == OperStatus.ACTIVATING \
- or onu_device.oper_status == OperStatus.DISCOVERED:
+ onu_id=onu_id, serial_number=serial_number,
+ oper_state=onu_device.oper_status)
+ if onu_device.oper_status == OperStatus.UNKNOWN:
+ # olt reboot
+ self.log.debug("onu active or activating", intf_id=intf_id,
+ onu_id=onu_id, serial_number=serial_number,
+ oper_state=onu_device.oper_status)
+ onu_device.oper_status = OperStatus.DISCOVERED
+ onu_device.connect_status = ConnectStatus.REACHABLE
+ self.adapter_agent.update_device(onu_device)
+ else:
+ # onu activating
+ self.log.debug("onu active or activating", intf_id=intf_id,
+ onu_id=onu_id, serial_number=serial_number,
+ oper_state=onu_device.oper_status)
raise ValueError
+ return
self.log.debug("data_model onu create", intf_id=intf_id,
onu_id=onu_id, serial_number=serial_number)