diff --git a/voltha/adapters/openolt/openolt_data_model.py b/voltha/adapters/openolt/openolt_data_model.py
index 5bad88d..e232a69 100644
--- a/voltha/adapters/openolt/openolt_data_model.py
+++ b/voltha/adapters/openolt/openolt_data_model.py
@@ -17,7 +17,6 @@
 import structlog
 import socket
 from scapy.layers.l2 import Ether
-import voltha.core.flow_decomposer as fd
 from voltha.adapters.openolt.openolt_utils import OpenoltUtils
 from voltha.protos.device_pb2 import Port, Device
 from voltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, \
@@ -166,15 +165,8 @@
     def olt_nni_intf_id(self):
         if self.nni_intf_id is not None:
             return self.nni_intf_id
-
-        port_list = self.adapter_agent.get_ports(self.device.id,
-                                                 Port.ETHERNET_NNI)
-        logical_port = self.adapter_agent.get_logical_port(
-            self.logical_device_id, port_list[0].label)
-        self.nni_intf_id = self.platform.intf_id_from_nni_port_num(
-            logical_port.ofp_port.port_no)
-        self.log.debug("nni-intf-d ", nni_intf_id=self.nni_intf_id)
-        return self.nni_intf_id
+        else:
+            raise ValueError
 
     def onu_create(self, intf_id, onu_id, serial_number):
         onu_device = self.adapter_agent.get_child_device(
@@ -223,11 +215,6 @@
         except Exception as e:
             self.log.error('adapter_agent error', error=e)
 
-        ofp_port_name = self.__get_uni_ofp_port_name(onu_device)
-        if ofp_port_name is None:
-            self.log.exception("uni-ofp-port-not-found")
-            return
-
         try:
             self.__delete_logical_port(onu_device)
         except Exception as e:
@@ -407,67 +394,6 @@
         self._onu_gemport_ids[gem] = onu_info
 
     # #######################################################################
-    # Flow decomposer utility functions
-    #
-    # Flow related functions that are used by the OpenOLT flow decomposer.
-    # These are all prefixed with _ to denote that they will likely be removed
-    # once OpenOLT adapter transitions back to using core's flow decomposer.
-    # #######################################################################
-
-    def _flow_extract_info(self, flow, flow_direction):
-        uni_port_no = None
-        child_device_id = None
-        if flow_direction == "upstream":
-            for field in fd.get_ofb_fields(flow):
-                if field.type == fd.IN_PORT:
-                    is_uni, child_device_id = self.__is_uni_port(field.port)
-                    if is_uni:
-                        uni_port_no = field.port
-        elif flow_direction == "downstream":
-            for field in fd.get_ofb_fields(flow):
-                if field.type == fd.METADATA:
-                    uni_port = field.table_metadata & 0xFFFFFFFF
-                    is_uni, child_device_id = self.__is_uni_port(uni_port)
-                    if is_uni:
-                        uni_port_no = field.port
-
-            if uni_port_no is None:
-                for action in fd.get_actions(flow):
-                    if action.type == fd.OUTPUT:
-                        is_uni, child_device_id = \
-                            self.__is_uni_port(action.output.port)
-                        if is_uni:
-                            uni_port_no = action.output.port
-
-        if child_device_id:
-            child_device = self.adapter_agent.get_device(child_device_id)
-            pon_intf = child_device.proxy_address.channel_id
-            onu_id = child_device.proxy_address.onu_id
-            uni_id = self.platform.uni_id_from_port_num(uni_port_no) \
-                if uni_port_no is not None else None
-        else:
-            raise ValueError
-
-        return pon_intf, onu_id, uni_id
-
-    def _get_ofp_port_name(self, intf_id, onu_id, uni_id):
-        parent_port_no = self.platform.intf_id_to_port_no(intf_id,
-                                                          Port.PON_OLT)
-        child_device = self.adapter_agent.get_child_device(
-            self.device.id, parent_port_no=parent_port_no, onu_id=onu_id)
-        if child_device is None:
-            self.log.error("could-not-find-child-device",
-                           parent_port_no=intf_id, onu_id=onu_id)
-            return (None, None)
-        ports = self.adapter_agent.get_ports(child_device.id,
-                                             Port.ETHERNET_UNI)
-        logical_port = self.adapter_agent.get_logical_port(
-            self.logical_device_id, ports[uni_id].label)
-        ofp_port_name = (logical_port.ofp_port.name,
-                         logical_port.ofp_port.port_no)
-        return ofp_port_name
-
-    # #######################################################################
     # Methods used by Alarm and Statistics Manager (TODO - re-visit)
     # #######################################################################
 
@@ -623,23 +549,3 @@
         self.adapter_agent.add_port(self.device.id, port)
 
         return port_no, label
-
-    def __get_uni_ofp_port_name(self, child_device):
-        logical_ports = self.proxy.get('/logical_devices/{}/ports'.format(
-            self.logical_device_id))
-        for logical_port in logical_ports:
-            if logical_port.device_id == child_device.id:
-                return logical_port.ofp_port.name
-        return None
-
-    def __is_uni_port(self, port_no):
-        try:
-            port = self.adapter_agent.get_logical_port(
-                self.logical_device_id, 'uni-{}'.format(port_no))
-            if port is not None:
-                return (not port.root_port), port.device_id
-            else:
-                return False, None
-        except Exception as e:
-            self.log.error("error-retrieving-port", e=e)
-            return False, None
diff --git a/voltha/adapters/openolt/openolt_flow_mgr.py b/voltha/adapters/openolt/openolt_flow_mgr.py
index fdef71a..1150d9a 100644
--- a/voltha/adapters/openolt/openolt_flow_mgr.py
+++ b/voltha/adapters/openolt/openolt_flow_mgr.py
@@ -234,7 +234,7 @@
     def _clear_flow_id_from_rm(self, flow, flow_id, flow_direction):
         try:
             pon_intf, onu_id, uni_id \
-                = self.data_model._flow_extract_info(flow, flow_direction)
+                = self.platform.flow_extract_info(flow, flow_direction)
         except ValueError:
             self.log.error("failure extracting pon_intf, onu_id, uni_id info \
                            from flow")
@@ -318,8 +318,8 @@
                                      ofp_port_name):
         # Remove the TP instance associated with the ONU
         if ofp_port_name is None:
