VOL-849: OpenOLT adapter changes in preperation for BAL 2.6

ONU indication in BAL 2.6 does not contain the serial number

Change-Id: I2c10eebf089646e197b7395849fc7d74d34a03c9
diff --git a/voltha/adapters/openolt/openolt_device.py b/voltha/adapters/openolt/openolt_device.py
index 8dfa42b..dea361e 100644
--- a/voltha/adapters/openolt/openolt_device.py
+++ b/voltha/adapters/openolt/openolt_device.py
@@ -320,30 +320,27 @@
                 self.log.warn('unexpected state', onu_id=onu_id, onu_device_oper_state=onu_device.oper_status)
 
     def onu_indication(self, onu_indication):
-        self.log.debug("onu-indication", intf_id=onu_indication.intf_id,
-                onu_id=onu_indication.onu_id, serial_number=onu_indication.serial_number,
-                    oper_state=onu_indication.oper_state, admin_state=onu_indication.admin_state)
+        self.log.debug("onu indication", intf_id=onu_indication.intf_id,
+                onu_id=onu_indication.onu_id,
+                serial_number=onu_indication.serial_number,
+                oper_state=onu_indication.oper_state,
+                admin_state=onu_indication.admin_state)
 
-        serial_number_str = self.stringify_serial_number(onu_indication.serial_number)
-
-        if serial_number_str == '000000000000':
-            self.log.debug('serial-number-was-not-provided-or-default-serial-number-provided-identifying-onu-by-onu_id')
-            #FIXME: if multiple PON ports onu_id is not a sufficient key
+        if onu_indication.serial_number:
             onu_device = self.adapter_agent.get_child_device(
-                self.device_id,
-                onu_id=onu_indication.onu_id)
+                    self.device_id,
+                    serial_number=self.stringify_serial_number(
+                            onu_indication.serial_number))
         else :
             onu_device = self.adapter_agent.get_child_device(
-                self.device_id,
-                serial_number=serial_number_str)
+                    self.device_id,
+                    parent_port_no=platform.intf_id_to_port_no(
+                            onu_indication.intf_id, Port.PON_OLT),
+                    onu_id=onu_indication.onu_id)
 
-        self.log.debug('onu-device', olt_device_id=self.device_id, device=onu_device)
-
-        # FIXME - handle serial_number mismatch
-        # assert key is not None
-        # assert onu_device is not None
         if onu_device is None:
-            self.log.warn('onu-device-is-none-invalid-message')
+            self.log.error('onu not found', intf_id=onu_indication.intf_id,
+                    onu_id=onu_indication.onu_id)
             return
 
         if onu_device.connect_status != ConnectStatus.REACHABLE:
@@ -363,7 +360,7 @@
                           received_onu_id=onu_indication.onu_id)
 
         uni_no = platform.mk_uni_port_num(onu_indication.intf_id, onu_indication.onu_id)
-        uni_name = self.port_name(uni_no, Port.ETHERNET_UNI, serial_number=serial_number_str)
+        uni_name = self.port_name(uni_no, Port.ETHERNET_UNI, serial_number=onu_device.serial_number)
 
         self.log.debug('port-number-ready', uni_no=uni_no, uni_name=uni_name)
 
@@ -839,4 +836,4 @@
 
         # Set all ports to enabled
         self.log.info('enabling-all-ports', device_id=self.device_id)
-        self.adapter_agent.enable_all_ports(self.device_id)
\ No newline at end of file
+        self.adapter_agent.enable_all_ports(self.device_id)