VOL-1451 Initial checkin of openonu build

Produced docker container capable of building and running
openonu/brcm_openonci_onu.  Copied over current onu code
and resolved all imports by copying into the local source tree.

Change-Id: Ib9785d37afc65b7d32ecf74aee2456352626e2b6
diff --git a/python/adapters/brcm_openomci_onu/VERSION b/python/adapters/brcm_openomci_onu/VERSION
new file mode 100644
index 0000000..c0ab82c
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/VERSION
@@ -0,0 +1 @@
+0.0.1-dev
diff --git a/python/adapters/brcm_openomci_onu/__init__.py b/python/adapters/brcm_openomci_onu/__init__.py
new file mode 100644
index 0000000..b0fb0b2
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu.py
new file mode 100644
index 0000000..ad89dc8
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu.py
@@ -0,0 +1,331 @@
+#
+# Copyright 2017 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""
+Broadcom OpenOMCI OLT/ONU adapter.
+
+This adapter does NOT support XPON
+"""
+
+from twisted.internet import reactor, task
+from zope.interface import implementer
+
+from voltha.adapters.brcm_openomci_onu.brcm_openomci_onu_handler import BrcmOpenomciOnuHandler
+from voltha.adapters.interface import IAdapterInterface
+from voltha.protos import third_party
+from voltha.protos.adapter_pb2 import Adapter
+from voltha.protos.adapter_pb2 import AdapterConfig
+from voltha.protos.common_pb2 import LogLevel
+from voltha.protos.device_pb2 import DeviceType, DeviceTypes, Port, Image
+from voltha.protos.health_pb2 import HealthStatus
+
+from common.frameio.frameio import hexify
+from voltha.extensions.omci.openomci_agent import OpenOMCIAgent, OpenOmciAgentDefaults
+from voltha.extensions.omci.omci_me import *
+from voltha.extensions.omci.database.mib_db_dict import MibDbVolatileDict
+from omci.brcm_capabilities_task import BrcmCapabilitiesTask
+from omci.brcm_get_mds_task import BrcmGetMdsTask
+from omci.brcm_mib_sync import BrcmMibSynchronizer
+from copy import deepcopy
+
+
+_ = third_party
+log = structlog.get_logger()
+
+
+@implementer(IAdapterInterface)
+class BrcmOpenomciOnuAdapter(object):
+
+    name = 'brcm_openomci_onu'
+
+    supported_device_types = [
+        DeviceType(
+            id=name,
+            vendor_ids=['OPEN', 'ALCL', 'BRCM', 'TWSH', 'ALPH', 'ISKT', 'SFAA', 'BBSM'],
+            adapter=name,
+            accepts_bulk_flow_update=True
+        )
+    ]
+
+    def __init__(self, adapter_agent, config):
+        log.debug('function-entry', config=config)
+        self.adapter_agent = adapter_agent
+        self.config = config
+        self.descriptor = Adapter(
+            id=self.name,
+            vendor='Voltha project',
+            version='0.50',
+            config=AdapterConfig(log_level=LogLevel.INFO)
+        )
+        self.devices_handlers = dict()
+
+        # Customize OpenOMCI for Broadcom ONUs
+        self.broadcom_omci = deepcopy(OpenOmciAgentDefaults)
+
+        self.broadcom_omci['mib-synchronizer']['state-machine'] = BrcmMibSynchronizer
+        self.broadcom_omci['omci-capabilities']['tasks']['get-capabilities'] = BrcmCapabilitiesTask
+
+        # Defer creation of omci agent to a lazy init that allows subclasses to override support classes
+
+        # register for adapter messages
+        self.adapter_agent.register_for_inter_adapter_messages()
+
+    def custom_me_entities(self):
+        return None
+
+    @property
+    def omci_agent(self):
+        if not hasattr(self, '_omci_agent') or self._omci_agent is None:
+            log.debug('creating-omci-agent')
+            self._omci_agent = OpenOMCIAgent(self.adapter_agent.core,
+                                             support_classes=self.broadcom_omci)
+        return self._omci_agent
+
+    def start(self):
+        log.debug('starting')
+        self.omci_agent.start()
+        log.info('started')
+
+    def stop(self):
+        log.debug('stopping')
+
+        omci, self._omci_agent = self._omci_agent, None
+        if omci is not None:
+            self._omci_agent.stop()
+
+        log.info('stopped')
+
+    def adapter_descriptor(self):
+        return self.descriptor
+
+    def device_types(self):
+        return DeviceTypes(items=self.supported_device_types)
+
+    def health(self):
+        return HealthStatus(state=HealthStatus.HealthState.HEALTHY)
+
+    def change_master_state(self, master):
+        raise NotImplementedError()
+
+    def adopt_device(self, device):
+        log.info('adopt_device', device_id=device.id)
+        self.devices_handlers[device.id] = BrcmOpenomciOnuHandler(self, device.id)
+        reactor.callLater(0, self.devices_handlers[device.id].activate, device)
+        return device
+
+    def reconcile_device(self, device):
+        log.info('reconcile-device', device_id=device.id)
+        self.devices_handlers[device.id] = BrcmOpenomciOnuHandler(self, device.id)
+        reactor.callLater(0, self.devices_handlers[device.id].reconcile, device)
+
+    def abandon_device(self, device):
+        raise NotImplementedError()
+
+    def disable_device(self, device):
+        log.info('disable-onu-device', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.disable(device)
+
+    def reenable_device(self, device):
+        log.info('reenable-onu-device', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.reenable(device)
+
+    def reboot_device(self, device):
+        log.info('reboot-device', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.reboot()
+
+    def download_image(self, device, request):
+        raise NotImplementedError()
+
+    def get_image_download_status(self, device, request):
+        raise NotImplementedError()
+
+    def cancel_image_download(self, device, request):
+        raise NotImplementedError()
+
+    def activate_image_update(self, device, request):
+        raise NotImplementedError()
+
+    def revert_image_update(self, device, request):
+        raise NotImplementedError()
+
+    def self_test_device(self, device):
+        """
+        This is called to Self a device based on a NBI call.
+        :param device: A Voltha.Device object.
+        :return: Will return result of self test
+        """
+        log.info('self-test-device - Not implemented yet', device=device.id)
+        raise NotImplementedError()
+
+    def delete_device(self, device):
+        log.info('delete-device', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.delete(device)
+            del self.devices_handlers[device.id]
+        return
+
+    def get_device_details(self, device):
+        raise NotImplementedError()
+
+    # TODO(smbaker): When BrcmOpenomciOnuAdapter is updated to inherit from OnuAdapter, this function can be deleted
+    def update_pm_config(self, device, pm_config):
+        log.info("adapter-update-pm-config", device=device,
+                 pm_config=pm_config)
+        handler = self.devices_handlers[device.id]
+        handler.update_pm_config(device, pm_config)
+
+    def update_flows_bulk(self, device, flows, groups):
+        '''
+        log.info('bulk-flow-update', device_id=device.id,
+                  flows=flows, groups=groups)
+        '''
+        assert len(groups.items) == 0
+        handler = self.devices_handlers[device.id]
+        return handler.update_flow_table(device, flows.items)
+
+    def update_flows_incrementally(self, device, flow_changes, group_changes):
+        raise NotImplementedError()
+
+    def send_proxied_message(self, proxy_address, msg):
+        log.debug('send-proxied-message', proxy_address=proxy_address, msg=msg)
+
+    def receive_proxied_message(self, proxy_address, msg):
+        log.debug('receive-proxied-message', proxy_address=proxy_address,
+                 device_id=proxy_address.device_id, msg=hexify(msg))
+        # Device_id from the proxy_address is the olt device id. We need to
+        # get the onu device id using the port number in the proxy_address
+        device = self.adapter_agent. \
+            get_child_device_with_proxy_address(proxy_address)
+        if device:
+            handler = self.devices_handlers[device.id]
+            handler.receive_message(msg)
+
+    def receive_packet_out(self, logical_device_id, egress_port_no, msg):
+        log.info('packet-out', logical_device_id=logical_device_id,
+                 egress_port_no=egress_port_no, msg_len=len(msg))
+
+    def receive_inter_adapter_message(self, msg):
+        log.debug('receive_inter_adapter_message', msg=msg)
+        proxy_address = msg['proxy_address']
+        assert proxy_address is not None
+        # Device_id from the proxy_address is the olt device id. We need to
+        # get the onu device id using the port number in the proxy_address
+        device = self.adapter_agent. \
+            get_child_device_with_proxy_address(proxy_address)
+        if device:
+            handler = self.devices_handlers[device.id]
+            handler.event_messages.put(msg)
+        else:
+            log.error("device-not-found")
+
+    def create_interface(self, device, data):
+        log.debug('create-interface', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.create_interface(data)
+
+    def update_interface(self, device, data):
+        log.debug('update-interface', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.update_interface(data)
+
+    def remove_interface(self, device, data):
+        log.debug('remove-interface', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.remove_interface(data)
+
+    def receive_onu_detect_state(self, device_id, state):
+        raise NotImplementedError()
+
+    def create_tcont(self, device, tcont_data, traffic_descriptor_data):
+        log.debug('create-tcont', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.create_tcont(tcont_data, traffic_descriptor_data)
+
+    def update_tcont(self, device, tcont_data, traffic_descriptor_data):
+        raise NotImplementedError()
+
+    def remove_tcont(self, device, tcont_data, traffic_descriptor_data):
+        log.debug('remove-tcont', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.remove_tcont(tcont_data, traffic_descriptor_data)
+
+    def create_gemport(self, device, data):
+        log.debug('create-gemport', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.create_gemport(data)
+
+    def update_gemport(self, device, data):
+        raise NotImplementedError()
+
+    def remove_gemport(self, device, data):
+        log.debug('remove-gemport', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.remove_gemport(data)
+
+    def create_multicast_gemport(self, device, data):
+        log.debug('create-multicast-gemport', device_id=device.id)
+        if device.id in self.devices_handlers:
+            handler = self.devices_handlers[device.id]
+            if handler is not None:
+                handler.create_multicast_gemport(data)
+
+    def update_multicast_gemport(self, device, data):
+        raise NotImplementedError()
+
+    def remove_multicast_gemport(self, device, data):
+        raise NotImplementedError()
+
+    def create_multicast_distribution_set(self, device, data):
+        raise NotImplementedError()
+
+    def update_multicast_distribution_set(self, device, data):
+        raise NotImplementedError()
+
+    def remove_multicast_distribution_set(self, device, data):
+        raise NotImplementedError()
+
+    def suppress_alarm(self, filter):
+        raise NotImplementedError()
+
+    def unsuppress_alarm(self, filter):
+        raise NotImplementedError()
+
+
diff --git a/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
new file mode 100644
index 0000000..42dd0a9
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/brcm_openomci_onu_handler.py
@@ -0,0 +1,1044 @@
+#
+# Copyright 2017 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""
+Broadcom OpenOMCI OLT/ONU adapter handler.
+"""
+
+import json
+import ast
+import structlog
+
+from collections import OrderedDict
+
+from twisted.internet import reactor, task
+from twisted.internet.defer import DeferredQueue, inlineCallbacks, returnValue, TimeoutError
+
+from heartbeat import HeartBeat
+from voltha.extensions.kpi.onu.onu_pm_metrics import OnuPmMetrics
+from voltha.extensions.kpi.onu.onu_omci_pm import OnuOmciPmMetrics
+from voltha.extensions.alarms.adapter_alarms import AdapterAlarms
+
+from common.utils.indexpool import IndexPool
+import voltha.core.flow_decomposer as fd
+from voltha.registry import registry
+from voltha.core.config.config_backend import ConsulStore
+from voltha.core.config.config_backend import EtcdStore
+from voltha.protos import third_party
+from voltha.protos.common_pb2 import OperStatus, ConnectStatus, AdminState
+from voltha.protos.openflow_13_pb2 import OFPXMC_OPENFLOW_BASIC, ofp_port
+from voltha.protos.bbf_fiber_tcont_body_pb2 import TcontsConfigData
+from voltha.protos.bbf_fiber_gemport_body_pb2 import GemportsConfigData
+from voltha.extensions.omci.onu_configuration import OMCCVersion
+from voltha.extensions.omci.onu_device_entry import OnuDeviceEvents, \
+    OnuDeviceEntry, IN_SYNC_KEY
+from voltha.adapters.brcm_openomci_onu.omci.brcm_mib_download_task import BrcmMibDownloadTask
+from voltha.adapters.brcm_openomci_onu.omci.brcm_tp_service_specific_task import BrcmTpServiceSpecificTask
+from voltha.adapters.brcm_openomci_onu.omci.brcm_uni_lock_task import BrcmUniLockTask
+from voltha.adapters.brcm_openomci_onu.omci.brcm_vlan_filter_task import BrcmVlanFilterTask
+from voltha.adapters.brcm_openomci_onu.onu_gem_port import *
+from voltha.adapters.brcm_openomci_onu.onu_tcont import *
+from voltha.adapters.brcm_openomci_onu.pon_port import *
+from voltha.adapters.brcm_openomci_onu.uni_port import *
+from voltha.adapters.brcm_openomci_onu.onu_traffic_descriptor import *
+from common.tech_profile.tech_profile import TechProfile
+
+OP = EntityOperations
+RC = ReasonCodes
+
+_ = third_party
+log = structlog.get_logger()
+
+_STARTUP_RETRY_WAIT = 20
+
+
+class BrcmOpenomciOnuHandler(object):
+
+    def __init__(self, adapter, device_id):
+        self.log = structlog.get_logger(device_id=device_id)
+        self.log.debug('function-entry')
+        self.adapter = adapter
+        self.adapter_agent = adapter.adapter_agent
+        self.parent_adapter = None
+        self.parent_id = None
+        self.device_id = device_id
+        self.incoming_messages = DeferredQueue()
+        self.event_messages = DeferredQueue()
+        self.proxy_address = None
+        self.tx_id = 0
+        self._enabled = False
+        self.alarms = None
+        self.pm_metrics = None
+        self._omcc_version = OMCCVersion.Unknown
+        self._total_tcont_count = 0  # From ANI-G ME
+        self._qos_flexibility = 0  # From ONT2_G ME
+
+        self._onu_indication = None
+        self._unis = dict()  # Port # -> UniPort
+
+        self._pon = None
+        # TODO: probably shouldnt be hardcoded, determine from olt maybe?
+        self._pon_port_number = 100
+        self.logical_device_id = None
+
+        self._heartbeat = HeartBeat.create(self, device_id)
+
+        # Set up OpenOMCI environment
+        self._onu_omci_device = None
+        self._dev_info_loaded = False
+        self._deferred = None
+
+        self._in_sync_subscription = None
+        self._connectivity_subscription = None
+        self._capabilities_subscription = None
+
+        self.mac_bridge_service_profile_entity_id = 0x201
+        self.gal_enet_profile_entity_id = 0x1
+
+        self._tp_service_specific_task = dict()
+        self._tech_profile_download_done = dict()
+
+        # Initialize KV store client
+        self.args = registry('main').get_args()
+        if self.args.backend == 'etcd':
+            host, port = self.args.etcd.split(':', 1)
+            self.kv_client = EtcdStore(host, port,
+                                       TechProfile.KV_STORE_TECH_PROFILE_PATH_PREFIX)
+        elif self.args.backend == 'consul':
+            host, port = self.args.consul.split(':', 1)
+            self.kv_client = ConsulStore(host, port,
+                                         TechProfile.KV_STORE_TECH_PROFILE_PATH_PREFIX)
+        else:
+            self.log.error('Invalid-backend')
+            raise Exception("Invalid-backend-for-kv-store")
+
+        # Handle received ONU event messages
+        reactor.callLater(0, self.handle_onu_events)
+
+    @property
+    def enabled(self):
+        return self._enabled
+
+    @enabled.setter
+    def enabled(self, value):
+        if self._enabled != value:
+            self._enabled = value
+
+    @property
+    def omci_agent(self):
+        return self.adapter.omci_agent
+
+    @property
+    def omci_cc(self):
+        return self._onu_omci_device.omci_cc if self._onu_omci_device is not None else None
+
+    @property
+    def heartbeat(self):
+        return self._heartbeat
+
+    @property
+    def uni_ports(self):
+        return self._unis.values()
+
+    def uni_port(self, port_no_or_name):
+        if isinstance(port_no_or_name, (str, unicode)):
+            return next((uni for uni in self.uni_ports
+                         if uni.name == port_no_or_name), None)
+
+        assert isinstance(port_no_or_name, int), 'Invalid parameter type'
+        return next((uni for uni in self.uni_ports
+                    if uni.logical_port_number == port_no_or_name), None)
+
+    @property
+    def pon_port(self):
+        return self._pon
+
+    def receive_message(self, msg):
+        if self.omci_cc is not None:
+            self.omci_cc.receive_message(msg)
+
+    # Called once when the adapter creates the device/onu instance
+    def activate(self, device):
+        self.log.debug('function-entry', device=device)
+
+        # first we verify that we got parent reference and proxy info
+        assert device.parent_id
+        assert device.proxy_address.device_id
+
+        # register for proxied messages right away
+        self.proxy_address = device.proxy_address
+        self.adapter_agent.register_for_proxied_messages(device.proxy_address)
+        self.parent_id = device.parent_id
+        parent_device = self.adapter_agent.get_device(self.parent_id)
+        if parent_device.type == 'openolt':
+            self.parent_adapter = registry('adapter_loader'). \
+                get_agent(parent_device.adapter).adapter
+
+        if self.enabled is not True:
+            self.log.info('activating-new-onu')
+            # populate what we know.  rest comes later after mib sync
+            device.root = True
+            device.vendor = 'Broadcom'
+            device.connect_status = ConnectStatus.REACHABLE
+            device.oper_status = OperStatus.DISCOVERED
+            device.reason = 'activating-onu'
+
+            # pm_metrics requires a logical device id
+            parent_device = self.adapter_agent.get_device(device.parent_id)
+            self.logical_device_id = parent_device.parent_id
+            assert self.logical_device_id, 'Invalid logical device ID'
+
+            self.adapter_agent.update_device(device)
+
+            self.log.debug('set-device-discovered')
+
+            self._init_pon_state(device)
+
+            ############################################################################
+            # Setup PM configuration for this device
+            # Pass in ONU specific options
+            kwargs = {
+                OnuPmMetrics.DEFAULT_FREQUENCY_KEY: OnuPmMetrics.DEFAULT_ONU_COLLECTION_FREQUENCY,
+                'heartbeat': self.heartbeat,
+                OnuOmciPmMetrics.OMCI_DEV_KEY: self._onu_omci_device
+            }
+            self.pm_metrics = OnuPmMetrics(self.adapter_agent, self.device_id,
+                                           self.logical_device_id, grouped=True,
+                                           freq_override=False, **kwargs)
+            pm_config = self.pm_metrics.make_proto()
+            self._onu_omci_device.set_pm_config(self.pm_metrics.omci_pm.openomci_interval_pm)
+            self.log.info("initial-pm-config", pm_config=pm_config)
+            self.adapter_agent.update_device_pm_config(pm_config, init=True)
+
+            ############################################################################
+            # Setup Alarm handler
+            self.alarms = AdapterAlarms(self.adapter_agent, device.id, self.logical_device_id)
+            # Note, ONU ID and UNI intf set in add_uni_port method
+            self._onu_omci_device.alarm_synchronizer.set_alarm_params(mgr=self.alarms,
+                                                                      ani_ports=[self._pon])
+            self.enabled = True
+        else:
+            self.log.info('onu-already-activated')
+
+    # Called once when the adapter needs to re-create device.  usually on vcore restart
+    def reconcile(self, device):
+        self.log.debug('function-entry', device=device)
+
+        # first we verify that we got parent reference and proxy info
+        assert device.parent_id
+        assert device.proxy_address.device_id
+
+        # register for proxied messages right away
+        self.proxy_address = device.proxy_address
+        self.adapter_agent.register_for_proxied_messages(device.proxy_address)
+
+        if self.enabled is not True:
+            self.log.info('reconciling-broadcom-onu-device')
+
+            self._init_pon_state(device)
+
+            # need to restart state machines on vcore restart.  there is no indication to do it for us.
+            self._onu_omci_device.start()
+            device.reason = "restarting-openomci"
+            self.adapter_agent.update_device(device)
+
+            # TODO: this is probably a bit heavy handed
+            # Force a reboot for now.  We need indications to reflow to reassign tconts and gems given vcore went away
+            # This may not be necessary when mib resync actually works
+            reactor.callLater(1, self.reboot)
+
+            self.enabled = True
+        else:
+            self.log.info('onu-already-activated')
+
+    @inlineCallbacks
+    def handle_onu_events(self):
+        event_msg = yield self.event_messages.get()
+        try:
+            if event_msg['event'] == 'download_tech_profile':
+                tp_path = event_msg['event_data']
+                uni_id = event_msg['uni_id']
+                self.load_and_configure_tech_profile(uni_id, tp_path)
+
+        except Exception as e:
+            self.log.error("exception-handling-onu-event", e=e)
+
+        # Handle next event
+        reactor.callLater(0, self.handle_onu_events)
+
+    def _init_pon_state(self, device):
+        self.log.debug('function-entry', device=device)
+
+        self._pon = PonPort.create(self, self._pon_port_number)
+        self.adapter_agent.add_port(device.id, self._pon.get_port())
+
+        self.log.debug('added-pon-port-to-agent', pon=self._pon)
+
+        parent_device = self.adapter_agent.get_device(device.parent_id)
+        self.logical_device_id = parent_device.parent_id
+
+        self.adapter_agent.update_device(device)
+
+        # Create and start the OpenOMCI ONU Device Entry for this ONU
+        self._onu_omci_device = self.omci_agent.add_device(self.device_id,
+                                                           self.adapter_agent,
+                                                           support_classes=self.adapter.broadcom_omci,
+                                                           custom_me_map=self.adapter.custom_me_entities())
+        # Port startup
+        if self._pon is not None:
+            self._pon.enabled = True
+
+    # TODO: move to UniPort
+    def update_logical_port(self, logical_device_id, port_id, state):
+        try:
+            self.log.info('updating-logical-port', logical_port_id=port_id,
+                          logical_device_id=logical_device_id, state=state)
+            logical_port = self.adapter_agent.get_logical_port(logical_device_id,
+                                                               port_id)
+            logical_port.ofp_port.state = state
+            self.adapter_agent.update_logical_port(logical_device_id,
+                                                   logical_port)
+        except Exception as e:
+            self.log.exception("exception-updating-port", e=e)
+
+    def delete(self, device):
+        self.log.info('delete-onu', device=device)
+        if self.parent_adapter:
+            try:
+                self.parent_adapter.delete_child_device(self.parent_id, device)
+            except AttributeError:
+                self.log.debug('parent-device-delete-child-not-implemented')
+        else:
+            self.log.debug("parent-adapter-not-available")
+
+    def _create_tconts(self, uni_id, us_scheduler):
+        alloc_id = us_scheduler['alloc_id']
+        q_sched_policy = us_scheduler['q_sched_policy']
+        self.log.debug('create-tcont', us_scheduler=us_scheduler)
+
+        tcontdict = dict()
+        tcontdict['alloc-id'] = alloc_id
+        tcontdict['q_sched_policy'] = q_sched_policy
+        tcontdict['uni_id'] = uni_id
+
+        # TODO: Not sure what to do with any of this...
+        tddata = dict()
+        tddata['name'] = 'not-sure-td-profile'
+        tddata['fixed-bandwidth'] = "not-sure-fixed"
+        tddata['assured-bandwidth'] = "not-sure-assured"
+        tddata['maximum-bandwidth'] = "not-sure-max"
+        tddata['additional-bw-eligibility-indicator'] = "not-sure-additional"
+
+        td = OnuTrafficDescriptor.create(tddata)
+        tcont = OnuTCont.create(self, tcont=tcontdict, td=td)
+
+        self._pon.add_tcont(tcont)
+
+        self.log.debug('pon-add-tcont', tcont=tcont)
+
+    # Called when there is an olt up indication, providing the gem port id chosen by the olt handler
+    def _create_gemports(self, uni_id, gem_ports, alloc_id_ref, direction):
+        self.log.debug('create-gemport',
+                       gem_ports=gem_ports, direction=direction)
+
+        for gem_port in gem_ports:
+            gemdict = dict()
+            gemdict['gemport_id'] = gem_port['gemport_id']
+            gemdict['direction'] = direction
+            gemdict['alloc_id_ref'] = alloc_id_ref
+            gemdict['encryption'] = gem_port['aes_encryption']
+            gemdict['discard_config'] = dict()
+            gemdict['discard_config']['max_probability'] = \
+                gem_port['discard_config']['max_probability']
+            gemdict['discard_config']['max_threshold'] = \
+                gem_port['discard_config']['max_threshold']
+            gemdict['discard_config']['min_threshold'] = \
+                gem_port['discard_config']['min_threshold']
+            gemdict['discard_policy'] = gem_port['discard_policy']
+            gemdict['max_q_size'] = gem_port['max_q_size']
+            gemdict['pbit_map'] = gem_port['pbit_map']
+            gemdict['priority_q'] = gem_port['priority_q']
+            gemdict['scheduling_policy'] = gem_port['scheduling_policy']
+            gemdict['weight'] = gem_port['weight']
+            gemdict['uni_id'] = uni_id
+
+            gem_port = OnuGemPort.create(self, gem_port=gemdict)
+
+            self._pon.add_gem_port(gem_port)
+
+            self.log.debug('pon-add-gemport', gem_port=gem_port)
+
+    def _do_tech_profile_configuration(self, uni_id, tp):
+        num_of_tconts = tp['num_of_tconts']
+        us_scheduler = tp['us_scheduler']
+        alloc_id = us_scheduler['alloc_id']
+        self._create_tconts(uni_id, us_scheduler)
+        upstream_gem_port_attribute_list = tp['upstream_gem_port_attribute_list']
+        self._create_gemports(uni_id, upstream_gem_port_attribute_list, alloc_id, "UPSTREAM")
+        downstream_gem_port_attribute_list = tp['downstream_gem_port_attribute_list']
+        self._create_gemports(uni_id, downstream_gem_port_attribute_list, alloc_id, "DOWNSTREAM")
+
+    def load_and_configure_tech_profile(self, uni_id, tp_path):
+        self.log.debug("loading-tech-profile-configuration", uni_id=uni_id, tp_path=tp_path)
+
+        if uni_id not in self._tp_service_specific_task:
+            self._tp_service_specific_task[uni_id] = dict()
+
+        if uni_id not in self._tech_profile_download_done:
+            self._tech_profile_download_done[uni_id] = dict()
+
+        if tp_path not in self._tech_profile_download_done[uni_id]:
+            self._tech_profile_download_done[uni_id][tp_path] = False
+
+        if not self._tech_profile_download_done[uni_id][tp_path]:
+            try:
+                if tp_path in self._tp_service_specific_task[uni_id]:
+                    self.log.info("tech-profile-config-already-in-progress",
+                                   tp_path=tp_path)
+                    return
+
+                tp = self.kv_client[tp_path]
+                tp = ast.literal_eval(tp)
+                self.log.debug("tp-instance", tp=tp)
+                self._do_tech_profile_configuration(uni_id, tp)
+
+                def success(_results):
+                    self.log.info("tech-profile-config-done-successfully")
+                    device = self.adapter_agent.get_device(self.device_id)
+                    device.reason = 'tech-profile-config-download-success'
+                    self.adapter_agent.update_device(device)
+                    if tp_path in self._tp_service_specific_task[uni_id]:
+                        del self._tp_service_specific_task[uni_id][tp_path]
+                    self._tech_profile_download_done[uni_id][tp_path] = True
+
+                def failure(_reason):
+                    self.log.warn('tech-profile-config-failure-retrying',
+                                   _reason=_reason)
+                    device = self.adapter_agent.get_device(self.device_id)
+                    device.reason = 'tech-profile-config-download-failure-retrying'
+                    self.adapter_agent.update_device(device)
+                    if tp_path in self._tp_service_specific_task[uni_id]:
+                        del self._tp_service_specific_task[uni_id][tp_path]
+                    self._deferred = reactor.callLater(_STARTUP_RETRY_WAIT, self.load_and_configure_tech_profile,
+                                                       uni_id, tp_path)
+
+                self.log.info('downloading-tech-profile-configuration')
+                self._tp_service_specific_task[uni_id][tp_path] = \
+                       BrcmTpServiceSpecificTask(self.omci_agent, self, uni_id)
+                self._deferred = \
+                       self._onu_omci_device.task_runner.queue_task(self._tp_service_specific_task[uni_id][tp_path])
+                self._deferred.addCallbacks(success, failure)
+
+            except Exception as e:
+                self.log.exception("error-loading-tech-profile", e=e)
+        else:
+            self.log.info("tech-profile-config-already-done")
+
+    def update_pm_config(self, device, pm_config):
+        # TODO: This has not been tested
+        self.log.info('update_pm_config', pm_config=pm_config)
+        self.pm_metrics.update(pm_config)
+
+    # Calling this assumes the onu is active/ready and had at least an initial mib downloaded.   This gets called from
+    # flow decomposition that ultimately comes from onos
+    def update_flow_table(self, device, flows):
+        self.log.debug('function-entry', device=device, flows=flows)
+
+        #
+        # We need to proxy through the OLT to get to the ONU
+        # Configuration from here should be using OMCI
+        #
+        # self.log.info('bulk-flow-update', device_id=device.id, flows=flows)
+
+        # no point in pushing omci flows if the device isnt reachable
+        if device.connect_status != ConnectStatus.REACHABLE or \
+           device.admin_state != AdminState.ENABLED:
+            self.log.warn("device-disabled-or-offline-skipping-flow-update",
+                          admin=device.admin_state, connect=device.connect_status)
+            return
+
+        def is_downstream(port):
+            return port == self._pon_port_number
+
+        def is_upstream(port):
+            return not is_downstream(port)
+
+        for flow in flows:
+            _type = None
+            _port = None
+            _vlan_vid = None
+            _udp_dst = None
+            _udp_src = None
+            _ipv4_dst = None
+            _ipv4_src = None
+            _metadata = None
+            _output = None
+            _push_tpid = None
+            _field = None
+            _set_vlan_vid = None
+            self.log.debug('bulk-flow-update', device_id=device.id, flow=flow)
+            try:
+                _in_port = fd.get_in_port(flow)
+                assert _in_port is not None
+
+                _out_port = fd.get_out_port(flow)  # may be None
+
+                if is_downstream(_in_port):
+                    self.log.debug('downstream-flow', in_port=_in_port, out_port=_out_port)
+                    uni_port = self.uni_port(_out_port)
+                elif is_upstream(_in_port):
+                    self.log.debug('upstream-flow', in_port=_in_port, out_port=_out_port)
+                    uni_port = self.uni_port(_in_port)
+                else:
+                    raise Exception('port should be 1 or 2 by our convention')
+
+                self.log.debug('flow-ports', in_port=_in_port, out_port=_out_port, uni_port=str(uni_port))
+
+                for field in fd.get_ofb_fields(flow):
+                    if field.type == fd.ETH_TYPE:
+                        _type = field.eth_type
+                        self.log.debug('field-type-eth-type',
+                                       eth_type=_type)
+
+                    elif field.type == fd.IP_PROTO:
+                        _proto = field.ip_proto
+                        self.log.debug('field-type-ip-proto',
+                                       ip_proto=_proto)
+
+                    elif field.type == fd.IN_PORT:
+                        _port = field.port
+                        self.log.debug('field-type-in-port',
+                                       in_port=_port)
+
+                    elif field.type == fd.VLAN_VID:
+                        _vlan_vid = field.vlan_vid & 0xfff
+                        self.log.debug('field-type-vlan-vid',
+                                       vlan=_vlan_vid)
+
+                    elif field.type == fd.VLAN_PCP:
+                        _vlan_pcp = field.vlan_pcp
+                        self.log.debug('field-type-vlan-pcp',
+                                       pcp=_vlan_pcp)
+
+                    elif field.type == fd.UDP_DST:
+                        _udp_dst = field.udp_dst
+                        self.log.debug('field-type-udp-dst',
+                                       udp_dst=_udp_dst)
+
+                    elif field.type == fd.UDP_SRC:
+                        _udp_src = field.udp_src
+                        self.log.debug('field-type-udp-src',
+                                       udp_src=_udp_src)
+
+                    elif field.type == fd.IPV4_DST:
+                        _ipv4_dst = field.ipv4_dst
+                        self.log.debug('field-type-ipv4-dst',
+                                       ipv4_dst=_ipv4_dst)
+
+                    elif field.type == fd.IPV4_SRC:
+                        _ipv4_src = field.ipv4_src
+                        self.log.debug('field-type-ipv4-src',
+                                       ipv4_dst=_ipv4_src)
+
+                    elif field.type == fd.METADATA:
+                        _metadata = field.table_metadata
+                        self.log.debug('field-type-metadata',
+                                       metadata=_metadata)
+
+                    else:
+                        raise NotImplementedError('field.type={}'.format(
+                            field.type))
+
+                for action in fd.get_actions(flow):
+
+                    if action.type == fd.OUTPUT:
+                        _output = action.output.port
+                        self.log.debug('action-type-output',
+                                       output=_output, in_port=_in_port)
+
+                    elif action.type == fd.POP_VLAN:
+                        self.log.debug('action-type-pop-vlan',
+                                       in_port=_in_port)
+
+                    elif action.type == fd.PUSH_VLAN:
+                        _push_tpid = action.push.ethertype
+                        self.log.debug('action-type-push-vlan',
+                                       push_tpid=_push_tpid, in_port=_in_port)
+                        if action.push.ethertype != 0x8100:
+                            self.log.error('unhandled-tpid',
+                                           ethertype=action.push.ethertype)
+
+                    elif action.type == fd.SET_FIELD:
+                        _field = action.set_field.field.ofb_field
+                        assert (action.set_field.field.oxm_class ==
+                                OFPXMC_OPENFLOW_BASIC)
+                        self.log.debug('action-type-set-field',
+                                       field=_field, in_port=_in_port)
+                        if _field.type == fd.VLAN_VID:
+                            _set_vlan_vid = _field.vlan_vid & 0xfff
+                            self.log.debug('set-field-type-vlan-vid',
+                                           vlan_vid=_set_vlan_vid)
+                        else:
+                            self.log.error('unsupported-action-set-field-type',
+                                           field_type=_field.type)
+                    else:
+                        self.log.error('unsupported-action-type',
+                                       action_type=action.type, in_port=_in_port)
+
+                # TODO: We only set vlan omci flows.  Handle omci matching ethertypes at some point in another task
+                if _type is not None:
+                    self.log.warn('ignoring-flow-with-ethType', ethType=_type)
+                elif _set_vlan_vid is None or _set_vlan_vid == 0:
+                    self.log.warn('ignorning-flow-that-does-not-set-vlanid')
+                else:
+                    self.log.warn('set-vlanid', uni_id=uni_port.port_number, set_vlan_vid=_set_vlan_vid)
+                    self._add_vlan_filter_task(device, uni_port, _set_vlan_vid)
+
+            except Exception as e:
+                self.log.exception('failed-to-install-flow', e=e, flow=flow)
+
+
+    def _add_vlan_filter_task(self, device, uni_port, _set_vlan_vid):
+        assert uni_port is not None
+
+        def success(_results):
+            self.log.info('vlan-tagging-success', uni_port=uni_port, vlan=_set_vlan_vid)
+            device.reason = 'omci-flows-pushed'
+            self._vlan_filter_task = None
+
+        def failure(_reason):
+            self.log.warn('vlan-tagging-failure', uni_port=uni_port, vlan=_set_vlan_vid)
+            device.reason = 'omci-flows-failed-retrying'
+            self._vlan_filter_task = reactor.callLater(_STARTUP_RETRY_WAIT,
+                                                       self._add_vlan_filter_task, device, uni_port, _set_vlan_vid)
+
+        self.log.info('setting-vlan-tag')
+        self._vlan_filter_task = BrcmVlanFilterTask(self.omci_agent, self.device_id, uni_port, _set_vlan_vid)
+        self._deferred = self._onu_omci_device.task_runner.queue_task(self._vlan_filter_task)
+        self._deferred.addCallbacks(success, failure)
+
+    def get_tx_id(self):
+        self.log.debug('function-entry')
+        self.tx_id += 1
+        return self.tx_id
+
+    # TODO: Actually conform to or create a proper interface.
+    # this and the other functions called from the olt arent very clear.
+    # Called each time there is an onu "up" indication from the olt handler
+    def create_interface(self, data):
+        self.log.debug('function-entry', data=data)
+        self._onu_indication = data
+
+        onu_device = self.adapter_agent.get_device(self.device_id)
+
+        self.log.debug('starting-openomci-statemachine')
+        self._subscribe_to_events()
+        reactor.callLater(1, self._onu_omci_device.start)
+        onu_device.reason = "starting-openomci"
+        self.adapter_agent.update_device(onu_device)
+        self._heartbeat.enabled = True
+
+    # Currently called each time there is an onu "down" indication from the olt handler
+    # TODO: possibly other reasons to "update" from the olt?
+    def update_interface(self, data):
+        self.log.debug('function-entry', data=data)
+        oper_state = data.get('oper_state', None)
+
+        onu_device = self.adapter_agent.get_device(self.device_id)
+
+        if oper_state == 'down':
+            self.log.debug('stopping-openomci-statemachine')
+            reactor.callLater(0, self._onu_omci_device.stop)
+
+            # Let TP download happen again
+            for uni_id in self._tp_service_specific_task:
+                self._tp_service_specific_task[uni_id].clear()
+            for uni_id in self._tech_profile_download_done:
+                self._tech_profile_download_done[uni_id].clear()
+
+            self.disable_ports(onu_device)
+            onu_device.reason = "stopping-openomci"
+            onu_device.connect_status = ConnectStatus.UNREACHABLE
+            onu_device.oper_status = OperStatus.DISCOVERED
+            self.adapter_agent.update_device(onu_device)
+        else:
+            self.log.debug('not-changing-openomci-statemachine')
+
+    # Not currently called by olt or anything else
+    def remove_interface(self, data):
+        self.log.debug('function-entry', data=data)
+
+        onu_device = self.adapter_agent.get_device(self.device_id)
+
+        self.log.debug('stopping-openomci-statemachine')
+        reactor.callLater(0, self._onu_omci_device.stop)
+
+        # Let TP download happen again
+        for uni_id in self._tp_service_specific_task:
+            self._tp_service_specific_task[uni_id].clear()
+        for uni_id in self._tech_profile_download_done:
+            self._tech_profile_download_done[uni_id].clear()
+
+        self.disable_ports(onu_device)
+        onu_device.reason = "stopping-openomci"
+        self.adapter_agent.update_device(onu_device)
+
+        # TODO: im sure there is more to do here
+
+    # Not currently called.  Would be called presumably from the olt handler
+    def remove_gemport(self, data):
+        self.log.debug('remove-gemport', data=data)
+        gem_port = GemportsConfigData()
+        gem_port.CopyFrom(data)
+        device = self.adapter_agent.get_device(self.device_id)
+        if device.connect_status != ConnectStatus.REACHABLE:
+            self.log.error('device-unreachable')
+            return
+
+    # Not currently called.  Would be called presumably from the olt handler
+    def remove_tcont(self, tcont_data, traffic_descriptor_data):
+        self.log.debug('remove-tcont', tcont_data=tcont_data, traffic_descriptor_data=traffic_descriptor_data)
+        device = self.adapter_agent.get_device(self.device_id)
+        if device.connect_status != ConnectStatus.REACHABLE:
+            self.log.error('device-unreachable')
+            return
+
+        # TODO: Create some omci task that encompases this what intended
+
+    # Not currently called.  Would be called presumably from the olt handler
+    def create_multicast_gemport(self, data):
+        self.log.debug('function-entry', data=data)
+
+        # TODO: create objects and populate for later omci calls
+
+    def disable(self, device):
+        self.log.debug('function-entry', device=device)
+        try:
+            self.log.info('sending-uni-lock-towards-device', device=device)
+
+            def stop_anyway(reason):
+                # proceed with disable regardless if we could reach the onu. for example onu is unplugged
+                self.log.debug('stopping-openomci-statemachine')
+                reactor.callLater(0, self._onu_omci_device.stop)
+
+                # Let TP download happen again
+                for uni_id in self._tp_service_specific_task:
+                    self._tp_service_specific_task[uni_id].clear()
+                for uni_id in self._tech_profile_download_done:
+                    self._tech_profile_download_done[uni_id].clear()
+
+                self.disable_ports(device)
+                device.oper_status = OperStatus.UNKNOWN
+                device.reason = "omci-admin-lock"
+                self.adapter_agent.update_device(device)
+
+            # lock all the unis
+            task = BrcmUniLockTask(self.omci_agent, self.device_id, lock=True)
+            self._deferred = self._onu_omci_device.task_runner.queue_task(task)
+            self._deferred.addCallbacks(stop_anyway, stop_anyway)
+        except Exception as e:
+            log.exception('exception-in-onu-disable', exception=e)
+
+    def reenable(self, device):
+        self.log.debug('function-entry', device=device)
+        try:
+            # Start up OpenOMCI state machines for this device
+            # this will ultimately resync mib and unlock unis on successful redownloading the mib
+            self.log.debug('restarting-openomci-statemachine')
+            self._subscribe_to_events()
+            device.reason = "restarting-openomci"
+            self.adapter_agent.update_device(device)
+            reactor.callLater(1, self._onu_omci_device.start)
+            self._heartbeat.enabled = True
+        except Exception as e:
+            log.exception('exception-in-onu-reenable', exception=e)
+
+    def reboot(self):
+        self.log.info('reboot-device')
+        device = self.adapter_agent.get_device(self.device_id)
+        if device.connect_status != ConnectStatus.REACHABLE:
+            self.log.error("device-unreachable")
+            return
+
+        def success(_results):
+            self.log.info('reboot-success', _results=_results)
+            self.disable_ports(device)
+            device.connect_status = ConnectStatus.UNREACHABLE
+            device.oper_status = OperStatus.DISCOVERED
+            device.reason = "rebooting"
+            self.adapter_agent.update_device(device)
+
+        def failure(_reason):
+            self.log.info('reboot-failure', _reason=_reason)
+
+        self._deferred = self._onu_omci_device.reboot()
+        self._deferred.addCallbacks(success, failure)
+
+    def disable_ports(self, onu_device):
+        self.log.info('disable-ports', device_id=self.device_id,
+                      onu_device=onu_device)
+
+        # Disable all ports on that device
+        self.adapter_agent.disable_all_ports(self.device_id)
+
+        parent_device = self.adapter_agent.get_device(onu_device.parent_id)
+        assert parent_device
+        logical_device_id = parent_device.parent_id
+        assert logical_device_id
+        ports = self.adapter_agent.get_ports(onu_device.id, Port.ETHERNET_UNI)
+        for port in ports:
+            port_id = 'uni-{}'.format(port.port_no)
+            # TODO: move to UniPort
+            self.update_logical_port(logical_device_id, port_id, OFPPS_LINK_DOWN)
+
+    def enable_ports(self, onu_device):
+        self.log.info('enable-ports', device_id=self.device_id, onu_device=onu_device)
+
+        # Disable all ports on that device
+        self.adapter_agent.enable_all_ports(self.device_id)
+
+        parent_device = self.adapter_agent.get_device(onu_device.parent_id)
+        assert parent_device
+        logical_device_id = parent_device.parent_id
+        assert logical_device_id
+        ports = self.adapter_agent.get_ports(onu_device.id, Port.ETHERNET_UNI)
+        for port in ports:
+            port_id = 'uni-{}'.format(port.port_no)
+            # TODO: move to UniPort
+            self.update_logical_port(logical_device_id, port_id, OFPPS_LIVE)
+
+    # Called just before openomci state machine is started.  These listen for events from selected state machines,
+    # most importantly, mib in sync.  Which ultimately leads to downloading the mib
+    def _subscribe_to_events(self):
+        self.log.debug('function-entry')
+
+        # OMCI MIB Database sync status
+        bus = self._onu_omci_device.event_bus
+        topic = OnuDeviceEntry.event_bus_topic(self.device_id,
+                                               OnuDeviceEvents.MibDatabaseSyncEvent)
+        self._in_sync_subscription = bus.subscribe(topic, self.in_sync_handler)
+
+        # OMCI Capabilities
+        bus = self._onu_omci_device.event_bus
+        topic = OnuDeviceEntry.event_bus_topic(self.device_id,
+                                               OnuDeviceEvents.OmciCapabilitiesEvent)
+        self._capabilities_subscription = bus.subscribe(topic, self.capabilties_handler)
+
+    # Called when the mib is in sync
+    def in_sync_handler(self, _topic, msg):
+        self.log.debug('function-entry', _topic=_topic, msg=msg)
+        if self._in_sync_subscription is not None:
+            try:
+                in_sync = msg[IN_SYNC_KEY]
+
+                if in_sync:
+                    # Only call this once
+                    bus = self._onu_omci_device.event_bus
+                    bus.unsubscribe(self._in_sync_subscription)
+                    self._in_sync_subscription = None
+
+                    # Start up device_info load
+                    self.log.debug('running-mib-sync')
+                    reactor.callLater(0, self._mib_in_sync)
+
+            except Exception as e:
+                self.log.exception('in-sync', e=e)
+
+    def capabilties_handler(self, _topic, _msg):
+        self.log.debug('function-entry', _topic=_topic, msg=_msg)
+        if self._capabilities_subscription is not None:
+            self.log.debug('capabilities-handler-done')
+
+    # Mib is in sync, we can now query what we learned and actually start pushing ME (download) to the ONU.
+    # Currently uses a basic mib download task that create a bridge with a single gem port and uni, only allowing EAP
+    # Implement your own MibDownloadTask if you wish to setup something different by default
+    def _mib_in_sync(self):
+        self.log.debug('function-entry')
+
+        omci = self._onu_omci_device
+        in_sync = omci.mib_db_in_sync
+
+        device = self.adapter_agent.get_device(self.device_id)
+        device.reason = 'discovery-mibsync-complete'
+        self.adapter_agent.update_device(device)
+
+        if not self._dev_info_loaded:
+            self.log.info('loading-device-data-from-mib', in_sync=in_sync, already_loaded=self._dev_info_loaded)
+
+            omci_dev = self._onu_omci_device
+            config = omci_dev.configuration
+
+            # TODO: run this sooner somehow. shouldnt have to wait for mib sync to push an initial download
+            # In Sync, we can register logical ports now. Ideally this could occur on
+            # the first time we received a successful (no timeout) OMCI Rx response.
+            try:
+
+                # sort the lists so we get consistent port ordering.
+                ani_list = sorted(config.ani_g_entities) if config.ani_g_entities else []
+                uni_list = sorted(config.uni_g_entities) if config.uni_g_entities else []
+                pptp_list = sorted(config.pptp_entities) if config.pptp_entities else []
+                veip_list = sorted(config.veip_entities) if config.veip_entities else []
+
+                if ani_list is None or (pptp_list is None and veip_list is None):
+                    device.reason = 'onu-missing-required-elements'
+                    self.log.warn("no-ani-or-unis")
+                    self.adapter_agent.update_device(device)
+                    raise Exception("onu-missing-required-elements")
+
+                # Currently logging the ani, pptp, veip, and uni for information purposes.
+                # Actually act on the veip/pptp as its ME is the most correct one to use in later tasks.
+                # And in some ONU the UNI-G list is incomplete or incorrect...
+                for entity_id in ani_list:
+                    ani_value = config.ani_g_entities[entity_id]
+                    self.log.debug("discovered-ani", entity_id=entity_id, value=ani_value)
+                    # TODO: currently only one OLT PON port/ANI, so this works out.  With NGPON there will be 2..?
+                    self._total_tcont_count = ani_value.get('total-tcont-count')
+                    self.log.debug("set-total-tcont-count", tcont_count=self._total_tcont_count)
+
+                for entity_id in uni_list:
+                    uni_value = config.uni_g_entities[entity_id]
+                    self.log.debug("discovered-uni", entity_id=entity_id, value=uni_value)
+
+                uni_entities = OrderedDict()
+                for entity_id in pptp_list:
+                    pptp_value = config.pptp_entities[entity_id]
+                    self.log.debug("discovered-pptp", entity_id=entity_id, value=pptp_value)
+                    uni_entities[entity_id] = UniType.PPTP
+
+                for entity_id in veip_list:
+                    veip_value = config.veip_entities[entity_id]
+                    self.log.debug("discovered-veip", entity_id=entity_id, value=veip_value)
+                    uni_entities[entity_id] = UniType.VEIP
+
+                uni_id = 0
+                for entity_id, uni_type in uni_entities.iteritems():
+                    try:
+                        self._add_uni_port(entity_id, uni_id, uni_type)
+                        uni_id += 1
+                    except AssertionError as e:
+                        self.log.warn("could not add UNI", entity_id=entity_id, uni_type=uni_type, e=e)
+
+                multi_uni = len(self._unis) > 1
+                for uni_port in self._unis.itervalues():
+                    uni_port.add_logical_port(uni_port.port_number, multi_uni)
+
+                self.adapter_agent.update_device(device)
+
+                self._qos_flexibility = config.qos_configuration_flexibility or 0
+                self._omcc_version = config.omcc_version or OMCCVersion.Unknown
+
+                if self._unis:
+                    self._dev_info_loaded = True
+                else:
+                    device.reason = 'no-usable-unis'
+                    self.adapter_agent.update_device(device)
+                    self.log.warn("no-usable-unis")
+                    raise Exception("no-usable-unis")
+
+            except Exception as e:
+                self.log.exception('device-info-load', e=e)
+                self._deferred = reactor.callLater(_STARTUP_RETRY_WAIT, self._mib_in_sync)
+
+        else:
+            self.log.info('device-info-already-loaded', in_sync=in_sync, already_loaded=self._dev_info_loaded)
+
+        if self._dev_info_loaded:
+            if device.admin_state == AdminState.ENABLED:
+                def success(_results):
+                    self.log.info('mib-download-success', _results=_results)
+                    device = self.adapter_agent.get_device(self.device_id)
+                    device.reason = 'initial-mib-downloaded'
+                    device.oper_status = OperStatus.ACTIVE
+                    device.connect_status = ConnectStatus.REACHABLE
+                    self.enable_ports(device)
+                    self.adapter_agent.update_device(device)
+                    self._mib_download_task = None
+
+                def failure(_reason):
+                    self.log.warn('mib-download-failure-retrying', _reason=_reason)
+                    device.reason = 'initial-mib-download-failure-retrying'
+                    self.adapter_agent.update_device(device)
+                    self._deferred = reactor.callLater(_STARTUP_RETRY_WAIT, self._mib_in_sync)
+
+                # Download an initial mib that creates simple bridge that can pass EAP.  On success (above) finally set
+                # the device to active/reachable.   This then opens up the handler to openflow pushes from outside
+                self.log.info('downloading-initial-mib-configuration')
+                self._mib_download_task = BrcmMibDownloadTask(self.omci_agent, self)
+                self._deferred = self._onu_omci_device.task_runner.queue_task(self._mib_download_task)
+                self._deferred.addCallbacks(success, failure)
+            else:
+                self.log.info('admin-down-disabling')
+                self.disable(device)
+        else:
+            self.log.info('device-info-not-loaded-skipping-mib-download')
+
+
+    def _add_uni_port(self, entity_id, uni_id, uni_type=UniType.PPTP):
+        self.log.debug('function-entry')
+
+        device = self.adapter_agent.get_device(self.device_id)
+        parent_device = self.adapter_agent.get_device(device.parent_id)
+
+        parent_adapter_agent = registry('adapter_loader').get_agent(parent_device.adapter)
+        if parent_adapter_agent is None:
+            self.log.error('parent-adapter-could-not-be-retrieved')
+
+        # TODO: This knowledge is locked away in openolt.  and it assumes one onu equals one uni...
+        parent_device = self.adapter_agent.get_device(device.parent_id)
+        parent_adapter = parent_adapter_agent.adapter.devices[parent_device.id]
+        uni_no = parent_adapter.platform.mk_uni_port_num(
+            self._onu_indication.intf_id, self._onu_indication.onu_id, uni_id)
+
+        # TODO: Some or parts of this likely need to move to UniPort. especially the format stuff
+        uni_name = "uni-{}".format(uni_no)
+
+        mac_bridge_port_num = uni_id + 1 # TODO +1 is only to test non-zero index
+
+        self.log.debug('uni-port-inputs', uni_no=uni_no, uni_id=uni_id, uni_name=uni_name, uni_type=uni_type,
+                       entity_id=entity_id, mac_bridge_port_num=mac_bridge_port_num)
+
+        uni_port = UniPort.create(self, uni_name, uni_id, uni_no, uni_name, uni_type)
+        uni_port.entity_id = entity_id
+        uni_port.enabled = True
+        uni_port.mac_bridge_port_num = mac_bridge_port_num
+
+        self.log.debug("created-uni-port", uni=uni_port)
+
+        self.adapter_agent.add_port(device.id, uni_port.get_port())
+        parent_adapter_agent.add_port(device.parent_id, uni_port.get_port())
+
+        self._unis[uni_port.port_number] = uni_port
+
+        self._onu_omci_device.alarm_synchronizer.set_alarm_params(onu_id=self._onu_indication.onu_id,
+                                                                  uni_ports=self._unis.values())
+        # TODO: this should be in the PonPortclass
+        pon_port = self._pon.get_port()
+
+        # Delete reference to my own UNI as peer from parent.
+        # TODO why is this here, add_port_reference_to_parent already prunes duplicates
+        me_as_peer = Port.PeerPort(device_id=device.parent_id, port_no=uni_port.port_number)
+        partial_pon_port = Port(port_no=pon_port.port_no, label=pon_port.label,
+                                type=pon_port.type, admin_state=pon_port.admin_state,
+                                oper_status=pon_port.oper_status,
+                                peers=[me_as_peer]) # only list myself as a peer to avoid deleting all other UNIs from parent
+        self.adapter_agent.delete_port_reference_from_parent(self.device_id, partial_pon_port)
+
+        pon_port.peers.extend([me_as_peer])
+
+        self._pon._port = pon_port
+
+        self.adapter_agent.add_port_reference_to_parent(self.device_id,
+                                                        pon_port)
diff --git a/python/adapters/brcm_openomci_onu/heartbeat.py b/python/adapters/brcm_openomci_onu/heartbeat.py
new file mode 100644
index 0000000..4a7ab1f
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/heartbeat.py
@@ -0,0 +1,179 @@
+# Copyright 2017-present Adtran, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from twisted.internet import reactor
+from voltha.protos.common_pb2 import OperStatus, ConnectStatus
+from voltha.extensions.omci.omci_me import OntGFrame
+
+
+class HeartBeat(object):
+    """Wraps health-check support for ONU"""
+    INITIAL_DELAY = 60                      # Delay after start until first check
+    TICK_DELAY = 2                          # Heartbeat interval
+
+    def __init__(self, handler, device_id):
+        self.log = structlog.get_logger(device_id=device_id)
+        self._enabled = False
+        self._handler = handler
+        self._device_id = device_id
+        self._defer = None
+        self._alarm_active = False
+        self._heartbeat_count = 0
+        self._heartbeat_miss = 0
+        self._alarms_raised_count = 0
+        self.heartbeat_failed_limit = 5
+        self.heartbeat_last_reason = ''
+        self.heartbeat_interval = self.TICK_DELAY
+
+    def __str__(self):
+        return "HeartBeat: count:{}, miss: {}".format(self._heartbeat_count,
+                                                      self._heartbeat_miss)
+
+    @staticmethod
+    def create(handler, device_id):
+        return HeartBeat(handler, device_id)
+
+    def _start(self, delay=INITIAL_DELAY):
+        self._defer = reactor.callLater(delay, self.check_pulse)
+
+    def _stop(self):
+        d, self._defeered = self._defeered, None
+        if d is not None and not d.called():
+            d.cancel()
+
+    @property
+    def enabled(self):
+        return self._enabled
+
+    @enabled.setter
+    def enabled(self, value):
+        if self._enabled != value:
+            self._enabled = value
+
+            # if value:
+            #     self._start()
+            # else:
+            #     self._stop()
+
+    @property
+    def check_item(self):
+        return 'vendor_id'
+
+    @property
+    def check_value(self):
+        # device = self._handler.adapter_agent.get_device(self._device_id)
+        # return device.serial_number
+        return 'ADTN'
+
+    @property
+    def alarm_active(self):
+        return self._alarm_active
+
+    @property
+    def heartbeat_count(self):
+        return self._heartbeat_count
+
+    @property
+    def heartbeat_miss(self):
+        return self._heartbeat_miss
+
+    @property
+    def alarms_raised_count(self):
+        return self._alarms_raised_count
+
+    def check_pulse(self):
+        if self.enabled:
+            try:
+                self._defer = self._handler.openomci.omci_cc.send(OntGFrame(self.check_item).get())
+                self._defer.addCallbacks(self._heartbeat_success, self._heartbeat_fail)
+
+            except Exception as e:
+                self._defer = reactor.callLater(5, self._heartbeat_fail, e)
+
+    def _heartbeat_success(self, results):
+        self.log.debug('heartbeat-success')
+
+        try:
+            omci_response = results.getfieldval("omci_message")
+            data = omci_response.getfieldval("data")
+            value = data[self.check_item]
+
+            if value != self.check_value:
+                self._heartbeat_miss = self.heartbeat_failed_limit
+                self.heartbeat_last_reason = "Invalid {}, got '{}' but expected '{}'".\
+                    format(self.check_item, value, self.check_value)
+            else:
+                self._heartbeat_miss = 0
+                self.heartbeat_last_reason = ''
+
+        except Exception as e:
+            self._heartbeat_miss = self.heartbeat_failed_limit
+            self.heartbeat_last_reason = e.message
+
+        self.heartbeat_check_status(results)
+
+    def _heartbeat_fail(self, failure):
+        self._heartbeat_miss += 1
+        self.log.info('heartbeat-miss', failure=failure,
+                      count=self._heartbeat_count,
+                      miss=self._heartbeat_miss)
+        self.heartbeat_last_reason = 'OMCI connectivity error'
+        self.heartbeat_check_status(None)
+
+    def on_heartbeat_alarm(self, active):
+        # TODO: Do something here ?
+        #
+        #  TODO: If failed (active = true) due to bad serial-number shut off the UNI port?
+        pass
+
+    def heartbeat_check_status(self, results):
+        """
+        Check the number of heartbeat failures against the limit and emit an alarm if needed
+        """
+        device = self._handler.adapter_agent.get_device(self._device_id)
+
+        try:
+            from voltha.extensions.alarms.heartbeat_alarm import HeartbeatAlarm
+
+            if self._heartbeat_miss >= self.heartbeat_failed_limit:
+                if device.connect_status == ConnectStatus.REACHABLE:
+                    self.log.warning('heartbeat-failed', count=self._heartbeat_miss)
+                    device.connect_status = ConnectStatus.UNREACHABLE
+                    device.oper_status = OperStatus.FAILED
+                    device.reason = self.heartbeat_last_reason
+                    self._handler.adapter_agent.update_device(device)
+                    HeartbeatAlarm(self._handler.alarms, 'onu', self._heartbeat_miss).raise_alarm()
+                    self._alarm_active = True
+                    self.on_heartbeat_alarm(True)
+            else:
+                # Update device states
+                if device.connect_status != ConnectStatus.REACHABLE and self._alarm_active:
+                    device.connect_status = ConnectStatus.REACHABLE
+                    device.oper_status = OperStatus.ACTIVE
+                    device.reason = ''
+                    self._handler.adapter_agent.update_device(device)
+                    HeartbeatAlarm(self._handler.alarms, 'onu').clear_alarm()
+
+                    self._alarm_active = False
+                    self._alarms_raised_count += 1
+                    self.on_heartbeat_alarm(False)
+
+        except Exception as e:
+            self.log.exception('heartbeat-check', e=e)
+
+        # Reschedule next heartbeat
+        if self.enabled:
+            self._heartbeat_count += 1
+            self._defer = reactor.callLater(self.heartbeat_interval, self.check_pulse)
diff --git a/python/adapters/brcm_openomci_onu/main.py b/python/adapters/brcm_openomci_onu/main.py
new file mode 100755
index 0000000..ed1d15f
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/main.py
@@ -0,0 +1,489 @@
+#!/usr/bin/env python
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+"""OpenONU Adapter main entry point"""
+
+import argparse
+import os
+import time
+
+import arrow
+import yaml
+from packaging.version import Version
+from simplejson import dumps
+from twisted.internet.defer import inlineCallbacks, returnValue
+from twisted.internet.task import LoopingCall
+from zope.interface import implementer
+
+from common.structlog_setup import setup_logging, update_logging
+from common.utils.asleep import asleep
+from common.utils.deferred_utils import TimeOutError
+from common.utils.dockerhelpers import get_my_containers_name
+from common.utils.nethelpers import get_my_primary_local_ipv4, \
+    get_my_primary_interface
+from voltha.core.registry import registry, IComponent
+from kafka.adapter_proxy import AdapterProxy
+from kafka.adapter_request_facade import AdapterRequestFacade
+from kafka.core_proxy import CoreProxy
+from kafka.kafka_inter_container_library import IKafkaMessagingProxy, \
+    get_messaging_proxy
+from kafka.kafka_proxy import KafkaProxy, get_kafka_proxy
+from brcm_openomci_onu import BrcmOpenomciOnuAdapter
+from voltha.protos import third_party
+from voltha.protos.adapter_pb2 import AdapterConfig
+
+_ = third_party
+
+defs = dict(
+    version_file='./VERSION',
+    config=os.environ.get('CONFIG', './openonu.yml'),
+    container_name_regex=os.environ.get('CONTAINER_NUMBER_EXTRACTOR', '^.*\.(['
+                                                                      '0-9]+)\..*$'),
+    consul=os.environ.get('CONSUL', 'localhost:8500'),
+    name=os.environ.get('NAME', 'openonu'),
+    vendor=os.environ.get('VENDOR', 'Voltha Project'),
+    device_type=os.environ.get('DEVICE_TYPE', 'openonu'),
+    accept_bulk_flow=os.environ.get('ACCEPT_BULK_FLOW', True),
+    accept_atomic_flow=os.environ.get('ACCEPT_ATOMIC_FLOW', True),
+    etcd=os.environ.get('ETCD', 'localhost:2379'),
+    core_topic=os.environ.get('CORE_TOPIC', 'rwcore'),
+    interface=os.environ.get('INTERFACE', get_my_primary_interface()),
+    instance_id=os.environ.get('INSTANCE_ID', os.environ.get('HOSTNAME', '1')),
+    kafka_adapter=os.environ.get('KAFKA_ADAPTER', '192.168.0.20:9092'),
+    kafka_cluster=os.environ.get('KAFKA_CLUSTER', '10.100.198.220:9092'),
+    backend=os.environ.get('BACKEND', 'none'),
+    retry_interval=os.environ.get('RETRY_INTERVAL', 2),
+    heartbeat_topic=os.environ.get('HEARTBEAT_TOPIC', "adapters.heartbeat"),
+)
+
+
+def parse_args():
+    parser = argparse.ArgumentParser()
+
+    _help = ('Path to openonu.yml config file (default: %s). '
+             'If relative, it is relative to main.py of openonu adapter.'
+             % defs['config'])
+    parser.add_argument('-c', '--config',
+                        dest='config',
+                        action='store',
+                        default=defs['config'],
+                        help=_help)
+
+    _help = 'Regular expression for extracting conatiner number from ' \
+            'container name (default: %s)' % defs['container_name_regex']
+    parser.add_argument('-X', '--container-number-extractor',
+                        dest='container_name_regex',
+                        action='store',
+                        default=defs['container_name_regex'],
+                        help=_help)
+
+    _help = '<hostname>:<port> to consul agent (default: %s)' % defs['consul']
+    parser.add_argument('-C', '--consul',
+                        dest='consul',
+                        action='store',
+                        default=defs['consul'],
+                        help=_help)
+
+    _help = 'name of this adapter (default: %s)' % defs['name']
+    parser.add_argument('-na', '--name',
+                        dest='name',
+                        action='store',
+                        default=defs['name'],
+                        help=_help)
+
+    _help = 'vendor of this adapter (default: %s)' % defs['vendor']
+    parser.add_argument('-ven', '--vendor',
+                        dest='vendor',
+                        action='store',
+                        default=defs['vendor'],
+                        help=_help)
+
+    _help = 'supported device type of this adapter (default: %s)' % defs[
+        'device_type']
+    parser.add_argument('-dt', '--device_type',
+                        dest='device_type',
+                        action='store',
+                        default=defs['device_type'],
+                        help=_help)
+
+    _help = 'specifies whether the device type accepts bulk flow updates ' \
+            'adapter (default: %s)' % defs['accept_bulk_flow']
+    parser.add_argument('-abf', '--accept_bulk_flow',
+                        dest='accept_bulk_flow',
+                        action='store',
+                        default=defs['accept_bulk_flow'],
+                        help=_help)
+
+    _help = 'specifies whether the device type accepts add/remove flow ' \
+            '(default: %s)' % defs['accept_atomic_flow']
+    parser.add_argument('-aaf', '--accept_atomic_flow',
+                        dest='accept_atomic_flow',
+                        action='store',
+                        default=defs['accept_atomic_flow'],
+                        help=_help)
+
+    _help = '<hostname>:<port> to etcd server (default: %s)' % defs['etcd']
+    parser.add_argument('-e', '--etcd',
+                        dest='etcd',
+                        action='store',
+                        default=defs['etcd'],
+                        help=_help)
+
+    _help = ('unique string id of this container instance (default: %s)'
+             % defs['instance_id'])
+    parser.add_argument('-i', '--instance-id',
+                        dest='instance_id',
+                        action='store',
+                        default=defs['instance_id'],
+                        help=_help)
+
+    _help = 'ETH interface to recieve (default: %s)' % defs['interface']
+    parser.add_argument('-I', '--interface',
+                        dest='interface',
+                        action='store',
+                        default=defs['interface'],
+                        help=_help)
+
+    _help = 'omit startup banner log lines'
+    parser.add_argument('-n', '--no-banner',
+                        dest='no_banner',
+                        action='store_true',
+                        default=False,
+                        help=_help)
+
+    _help = 'do not emit periodic heartbeat log messages'
+    parser.add_argument('-N', '--no-heartbeat',
+                        dest='no_heartbeat',
+                        action='store_true',
+                        default=False,
+                        help=_help)
+
+    _help = "suppress debug and info logs"
+    parser.add_argument('-q', '--quiet',
+                        dest='quiet',
+                        action='count',
+                        help=_help)
+
+    _help = 'enable verbose logging'
+    parser.add_argument('-v', '--verbose',
+                        dest='verbose',
+                        action='count',
+                        help=_help)
+
+    _help = ('use docker container name as conatiner instance id'
+             ' (overrides -i/--instance-id option)')
+    parser.add_argument('--instance-id-is-container-name',
+                        dest='instance_id_is_container_name',
+                        action='store_true',
+                        default=False,
+                        help=_help)
+
+    _help = ('<hostname>:<port> of the kafka adapter broker (default: %s). ('
+             'If not '
+             'specified (None), the address from the config file is used'
+             % defs['kafka_adapter'])
+    parser.add_argument('-KA', '--kafka_adapter',
+                        dest='kafka_adapter',
+                        action='store',
+                        default=defs['kafka_adapter'],
+                        help=_help)
+
+    _help = ('<hostname>:<port> of the kafka cluster broker (default: %s). ('
+             'If not '
+             'specified (None), the address from the config file is used'
+             % defs['kafka_cluster'])
+    parser.add_argument('-KC', '--kafka_cluster',
+                        dest='kafka_cluster',
+                        action='store',
+                        default=defs['kafka_cluster'],
+                        help=_help)
+
+    _help = 'backend to use for config persitence'
+    parser.add_argument('-b', '--backend',
+                        default=defs['backend'],
+                        choices=['none', 'consul', 'etcd'],
+                        help=_help)
+
+    _help = 'topic of core on the kafka bus'
+    parser.add_argument('-ct', '--core_topic',
+                        dest='core_topic',
+                        action='store',
+                        default=defs['core_topic'],
+                        help=_help)
+
+    args = parser.parse_args()
+
+    # post-processing
+
+    if args.instance_id_is_container_name:
+        args.instance_id = get_my_containers_name()
+
+    return args
+
+
+def load_config(args):
+    path = args.config
+    if path.startswith('.'):
+        dir = os.path.dirname(os.path.abspath(__file__))
+        path = os.path.join(dir, path)
+    path = os.path.abspath(path)
+    with open(path) as fd:
+        config = yaml.load(fd)
+    return config
+
+
+def print_banner(log):
+   log.info('                                                    ')
+   log.info('               OpenOnu Adapter                      ')
+   log.info('                                                    ')
+   log.info('(to stop: press Ctrl-C)')
+
+
+@implementer(IComponent)
+class Main(object):
+
+    def __init__(self):
+
+        self.args = args = parse_args()
+        self.config = load_config(args)
+
+        verbosity_adjust = (args.verbose or 0) - (args.quiet or 0)
+        self.log = setup_logging(self.config.get('logging', {}),
+                                 args.instance_id,
+                                 verbosity_adjust=verbosity_adjust)
+        self.log.info('container-number-extractor',
+                      regex=args.container_name_regex)
+
+        self.adapter_version = self.get_version()
+        self.log.info('OpenONU-Adapter-Version', version=
+        self.adapter_version)
+
+        if not args.no_banner:
+            print_banner(self.log)
+
+        self.adapter = None
+        # Create a unique instance id using the passed-in instance id and
+        # UTC timestamp
+        current_time = arrow.utcnow().timestamp
+        self.instance_id = self.args.instance_id + '_' + str(current_time)
+
+        self.core_topic = args.core_topic
+        self.listening_topic = args.name
+        self.startup_components()
+
+        if not args.no_heartbeat:
+            self.start_heartbeat()
+            self.start_kafka_cluster_heartbeat(self.instance_id)
+
+    def get_version(self):
+        path = defs['version_file']
+        if not path.startswith('/'):
+            dir = os.path.dirname(os.path.abspath(__file__))
+            path = os.path.join(dir, path)
+
+        path = os.path.abspath(path)
+        version_file = open(path, 'r')
+        v = version_file.read()
+
+        # Use Version to validate the version string - exception will be raised
+        # if the version is invalid
+        Version(v)
+
+        version_file.close()
+        return v
+
+    def start(self):
+        self.start_reactor()  # will not return except Keyboard interrupt
+
+    def stop(self):
+        pass
+
+    def get_args(self):
+        """Allow access to command line args"""
+        return self.args
+
+    def get_config(self):
+        """Allow access to content of config file"""
+        return self.config
+
+    def _get_adapter_config(self):
+        cfg = AdapterConfig()
+        return cfg
+
+    @inlineCallbacks
+    def startup_components(self):
+        try:
+            self.log.info('starting-internal-components',
+                          consul=self.args.consul,
+                          etcd=self.args.etcd)
+
+            registry.register('main', self)
+
+            # Update the logger to output the vcore id.
+            self.log = update_logging(instance_id=self.instance_id,
+                                      vcore_id=None)
+
+            yield registry.register(
+                'kafka_cluster_proxy',
+                KafkaProxy(
+                    self.args.consul,
+                    self.args.kafka_cluster,
+                    config=self.config.get('kafka-cluster-proxy', {})
+                )
+            ).start()
+
+            config = self._get_adapter_config()
+
+            self.core_proxy = CoreProxy(
+                kafka_proxy=None,
+                core_topic=self.core_topic,
+                my_listening_topic=self.listening_topic)
+
+            self.adapter_proxy = AdapterProxy(
+                kafka_proxy=None,
+                core_topic=self.core_topic,
+                my_listening_topic=self.listening_topic)
+
+            self.adapter = BrcmOpenomciOnuAdapter(
+                core_proxy=self.core_proxy, adapter_proxy=self.adapter_proxy,
+                config=config)
+            openonu_request_handler = AdapterRequestFacade(
+                adapter=self.adapter)
+
+            yield registry.register(
+                'kafka_adapter_proxy',
+                IKafkaMessagingProxy(
+                    kafka_host_port=self.args.kafka_adapter,
+                    # TODO: Add KV Store object reference
+                    kv_store=self.args.backend,
+                    default_topic=self.args.name,
+                    group_id_prefix=self.args.instance_id,
+                    target_cls=openonu_request_handler
+                )
+            ).start()
+
+            self.core_proxy.kafka_proxy = get_messaging_proxy()
+            self.adapter_proxy.kafka_proxy = get_messaging_proxy()
+
+            # retry for ever
+            res = yield self._register_with_core(-1)
+
+            self.log.info('started-internal-services')
+
+        except Exception as e:
+            self.log.exception('Failure-to-start-all-components', e=e)
+
+    @inlineCallbacks
+    def shutdown_components(self):
+        """Execute before the reactor is shut down"""
+        self.log.info('exiting-on-keyboard-interrupt')
+        for component in reversed(registry.iterate()):
+            yield component.stop()
+
+        import threading
+        self.log.info('THREADS:')
+        main_thread = threading.current_thread()
+        for t in threading.enumerate():
+            if t is main_thread:
+                continue
+            if not t.isDaemon():
+                continue
+            self.log.info('joining thread {} {}'.format(
+                t.getName(), "daemon" if t.isDaemon() else "not-daemon"))
+            t.join()
+
+    def start_reactor(self):
+        from twisted.internet import reactor
+        reactor.callWhenRunning(
+            lambda: self.log.info('twisted-reactor-started'))
+        reactor.addSystemEventTrigger('before', 'shutdown',
+                                      self.shutdown_components)
+        reactor.run()
+
+    @inlineCallbacks
+    def _register_with_core(self, retries):
+        while 1:
+            try:
+                resp = yield self.core_proxy.register(
+                    self.adapter.adapter_descriptor(),
+                    self.adapter.device_types())
+                if resp:
+                    self.log.info('registered-with-core',
+                                  coreId=resp.instance_id)
+
+                returnValue(resp)
+            except TimeOutError as e:
+                self.log.warn("timeout-when-registering-with-core", e=e)
+                if retries == 0:
+                    self.log.exception("no-more-retries", e=e)
+                    raise
+                else:
+                    retries = retries if retries < 0 else retries - 1
+                    yield asleep(defs['retry_interval'])
+            except Exception as e:
+                self.log.exception("failed-registration", e=e)
+                raise
+
+    def start_heartbeat(self):
+
+        t0 = time.time()
+        t0s = time.ctime(t0)
+
+        def heartbeat():
+            self.log.debug(status='up', since=t0s, uptime=time.time() - t0)
+
+        lc = LoopingCall(heartbeat)
+        lc.start(10)
+
+    # Temporary function to send a heartbeat message to the external kafka
+    # broker
+    def start_kafka_cluster_heartbeat(self, instance_id):
+        # For heartbeat we will send a message to a specific "voltha-heartbeat"
+        #  topic.  The message is a protocol buf
+        # message
+        message = dict(
+            type='heartbeat',
+            adapter=self.args.name,
+            instance=instance_id,
+            ip=get_my_primary_local_ipv4()
+        )
+        topic = defs['heartbeat_topic']
+
+        def send_msg(start_time):
+            try:
+                kafka_cluster_proxy = get_kafka_proxy()
+                if kafka_cluster_proxy and not kafka_cluster_proxy.is_faulty():
+                    # self.log.debug('kafka-proxy-available')
+                    message['ts'] = arrow.utcnow().timestamp
+                    message['uptime'] = time.time() - start_time
+                    # self.log.debug('start-kafka-heartbeat')
+                    kafka_cluster_proxy.send_message(topic, dumps(message))
+                else:
+                    self.log.error('kafka-proxy-unavailable')
+            except Exception, e:
+                self.log.exception('failed-sending-message-heartbeat', e=e)
+
+        try:
+            t0 = time.time()
+            lc = LoopingCall(send_msg, t0)
+            lc.start(10)
+        except Exception, e:
+            self.log.exception('failed-kafka-heartbeat', e=e)
+
+
+if __name__ == '__main__':
+    Main().start()
diff --git a/python/adapters/brcm_openomci_onu/omci/__init__.py b/python/adapters/brcm_openomci_onu/omci/__init__.py
new file mode 100644
index 0000000..b0fb0b2
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/__init__.py
@@ -0,0 +1,13 @@
+# Copyright 2017-present Open Networking Foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py
new file mode 100644
index 0000000..6bf5b93
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py
@@ -0,0 +1,155 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from voltha.extensions.omci.tasks.onu_capabilities_task import OnuCapabilitiesTask
+from twisted.internet.defer import failure
+
+
+class BrcmCapabilitiesTask(OnuCapabilitiesTask):
+    """
+    OpenOMCI MIB Capabilities Task - BROADCOM ONUs
+
+    This task requests information on supported MEs via the OMCI (ME#287)
+    Managed entity.
+
+    This task should be ran after MIB Synchronization and before any MIB
+    Downloads to the ONU.
+
+    Upon completion, the Task deferred callback is invoked with dictionary
+    containing the supported managed entities and message types.
+
+    results = {
+                'supported-managed-entities': {set of supported managed entities},
+                'supported-message-types': {set of supported message types}
+              }
+    """
+    def __init__(self, omci_agent, device_id):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        self.log = structlog.get_logger(device_id=device_id)
+        self.log.debug('function-entry')
+
+        super(BrcmCapabilitiesTask, self).__init__(omci_agent, device_id)
+        self._omci_managed = False      # TODO: Look up capabilities/model number
+
+    @property
+    def supported_managed_entities(self):
+        """
+        Return a set of the Managed Entity class IDs supported on this ONU
+
+        None is returned if not MEs have been discovered
+
+        :return: (set of ints)
+        """
+        self.log.debug('function-entry')
+
+        if self._omci_managed:
+            return super(BrcmCapabilitiesTask, self).supported_managed_entities
+
+        # TODO: figure out why broadcom wont answer for ME 287 to get this.  otherwise manually fill in
+        me_1287800f1 = [
+            2, 5, 6, 7, 11, 24, 45, 46, 47, 48, 49, 50, 51, 52, 78, 79, 84, 89, 130,
+            131, 133, 134, 135, 136, 137, 148, 157, 158, 159, 162, 163, 164, 171, 240,
+            241, 242, 256, 257, 262, 263, 264, 266, 268, 272, 273, 274, 276, 277, 278,
+            279, 280, 281, 287, 296, 297, 298, 307, 308, 309, 310, 311, 312, 321, 322,
+            329, 330, 332, 334, 336, 340, 341, 342, 343, 347, 348, 425, 426
+        ]
+        return frozenset(list(me_1287800f1))
+
+    @property
+    def supported_message_types(self):
+        """
+        Return a set of the Message Types supported on this ONU
+
+        None is returned if no message types have been discovered
+
+        :return: (set of EntityOperations)
+        """
+        self.log.debug('function-entry')
+
+        if self._omci_managed:
+            return super(BrcmCapabilitiesTask, self).supported_message_types
+
+        # TODO: figure out why broadcom wont answer for ME 287 to get this.  otherwise manually fill in
+        from voltha.extensions.omci.omci_entities import EntityOperations
+        op_11287800f1 = [
+            EntityOperations.Create,
+            EntityOperations.CreateComplete,
+            EntityOperations.Delete,
+            EntityOperations.Set,
+            EntityOperations.Get,
+            EntityOperations.GetComplete,
+            EntityOperations.GetAllAlarms,
+            EntityOperations.GetAllAlarmsNext,
+            EntityOperations.MibUpload,
+            EntityOperations.MibUploadNext,
+            EntityOperations.MibReset,
+            EntityOperations.AlarmNotification,
+            EntityOperations.AttributeValueChange,
+            EntityOperations.Test,
+            EntityOperations.StartSoftwareDownload,
+            EntityOperations.DownloadSection,
+            EntityOperations.EndSoftwareDownload,
+            EntityOperations.ActivateSoftware,
+            EntityOperations.CommitSoftware,
+            EntityOperations.SynchronizeTime,
+            EntityOperations.Reboot,
+            EntityOperations.GetNext,
+        ]
+        return frozenset(op_11287800f1)
+
+    def perform_get_capabilities(self):
+        """
+        Perform the MIB Capabilities sequence.
+
+        The sequence is to perform a Get request with the attribute mask equal
+        to 'me_type_table'.  The response to this request will carry the size
+        of (number of get-next sequences).
+
+        Then a loop is entered and get-next commands are sent for each sequence
+        requested.
+        """
+        self.log.debug('function-entry')
+
+        self.log.info('perform-get')
+
+        if self._omci_managed:
+            # Return generator deferred/results
+            return super(BrcmCapabilitiesTask, self).perform_get_capabilities()
+
+        # Fixed values, no need to query
+        try:
+            self._supported_entities = self.supported_managed_entities
+            self._supported_msg_types = self.supported_message_types
+
+            self.log.debug('get-success',
+                           supported_entities=self.supported_managed_entities,
+                           supported_msg_types=self.supported_message_types)
+            results = {
+                'supported-managed-entities': self.supported_managed_entities,
+                'supported-message-types': self.supported_message_types
+            }
+            self.deferred.callback(results)
+
+        except Exception as e:
+            self.log.exception('get-failed', e=e)
+            self.deferred.errback(failure.Failure(e))
+
+
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_get_mds_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_get_mds_task.py
new file mode 100644
index 0000000..eabf356
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_get_mds_task.py
@@ -0,0 +1,61 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from voltha.extensions.omci.tasks.get_mds_task import GetMdsTask
+
+
+class BrcmGetMdsTask(GetMdsTask):
+    """
+    OpenOMCI Get MIB Data Sync value task - Broadcom ONU
+
+    On successful completion, this task will call the 'callback' method of the
+    deferred returned by the start method and return the value of the MIB
+    Data Sync attribute of the ONT Data ME
+    """
+    name = "BRCM: Get MDS Task"
+
+    def __init__(self, omci_agent, device_id):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        self.log = structlog.get_logger(device_id=device_id)
+        self.log.debug('function-entry')
+
+        super(BrcmGetMdsTask, self).__init__(omci_agent, device_id)
+
+        self.name = BrcmGetMdsTask.name
+        self._device = omci_agent.get_device(device_id)
+        self._omci_managed = False      # TODO: Look up capabilities/model number/check handler
+
+    def perform_get_mds(self):
+        """
+        Get the 'mib_data_sync' attribute of the ONU
+        """
+        self.log.debug('function-entry')
+        self.log.info('perform-get-mds')
+
+        if self._omci_managed:
+            return super(BrcmGetMdsTask, self).perform_get_mds()
+
+        # Non-OMCI managed BRCM ONUs always return 0 for MDS, use the MIB
+        # sync value and depend on an accelerated mib resync to do the
+        # proper comparison
+
+        self.deferred.callback(self._device.mib_synchronizer.mib_data_sync)
+
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
new file mode 100644
index 0000000..3341219
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
@@ -0,0 +1,449 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from common.frameio.frameio import hexify
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError, failure
+from voltha.extensions.omci.omci_me import *
+from voltha.extensions.omci.tasks.task import Task
+from voltha.extensions.omci.omci_defs import *
+from voltha.adapters.brcm_openomci_onu.uni_port import *
+from voltha.adapters.brcm_openomci_onu.pon_port \
+    import BRDCM_DEFAULT_VLAN, TASK_PRIORITY, DEFAULT_TPID, DEFAULT_GEM_PAYLOAD
+
+OP = EntityOperations
+RC = ReasonCodes
+
+
+class MibDownloadFailure(Exception):
+    """
+    This error is raised by default when the download fails
+    """
+
+
+class MibResourcesFailure(Exception):
+    """
+    This error is raised by when one or more resources required is not available
+    """
+
+
+class BrcmMibDownloadTask(Task):
+    """
+    OpenOMCI MIB Download Example
+
+    This task takes the legacy OMCI 'script' for provisioning the Broadcom ONU
+    and converts it to run as a Task on the OpenOMCI Task runner.  This is
+    in order to begin to decompose service instantiation in preparation for
+    Technology Profile work.
+
+    Once technology profiles are ready, some of this task may hang around or
+    be moved into OpenOMCI if there are any very common settings/configs to do
+    for any profile that may be provided in the v2.0 release
+
+    Currently, the only service tech profiles expected by v2.0 will be for AT&T
+    residential data service and DT residential data service.
+    """
+
+    name = "Broadcom MIB Download Example Task"
+
+    def __init__(self, omci_agent, handler):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+
+        self.log = structlog.get_logger(device_id=handler.device_id)
+        self.log.debug('function-entry')
+
+        super(BrcmMibDownloadTask, self).__init__(BrcmMibDownloadTask.name,
+                                                  omci_agent,
+                                                  handler.device_id,
+                                                  priority=TASK_PRIORITY)
+        self._handler = handler
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+
+        # Frame size
+        self._max_gem_payload = DEFAULT_GEM_PAYLOAD
+
+        self._pon = handler.pon_port
+
+        # Defaults
+        self._input_tpid = DEFAULT_TPID
+        self._output_tpid = DEFAULT_TPID
+
+        self._vlan_tcis_1 = BRDCM_DEFAULT_VLAN
+        self._cvid = BRDCM_DEFAULT_VLAN
+        self._vlan_config_entity_id = self._vlan_tcis_1
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+
+        self._mac_bridge_service_profile_entity_id = \
+            self._handler.mac_bridge_service_profile_entity_id
+        self._ieee_mapper_service_profile_entity_id = \
+            self._pon.ieee_mapper_service_profile_entity_id
+        self._mac_bridge_port_ani_entity_id = \
+            self._pon.mac_bridge_port_ani_entity_id
+        self._gal_enet_profile_entity_id = \
+            self._handler.gal_enet_profile_entity_id
+
+        self._free_ul_prior_q_entity_ids = set()
+        self._free_dl_prior_q_entity_ids = set()
+
+    def cancel_deferred(self):
+        self.log.debug('function-entry')
+        super(BrcmMibDownloadTask, self).cancel_deferred()
+
+        d, self._local_deferred = self._local_deferred, None
+        try:
+            if d is not None and not d.called:
+                d.cancel()
+        except:
+            pass
+
+    def start(self):
+        """
+        Start the MIB Download
+        """
+        self.log.debug('function-entry')
+        super(BrcmMibDownloadTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_mib_download)
+
+    def stop(self):
+        """
+        Shutdown MIB Synchronization tasks
+        """
+        self.log.debug('function-entry')
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(BrcmMibDownloadTask, self).stop()
+
+    def check_status_and_state(self, results, operation=''):
+        """
+        Check the results of an OMCI response.  An exception is thrown
+        if the task was cancelled or an error was detected.
+
+        :param results: (OmciFrame) OMCI Response frame
+        :param operation: (str) what operation was being performed
+        :return: True if successful, False if the entity existed (already created)
+        """
+        self.log.debug('function-entry')
+
+        omci_msg = results.fields['omci_message'].fields
+        status = omci_msg['success_code']
+        error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
+        failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
+        unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
+
+        self.log.debug("OMCI Result: %s", operation,
+                       omci_msg=omci_msg, status=status,
+                       error_mask=error_mask, failed_mask=failed_mask,
+                       unsupported_mask=unsupported_mask)
+
+        if status == RC.Success:
+            self.strobe_watchdog()
+            return True
+
+        elif status == RC.InstanceExists:
+            return False
+
+        raise MibDownloadFailure('{} failed with a status of {}, error_mask: {}, failed_mask: {}, unsupported_mask: {}'
+                                 .format(operation, status, error_mask, failed_mask, unsupported_mask))
+
+    @inlineCallbacks
+    def perform_mib_download(self):
+        """
+        Send the commands to minimally configure the PON, Bridge, and
+        UNI ports for this device. The application of any service flows
+        and other characteristics are done as needed.
+        """
+        try:
+            self.log.debug('function-entry')
+            self.log.info('perform-download')
+
+            device = self._handler.adapter_agent.get_device(self.device_id)
+
+            if self._handler.enabled and len(self._handler.uni_ports) > 0:
+                device.reason = 'performing-initial-mib-download'
+                self._handler.adapter_agent.update_device(device)
+
+            try:
+                # Lock the UNI ports to prevent any alarms during initial configuration
+                # of the ONU
+                self.strobe_watchdog()
+
+                # Provision the initial bridge configuration
+                yield self.perform_initial_bridge_setup()
+
+                for uni_port in self._handler.uni_ports:
+                    yield self.enable_uni(uni_port, True)
+
+                    # Provision the initial bridge configuration
+                    yield self.perform_uni_initial_bridge_setup(uni_port)
+
+                    # And re-enable the UNIs if needed
+                    yield self.enable_uni(uni_port, False)
+
+                self.deferred.callback('initial-download-success')
+
+            except TimeoutError as e:
+                self.log.error('initial-download-failure', e=e)
+                self.deferred.errback(failure.Failure(e))
+
+            except Exception as e:
+                self.log.exception('initial-download-failure', e=e)
+                self.deferred.errback(failure.Failure(e))
+
+            else:
+                e = MibResourcesFailure('Required resources are not available',
+                                        len(self._handler.uni_ports))
+                self.deferred.errback(failure.Failure(e))
+        except BaseException as e:
+            self.log.debug('@thyy_mib_check:', exception=e)
+
+    @inlineCallbacks
+    def perform_initial_bridge_setup(self):
+        self.log.debug('function-entry')
+
+        omci_cc = self._onu_device.omci_cc
+        # TODO: too many magic numbers
+
+        try:
+            ########################################################################################
+            # Create GalEthernetProfile - Once per ONU/PON interface
+            #
+            #  EntityID will be referenced by:
+            #            - GemInterworkingTp
+            #  References:
+            #            - Nothing
+
+            msg = GalEthernetProfileFrame(
+                self._gal_enet_profile_entity_id,
+                max_gem_payload_size=self._max_gem_payload
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-gal-ethernet-profile')
+
+        except TimeoutError as e:
+            self.log.warn('rx-timeout-0', e=e)
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-setup-0', e=e)
+            raise
+
+        returnValue(None)
+
+    @inlineCallbacks
+    def perform_uni_initial_bridge_setup(self, uni_port):
+        self.log.debug('function-entry')
+        omci_cc = self._onu_device.omci_cc
+        frame = None
+        try:
+            ################################################################################
+            # Common - PON and/or UNI                                                      #
+            ################################################################################
+            # MAC Bridge Service Profile
+            #
+            #  EntityID will be referenced by:
+            #            - MAC Bridge Port Configuration Data (PON & UNI)
+            #  References:
+            #            - Nothing
+
+            # TODO: magic. event if static, assign to a meaningful variable name
+            attributes = {
+                'spanning_tree_ind': False,
+                'learning_ind': True,
+                'priority': 0x8000,
+                'max_age': 20 * 256,
+                'hello_time': 2 * 256,
+                'forward_delay': 15 * 256,
+                'unknown_mac_address_discard': True
+            }
+            msg = MacBridgeServiceProfileFrame(
+                self._mac_bridge_service_profile_entity_id + uni_port.mac_bridge_port_num,
+                attributes
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-mac-bridge-service-profile')
+
+            ################################################################################
+            # PON Specific                                                                 #
+            ################################################################################
+            # IEEE 802.1 Mapper Service config - Once per PON
+            #
+            #  EntityID will be referenced by:
+            #            - MAC Bridge Port Configuration Data for the PON port
+            #  References:
+            #            - Nothing at this point. When a GEM port is created, this entity will
+            #              be updated to reference the GEM Interworking TP
+
+            msg = Ieee8021pMapperServiceProfileFrame(self._ieee_mapper_service_profile_entity_id + uni_port.mac_bridge_port_num)
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-8021p-mapper-service-profile')
+
+            ################################################################################
+            # Create MAC Bridge Port Configuration Data for the PON port via IEEE 802.1
+            # mapper service. Upon receipt by the ONU, the ONU will create an instance
+            # of the following before returning the response.
+            #
+            #     - MAC bridge port designation data
+            #     - MAC bridge port filter table data
+            #     - MAC bridge port bridge table data
+            #
+            #  EntityID will be referenced by:
+            #            - Implicitly by the VLAN tagging filter data
+            #  References:
+            #            - MAC Bridge Service Profile (the bridge)
+            #            - IEEE 802.1p mapper service profile for PON port
+
+            # TODO: magic. make a static variable for tp_type
+            msg = MacBridgePortConfigurationDataFrame(
+                self._mac_bridge_port_ani_entity_id + uni_port.mac_bridge_port_num,
+                bridge_id_pointer=self._mac_bridge_service_profile_entity_id + uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                port_num= 0xff, # Port ID - unique number within the bridge
+                tp_type=3, # TP Type (IEEE 802.1p mapper service)
+                tp_pointer=self._ieee_mapper_service_profile_entity_id + uni_port.mac_bridge_port_num  # TP ID, 8021p mapper ID
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-mac-bridge-port-configuration-data-part-1')
+
+            ################################################################################
+            # VLAN Tagging Filter config
+            #
+            #  EntityID will be referenced by:
+            #            - Nothing
+            #  References:
+            #            - MacBridgePortConfigurationData for the ANI/PON side
+            #
+            # Set anything, this request will not be used when using Extended Vlan
+
+            # TODO: magic. make a static variable for forward_op
+            msg = VlanTaggingFilterDataFrame(
+                self._mac_bridge_port_ani_entity_id + uni_port.mac_bridge_port_num,  # Entity ID
+                vlan_tcis=[self._vlan_tcis_1],        # VLAN IDs
+                forward_operation=0x10
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-vlan-tagging-filter-data')
+
+            ################################################################################
+            # UNI Specific                                                                 #
+            ################################################################################
+            # MAC Bridge Port config
+            # This configuration is for Ethernet UNI
+            #
+            #  EntityID will be referenced by:
+            #            - Nothing
+            #  References:
+            #            - MAC Bridge Service Profile (the bridge)
+            #            - PPTP Ethernet or VEIP UNI
+
+            # TODO: do this for all uni/ports...
+            # TODO: magic. make a static variable for tp_type
+
+            # default to PPTP
+            tp_type = None
+            if uni_port.type is UniType.VEIP:
+                tp_type = 11
+            elif uni_port.type is UniType.PPTP:
+                tp_type = 1
+            else:
+                tp_type = 1
+
+            msg = MacBridgePortConfigurationDataFrame(
+                uni_port.entity_id,            # Entity ID - This is read-only/set-by-create !!!
+                bridge_id_pointer=self._mac_bridge_service_profile_entity_id + uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                port_num=uni_port.mac_bridge_port_num,   # Port ID
+                tp_type=tp_type,                         # PPTP Ethernet or VEIP UNI
+                tp_pointer=uni_port.entity_id            # Ethernet UNI ID
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-mac-bridge-port-configuration-data-part-2')
+
+        except TimeoutError as e:
+            self.log.warn('rx-timeout-1', e=e)
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-setup-1', e=e)
+            raise
+
+        returnValue(None)
+
+    @inlineCallbacks
+    def enable_uni(self, uni_port, force_lock):
+        """
+        Lock or unlock a single uni port
+
+        :param uni_port: UniPort to admin up/down
+        :param force_lock: (boolean) If True, force lock regardless of enabled state
+        """
+        self.log.debug('function-entry')
+
+        omci_cc = self._onu_device.omci_cc
+        frame = None
+
+        ################################################################################
+        #  Lock/Unlock UNI  -  0 to Unlock, 1 to lock
+        #
+        #  EntityID is referenced by:
+        #            - MAC bridge port configuration data for the UNI side
+        #  References:
+        #            - Nothing
+        try:
+            state = 1 if force_lock or not uni_port.enabled else 0
+            msg = None
+            if uni_port.type is UniType.PPTP:
+                msg = PptpEthernetUniFrame(uni_port.entity_id,
+                                           attributes=dict(administrative_state=state))
+            elif uni_port.type is UniType.VEIP:
+                msg = VeipUniFrame(uni_port.entity_id,
+                                   attributes=dict(administrative_state=state))
+            else:
+                self.log.warn('unknown-uni-type', uni_port=uni_port)
+
+            if msg:
+               frame = msg.set()
+               self.log.debug('openomci-msg', omci_msg=msg)
+               results = yield omci_cc.send(frame)
+               self.check_status_and_state(results, 'set-pptp-ethernet-uni-lock-restore')
+
+        except TimeoutError as e:
+            self.log.warn('rx-timeout', e=e)
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-failure', e=e)
+            raise
+
+        returnValue(None)
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_mib_sync.py b/python/adapters/brcm_openomci_onu/omci/brcm_mib_sync.py
new file mode 100644
index 0000000..1898c52
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_mib_sync.py
@@ -0,0 +1,77 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from twisted.internet import reactor
+from voltha.extensions.omci.state_machines.mib_sync import MibSynchronizer
+
+log = structlog.get_logger()
+
+class BrcmMibSynchronizer(MibSynchronizer):
+    """
+    OpenOMCI MIB Synchronizer state machine for Broadcom ONUs
+    """
+
+    def __init__(self, agent, device_id, mib_sync_tasks, db,
+                 advertise_events=False):
+        """
+        Class initialization
+
+        :param agent: (OpenOmciAgent) Agent
+        :param device_id: (str) ONU Device ID
+        :param db: (MibDbVolatileDict) MIB Database
+        :param mib_sync_tasks: (dict) Tasks to run
+        :param advertise_events: (bool) Advertise events on OpenOMCI Event Bus
+        """
+        self.log = structlog.get_logger(device_id=device_id)
+        self.log.debug('function-entry')
+
+        super(BrcmMibSynchronizer, self).__init__(agent, device_id, mib_sync_tasks, db,
+                                                  advertise_events=advertise_events)
+
+    def on_enter_starting(self):
+        """
+        Given resync and mib update is questionable (see below) flag the ONU as a new device which forces a mib
+        reset and a mib upload
+        """
+        self.log.warn('db-sync-not-supported-forcing-reset')
+        self._last_mib_db_sync_value = None
+        super(BrcmMibSynchronizer, self).on_enter_starting()
+
+    def on_enter_auditing(self):
+        """
+        Perform a MIB Audit.  Currently this is broken on BRCM based onu and its never in sync and continuously
+        retries. On disable/enable it never enables becaues its never in sync.  Effectively disable the function so
+        disable/enable works and we can figure out whats going on
+
+        Oddly enough this is only an issue with MibVolatileDict
+        """
+        # TODO: Actually fix resync
+        self.log.warn('audit-resync-not-supported')
+
+        self._deferred = reactor.callLater(0, self.success)
+
+    def on_enter_examining_mds(self):
+        """
+        Examine MIB difference counter between onu and voltha.  Currently same problem as on_enter_auditing.
+        examine mds is always mismatched and causing disable/enable to fail
+
+        Oddly enough this is only an issue with MibVolatileDict
+        """
+        # TODO: Actually fix resync
+        self.log.warn('examine-mds-resync-not-supported')
+
+        self._deferred = reactor.callLater(0, self.success)
+
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py
new file mode 100644
index 0000000..ff0bd30
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py
@@ -0,0 +1,482 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from common.frameio.frameio import hexify
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError, failure
+from voltha.extensions.omci.omci_me import *
+from voltha.extensions.omci.tasks.task import Task
+from voltha.extensions.omci.omci_defs import *
+from voltha.adapters.brcm_openomci_onu.uni_port import *
+from voltha.adapters.brcm_openomci_onu.pon_port \
+    import BRDCM_DEFAULT_VLAN, TASK_PRIORITY, DEFAULT_TPID, DEFAULT_GEM_PAYLOAD
+
+OP = EntityOperations
+RC = ReasonCodes
+
+
+class TechProfileDownloadFailure(Exception):
+    """
+    This error is raised by default when the download fails
+    """
+
+
+class TechProfileResourcesFailure(Exception):
+    """
+    This error is raised by when one or more resources required is not available
+    """
+
+
+class BrcmTpServiceSpecificTask(Task):
+    """
+    OpenOMCI Tech-Profile Download Task
+
+    """
+
+    name = "Broadcom Tech-Profile Download Task"
+
+    def __init__(self, omci_agent, handler, uni_id):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        log = structlog.get_logger(device_id=handler.device_id, uni_id=uni_id)
+        log.debug('function-entry')
+
+        super(BrcmTpServiceSpecificTask, self).__init__(BrcmTpServiceSpecificTask.name,
+                                                        omci_agent,
+                                                        handler.device_id,
+                                                        priority=TASK_PRIORITY,
+                                                        exclusive=True)
+
+        self.log = log
+
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+
+        # Frame size
+        self._max_gem_payload = DEFAULT_GEM_PAYLOAD
+
+        self._uni_port = handler.uni_ports[uni_id]
+        assert self._uni_port.uni_id == uni_id
+
+        # Port numbers
+        self._input_tpid = DEFAULT_TPID
+        self._output_tpid = DEFAULT_TPID
+
+        self._vlan_tcis_1 = BRDCM_DEFAULT_VLAN
+        self._cvid = BRDCM_DEFAULT_VLAN
+        self._vlan_config_entity_id = self._vlan_tcis_1
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+
+        self._mac_bridge_service_profile_entity_id = \
+            handler.mac_bridge_service_profile_entity_id
+        self._ieee_mapper_service_profile_entity_id = \
+            handler.pon_port.ieee_mapper_service_profile_entity_id
+        self._mac_bridge_port_ani_entity_id = \
+            handler.pon_port.mac_bridge_port_ani_entity_id
+        self._gal_enet_profile_entity_id = \
+            handler.gal_enet_profile_entity_id
+
+        # Extract the current set of TCONT and GEM Ports from the Handler's pon_port that are
+        # relevant to this task's UNI. It won't change. But, the underlying pon_port may change
+        # due to additional tasks on different UNIs. So, it we cannot use the pon_port affter
+        # this initializer
+        self._tconts = []
+        for tcont in handler.pon_port.tconts.itervalues():
+            if tcont.uni_id is not None and tcont.uni_id != self._uni_port.uni_id: continue
+            self._tconts.append(tcont)
+
+        self._gem_ports = []
+        for gem_port in handler.pon_port.gem_ports.itervalues():
+            if gem_port.uni_id is not None and gem_port.uni_id != self._uni_port.uni_id: continue
+            self._gem_ports.append(gem_port)
+
+        self.tcont_me_to_queue_map = dict()
+        self.uni_port_to_queue_map = dict()
+
+    def cancel_deferred(self):
+        self.log.debug('function-entry')
+        super(BrcmTpServiceSpecificTask, self).cancel_deferred()
+
+        d, self._local_deferred = self._local_deferred, None
+        try:
+            if d is not None and not d.called:
+                d.cancel()
+        except:
+            pass
+
+    def start(self):
+        """
+        Start the Tech-Profile Download
+        """
+        self.log.debug('function-entry')
+        super(BrcmTpServiceSpecificTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_service_specific_steps)
+
+    def stop(self):
+        """
+        Shutdown Tech-Profile download tasks
+        """
+        self.log.debug('function-entry')
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(BrcmTpServiceSpecificTask, self).stop()
+
+    def check_status_and_state(self, results, operation=''):
+        """
+        Check the results of an OMCI response.  An exception is thrown
+        if the task was cancelled or an error was detected.
+
+        :param results: (OmciFrame) OMCI Response frame
+        :param operation: (str) what operation was being performed
+        :return: True if successful, False if the entity existed (already created)
+        """
+        self.log.debug('function-entry')
+
+        omci_msg = results.fields['omci_message'].fields
+        status = omci_msg['success_code']
+        error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
+        failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
+        unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
+
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg, status=status, error_mask=error_mask,
+                       failed_mask=failed_mask, unsupported_mask=unsupported_mask)
+
+        if status == RC.Success:
+            self.strobe_watchdog()
+            return True
+
+        elif status == RC.InstanceExists:
+            return False
+
+        raise TechProfileDownloadFailure(
+            '{} failed with a status of {}, error_mask: {}, failed_mask: {}, unsupported_mask: {}'
+            .format(operation, status, error_mask, failed_mask, unsupported_mask))
+
+    @inlineCallbacks
+    def perform_service_specific_steps(self):
+        self.log.debug('function-entry')
+
+        omci_cc = self._onu_device.omci_cc
+
+        try:
+            ################################################################################
+            # TCONTS
+            #
+            #  EntityID will be referenced by:
+            #            - GemPortNetworkCtp
+            #  References:
+            #            - ONU created TCONT (created on ONU startup)
+
+            tcont_idents = self._onu_device.query_mib(Tcont.class_id)
+            self.log.debug('tcont-idents', tcont_idents=tcont_idents)
+
+            for tcont in self._tconts:
+                self.log.debug('tcont-loop', tcont=tcont)
+
+                if tcont.entity_id is None:
+                    free_entity_id = None
+                    for k, v in tcont_idents.items():
+                        alloc_check = v.get('attributes', {}).get('alloc_id', 0)
+                        # Some onu report both to indicate an available tcont
+                        if alloc_check == 0xFF or alloc_check == 0xFFFF:
+                            free_entity_id = k
+                            break
+
+                    self.log.debug('tcont-loop-free', free_entity_id=free_entity_id, alloc_id=tcont.alloc_id)
+
+                    if free_entity_id is None:
+                        self.log.error('no-available-tconts')
+                        break
+
+                    # Also assign entity id within tcont object
+                    results = yield tcont.add_to_hardware(omci_cc, free_entity_id)
+                    self.check_status_and_state(results, 'new-tcont-added')
+                else:
+                    # likely already added given entity_id is set, but no harm in doing it again
+                    results = yield tcont.add_to_hardware(omci_cc, tcont.entity_id)
+                    self.check_status_and_state(results, 'existing-tcont-added')
+
+            ################################################################################
+            # GEMS  (GemPortNetworkCtp and GemInterworkingTp)
+            #
+            #  For both of these MEs, the entity_id is the GEM Port ID. The entity id of the
+            #  GemInterworkingTp ME could be different since it has an attribute to specify
+            #  the GemPortNetworkCtp entity id.
+            #
+            #        for the GemPortNetworkCtp ME
+            #
+            #  GemPortNetworkCtp
+            #    EntityID will be referenced by:
+            #              - GemInterworkingTp
+            #    References:
+            #              - TCONT
+            #              - Hardcoded upstream TM Entity ID
+            #              - (Possibly in Future) Upstream Traffic descriptor profile pointer
+            #
+            #  GemInterworkingTp
+            #    EntityID will be referenced by:
+            #              - Ieee8021pMapperServiceProfile
+            #    References:
+            #              - GemPortNetworkCtp
+            #              - Ieee8021pMapperServiceProfile
+            #              - GalEthernetProfile
+            #
+
+            onu_g = self._onu_device.query_mib(OntG.class_id)
+            # If the traffic management option attribute in the ONU-G ME is 0
+            # (priority controlled) or 2 (priority and rate controlled), this
+            # pointer specifies the priority queue ME serving this GEM port
+            # network CTP. If the traffic management option attribute is 1
+            # (rate controlled), this attribute redundantly points to the
+            # T-CONT serving this GEM port network CTP.
+            traffic_mgmt_opt = \
+                onu_g.get('attributes', {}).get('traffic_management_options', 0)
+            self.log.debug("traffic-mgmt-option", traffic_mgmt_opt=traffic_mgmt_opt)
+
+            prior_q = self._onu_device.query_mib(PriorityQueueG.class_id)
+            for k, v in prior_q.items():
+                self.log.debug("prior-q", k=k, v=v)
+
+                try:
+                    _ = iter(v)
+                except TypeError:
+                    continue
+
+                if 'instance_id' in v:
+                    related_port = v['attributes']['related_port']
+                    if v['instance_id'] & 0b1000000000000000:
+                        tcont_me = (related_port & 0xffff0000) >> 16
+                        if tcont_me not in self.tcont_me_to_queue_map:
+                            self.log.debug("prior-q-related-port-and-tcont-me",
+                                            related_port=related_port,
+                                            tcont_me=tcont_me)
+                            self.tcont_me_to_queue_map[tcont_me] = list()
+
+                        self.tcont_me_to_queue_map[tcont_me].append(k)
+                    else:
+                        uni_port = (related_port & 0xffff0000) >> 16
+                        if uni_port ==  self._uni_port.entity_id:
+                            if uni_port not in self.uni_port_to_queue_map:
+                                self.log.debug("prior-q-related-port-and-uni-port-me",
+                                                related_port=related_port,
+                                                uni_port_me=uni_port)
+                                self.uni_port_to_queue_map[uni_port] = list()
+
+                            self.uni_port_to_queue_map[uni_port].append(k)
+
+
+            self.log.debug("ul-prior-q", ul_prior_q=self.tcont_me_to_queue_map)
+            self.log.debug("dl-prior-q", dl_prior_q=self.uni_port_to_queue_map)
+
+            for gem_port in self._gem_ports:
+                # TODO: Traffic descriptor will be available after meter bands are available
+                tcont = gem_port.tcont
+                if tcont is None:
+                    self.log.error('unknown-tcont-reference', gem_id=gem_port.gem_id)
+                    continue
+
+                ul_prior_q_entity_id = None
+                dl_prior_q_entity_id = None
+                if gem_port.direction == "upstream" or \
+                        gem_port.direction == "bi-directional":
+
+                    # Sort the priority queue list in order of priority.
+                    # 0 is highest priority and 0x0fff is lowest.
+                    self.tcont_me_to_queue_map[tcont.entity_id].sort()
+                    self.uni_port_to_queue_map[self._uni_port.entity_id].sort()
+                    # Get the priority queue associated with p-bit that is
+                    # mapped to the gem port.
+                    # p-bit-7 is highest priority and p-bit-0 is lowest
+                    # Gem port associated with p-bit-7 should be mapped to
+                    # highest priority queue and gem port associated with p-bit-0
+                    # should be mapped to lowest priority queue.
+                    # The self.tcont_me_to_queue_map and self.uni_port_to_queue_map
+                    # have priority queue entities ordered in descending order
+                    # of priority
+                    for i, p in enumerate(gem_port.pbit_map):
+                        if p == '1':
+                            ul_prior_q_entity_id = \
+                                self.tcont_me_to_queue_map[tcont.entity_id][i]
+                            dl_prior_q_entity_id = \
+                                self.uni_port_to_queue_map[self._uni_port.entity_id][i]
+                            break
+
+                    assert ul_prior_q_entity_id is not None and \
+                           dl_prior_q_entity_id is not None
+
+                    # TODO: Need to restore on failure.  Need to check status/results
+                    results = yield gem_port.add_to_hardware(omci_cc,
+                                             tcont.entity_id,
+                                             self._ieee_mapper_service_profile_entity_id +
+                                                      self._uni_port.mac_bridge_port_num,
+                                             self._gal_enet_profile_entity_id,
+                                             ul_prior_q_entity_id, dl_prior_q_entity_id)
+                    self.check_status_and_state(results, 'assign-gem-port')
+                elif gem_port.direction == "downstream":
+                    # Downstream is inverse of upstream
+                    # TODO: could also be a case of multicast. Not supported for now
+                    self.log.debug("skipping-downstream-gem", gem_port=gem_port)
+                    pass
+
+            ################################################################################
+            # Update the IEEE 802.1p Mapper Service Profile config
+            #
+            #  EntityID was created prior to this call. This is a set
+            #
+            #  References:
+            #            - Gem Interwork TPs are set here
+            #
+
+            gem_entity_ids = [OmciNullPointer] * 8
+            for gem_port in self._gem_ports:
+                self.log.debug("tp-gem-port", entity_id=gem_port.entity_id, uni_id=gem_port.uni_id)
+
+                if gem_port.direction == "upstream" or \
+                        gem_port.direction == "bi-directional":
+                    for i, p in enumerate(reversed(gem_port.pbit_map)):
+                        if p == '1':
+                            gem_entity_ids[i] = gem_port.entity_id
+                elif gem_port.direction == "downstream":
+                    # Downstream gem port p-bit mapper is inverse of upstream
+                    # TODO: Could also be a case of multicast. Not supported for now
+                    pass
+
+            msg = Ieee8021pMapperServiceProfileFrame(
+                self._ieee_mapper_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # 802.1p mapper Service Mapper Profile ID
+                interwork_tp_pointers=gem_entity_ids  # Interworking TP IDs
+            )
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-8021p-mapper-service-profile-ul')
+
+            ################################################################################
+            # Create Extended VLAN Tagging Operation config (PON-side)
+            #
+            #  EntityID relates to the VLAN TCIS
+            #  References:
+            #            - VLAN TCIS from previously created VLAN Tagging filter data
+            #            - PPTP Ethernet or VEIP UNI
+            #
+
+            # TODO: do this for all uni/ports...
+            # TODO: magic.  static variable for assoc_type
+
+            # default to PPTP
+            if self._uni_port.type is UniType.VEIP:
+                association_type = 10
+            elif self._uni_port.type is UniType.PPTP:
+                association_type = 2
+            else:
+                association_type = 2
+
+            attributes = dict(
+                association_type=association_type,                  # Assoc Type, PPTP/VEIP Ethernet UNI
+                associated_me_pointer=self._uni_port.entity_id,      # Assoc ME, PPTP/VEIP Entity Id
+
+                # See VOL-1311 - Need to set table during create to avoid exception
+                # trying to read back table during post-create-read-missing-attributes
+                # But, because this is a R/W attribute. Some ONU may not accept the
+                # value during create. It is repeated again in a set below.
+                input_tpid=self._input_tpid,  # input TPID
+                output_tpid=self._output_tpid,  # output TPID
+            )
+
+            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                attributes=attributes
+            )
+
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-extended-vlan-tagging-operation-configuration-data')
+
+            attributes = dict(
+                # Specifies the TPIDs in use and that operations in the downstream direction are
+                # inverse to the operations in the upstream direction
+                input_tpid=self._input_tpid,    # input TPID
+                output_tpid=self._output_tpid,  # output TPID
+                downstream_mode=0,              # inverse of upstream
+            )
+
+            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                attributes=attributes
+            )
+
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
+
+            attributes = dict(
+                # parameters: Entity Id ( 0x900), Filter Inner Vlan Id(0x1000-4096,do not filter on Inner vid,
+                #             Treatment Inner Vlan Id : 2
+
+                # Update uni side extended vlan filter
+                # filter for untagged
+                # probably for eapol
+                # TODO: lots of magic
+                # TODO: magic 0x1000 / 4096?
+                received_frame_vlan_tagging_operation_table=
+                VlanTaggingOperation(
+                    filter_outer_priority=15,  # This entry is not a double-tag rule
+                    filter_outer_vid=4096,     # Do not filter on the outer VID value
+                    filter_outer_tpid_de=0,    # Do not filter on the outer TPID field
+
+                    filter_inner_priority=15,
+                    filter_inner_vid=4096,
+                    filter_inner_tpid_de=0,
+                    filter_ether_type=0,
+
+                    treatment_tags_to_remove=0,
+                    treatment_outer_priority=15,
+                    treatment_outer_vid=0,
+                    treatment_outer_tpid_de=0,
+
+                    treatment_inner_priority=0,
+                    treatment_inner_vid=self._cvid,
+                    treatment_inner_tpid_de=4,
+                )
+            )
+
+            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                attributes=attributes
+            )
+
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data-table')
+
+            self.deferred.callback("tech-profile-download-success")
+
+        except TimeoutError as e:
+            self.log.warn('rx-timeout-2', e=e)
+            self.deferred.errback(failure.Failure(e))
+
+        except Exception as e:
+            self.log.exception('omci-setup-2', e=e)
+            self.deferred.errback(failure.Failure(e))
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
new file mode 100644
index 0000000..c304a27
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
@@ -0,0 +1,140 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from voltha.extensions.omci.tasks.task import Task
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, failure, returnValue
+from voltha.extensions.omci.omci_defs import ReasonCodes, EntityOperations
+from voltha.extensions.omci.omci_me import OntGFrame
+from voltha.extensions.omci.omci_me import PptpEthernetUniFrame, VeipUniFrame
+
+RC = ReasonCodes
+OP = EntityOperations
+
+
+class BrcmUniLockException(Exception):
+    pass
+
+
+class BrcmUniLockTask(Task):
+    """
+    Lock or unlock all discovered UNI/PPTP on the ONU
+    """
+    task_priority = 200
+    name = "Broadcom UNI Lock Task"
+
+    def __init__(self, omci_agent, device_id, lock=True, priority=task_priority):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        :param lock: (bool) If true administratively lock all the UNI.  If false unlock
+        :param priority: (int) OpenOMCI Task priority (0..255) 255 is the highest
+        """
+        super(BrcmUniLockTask, self).__init__(BrcmUniLockTask.name,
+                                                omci_agent,
+                                                device_id,
+                                                priority=priority,
+                                                exclusive=True)
+        self._device = omci_agent.get_device(device_id)
+        self._lock = lock
+        self._results = None
+        self._local_deferred = None
+        self._config = self._device.configuration
+
+    def cancel_deferred(self):
+        super(BrcmUniLockTask, self).cancel_deferred()
+
+        d, self._local_deferred = self._local_deferred, None
+        try:
+            if d is not None and not d.called:
+                d.cancel()
+        except:
+            pass
+
+    def start(self):
+        """
+        Start UNI/PPTP Lock/Unlock Task
+        """
+        super(BrcmUniLockTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_lock)
+
+
+    @inlineCallbacks
+    def perform_lock(self):
+        """
+        Perform the lock/unlock
+        """
+        self.log.info('setting-uni-lock-state', lock=self._lock)
+
+        try:
+            state = 1 if self._lock else 0
+
+            # lock the whole ont and all the pptp.  some onu dont causing odd behavior.
+            msg = OntGFrame(attributes={'administrative_state': state})
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield self._device.omci_cc.send(frame)
+            self.strobe_watchdog()
+
+            status = results.fields['omci_message'].fields['success_code']
+            self.log.info('response-status', status=status)
+
+            # Success?
+            if status in (RC.Success.value, RC.InstanceExists):
+                self.log.debug('set-lock-ontg', lock=self._lock)
+            else:
+                self.log.warn('cannot-set-lock-ontg', lock=self._lock)
+
+            pptp_list = sorted(self._config.pptp_entities) if self._config.pptp_entities else []
+            veip_list = sorted(self._config.veip_entities) if self._config.veip_entities else []
+
+            for entity_id in pptp_list:
+                pptp_value = self._config.pptp_entities[entity_id]
+                msg = PptpEthernetUniFrame(entity_id,
+                                           attributes=dict(administrative_state=state))
+                self._send_uni_lock_msg(entity_id, pptp_value, msg)
+
+            for entity_id in veip_list:
+                veip_value = self._config.veip_entities[entity_id]
+                msg = VeipUniFrame(entity_id,
+                                           attributes=dict(administrative_state=state))
+                self._send_uni_lock_msg(entity_id, veip_value, msg)
+
+            self.deferred.callback(self)
+
+        except Exception as e:
+            self.log.exception('setting-uni-lock-state', e=e)
+            self.deferred.errback(failure.Failure(e))
+
+
+    @inlineCallbacks
+    def _send_uni_lock_msg(self, entity_id, value, me_message):
+        frame = me_message.set()
+        self.log.debug('openomci-msg', omci_msg=me_message)
+        results = yield self._device.omci_cc.send(frame)
+        self.strobe_watchdog()
+
+        status = results.fields['omci_message'].fields['success_code']
+        self.log.info('response-status', status=status)
+
+        # Success?
+        if status in (RC.Success.value, RC.InstanceExists):
+            self.log.debug('set-lock-uni', uni=entity_id, value=value, lock=self._lock)
+        else:
+            self.log.warn('cannot-set-lock-uni', uni=entity_id, value=value, lock=self._lock)
+
+        returnValue(None)
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
new file mode 100644
index 0000000..6c665c7
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
@@ -0,0 +1,216 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+from voltha.extensions.omci.tasks.task import Task
+from twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, failure, returnValue
+from voltha.extensions.omci.omci_defs import ReasonCodes, EntityOperations
+from voltha.extensions.omci.omci_me import *
+
+RC = ReasonCodes
+OP = EntityOperations
+
+
+class BrcmVlanFilterException(Exception):
+    pass
+
+
+class BrcmVlanFilterTask(Task):
+    """
+    Apply Vlan Tagging Filter Data and Extended VLAN Tagging Operation Configuration on an ANI and UNI
+    """
+    task_priority = 200
+    name = "Broadcom VLAN Filter Task"
+
+    def __init__(self, omci_agent, device_id, uni_port, set_vlan_id, priority=task_priority):
+        """
+        Class initialization
+
+        :param omci_agent: (OmciAdapterAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        :param set_vlan_id: (int) VLAN to filter for and set
+        :param priority: (int) OpenOMCI Task priority (0..255) 255 is the highest
+        """
+
+        self.log = structlog.get_logger(device_id=device_id, uni_port=uni_port.port_number)
+
+        super(BrcmVlanFilterTask, self).__init__(BrcmVlanFilterTask.name,
+                                                 omci_agent,
+                                                 device_id,
+                                                 priority=priority,
+                                                 exclusive=True)
+        self._device = omci_agent.get_device(device_id)
+        self._uni_port = uni_port
+        self._set_vlan_id = set_vlan_id
+        self._results = None
+        self._local_deferred = None
+        self._config = self._device.configuration
+
+    def cancel_deferred(self):
+        super(BrcmVlanFilterTask, self).cancel_deferred()
+
+        d, self._local_deferred = self._local_deferred, None
+        try:
+            if d is not None and not d.called:
+                d.cancel()
+        except:
+            pass
+
+    def start(self):
+        """
+        Start Vlan Tagging Task
+        """
+        super(BrcmVlanFilterTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_vlan_tagging)
+
+    @inlineCallbacks
+    def perform_vlan_tagging(self):
+        """
+        Perform the vlan tagging
+        """
+        self.log.info('setting-vlan-tagging')
+
+        try:
+            # TODO: parameterize these from the handler, or objects in the handler
+            # TODO: make this a member of the onu gem port or the uni port
+            _mac_bridge_service_profile_entity_id = 0x201
+            _mac_bridge_port_ani_entity_id = 0x2102  # TODO: can we just use the entity id from the anis list?
+            # Delete bridge ani side vlan filter
+            msg = VlanTaggingFilterDataFrame(_mac_bridge_port_ani_entity_id + self._uni_port.mac_bridge_port_num)
+            frame = msg.delete()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            self.strobe_watchdog()
+            results = yield self._device.omci_cc.send(frame)
+            self.check_status_and_state(results, 'flow-delete-vlan-tagging-filter-data')
+
+            # Re-Create bridge ani side vlan filter
+            msg = VlanTaggingFilterDataFrame(
+                _mac_bridge_port_ani_entity_id + self._uni_port.mac_bridge_port_num,  # Entity ID
+                vlan_tcis=[self._set_vlan_id],  # VLAN IDs
+                forward_operation=0x10
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            self.strobe_watchdog()
+            results = yield self._device.omci_cc.send(frame)
+            self.check_status_and_state(results, 'flow-create-vlan-tagging-filter-data')
+
+            # Re-Create bridge ani side vlan filter
+
+            # Update uni side extended vlan filter
+            # filter for untagged
+            # probably for eapol
+            # TODO: Create constants for the operation values.  See omci spec
+            attributes = dict(
+                received_frame_vlan_tagging_operation_table=
+                VlanTaggingOperation(
+                    filter_outer_priority=15,
+                    filter_outer_vid=4096,
+                    filter_outer_tpid_de=0,
+
+                    filter_inner_priority=15,
+                    filter_inner_vid=4096,
+                    filter_inner_tpid_de=0,
+                    filter_ether_type=0,
+
+                    treatment_tags_to_remove=0,
+                    treatment_outer_priority=15,
+                    treatment_outer_vid=0,
+                    treatment_outer_tpid_de=0,
+
+                    treatment_inner_priority=0,
+                    treatment_inner_vid=self._set_vlan_id,
+                    treatment_inner_tpid_de=4
+                )
+            )
+            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                _mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                attributes=attributes  # See above
+            )
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            self.strobe_watchdog()
+            results = yield self._device.omci_cc.send(frame)
+            self.check_status_and_state(results,
+                                        'flow-set-ext-vlan-tagging-op-config-data-untagged')
+
+            # Update uni side extended vlan filter
+            # filter for vlan 0
+            # TODO: Create constants for the operation values.  See omci spec
+            attributes = dict(
+                received_frame_vlan_tagging_operation_table=
+                VlanTaggingOperation(
+                    filter_outer_priority=15,  # This entry is not a double-tag rule
+                    filter_outer_vid=4096,  # Do not filter on the outer VID value
+                    filter_outer_tpid_de=0,  # Do not filter on the outer TPID field
+
+                    filter_inner_priority=8,  # Filter on inner vlan
+                    filter_inner_vid=0x0,  # Look for vlan 0
+                    filter_inner_tpid_de=0,  # Do not filter on inner TPID field
+                    filter_ether_type=0,  # Do not filter on EtherType
+
+                    treatment_tags_to_remove=1,
+                    treatment_outer_priority=15,
+                    treatment_outer_vid=0,
+                    treatment_outer_tpid_de=0,
+
+                    treatment_inner_priority=8,  # Add an inner tag and insert this value as the priority
+                    treatment_inner_vid=self._set_vlan_id,  # use this value as the VID in the inner VLAN tag
+                    treatment_inner_tpid_de=4,  # set TPID
+                )
+            )
+            msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                _mac_bridge_service_profile_entity_id + self._uni_port.mac_bridge_port_num,  # Bridge Entity ID
+                attributes=attributes  # See above
+            )
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            self.strobe_watchdog()
+            results = yield self._device.omci_cc.send(frame)
+            self.check_status_and_state(results,
+                                        'flow-set-ext-vlan-tagging-op-config-data-zero-tagged')
+
+            self.deferred.callback(self)
+
+        except Exception as e:
+            self.log.exception('setting-vlan-tagging', e=e)
+            self.deferred.errback(failure.Failure(e))
+
+    def check_status_and_state(self, results, operation=''):
+        """
+        Check the results of an OMCI response.  An exception is thrown
+        if the task was cancelled or an error was detected.
+
+        :param results: (OmciFrame) OMCI Response frame
+        :param operation: (str) what operation was being performed
+        :return: True if successful, False if the entity existed (already created)
+        """
+
+        omci_msg = results.fields['omci_message'].fields
+        status = omci_msg['success_code']
+        error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
+        failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
+        unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
+
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
+                       failed_mask=failed_mask, unsupported_mask=unsupported_mask)
+
+        if status == RC.Success:
+            self.strobe_watchdog()
+            return True
+
+        elif status == RC.InstanceExists:
+            return False
diff --git a/python/adapters/brcm_openomci_onu/onu_gem_port.py b/python/adapters/brcm_openomci_onu/onu_gem_port.py
new file mode 100644
index 0000000..b388030
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/onu_gem_port.py
@@ -0,0 +1,385 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from twisted.internet.defer import inlineCallbacks, returnValue
+from voltha.extensions.omci.omci_me import *
+from voltha.extensions.omci.omci_defs import *
+
+RC = ReasonCodes
+
+
+class OnuGemPort(object):
+    """
+    Broadcom ONU specific implementation
+    """
+
+    def __init__(self, gem_id, uni_id, alloc_id,
+                 entity_id=None,
+                 direction="BIDIRECTIONAL",
+                 encryption=False,
+                 discard_config=None,
+                 discard_policy=None,
+                 max_q_size="auto",
+                 pbit_map="0b00000011",
+                 priority_q=3,
+                 scheduling_policy="WRR",
+                 weight=8,
+                 omci_transport=False,
+                 multicast=False,
+                 tcont_ref=None,
+                 traffic_class=None,
+                 intf_ref=None,
+                 untagged=False,
+                 name=None,
+                 handler=None):
+
+        self.log = structlog.get_logger(device_id=handler.device_id, uni_id=uni_id, gem_id=gem_id)
+        self.log.debug('function-entry')
+
+        self.name = name
+        self.gem_id = gem_id
+        self.uni_id = uni_id
+        self._alloc_id = alloc_id
+        self.tcont_ref = tcont_ref
+        self.intf_ref = intf_ref
+        self.traffic_class = traffic_class
+        self._direction = None
+        self._encryption = encryption
+        self._discard_config = None
+        self._discard_policy = None
+        self._max_q_size = None
+        self._pbit_map = None
+        self._scheduling_policy = None
+        self._omci_transport = omci_transport
+        self.multicast = multicast
+        self.untagged = untagged
+        self._handler = handler
+
+        self.direction = direction
+        self.encryption = encryption
+        self.discard_config = discard_config
+        self.discard_policy = discard_policy
+        self.max_q_size = max_q_size
+        self.pbit_map = pbit_map
+        self.priority_q = priority_q
+        self.scheduling_policy = scheduling_policy
+        self.weight = weight
+
+        self._pon_id = None
+        self._onu_id = None
+        self._entity_id = entity_id
+
+        # Statistics
+        self.rx_packets = 0
+        self.rx_bytes = 0
+        self.tx_packets = 0
+        self.tx_bytes = 0
+
+    def __str__(self):
+        return "OnuGemPort - entity_id {}, alloc-id: {}, gem-id: {}, ".format(self.entity_id, self.alloc_id, self.gem_id)
+
+    def __repr__(self):
+        return str(self)
+
+    @property
+    def pon_id(self):
+        self.log.debug('function-entry')
+        return self._pon_id
+
+    @pon_id.setter
+    def pon_id(self, pon_id):
+        self.log.debug('function-entry')
+        assert self._pon_id is None or self._pon_id == pon_id, 'PON-ID can only be set once'
+        self._pon_id = pon_id
+
+    @property
+    def onu_id(self):
+        self.log.debug('function-entry')
+        return self._onu_id
+
+    @onu_id.setter
+    def onu_id(self, onu_id):
+        self.log.debug('function-entry', onu_id=onu_id)
+        assert self._onu_id is None or self._onu_id == onu_id, 'ONU-ID can only be set once'
+        self._onu_id = onu_id
+
+    @property
+    def alloc_id(self):
+        self.log.debug('function-entry')
+        return self._alloc_id
+
+    @property
+    def direction(self):
+        self.log.debug('function-entry')
+        return self._direction
+
+    @direction.setter
+    def direction(self, direction):
+        self.log.debug('function-entry')
+        # GEM Port CTP are configured separately in UPSTREAM and DOWNSTREAM.
+        # BIDIRECTIONAL is not supported.
+        assert direction == "UPSTREAM" or direction == "DOWNSTREAM" or \
+               direction == "BIDIRECTIONAL", "invalid-direction"
+
+        # OMCI framework expects string in lower-case. Tech-Profile sends in upper-case.
+        if direction == "UPSTREAM":
+            self._direction = "upstream"
+        elif direction == "DOWNSTREAM":
+            self._direction = "downstream"
+        elif direction == "BIDIRECTIONAL":
+            self._direction = "bi-directional"
+
+    @property
+    def tcont(self):
+        self.log.debug('function-entry')
+        tcont_item = self._handler.pon_port.tconts.get(self.alloc_id)
+        return tcont_item
+
+    @property
+    def omci_transport(self):
+        self.log.debug('function-entry')
+        return self._omci_transport
+
+    def to_dict(self):
+        self.log.debug('function-entry')
+        return {
+            'port-id': self.gem_id,
+            'alloc-id': self.alloc_id,
+            'encryption': self._encryption,
+            'omci-transport': self.omci_transport
+        }
+
+    @property
+    def entity_id(self):
+        self.log.debug('function-entry')
+        return self._entity_id
+
+    @entity_id.setter
+    def entity_id(self, value):
+        self.log.debug('function-entry')
+        self._entity_id = value
+
+    @property
+    def encryption(self):
+        self.log.debug('function-entry')
+        return self._encryption
+
+    @encryption.setter
+    def encryption(self, value):
+        self.log.debug('function-entry')
+        # FIXME The encryption should come as boolean by default
+        value = eval(value)
+        assert isinstance(value, bool), 'encryption is a boolean'
+
+        if self._encryption != value:
+            self._encryption = value
+
+    @property
+    def discard_config(self):
+        self.log.debug('function-entry')
+        return self._discard_config
+
+    @discard_config.setter
+    def discard_config(self, discard_config):
+        self.log.debug('function-entry')
+        assert isinstance(discard_config, dict), "discard_config not dict"
+        assert 'max_probability' in discard_config, "max_probability missing"
+        assert 'max_threshold' in discard_config, "max_threshold missing"
+        assert 'min_threshold' in discard_config, "min_threshold missing"
+        self._discard_config = discard_config
+
+    @property
+    def discard_policy(self):
+        self.log.debug('function-entry')
+        return self._discard_policy
+
+    @discard_policy.setter
+    def discard_policy(self, discard_policy):
+        self.log.debug('function-entry')
+        dp = ("TailDrop", "WTailDrop", "RED", "WRED")
+        assert (isinstance(discard_policy, str))
+        assert (discard_policy in dp)
+        self._discard_policy = discard_policy
+
+    @property
+    def max_q_size(self):
+        self.log.debug('function-entry')
+        return self._max_q_size
+
+    @max_q_size.setter
+    def max_q_size(self, max_q_size):
+        self.log.debug('function-entry')
+        if isinstance(max_q_size, str):
+            assert (max_q_size == "auto")
+        else:
+            assert (isinstance(max_q_size, int))
+
+        self._max_q_size = max_q_size
+
+    @property
+    def pbit_map(self):
+        self.log.debug('function-entry')
+        return self._pbit_map
+
+    @pbit_map.setter
+    def pbit_map(self, pbit_map):
+        self.log.debug('function-entry')
+        assert (isinstance(pbit_map, str))
+        assert (len(pbit_map[2:]) == 8)  # Example format of pbit_map: "0b00000101"
+        try:
+            _ = int(pbit_map[2], 2)
+        except ValueError:
+            raise Exception("pbit_map-not-binary-string-{}".format(pbit_map))
+
+        # remove '0b'
+        self._pbit_map = pbit_map[2:]
+
+    @property
+    def scheduling_policy(self):
+        self.log.debug('function-entry')
+        return self._scheduling_policy
+
+    @scheduling_policy.setter
+    def scheduling_policy(self, scheduling_policy):
+        self.log.debug('function-entry')
+        sp = ("WRR", "StrictPriority")
+        assert (isinstance(scheduling_policy, str))
+        assert (scheduling_policy in sp)
+        self._scheduling_policy = scheduling_policy
+
+    @staticmethod
+    def create(handler, gem_port):
+        log.debug('function-entry', gem_port=gem_port)
+
+        return OnuGemPort(gem_id=gem_port['gemport_id'],
+                          uni_id=gem_port['uni_id'],
+                          alloc_id=gem_port['alloc_id_ref'],
+                          direction=gem_port['direction'],
+                          encryption=gem_port['encryption'],  # aes_indicator,
+                          discard_config=gem_port['discard_config'],
+                          discard_policy=gem_port['discard_policy'],
+                          max_q_size=gem_port['max_q_size'],
+                          pbit_map=gem_port['pbit_map'],
+                          priority_q=gem_port['priority_q'],
+                          scheduling_policy=gem_port['scheduling_policy'],
+                          weight=gem_port['weight'],
+                          handler=handler,
+                          untagged=False)
+
+    @inlineCallbacks
+    def add_to_hardware(self, omci,
+                        tcont_entity_id,
+                        ieee_mapper_service_profile_entity_id,
+                        gal_enet_profile_entity_id,
+                        ul_prior_q_entity_id,
+                        dl_prior_q_entity_id):
+
+        self.log.debug('add-to-hardware', entity_id=self.entity_id, gem_id=self.gem_id,
+                       tcont_entity_id=tcont_entity_id,
+                       ieee_mapper_service_profile_entity_id=ieee_mapper_service_profile_entity_id,
+                       gal_enet_profile_entity_id=gal_enet_profile_entity_id,
+                       ul_prior_q_entity_id=ul_prior_q_entity_id,
+                       dl_prior_q_entity_id=dl_prior_q_entity_id)
+
+        try:
+            direction = "downstream" if self.multicast else "bi-directional"
+            assert not self.multicast, 'MCAST is not supported yet'
+
+            attributes = dict()
+            attributes['priority_queue_pointer_downstream'] = dl_prior_q_entity_id
+            msg = GemPortNetworkCtpFrame(
+                self.entity_id,  # same entity id as GEM port
+                port_id=self.gem_id,
+                tcont_id=tcont_entity_id,
+                direction=direction,
+                upstream_tm=ul_prior_q_entity_id,
+                attributes=attributes
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'create-gem-port-network-ctp')
+
+        except Exception as e:
+            self.log.exception('gemport-create', e=e)
+            raise
+
+        try:
+            # TODO: magic numbers here
+            msg = GemInterworkingTpFrame(
+                self.entity_id,  # same entity id as GEM port
+                gem_port_network_ctp_pointer=self.entity_id,
+                interworking_option=5,  # IEEE 802.1
+                service_profile_pointer=ieee_mapper_service_profile_entity_id,
+                interworking_tp_pointer=0x0,
+                pptp_counter=1,
+                gal_profile_pointer=gal_enet_profile_entity_id
+            )
+            frame = msg.create()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'create-gem-interworking-tp')
+
+        except Exception as e:
+            self.log.exception('interworking-create', e=e)
+            raise
+
+        returnValue(results)
+
+    @inlineCallbacks
+    def remove_from_hardware(self, omci):
+        self.log.debug('function-entry', omci=omci)
+        self.log.debug('remove-from-hardware', gem_id=self.gem_id)
+
+        try:
+            msg = GemInterworkingTpFrame(self.entity_id)
+            frame = msg.delete()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'delete-gem-port-network-ctp')
+        except Exception as e:
+            self.log.exception('interworking-delete', e=e)
+            raise
+
+        try:
+            msg = GemPortNetworkCtpFrame(self.entity_id)
+            frame = msg.delete()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'delete-gem-interworking-tp')
+        except Exception as e:
+            self.log.exception('gemport-delete', e=e)
+            raise
+
+        returnValue(results)
+
+    def check_status_and_state(self, results, operation=''):
+        self.log.debug('function-entry')
+        omci_msg = results.fields['omci_message'].fields
+        status = omci_msg['success_code']
+        error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
+        failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
+        unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
+
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
+                       failed_mask=failed_mask, unsupported_mask=unsupported_mask)
+
+        if status == RC.Success:
+            return True
+
+        elif status == RC.InstanceExists:
+            return False
diff --git a/python/adapters/brcm_openomci_onu/onu_tcont.py b/python/adapters/brcm_openomci_onu/onu_tcont.py
new file mode 100644
index 0000000..c5414ee
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/onu_tcont.py
@@ -0,0 +1,140 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from common.frameio.frameio import hexify
+from twisted.internet.defer import  inlineCallbacks, returnValue, succeed
+from voltha.extensions.omci.omci_me import *
+from voltha.extensions.omci.omci_defs import *
+
+RC = ReasonCodes
+
+
+class OnuTCont(object):
+    """
+    Broadcom ONU specific implementation
+    """
+    def __init__(self, handler, uni_id, alloc_id, q_sched_policy, traffic_descriptor):
+
+        self.log = structlog.get_logger(device_id=handler.device_id, uni_id=uni_id, alloc_id=alloc_id)
+        self.log.debug('function-entry')
+
+        self.uni_id = uni_id
+        self.alloc_id = alloc_id
+        self._q_sched_policy = 0
+        self.q_sched_policy = q_sched_policy
+        self.traffic_descriptor = traffic_descriptor
+
+        self._handler = handler
+        self._entity_id = None
+
+    def __str__(self):
+        return "OnuTCont - uni_id: {}, entity_id {}, alloc-id: {}, q_sched_policy: {}, traffic_descriptor: {}".format(
+            self.uni_id, self._entity_id, self.alloc_id, self.q_sched_policy, self.traffic_descriptor)
+
+    def __repr__(self):
+        return str(self)
+
+    @property
+    def entity_id(self):
+        self.log.debug('function-entry')
+        return self._entity_id
+
+    @property
+    def q_sched_policy(self):
+        self.log.debug('function-entry')
+        return self._q_sched_policy
+
+
+    @q_sched_policy.setter
+    def q_sched_policy(self, q_sched_policy):
+        sp = ('Null', 'WRR', 'StrictPriority')
+        if q_sched_policy in sp:
+            self._q_sched_policy = sp.index(q_sched_policy)
+        else:
+            self._q_sched_policy = 0
+
+    @staticmethod
+    def create(handler, tcont, td):
+        log = structlog.get_logger(tcont=tcont, td=td)
+        log.debug('function-entry', tcont=tcont)
+
+        return OnuTCont(handler,
+                        tcont['uni_id'],
+                        tcont['alloc-id'],
+                        tcont['q_sched_policy'],
+                        td
+                        )
+
+    @inlineCallbacks
+    def add_to_hardware(self, omci, tcont_entity_id):
+        self.log.debug('add-to-hardware', tcont_entity_id=tcont_entity_id)
+
+        self._entity_id = tcont_entity_id
+
+        try:
+            # FIXME: self.q_sched_policy seems to be READ-ONLY
+            # Ideally the READ-ONLY or NOT attribute is available from ONU-2G ME
+            #msg = TcontFrame(self.entity_id, self.alloc_id, self.q_sched_policy)
+            msg = TcontFrame(self.entity_id, self.alloc_id)
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'set-tcont')
+
+        except Exception as e:
+            self.log.exception('tcont-set', e=e)
+            raise
+
+        returnValue(results)
+
+    @inlineCallbacks
+    def remove_from_hardware(self, omci):
+        self.log.debug('function-entry', omci=omci)
+        self.log.debug('remove-from-hardware', tcont_entity_id=self.entity_id)
+
+        # Release tcont by setting alloc_id=0xFFFF
+        # TODO: magic number, create a named variable
+
+        try:
+            msg = TcontFrame(self.entity_id, 0xFFFF)
+            frame = msg.set()
+            self.log.debug('openomci-msg', omci_msg=msg)
+            results = yield omci.send(frame)
+            self.check_status_and_state(results, 'delete-tcont')
+
+        except Exception as e:
+            self.log.exception('tcont-delete', e=e)
+            raise
+
+        returnValue(results)
+
+    def check_status_and_state(self, results, operation=''):
+        self.log.debug('function-entry')
+        omci_msg = results.fields['omci_message'].fields
+        status = omci_msg['success_code']
+        error_mask = omci_msg.get('parameter_error_attributes_mask', 'n/a')
+        failed_mask = omci_msg.get('failed_attributes_mask', 'n/a')
+        unsupported_mask = omci_msg.get('unsupported_attributes_mask', 'n/a')
+
+        self.log.debug("OMCI Result: %s", operation, omci_msg=omci_msg,
+                       status=status, error_mask=error_mask,
+                       failed_mask=failed_mask, unsupported_mask=unsupported_mask)
+
+        if status == RC.Success:
+            return True
+
+        elif status == RC.InstanceExists:
+            return False
diff --git a/python/adapters/brcm_openomci_onu/onu_traffic_descriptor.py b/python/adapters/brcm_openomci_onu/onu_traffic_descriptor.py
new file mode 100644
index 0000000..a70aa7e
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/onu_traffic_descriptor.py
@@ -0,0 +1,112 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from twisted.internet.defer import inlineCallbacks, returnValue, succeed
+
+
+NONE = 0
+BEST_EFFORT_SHARING = 1
+NON_ASSURED_SHARING = 2             # Should match xpon.py values
+DEFAULT = NONE
+
+
+class OnuTrafficDescriptor(object):
+    """
+    Broadcom ONU specific implementation
+    """
+    def __init__(self, fixed, assured, maximum,
+                 additional=DEFAULT,
+                 best_effort=None,
+                 name=None):
+
+        self.log = structlog.get_logger(fixed=fixed, assured=assured, maximum=maximum, additional=additional)
+        self.log.debug('function-entry')
+
+        self.name = name
+        self.fixed_bandwidth = fixed       # bps
+        self.assured_bandwidth = assured   # bps
+        self.maximum_bandwidth = maximum   # bps
+        self.additional_bandwidth_eligibility = additional
+
+        self.best_effort = best_effort if additional == BEST_EFFORT_SHARING else None
+
+
+    @staticmethod
+    def to_string(value):
+        log = structlog.get_logger()
+        log.debug('function-entry', value=value)
+        return {
+            NON_ASSURED_SHARING: "non-assured-sharing",
+            BEST_EFFORT_SHARING: "best-effort-sharing",
+            NONE: "none"
+        }.get(value, "unknown")
+
+
+    @staticmethod
+    def from_value(value):
+        log = structlog.get_logger()
+        log.debug('function-entry', value=value)
+        return {
+            0: NONE,
+            1: BEST_EFFORT_SHARING,
+            2: NON_ASSURED_SHARING,
+        }.get(value, DEFAULT)
+
+
+    def __str__(self):
+        self.log.debug('function-entry')
+        return "OnuTrafficDescriptor: {}, {}/{}/{}".format(self.name,
+                                                        self.fixed_bandwidth,
+                                                        self.assured_bandwidth,
+                                                        self.maximum_bandwidth)
+
+    def to_dict(self):
+        self.log.debug('function-entry')
+        val = {
+            'fixed-bandwidth': self.fixed_bandwidth,
+            'assured-bandwidth': self.assured_bandwidth,
+            'maximum-bandwidth': self.maximum_bandwidth,
+            'additional-bandwidth-eligibility': OnuTrafficDescriptor.to_string(self.additional_bandwidth_eligibility)
+        }
+        return val
+
+
+    @staticmethod
+    def create(traffic_disc):
+        log = structlog.get_logger()
+        log.debug('function-entry',traffic_disc=traffic_disc)
+
+        additional = OnuTrafficDescriptor.from_value(
+            traffic_disc['additional-bw-eligibility-indicator'])
+
+        # TODO: this is all stub code.  Doesnt do anything yet. tech profiles will likely make this clearer
+        best_effort = None
+
+        return OnuTrafficDescriptor(traffic_disc['fixed-bandwidth'],
+                                    traffic_disc['assured-bandwidth'],
+                                    traffic_disc['maximum-bandwidth'],
+                                    name=traffic_disc['name'],
+                                    best_effort=best_effort,
+                                    additional=additional)
+
+    @inlineCallbacks
+    def add_to_hardware(self, omci):
+       self.log.debug('function-entry', omci=omci)
+       results = succeed('TODO: Implement me')
+       returnValue(results)
+
+
+
diff --git a/python/adapters/brcm_openomci_onu/openonu.yml b/python/adapters/brcm_openomci_onu/openonu.yml
new file mode 100644
index 0000000..542fdf5
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/openonu.yml
@@ -0,0 +1,67 @@
+---
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+logging:
+    version: 1
+
+    formatters:
+      brief:
+        format: '%(message)s'
+      default:
+        format: '%(asctime)s.%(msecs)03d %(levelname)-8s %(threadName)s %(module)s.%(funcName)s %(message)s'
+        datefmt: '%Y%m%dT%H%M%S'
+
+    handlers:
+        console:
+            class : logging.StreamHandler
+            level: DEBUG
+            formatter: default
+            stream: ext://sys.stdout
+        localRotatingFile:
+            class: logging.handlers.RotatingFileHandler
+            filename: openonu.log
+            formatter: default
+            maxBytes: 2097152
+            backupCount: 10
+            level: DEBUG
+        null:
+            class: logging.NullHandler
+
+    loggers:
+        amqp:
+            handlers: [null]
+            propagate: False
+        conf:
+            propagate: False
+        '': # root logger
+            handlers: [console, localRotatingFile]
+            level: DEBUG # this can be bumped up/down by -q and -v command line
+                        # options
+            propagate: False
+
+
+kafka-cluster-proxy:
+    event_bus_publisher:
+        topic_mappings:
+            'model-change-events':
+                kafka_topic: 'voltha.events'
+                filters:     [null]
+            'alarms':
+                kafka_topic: 'voltha.alarms'
+                filters:     [null]
+            'kpis':
+                kafka_topic: 'voltha.kpis'
+                filters:     [null]
+
diff --git a/python/adapters/brcm_openomci_onu/pon_port.py b/python/adapters/brcm_openomci_onu/pon_port.py
new file mode 100644
index 0000000..db1daa8
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/pon_port.py
@@ -0,0 +1,294 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from twisted.internet.defer import inlineCallbacks, returnValue
+from voltha.protos.common_pb2 import AdminState, OperStatus
+from voltha.protos.device_pb2 import Port
+from voltha.extensions.omci.tasks.task import Task
+
+BRDCM_DEFAULT_VLAN = 4091
+TASK_PRIORITY = Task.DEFAULT_PRIORITY + 10
+DEFAULT_TPID = 0x8100
+DEFAULT_GEM_PAYLOAD = 48
+
+
+class PonPort(object):
+    """Wraps northbound-port/ANI support for ONU"""
+    # TODO: possibly get from olt
+    MIN_GEM_ENTITY_ID = 0x408
+    MAX_GEM_ENTITY_ID = 0x4FF  # TODO: This limits is internal to specific ONU. It should be more "discoverable"?
+
+    def __init__(self, handler, port_no):
+        self.log = structlog.get_logger(device_id=handler.device_id, port_no=port_no)
+        self.log.debug('function-entry')
+
+        self._enabled = False
+        self._valid = True
+        self._handler = handler
+        self._deferred = None
+        self._port = None
+        self._port_number = port_no
+        self._next_entity_id = PonPort.MIN_GEM_ENTITY_ID
+
+        self._admin_state = AdminState.ENABLED
+        self._oper_status = OperStatus.ACTIVE
+
+        self._gem_ports = {}                           # gem-id -> GemPort
+        self._tconts = {}                              # alloc-id -> TCont
+
+        self.ieee_mapper_service_profile_entity_id = 0x8001
+        self.mac_bridge_port_ani_entity_id = 0x2102  # TODO: can we just use the entity id from the anis list?
+
+    def __str__(self):
+        return "PonPort - port_number: {}, next_entity_id: {}, num_gem_ports: {}, num_tconts: {}".format(
+            self._port_number, self._next_entity_id, len(self._gem_ports), len(self._tconts))
+
+    def __repr__(self):
+        return str(self)
+
+    @staticmethod
+    def create(handler, port_no):
+        log = structlog.get_logger(device_id=handler.device_id, port_no=port_no)
+        log.debug('function-entry')
+        port = PonPort(handler, port_no)
+
+        return port
+
+    def _start(self):
+        self.log.debug('function-entry')
+        self._cancel_deferred()
+
+        self._admin_state = AdminState.ENABLED
+        self._oper_status = OperStatus.ACTIVE
+        self._update_adapter_agent()
+
+    def _stop(self):
+        self.log.debug('function-entry')
+        self._cancel_deferred()
+
+        self._admin_state = AdminState.DISABLED
+        self._oper_status = OperStatus.UNKNOWN
+        self._update_adapter_agent()
+
+        # TODO: stop h/w sync
+
+    def _cancel_deferred(self):
+        self.log.debug('function-entry')
+        d1, self._deferred = self._deferred, None
+
+        for d in [d1]:
+            try:
+                if d is not None and not d.called:
+                    d.cancel()
+            except:
+                pass
+
+    def delete(self):
+        self.log.debug('function-entry')
+        self.enabled = False
+        self._valid = False
+        self._handler = None
+
+    @property
+    def enabled(self):
+        self.log.debug('function-entry')
+        return self._enabled
+
+    @enabled.setter
+    def enabled(self, value):
+        self.log.debug('function-entry')
+        if self._enabled != value:
+            self._enabled = value
+
+            if value:
+                self._start()
+            else:
+                self._stop()
+
+    @property
+    def port_number(self):
+        self.log.debug('function-entry')
+        return self._port_number
+
+    @property
+    def next_gem_entity_id(self):
+        self.log.debug('function-entry')
+        entity_id = self._next_entity_id
+
+        self._next_entity_id = self._next_entity_id + 1
+        if self._next_entity_id > PonPort.MAX_GEM_ENTITY_ID:
+            self._next_entity_id = PonPort.MIN_GEM_ENTITY_ID
+
+        return entity_id
+
+    @property
+    def tconts(self):
+        self.log.debug('function-entry')
+        return self._tconts
+
+    @property
+    def gem_ports(self):
+        self.log.debug('function-entry')
+        return self._gem_ports
+
+    def get_port(self):
+        """
+        Get the VOLTHA PORT object for this port
+        :return: VOLTHA Port object
+        """
+        self.log.debug('function-entry')
+
+        if self._port is None:
+            self._port = Port(port_no=self.port_number,
+                              label='PON port',
+                              type=Port.PON_ONU,
+                              admin_state=self._admin_state,
+                              oper_status=self._oper_status,
+                              peers=[])
+        return self._port
+
+    def _update_adapter_agent(self):
+        """
+        Update the port status and state in the core
+        """
+        self.log.debug('function-entry')
+        self.log.debug('update-adapter-agent', admin_state=self._admin_state,
+                       oper_status=self._oper_status)
+
+        if self._port is not None:
+            self._port.admin_state = self._admin_state
+            self._port.oper_status = self._oper_status
+
+        # adapter_agent add_port also does an update of port status
+        try:
+            self._handler.adapter_agent.add_port(self._handler.device_id, self.get_port())
+        except Exception as e:
+            self.log.exception('update-port', e=e)
+
+    def add_tcont(self, tcont, reflow=False):
+        """
+        Creates/ a T-CONT with the given alloc-id
+
+        :param tcont: (TCont) Object that maintains the TCONT properties
+        :param reflow: (boolean) If true, force add (used during h/w resync)
+        :return: (deferred)
+        """
+        self.log.debug('function-entry', tcont=tcont.alloc_id)
+
+        if not self._valid:
+            return      # Deleting
+
+        if not reflow and tcont.alloc_id in self._tconts:
+            return      # already created
+
+        self.log.info('add-tcont', tcont=tcont.alloc_id, reflow=reflow)
+        self._tconts[tcont.alloc_id] = tcont
+
+    def update_tcont_td(self, alloc_id, new_td):
+        self.log.debug('function-entry')
+
+        tcont = self._tconts.get(alloc_id)
+
+        if tcont is None:
+            return  # not-found
+
+        tcont.traffic_descriptor = new_td
+
+        # TODO: Not yet implemented
+        #TODO: How does this affect ONU tcont settings?
+        #try:
+        #    results = yield tcont.add_to_hardware(self._handler.omci)
+        #except Exception as e:
+        #    self.log.exception('tcont', tcont=tcont, e=e)
+        #    # May occur with xPON provisioning, use hw-resync to recover
+        #    results = 'resync needed'
+        # returnValue(results)
+
+    @inlineCallbacks
+    def remove_tcont(self, alloc_id):
+        self.log.debug('function-entry')
+
+        tcont = self._tconts.get(alloc_id)
+
+        if tcont is None:
+            returnValue('nop')
+
+        try:
+            del self._tconts[alloc_id]
+            results = yield tcont.remove_from_hardware(self._handler.openomci.omci_cc)
+            returnValue(results)
+
+        except Exception as e:
+            self.log.exception('delete', e=e)
+            raise
+
+    def gem_port(self, gem_id, direction):
+        self.log.debug('function-entry')
+        return self._gem_ports.get((gem_id, direction))
+
+    @property
+    def gem_ids(self):
+        """Get all GEM Port IDs used by this ONU"""
+        self.log.debug('function-entry')
+        return sorted([gem_id_and_direction[0] for gem_id_and_direction, gem in self._gem_ports.items()])
+
+    def add_gem_port(self, gem_port, reflow=False):
+        """
+        Add a GEM Port to this ONU
+
+        :param gem_port: (GemPort) GEM Port to add
+        :param reflow: (boolean) If true, force add (used during h/w resync)
+        :return: (deferred)
+        """
+        self.log.debug('function-entry', gem_port=gem_port.gem_id)
+
+        if not self._valid:
+            return  # Deleting
+
+        if not reflow and (gem_port.gem_id, gem_port.direction) in self._gem_ports:
+            return  # nop
+
+        # if this is actually a new gem port then issue the next entity_id
+        gem_port.entity_id = self.next_gem_entity_id
+        self.log.info('add-gem-port', gem_port=gem_port, reflow=reflow)
+        self._gem_ports[(gem_port.gem_id, gem_port.direction)] = gem_port
+
+    @inlineCallbacks
+    def remove_gem_id(self, gem_id, direction):
+        """
+        Remove a GEM Port from this ONU
+
+        :param gem_id: (GemPort) GEM Port to remove
+        :param direction: Direction of the gem port
+        :return: deferred
+        """
+        self.log.debug('function-entry', gem_id=gem_id)
+
+        gem_port = self._gem_ports.get((gem_id, direction))
+
+        if gem_port is None:
+            returnValue('nop')
+
+        try:
+            del self._gem_ports[(gem_id, direction)]
+            results = yield gem_port.remove_from_hardware(self._handler.openomci.omci_cc)
+            returnValue(results)
+
+        except Exception as ex:
+            self.log.exception('gem-port-delete', e=ex)
+            raise
+
+
diff --git a/python/adapters/brcm_openomci_onu/uni_port.py b/python/adapters/brcm_openomci_onu/uni_port.py
new file mode 100644
index 0000000..2ee307b
--- /dev/null
+++ b/python/adapters/brcm_openomci_onu/uni_port.py
@@ -0,0 +1,248 @@
+#
+# Copyright 2018 the original author or authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+import structlog
+from enum import Enum
+from voltha.protos.common_pb2 import OperStatus, AdminState
+from voltha.protos.device_pb2 import Port
+from voltha.protos.openflow_13_pb2 import OFPPF_10GB_FD
+from voltha.core.logical_device_agent import mac_str_to_tuple
+from voltha.protos.logical_device_pb2 import LogicalPort
+from voltha.protos.openflow_13_pb2 import OFPPS_LIVE, OFPPF_FIBER, OFPPS_LINK_DOWN
+from voltha.protos.openflow_13_pb2 import ofp_port
+
+class UniType(Enum):
+    """
+    UNI Types Defined in G.988
+    """
+    PPTP = 'PhysicalPathTerminationPointEthernet'
+    VEIP = 'VirtualEthernetInterfacePoint'
+    # TODO: Add others as they become supported
+
+
+class UniPort(object):
+    """Wraps southbound-port(s) support for ONU"""
+
+    def __init__(self, handler, name, uni_id, port_no, ofp_port_no,
+                 type=UniType.PPTP):
+        self.log = structlog.get_logger(device_id=handler.device_id,
+                                        port_no=port_no)
+        self._enabled = False
+        self._handler = handler
+        self._name = name
+        self._port = None
+        self._port_number = port_no
+        self._ofp_port_no = ofp_port_no
+        self._logical_port_number = None
+        self._entity_id = None
+        self._mac_bridge_port_num = 0
+        self._type = type
+        self._uni_id = uni_id
+
+        self._admin_state = AdminState.ENABLED
+        self._oper_status = OperStatus.ACTIVE
+
+    def __str__(self):
+        return "UniPort - name: {}, port_number: {}, entity_id: {}, mac_bridge_port_num: {}, type: {}, ofp_port: {}"\
+            .format(self.name, self.port_number, self.entity_id, self._mac_bridge_port_num, self.type, self._ofp_port_no)
+
+    def __repr__(self):
+        return str(self)
+
+    @staticmethod
+    def create(handler, name, uni_id, port_no, ofp_port_no, type):
+        port = UniPort(handler, name, uni_id, port_no, ofp_port_no, type)
+        return port
+
+    def _start(self):
+        self._cancel_deferred()
+        self._admin_state = AdminState.ENABLED
+        self._oper_status = OperStatus.ACTIVE
+        self._update_adapter_agent()
+
+    def _stop(self):
+        self._cancel_deferred()
+        self._admin_state = AdminState.DISABLED
+        self._oper_status = OperStatus.UNKNOWN
+        self._update_adapter_agent()
+
+    def delete(self):
+        self.enabled = False
+        self._handler = None
+
+    def _cancel_deferred(self):
+        pass
+
+    @property
+    def name(self):
+        return self._name
+
+    @property
+    def enabled(self):
+        return self._enabled
+
+    @enabled.setter
+    def enabled(self, value):
+        if self._enabled != value:
+            self._enabled = value
+
+            if value:
+                self._start()
+            else:
+                self._stop()
+
+    @property
+    def uni_id(self):
+        """
+        Physical prt index on ONU 0 - N
+        :return: (int) uni id
+        """
+        return self._uni_id
+
+
+    @property
+    def mac_bridge_port_num(self):
+        """
+        Port number used when creating MacBridgePortConfigurationDataFrame port number
+        :return: (int) port number
+        """
+        return self._mac_bridge_port_num
+
+    @mac_bridge_port_num.setter
+    def mac_bridge_port_num(self, value):
+        self._mac_bridge_port_num = value
+
+    @property
+    def port_number(self):
+        """
+        Physical device port number
+        :return: (int) port number
+        """
+        return self._port_number
+
+    @property
+    def entity_id(self):
+        """
+        OMCI UNI_G entity ID for port
+        """
+        return self._entity_id
+
+    @entity_id.setter
+    def entity_id(self, value):
+        assert self._entity_id is None, 'Cannot reset the Entity ID'
+        self._entity_id = value
+
+    @property
+    def logical_port_number(self):
+        """
+        Logical device port number (used as OpenFlow port for UNI)
+        :return: (int) port number
+        """
+        return self._logical_port_number
+
+    @property
+    def type(self):
+        """
+        UNI Type used in OMCI messaging
+        :return: (UniType) One of the enumerated types
+        """
+        return self._type
+
+    def _update_adapter_agent(self):
+        """
+        Update the port status and state in the core
+        """
+        self.log.debug('update-adapter-agent', admin_state=self._admin_state,
+                       oper_status=self._oper_status)
+
+        if self._port is not None:
+            self._port.admin_state = self._admin_state
+            self._port.oper_status = self._oper_status
+
+        try:
+            # adapter_agent add_port also does an update of existing port
+            self._handler.adapter_agent.add_port(self._handler.device_id,
+                                                 self.get_port())
+
+        except Exception as e:
+            self.log.exception('update-port', e=e)
+
+    def get_port(self):
+        """
+        Get the VOLTHA PORT object for this port
+        :return: VOLTHA Port object
+        """
+        self._port = Port(port_no=self.port_number,
+                          label=self.port_id_name(),
+                          type=Port.ETHERNET_UNI,
+                          admin_state=self._admin_state,
+                          oper_status=self._oper_status)
+        return self._port
+
+    def port_id_name(self):
+        return 'uni-{}'.format(self._port_number)
+
+    def add_logical_port(self, openflow_port_no, multi_uni_naming,
+                         capabilities=OFPPF_10GB_FD | OFPPF_FIBER,
+                         speed=OFPPF_10GB_FD):
+
+        self.log.debug('function-entry')
+
+        if self._logical_port_number is not None:
+            # delete old logical port if it exists
+            try:
+                port = self._handler.adapter_agent.get_logical_port(self._handler.logical_device_id,
+                                                           self.port_id_name())
+                self._handler.adapter_agent.delete_logical_port(self._handler.logical_device_id, port)
+
+            except Exception as e:
+                # assume this exception was because logical port does not already exist
+                pass
+
+            self._logical_port_number = None
+
+        port_no = openflow_port_no or self._ofp_port_no
+
+        if self._logical_port_number is None and port_no is not None:
+            self._logical_port_number = port_no
+
+            device = self._handler.adapter_agent.get_device(self._handler.device_id)
+
+            # leave the ports down until omci mib download has finished.  otherwise flows push before time
+            openflow_port = ofp_port(
+                port_no=port_no,
+                hw_addr=mac_str_to_tuple('08:%02x:%02x:%02x:%02x:%02x' %
+                                         ((device.parent_port_no >> 8 & 0xff),
+                                          device.parent_port_no & 0xff,
+                                          (port_no >> 16) & 0xff,
+                                          (port_no >> 8) & 0xff,
+                                          port_no & 0xff)),
+                name=device.serial_number + ['', '-' + str(self._mac_bridge_port_num)][multi_uni_naming],
+                config=0,
+                state=OFPPS_LINK_DOWN,
+                curr=capabilities,
+                advertised=capabilities,
+                peer=capabilities,
+                curr_speed=speed,
+                max_speed=speed
+            )
+            self._handler.adapter_agent.add_logical_port(self._handler.logical_device_id,
+                                                         LogicalPort(
+                                                             id=self.port_id_name(),
+                                                             ofp_port=openflow_port,
+                                                             device_id=device.id,
+                                                             device_port_no=self._port_number))
+
+            self.log.debug('logical-port', id=self.port_id_name(), device_port_no=self._port_number, openflow_port=openflow_port)