-            ofp_port_name, ofp_port_no \
-                = self.data_model._get_ofp_port_name(intf_id, onu_id, uni_id)
+            ofp_port_name = self.data_model.serial_number(intf_id, onu_id)
+
         tp_id = self.resource_mgr.get_tech_profile_id_for_onu(intf_id, onu_id,
                                                               uni_id)
         tp_path = self.get_tp_path(intf_id, ofp_port_name, tp_id)
@@ -368,12 +368,8 @@
                         self.add_eapol_flow(intf_id, onu_id, uni_id, port_no,
                                             flow, alloc_id, gemport_id,
                                             vlan_id=vlan_id)
-                    (ofp_port_name, ofp_port_no) \
-                        = self.data_model._get_ofp_port_name(intf_id, onu_id,
-                                                             uni_id)
-                    if ofp_port_name is None:
-                        self.log.error("port-name-not-found")
-                        return
+                    ofp_port_name = self.data_model.serial_number(intf_id,
+                                                                  onu_id)
                     tp_id = self.resource_mgr.get_tech_profile_id_for_onu(
                         intf_id, onu_id, uni_id)
                     tp_path = self.get_tp_path(intf_id, ofp_port_name, tp_id)
@@ -415,11 +411,10 @@
             return alloc_id, gem_port_ids
 
         try:
-            (ofp_port_name, ofp_port_no) \
-                = self.data_model._get_ofp_port_name(intf_id, onu_id, uni_id)
-            if ofp_port_name is None:
-                self.log.error("port-name-not-found")
-                return alloc_id, gem_port_ids
+            ofp_port_name = self.data_model.serial_number(intf_id, onu_id)
+            ofp_port_no = self.platform.mk_uni_port_num(intf_id,
+                                                        onu_id, uni_id)
+
             # FIXME: If table id is <= 63 using 64 as table id
             if table_id < DEFAULT_TECH_PROFILE_TABLE_ID:
                 table_id = DEFAULT_TECH_PROFILE_TABLE_ID
@@ -466,7 +461,7 @@
                 gem_port_ids.append(
                     tech_profile_instance.upstream_gem_port_attribute_list[i].
                     gemport_id)
-        except BaseException as e:
+        except Exception as e:
             self.log.exception(exception=e)
 
         # Update the allocated alloc_id and gem_port_id for the ONU/UNI to KV
diff --git a/voltha/adapters/openolt/openolt_platform.py b/voltha/adapters/openolt/openolt_platform.py
index ec37a0d..14142d9 100644
--- a/voltha/adapters/openolt/openolt_platform.py
+++ b/voltha/adapters/openolt/openolt_platform.py
@@ -16,6 +16,7 @@
 
 from voltha.protos.device_pb2 import Port
 import voltha.protos.device_pb2 as dev_pb2
+import voltha.core.flow_decomposer as fd
 
 """
 Encoding of identifiers
@@ -99,6 +100,9 @@
     def intf_id_from_uni_port_num(self, port_num):
         return (port_num >> 11) & 0xF
 
+    def onu_id_from_uni_port_num(self, port_num):
+        return (port_num >> 4) & 0x7F
+
     def intf_id_from_pon_port_no(self, port_no):
         return port_no & 0xF
 
@@ -147,3 +151,31 @@
             # NNI interface
             return True
         return False
+
+    def flow_extract_info(self, flow, flow_direction):
+        uni_port_no = None
+        if flow_direction == "upstream":
+            for field in fd.get_ofb_fields(flow):
+                if field.type == fd.IN_PORT:
+                    uni_port_no = field.port
+                    break
+        elif flow_direction == "downstream":
+            for field in fd.get_ofb_fields(flow):
+                if field.type == fd.METADATA:
+                    uni_port_no = field.table_metadata & 0xFFFFFFFF
+                    break
+
+            if uni_port_no is None:
+                for action in fd.get_actions(flow):
+                    if action.type == fd.OUTPUT:
+                        uni_port_no = action.output.port
+                        break
+
+        if uni_port_no is None:
+            raise ValueError
+
+        pon_intf = self.platform.intf_id_from_uni_port_num(uni_port_no)
+        onu_id = self.platform.onu_id_from_uni_port_num(uni_port_no)
+        uni_id = self.platform.uni_id_from_port_num(uni_port_no)
+
+        return pon_intf, onu_id, uni_id
