VOL-1398: Adtran-ONU - Initial containerization commit

Change-Id: I7afcc1ad65b9ef80da994b0b0ddf74860911bb46
diff --git a/adapters/adtran_onu/omci/README.md b/adapters/adtran_onu/omci/README.md
new file mode 100644
index 0000000..babd884
--- /dev/null
+++ b/adapters/adtran_onu/omci/README.md
@@ -0,0 +1,97 @@
+#OMCI Support
+
+This directory contains classes to assist in the creation, transmission,
+and reception of OMCI frames on this ONU Adapter. A number of these files (but
+not all) could be moved into the common *.../voltha/extensions/omci* subdirectory.
+
+##Files
+### omci_cc.py
+
+The *omci_cc.py* file contains the OMCI communications channel for sending and receiving
+OMCI messages.  For transmits, it will send the OMCI message to the proper proxy channel,
+but for received, OMCI frames, your device adapter will need to call the
+*receive_message()* method.
+
+The communications channel will return a deferred on a Tx request which will fire when
+a corresponding response is received or if a timeout or other error occurs. When a
+successful response is received, the *OMCI_CC* will also look at *Get, Set, Create*, and
+*Delete* messages prior to calling any additional callbacks so that the MIB Database can be
+checked or updated as needed.  Note that the MIB Database is not yet implemented.
+
+ONU Autonomous messages are also handled (Test Results messages are TBD) and these are
+placed
+
+A collection of statistics are available in case the ONU wishes to publish a
+PM group containing these statistics. The Adtran ONU does so in the *onu_pm_metrics.py*
+file.
+
+Finally, a list of vendor-specific ME's can be passed to the class initializer so that
+they are registered in the class_id map. This allows for successful decode of custom MEs.
+See the Adtran ONU's instantiation of the *OMCI_CC* class as an example of how to
+add vendor-specific MEs.
+
+### me_frame.py
+
+This file contains the base class implementation that helps to transform defined
+Managed EntityClasses into OMCI Frames with specific actions (*get, set, create, 
+delete, ...*). Prior this class, frames to do each action were hand created methods.
+
+Besides providing methods for creating OMCI frames, the ME attributes names, access
+attributes, and allowed operations are checked to verify that the action is valid
+for both the ME as well as the specific attribute.
+
+What is currently missing is other OMCI actions have not been coded:
+ - GetNext
+ - GetCurrentData
+ - GetAllAlarms
+ - GetAllAlarmsNext
+ - MibUpload
+ - MibUploadNext
+ - MibReset
+ - Test
+ - StartSoftwareDownload
+ - DownloadSection
+ - EndSoftwareDownload
+ - ActivateSoftware
+ - CommitSoftware
+ - SynchronizeTime
+ - Reboot
+ 
+For many of these actions, such as MibReset, these are only performed on a specific
+ME and it may be best to provide these as explicit static methods.
+
+### omci_me.py
+
+This file is a collection of ME classes derived from the MEFrame base class. For many
+of the currently defined ME's in *omci_entities.py*
+
+### omci_defs.py
+
+This file contains an additional status code enumeration which could be merged with
+the main OMCI extensions directory.
+
+### omci_entities.py
+
+This is an Adtran ONU specific file to add custom OMCI **OMCI_CC** entities and a function
+that can be called by the **OMCI_CC** class to install them into the appropriate locations
+such that OMCI frame decode works as expected during MIB uploads.
+
+Eventually I envision the **OMCI_CC** to be mostly hidden from an ONU device adapter, so
+a method to register these custom ME's needs to be provided.
+ 
+### deprecated.py
+
+This file contains some of the original _old-style_ OMCI frame creation and send
+commands for the Adtran ONU. These were originally copied over from the BroadCom
+ONU Device Adapter and modified for use in the Adtran ONU. After the **OMCI_CC** class
+was created to handle OMCI Tx/Rx, a reference to the **OMCI_CC** was passed in so that
+these methods could use the *OMCI_CC.send()* method
+
+If you look at the current Adtran ONU **pon_port.py** file, it still contains the original
+calls to these are still in place (commented out) next to how to do the same calls with
+the new **ME_Frame** and **OMCI_CC** classes.
+
+##Unit Tests
+
+After some peer review and any needed refactoring of code, the plan is to create unit tests
+to cover the **OMCI_CC** and **ME_Frame** classes with a target of _90%+_ line coverage.
\ No newline at end of file
diff --git a/adapters/adtran_onu/omci/__init__.py b/adapters/adtran_onu/omci/__init__.py
new file mode 100644
index 0000000..b0fb0b2
--- /dev/null
+++ b/adapters/adtran_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/adapters/adtran_onu/omci/adtn_capabilities_task.py b/adapters/adtran_onu/omci/adtn_capabilities_task.py
new file mode 100644
index 0000000..6dbed03
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_capabilities_task.py
@@ -0,0 +1,147 @@
+#
+# 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.onu_capabilities_task import OnuCapabilitiesTask
+from twisted.internet.defer import failure
+
+
+class AdtnCapabilitiesTask(OnuCapabilitiesTask):
+    """
+    OpenOMCI MIB Capabilities Task - ADTRAN 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}
+              }
+    """
+    name = "Adtran ONU Capabilities Task"
+
+    def __init__(self, omci_agent, device_id):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        super(AdtnCapabilitiesTask, self).__init__(omci_agent, device_id)
+
+        self.name = AdtnCapabilitiesTask.name
+        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)
+        """
+        if self._omci_managed:
+            return super(AdtnCapabilitiesTask, self).supported_managed_entities
+
+        me_1287800f1 = [
+            2, 5, 6, 7, 11, 24, 45, 46, 47, 48, 49, 50, 51, 52, 79, 84, 89, 130,
+            131, 133, 134, 135, 136, 137, 148, 157, 158, 159, 171, 256, 257, 262,
+            263, 264, 266, 268, 272, 273, 274, 277, 278, 279, 280, 281, 297, 298,
+            299, 300, 301, 302, 303, 304, 305, 306, 307, 308, 309, 310, 311, 312,
+            329, 330, 332, 334, 336, 340, 341, 342, 343, 348, 425, 426, 65300,
+            65400, 65401, 65402, 65403, 65404, 65406, 65407, 65408, 65409, 65410,
+            65411, 65412, 65413, 65414, 65420, 65421, 65422, 65423, 65424
+        ]
+        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)
+        """
+        if self._omci_managed:
+            return super(AdtnCapabilitiesTask, self).supported_message_types
+
+        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.info('perform-get')
+
+        if self._omci_managed:
+            # Return generator deferred/results
+            return super(AdtnCapabilitiesTask, 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/adapters/adtran_onu/omci/adtn_get_mds_task.py b/adapters/adtran_onu/omci/adtn_get_mds_task.py
new file mode 100644
index 0000000..0de236f
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_get_mds_task.py
@@ -0,0 +1,56 @@
+#
+# 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.get_mds_task import GetMdsTask
+
+
+class AdtnGetMdsTask(GetMdsTask):
+    """
+    OpenOMCI Get MIB Data Sync value task - Adtran 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 = "ADTN: 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
+        """
+        super(AdtnGetMdsTask, self).__init__(omci_agent, device_id)
+
+        self.name = AdtnGetMdsTask.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.info('perform-get-mds')
+
+        if self._omci_managed:
+            return super(AdtnGetMdsTask, self).perform_get_mds()
+
+        # Non-OMCI managed ADTN 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/adapters/adtran_onu/omci/adtn_install_flow.py b/adapters/adtran_onu/omci/adtn_install_flow.py
new file mode 100644
index 0000000..5d5a2f6
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_install_flow.py
@@ -0,0 +1,321 @@
+#
+# 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 twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, failure, returnValue
+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.adtran_onu.flow.flow_entry import FlowEntry
+
+OP = EntityOperations
+RC = ReasonCodes
+
+
+class ServiceInstallFailure(Exception):
+    """
+    This error is raised by default when the flow-install fails
+    """
+
+
+class AdtnInstallFlowTask(Task):
+    """
+    OpenOMCI MIB Flow Install Task
+
+    Currently, the only service tech profiles expected by v2.0 will be for AT&T
+    residential data service and DT residential data service.
+    """
+    task_priority = Task.DEFAULT_PRIORITY + 10
+    name = "ADTRAN MIB Install Flow Task"
+
+    def __init__(self, omci_agent, handler, flow_entry):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param handler: (AdtranOnuHandler) ONU Handler
+        :param flow_entry: (FlowEntry) Flow to install
+        """
+        super(AdtnInstallFlowTask, self).__init__(AdtnInstallFlowTask.name,
+                                                  omci_agent,
+                                                  handler.device_id,
+                                                  priority=AdtnInstallFlowTask.task_priority,
+                                                  exclusive=False)
+        self._handler = handler
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+        self._flow_entry = flow_entry
+        self._install_by_delete = True
+
+        # TODO: Cleanup below that is not needed
+        is_upstream = flow_entry.flow_direction in FlowEntry.upstream_flow_types
+        uni_port = flow_entry.in_port if is_upstream else flow_entry.out_port
+        pon_port = flow_entry.out_port if is_upstream else flow_entry.in_port
+
+        self._uni = handler.uni_port(uni_port)
+        self._pon = handler.pon_port(pon_port)
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+        #
+        # TODO: Probably need to store many of these in the appropriate object (UNI, PON,...)
+        #
+        self._ethernet_uni_entity_id = self._handler.uni_ports[0].entity_id
+        self._ieee_mapper_service_profile_entity_id = self._pon.ieee_mapper_service_profile_entity_id
+
+        # Next to are specific
+        self._mac_bridge_service_profile_entity_id = handler.mac_bridge_service_profile_entity_id
+
+    def cancel_deferred(self):
+        super(AdtnInstallFlowTask, 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 flow installation
+        """
+        super(AdtnInstallFlowTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_flow_install)
+
+    def stop(self):
+        """
+        Shutdown flow install task
+        """
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(AdtnInstallFlowTask, 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)
+        """
+        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(operation, 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
+
+        elif status == RC.UnknownInstance and operation == 'delete':
+            return True
+
+        raise ServiceInstallFailure('{} failed with a status of {}, error_mask: {}, failed_mask: {}, unsupported_mask: {}'
+                                    .format(operation, status, error_mask, failed_mask, unsupported_mask))
+
+    @inlineCallbacks
+    def perform_flow_install(self):
+        """
+        Send the commands to configure the flow.
+
+        Currently this task uses the pre-installed default TCONT and GEM Port.  This will
+        change when Technology Profiles are supported.
+        """
+        self.log.info('perform-flow-install', vlan_vid=self._flow_entry.vlan_vid)
+
+        if self._flow_entry.vlan_vid == 0:
+            return
+
+        def resources_available():
+            # TODO: Rework for non-xpon mode
+            return (len(self._handler.uni_ports) > 0 and
+                    len(self._pon.tconts) and
+                    len(self._pon.gem_ports))
+
+        if self._handler.enabled and resources_available():
+
+            omci = self._onu_device.omci_cc
+            brg_id = self._mac_bridge_service_profile_entity_id
+            vlan_vid = self._flow_entry.vlan_vid
+
+            if self._install_by_delete:
+                # Delete any existing flow before adding this new one
+
+                msg = ExtendedVlanTaggingOperationConfigurationDataFrame(brg_id, attributes=None)
+                frame = msg.delete()
+
+                try:
+                    results = yield omci.send(frame)
+                    self.check_status_and_state(results, operation='delete')
+
+                    attributes = dict(
+                        association_type=2,  # Assoc Type, PPTP Ethernet UNI
+                        associated_me_pointer=self._ethernet_uni_entity_id  # Assoc ME, PPTP Entity Id
+                    )
+
+                    frame = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                        self._mac_bridge_service_profile_entity_id + self._uni.mac_bridge_port_num,
+                        attributes=attributes
+                    ).create()
+                    results = yield omci.send(frame)
+                    self.check_status_and_state(results, 'flow-recreate-before-set')
+
+                    # TODO: Any of the following needed as well
+
+                    # # Delete bridge ani side vlan filter
+                    # msg = VlanTaggingFilterDataFrame(self._mac_bridge_port_ani_entity_id)
+                    # frame = msg.delete()
+                    #
+                    # results = yield omci.send(frame)
+                    # self.check_status_and_state(results, 'flow-delete-vlan-tagging-filter-data')
+                    #
+                    # # Re-Create bridge ani side vlan filter
+                    # msg = VlanTaggingFilterDataFrame(
+                    #         self._mac_bridge_port_ani_entity_id,  # Entity ID
+                    #         vlan_tcis=[vlan_vid],             # VLAN IDs
+                    #         forward_operation=0x10
+                    # )
+                    # frame = msg.create()
+                    #
+                    # results = yield omci.send(frame)
+                    # self.check_status_and_state(results, 'flow-create-vlan-tagging-filter-data')
+
+                except Exception as e:
+                    self.log.exception('flow-delete-before-install-failure', e=e)
+                    self.deferred.errback(failure.Failure(e))
+                    returnValue(None)
+
+            try:
+                # Now set the VLAN Tagging Operation up as we want it
+                # Update uni side extended vlan filter
+                # filter for untagged
+                # probably for eapol
+                # TODO: lots of magic
+                # attributes = dict(
+                #         # This table filters and tags upstream frames
+                #         received_frame_vlan_tagging_operation_table=
+                #         VlanTaggingOperation(
+                #                 filter_outer_priority=15,     # This entry is not a double-tag rule (ignore out tag rules)
+                #                 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,     # This is a no-tag rule, ignore all other VLAN tag filter fields
+                #                 filter_inner_vid=4096,        # Do not filter on the inner VID
+                #                 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=0,   # Remove 0 tags
+                #
+                #                 treatment_outer_priority=15,  # Do not add an outer tag
+                #                 treatment_outer_vid=0,        # n/a
+                #                 treatment_outer_tpid_de=0,    # n/a
+                #
+                #                 treatment_inner_priority=0,    # Add an inner tag and insert this value as the priority
+                #                 treatment_inner_vid=vlan_vid,  # Push this tag onto the frame
+                #                 treatment_inner_tpid_de=4      # set TPID
+                #         )
+                # )
+                # msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                #         self._mac_bridge_service_profile_entity_id + self._uni.mac_bridge_port_num,  # Bridge Entity ID
+                #         attributes=attributes  # See above
+                # )
+                # frame = msg.set()
+                #
+                # results = yield omci.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: lots of magic
+
+                ################################################################################
+                # Update Extended VLAN Tagging Operation Config Data
+                #
+                # Specifies the TPIDs in use and that operations in the downstream direction are
+                # inverse to the operations in the upstream direction
+                # TODO: Downstream mode may need to be modified once we work more on the flow rules
+
+                attributes = dict(
+                    input_tpid=0x8100,   # input TPID
+                    output_tpid=0x8100,  # output TPID
+                    downstream_mode=0,   # inverse of upstream
+                )
+
+                msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                        self._mac_bridge_service_profile_entity_id +
+                        self._uni.mac_bridge_port_num,  # Bridge Entity ID
+                        attributes=attributes           # See above
+                )
+                frame = msg.set()
+
+                results = yield omci.send(frame)
+                self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
+
+                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=15,  # This is a no-tag rule, ignore all other VLAN tag filter fields
+                        filter_inner_vid=0x1000,   # Do not filter on the inner VID
+                        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=0,  # Remove 0 tags
+
+                        treatment_outer_priority=15,  # Do not add an outer tag
+                        treatment_outer_vid=0,        # n/a
+                        treatment_outer_tpid_de=0,    # n/a
+
+                        treatment_inner_priority=0,    # Add an inner tag and insert this value as the priority
+                        treatment_inner_vid=vlan_vid,  # use this value as the VID in the inner VLAN tag
+                        treatment_inner_tpid_de=4,     # set TPID
+                    )
+                )
+
+                msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                        self._mac_bridge_service_profile_entity_id +
+                        self._uni.mac_bridge_port_num,  # Bridge Entity ID
+                        attributes=attributes           # See above
+                )
+                frame = msg.set()
+
+                results = yield omci.send(frame)
+                self.check_status_and_state(results,
+                                            'flow-set-ext-vlan-tagging-op-config-data-untagged')
+                self.deferred.callback('flow-install-success')
+
+            except Exception as e:
+                # TODO: Better context info for this exception output...
+                self.log.exception('failed-to-install-flow', e=e)
+                self.deferred.errback(failure.Failure(e))
+
+        else:
+            # TODO: Provide better error reason, what was missing...
+            e = ServiceInstallFailure('Required resources are not available')
+            self.deferred.errback(failure.Failure(e))
diff --git a/adapters/adtran_onu/omci/adtn_mib_download_task.py b/adapters/adtran_onu/omci/adtn_mib_download_task.py
new file mode 100644
index 0000000..36289bf
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_mib_download_task.py
@@ -0,0 +1,370 @@
+#
+# 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 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 *
+
+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 AdtnMibDownloadTask(Task):
+    """
+    OpenOMCI MIB Download Example
+
+    This task takes the legacy OMCI 'script' for provisioning the Adtran 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.
+    """
+    task_priority = Task.DEFAULT_PRIORITY + 10
+    default_tpid = 0x8100
+    default_gem_payload = 1518
+
+    name = "ADTRAN MIB Download Task"
+
+    def __init__(self, omci_agent, handler):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param handler: (OnuHandler) ONU Device Handler
+        """
+        super(AdtnMibDownloadTask, self).__init__(AdtnMibDownloadTask.name,
+                                                  omci_agent,
+                                                  handler.device_id,
+                                                  priority=AdtnMibDownloadTask.task_priority,
+                                                  exclusive=False)
+        self._handler = handler
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+
+        # Frame size
+        self._max_gem_payload = AdtnMibDownloadTask.default_gem_payload
+
+        # Port numbers
+        self._pon_port_num = 0
+        self._uni_port_num = 0  # TODO Both port numbers are the same, is this correct?  See MacBridgePortConfigurationDataFrame
+
+        self._pon = handler.pon_port()
+        self._vlan_tcis_1 = self._handler.vlan_tcis_1
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+        #
+        # TODO: Probably need to store many of these in the appropriate object (UNI, PON,...)
+        #
+        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
+
+        # Next to are specific     TODO: UNI lookups here or uni specific install !!!
+        self._ethernet_uni_entity_id = self._handler.uni_ports[0].entity_id
+        self._mac_bridge_service_profile_entity_id = \
+            self._handler.mac_bridge_service_profile_entity_id
+
+    def cancel_deferred(self):
+        super(AdtnMibDownloadTask, 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
+        """
+        super(AdtnMibDownloadTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_mib_download)
+
+    def stop(self):
+        """
+        Shutdown MIB Synchronization tasks
+        """
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(AdtnMibDownloadTask, 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)
+        """
+        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(operation, 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 once resources (gem-ports, tconts, ...)
+        have been defined.
+        """
+        self.log.info('perform-initial-download')
+
+        device = self._handler.adapter_agent.get_device(self.device_id)
+
+        def resources_available():
+            return len(self._handler.uni_ports) > 0
+
+        if self._handler.enabled and resources_available():
+            device.reason = 'Performing Initial OMCI Download'
+            self._handler.adapter_agent.update_device(device)
+
+            try:
+                # Lock the UNI ports to prevent any alarms during initial configuration
+                # of the ONU
+                for uni_port in self._handler.uni_ports:
+                    self.strobe_watchdog()
+
+                    yield self.enable_uni(uni_port, True)
+
+                    # Provision the initial bridge configuration
+                    yield self.perform_initial_bridge_setup(uni_port)
+
+                    # And re-enable the UNIs if needed
+                    yield self.enable_uni(uni_port, False)
+
+                    # If here, we are done with the generic MIB download
+                    device = self._handler.adapter_agent.get_device(self.device_id)
+
+                    device.reason = 'Initial OMCI Download Complete'
+                    self._handler.adapter_agent.update_device(device)
+                    self.deferred.callback('MIB Download - success')
+
+            except TimeoutError as e:
+                self.deferred.errback(failure.Failure(e))
+
+        else:
+            # TODO: Provide better error reason, what was missing...
+            e = MibResourcesFailure('ONU is not enabled')
+            self.deferred.errback(failure.Failure(e))
+
+    @inlineCallbacks
+    def perform_initial_bridge_setup(self, uni_port):
+        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
+            attributes = {
+                'spanning_tree_ind': False,
+                'learning_ind': True
+            }
+            frame = MacBridgeServiceProfileFrame(
+                self._mac_bridge_service_profile_entity_id,
+                attributes
+            ).create()
+            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
+
+            frame = Ieee8021pMapperServiceProfileFrame(self._ieee_mapper_service_profile_entity_id +
+                                                       uni_port.mac_bridge_port_num).create()
+            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
+
+            frame = MacBridgePortConfigurationDataFrame(
+                self._mac_bridge_port_ani_entity_id,                    # Entity ID
+                bridge_id_pointer=self._mac_bridge_service_profile_entity_id,  # Bridge Entity ID
+                # TODO: The PORT number for this port and the UNI port are the same. Correct?
+                port_num=self._pon_port_num,                            # Port ID
+                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
+            ).create()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-mac-bridge-port-config-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
+
+            frame = VlanTaggingFilterDataFrame(
+                self._mac_bridge_port_ani_entity_id,  # Entity ID
+                vlan_tcis=[self._vlan_tcis_1],        # VLAN IDs
+                forward_operation=0x00
+            ).create()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-vlan-tagging-filter-data')
+
+            #############################################################
+            # Create GalEthernetProfile - Once per ONU/PON interface
+            #
+            #  EntityID will be referenced by:
+            #            - GemInterworkingTp
+            #  References:
+            #            - Nothing
+
+            frame = GalEthernetProfileFrame(
+                self._gal_enet_profile_entity_id,
+                max_gem_payload_size=self._max_gem_payload
+            ).create()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-gal-ethernet-profile')
+
+            ##################################################
+            # 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 UNI
+
+            frame = MacBridgePortConfigurationDataFrame(
+                0x000,                                   # Entity ID - This is read-only/set-by-create !!!
+                bridge_id_pointer=self._mac_bridge_service_profile_entity_id,  # Bridge Entity ID
+                port_num=self._uni_port_num,             # Port ID
+                tp_type=1,                               # PPTP Ethernet UNI
+                tp_pointer=self._ethernet_uni_entity_id  # TP ID, 8021p mapper Id
+            ).create()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-mac-bridge-port-config-data-part-2')
+
+        except TimeoutError as _e:
+            self.log.warn('rx-timeout-download', frame=hexlify(frame))
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-setup-1', e=e)
+            raise
+
+        returnValue(None)
+
+    @inlineCallbacks
+    def enable_uni(self, uni, force_lock):
+        """
+        Lock or unlock one or more UNI ports
+
+        :param unis: (list) of UNI objects
+        :param force_lock: (boolean) If True, force lock regardless of enabled state
+        """
+        omci_cc = self._onu_device.omci_cc
+
+        ##################################################################
+        #  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.enabled else 0
+
+            frame = PptpEthernetUniFrame(uni.entity_id,
+                                         attributes=dict(administrative_state=state)).set()
+
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-pptp-ethernet-uni-lock-restore')
+
+        except TimeoutError:
+            self.log.warn('rx-timeout-uni-enable', uni_port=uni)
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-failure', e=e)
+            raise
+
+        returnValue(None)
diff --git a/adapters/adtran_onu/omci/adtn_mib_reconcile_task.py b/adapters/adtran_onu/omci/adtn_mib_reconcile_task.py
new file mode 100644
index 0000000..b0892ad
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_mib_reconcile_task.py
@@ -0,0 +1,184 @@
+#
+# 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 twisted.internet.defer import returnValue
+from pyvoltha.adapters.extensions.omci.omci_defs import *
+from voltha.extensions.omci.omci_entities import Ieee8021pMapperServiceProfile
+from voltha.extensions.omci.tasks.mib_reconcile_task import MibReconcileTask
+from voltha.extensions.omci.database.mib_db_api import ATTRIBUTES_KEY
+from twisted.internet.defer import  inlineCallbacks
+from voltha.extensions.omci.omci_defs import ReasonCodes, EntityOperations
+from voltha.extensions.omci.omci_me import MEFrame
+
+OP = EntityOperations
+RC = ReasonCodes
+AA = AttributeAccess
+
+
+class AdtnMibReconcileTask(MibReconcileTask):
+    """
+    Adtran ONU OpenOMCI MIB Reconcile Task
+
+    For some crazy reason, the ADTRAN ONU does not report the IEEE802.1p Mapper ME
+    in the ONU upload even though it does exists.  This results in an 'instance
+    exists' error when trying to create it on the ONU
+    """
+    name = "Adtran MIB Reconcile Task"
+
+    def __init__(self, omci_agent, device_id, diffs):
+        super(AdtnMibReconcileTask, self).__init__(omci_agent, device_id, diffs)
+
+        self.name = AdtnMibReconcileTask.name
+        self._me_130_okay = False   # Set true once bug is fixed (auto detect)
+        self._omci_managed = False  # Set once ONU Data tracking of MIB-Data-Sync supported
+
+    @inlineCallbacks
+    def fix_olt_only(self, olt, onu_db, olt_db):
+        """
+        Fix ME's that were only found on the OLT. For OLT only MEs there are
+        the following things that will be checked.
+
+            o ME's that do not have an OpenOMCI class decoder. These are stored
+              as binary blobs in the MIB database. Since the OLT will never
+              create these (all are learned from ONU), it is assumed the ONU
+              has removed them for some purpose. So delete them from the OLT
+              database.
+
+            o For ME's that are created by the ONU (no create/delete access), the
+              MEs 'may' not be on the ONU because of a reboot or an OLT created
+              ME was deleted and the ONU gratuitously removes it.  So delete them
+              from the OLT database.
+
+            o For ME's that are created by the OLT/OpenOMCI, delete them from the
+              ONU
+
+        :param olt: (list(int,int)) List of tuples where (class_id, inst_id)
+        :param onu_db: (dict) ONU Database snapshot at time of audit
+        :param olt_db: (dict) OLT Database snapshot at time of audit
+
+        :return: (int, int) successes, failures
+        """
+        # Has IEEE 802.1p reporting Bug fixed?
+
+        if self._me_130_okay or Ieee8021pMapperServiceProfile.class_id in onu_db:
+            self._me_130_okay = True
+            returnValue(super(AdtnMibReconcileTask, self).fix_olt_only(olt, onu_db, olt_db))
+
+        ############################
+        # Base class handles all but ME 130
+        local_mes = {Ieee8021pMapperServiceProfile.class_id}
+        not_manual = [(cid, eid) for cid, eid in olt if cid not in local_mes]
+
+        results = yield super(AdtnMibReconcileTask, self).fix_olt_only(not_manual,
+                                                                       onu_db,
+                                                                       olt_db)
+        successes = results[0]
+        failures = results[1]
+
+        # If IEEE 802.1p mapper needs to be checked, do it manually as the IBONT 602
+        # manipulates it during MEF EVC/EVC-Map creation
+        for cid in local_mes:
+            class_entry = olt_db.get(cid, None)
+
+            if class_entry is not None:
+                entries = {k: v for k, v in class_entry.items() if isinstance(k, int)}
+                for eid, instance in entries.items():
+                    try:
+                        self.strobe_watchdog()
+                        results = yield self.manual_verification(cid, eid, instance[ATTRIBUTES_KEY])
+                        successes += results[0]
+                        failures += results[1]
+
+                    except Exception as _e:
+                        failures += 1
+
+        returnValue((successes, failures))
+
+    @inlineCallbacks
+    def update_mib_data_sync(self):
+        """ IBONT version does not support MDS"""
+        if self._omci_managed:
+            results = yield super(AdtnMibReconcileTask, self).update_mib_data_sync()
+            returnValue(results)
+
+        returnValue((1, 0))
+
+    @inlineCallbacks
+    def manual_verification(self, cid, eid, attributes):
+        # Trim off read-only attributes from ones passed in
+
+        me_map = self._device.me_map
+        ro_set = {AA.R}
+        ro_attrs = {attr.field.name for attr in me_map[cid].attributes
+                    if attr.access == ro_set}
+        attributes = {k: v for k, v in attributes.items() if k not in ro_attrs}
+        attributes_to_fix = dict()
+
+        try:
+            while len(attributes):
+                frame = MEFrame(me_map[cid], eid, attributes).get()
+                self.strobe_watchdog()
+                results = yield self._device.omci_cc.send(frame)
+                omci_message = results.fields['omci_message'].fields
+                status = omci_message['success_code']
+
+                if status == RC.UnknownEntity.value:
+                    self.strobe_watchdog()
+                    results = yield self.create_instance(me_map[cid], eid, attributes)
+                    returnValue((results[0], results[1]))
+
+                if status != RC.Success.value:
+                    self.log.error('manual-check-get-failed', cid=cid, eid=eid,
+                                   attributes=attributes, status=status)
+                    returnValue((1, 0))
+
+                onu_attr = {k: v for k, v in omci_message['data'].items()}
+                attributes_to_fix.update({k: v for k, v in onu_attr.items()
+                                         if k in attributes and v != attributes[k]})
+                attributes = {k: v for k, v in attributes if k not in onu_attr.keys()}
+
+            if len(attributes_to_fix) > 0:
+                try:
+                    frame = MEFrame(me_map[cid], eid, attributes_to_fix).set()
+                    self.strobe_watchdog()
+                    yield self._device.omci_cc.send(frame)
+                    returnValue((1, 0))
+
+                except Exception as _e:
+                    returnValue((0, 1))
+
+        except Exception as e:
+            self.log.exception('manual-check-failed', e=e, cid=cid, eid=eid)
+            raise
+
+    @inlineCallbacks
+    def create_instance(self, cid, eid, attributes):
+        try:
+            me_map = self._device.me_map
+            frame = MEFrame(me_map[cid], eid, attributes).create()
+
+            self.strobe_watchdog()
+            results = yield self._device.omci_cc.send(frame)
+            status = results.fields['omci_message'].fields['success_code']
+            if status == RC.Success.value or status == RC.InstanceExists.value:
+                returnValue((1, 0))
+
+            self.log.error('manual-check-create-failed', cid=cid, eid=eid,
+                           attributes=attributes, status=status)
+            returnValue((0, 1))
+
+        except Exception as e:
+            self.log.exception('manual-check-failed', e=e, cid=cid, eid=eid)
+            raise
diff --git a/adapters/adtran_onu/omci/adtn_mib_resync_task.py b/adapters/adtran_onu/omci/adtn_mib_resync_task.py
new file mode 100644
index 0000000..500ee02
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_mib_resync_task.py
@@ -0,0 +1,67 @@
+#
+# 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.
+#
+from voltha.extensions.omci.tasks.mib_resync_task import MibResyncTask
+from voltha.extensions.omci.omci_entities import GalEthernetProfile, GemPortNetworkCtp, \
+    Ieee8021pMapperServiceProfile
+
+
+class AdtnMibResyncTask(MibResyncTask):
+    """
+    ADTRAN MIB resynchronization Task
+
+    The ADTRAN IBONT 602 does not report the current value of the GAL Ethernet
+    Payload size, it is always 0.
+
+    Also, the MEF EVC/EVC-MAP code monitors GEM Port CTP ME
+    """
+    def __init__(self, omci_agent, device_id):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        super(AdtnMibResyncTask, self).__init__(omci_agent, device_id)
+        self.omci_fixed = False
+
+    def compare_mibs(self, db_copy, db_active):
+        """
+        Compare the our db_copy with the ONU's active copy
+
+        :param db_copy: (dict) OpenOMCI's copy of the database
+        :param db_active: (dict) ONU's database snapshot
+        :return: (dict), (dict), (list)  Differences
+        """
+        on_olt_only, on_onu_only, attr_diffs = super(AdtnMibResyncTask, self).\
+            compare_mibs(db_copy, db_active)
+
+        if not self.omci_fixed:
+            # Exclude 'max_gem_payload_size' in GAL Ethernet Profile
+            attr_diffs = [attr for attr in attr_diffs
+                          if attr[0] != GalEthernetProfile.class_id
+                          or attr[2] != 'max_gem_payload_size']
+
+            # Exclude any changes to GEM Port Network CTP
+            attr_diffs = [attr for attr in attr_diffs
+                          if attr[0] != GemPortNetworkCtp.class_id]
+
+            if on_olt_only is not None:
+                # Exclude IEEE 8021.p Mapper Service Profile from OLT Only as not
+                # reported in current IBONT 602 software
+                on_olt_only = [(cid, eid) for cid, eid in on_olt_only
+                               if cid != Ieee8021pMapperServiceProfile.class_id]
+
+        return on_olt_only, on_onu_only, attr_diffs
diff --git a/adapters/adtran_onu/omci/adtn_mib_sync.py b/adapters/adtran_onu/omci/adtn_mib_sync.py
new file mode 100644
index 0000000..e0d6b82
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_mib_sync.py
@@ -0,0 +1,85 @@
+#
+# 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.state_machines.mib_sync import MibSynchronizer
+
+
+class AdtnMibSynchronizer(MibSynchronizer):
+    """
+    OpenOMCI MIB Synchronizer state machine for Adtran ONUs
+    """
+    ADTN_RESYNC_DELAY = 120     # Periodically force a resync (lower for debugging)
+    ADTN_AUDIT_DELAY = 60
+
+    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
+        """
+        super(AdtnMibSynchronizer, self).__init__(agent, device_id, mib_sync_tasks, db,
+                                                  advertise_events=advertise_events,
+                                                  audit_delay=AdtnMibSynchronizer.ADTN_AUDIT_DELAY,
+                                                  resync_delay=AdtnMibSynchronizer.ADTN_RESYNC_DELAY)
+        self._first_in_sync = True
+        self._omci_managed = False      # TODO: Look up model number/check handler
+
+    def increment_mib_data_sync(self):
+        if self._omci_managed:
+            super(AdtnMibSynchronizer, self).increment_mib_data_sync()
+
+        # IBONT 602 does not support MDS
+        self._mib_data_sync = 0
+
+    def on_enter_in_sync(self):
+        """ Early first sync """
+        if not self._omci_managed:
+            # IBONT 602 does not support MDS, accelerate first forced resync
+            # after a MIB reset occurs or on first startup
+            if self._first_in_sync:
+                self._first_in_sync = False
+                # self._audit_delay = 10            # Re-enable after BBWF
+                # self._resync_delay = 10
+            else:
+                self._audit_delay = MibSynchronizer.DEFAULT_AUDIT_DELAY
+                self._resync_delay = AdtnMibSynchronizer.ADTN_RESYNC_DELAY
+
+        super(AdtnMibSynchronizer, self).on_enter_in_sync()
+
+    def on_enter_auditing(self):
+        """
+        Perform a MIB Audit.  If our last MIB resync was too long in the
+        past, perform a resynchronization anyway
+        """
+        # Is this a model that supports full OMCI management. If so, use standard
+        # forced resync delay
+
+        if not self._omci_managed and self._check_if_mib_data_sync_supported():
+            self._omci_managed = True
+            # Revert to standard timeouts
+            self._resync_delay = MibSynchronizer.DEFAULT_RESYNC_DELAY
+
+        super(AdtnMibSynchronizer, self).on_enter_auditing()
+
+    def _check_if_mib_data_sync_supported(self):
+        return False    # TODO: Look up to see if we are/check handler
+
+    def on_mib_reset_response(self, topic, msg):
+        self._first_in_sync = True
+        super(AdtnMibSynchronizer, self).on_mib_reset_response(topic, msg)
diff --git a/adapters/adtran_onu/omci/adtn_remove_flow.py b/adapters/adtran_onu/omci/adtn_remove_flow.py
new file mode 100644
index 0000000..f0fbf77
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_remove_flow.py
@@ -0,0 +1,225 @@
+#
+# 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 twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, 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.adtran_onu.flow.flow_entry import FlowEntry
+from voltha.adapters.adtran_onu.omci.omci import OMCI
+
+OP = EntityOperations
+RC = ReasonCodes
+
+
+class ServiceRemovalFailure(Exception):
+    """
+    This error is raised by default when the flow-install fails
+    """
+
+
+class AdtnRemoveFlowTask(Task):
+    """
+    OpenOMCI MIB Flow Remove Task
+
+    Currently, the only service tech profiles expected by v2.0 will be for AT&T
+    residential data service and DT residential data service.
+    """
+    task_priority = Task.DEFAULT_PRIORITY + 10
+    default_tpid = 0x8100                           # TODO: Locate to a better location
+
+    name = "ADTRAN MIB Install Flow Task"
+
+    def __init__(self, omci_agent, handler, flow_entry):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param handler: (AdtranOnuHandler) ONU Handler
+        :param flow_entry: (FlowEntry) Flow to install
+        """
+        super(AdtnRemoveFlowTask, self).__init__(AdtnRemoveFlowTask.name,
+                                                 omci_agent,
+                                                 handler.device_id,
+                                                 priority=AdtnRemoveFlowTask.task_priority,
+                                                 exclusive=False)
+        self._handler = handler
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+        self._flow_entry = flow_entry
+
+        # TODO: Cleanup below that is not needed
+        # self._vlan_tcis_1 = 0x900
+        # self._input_tpid = AdtnRemoveFlowTask.default_tpid
+        # self._output_tpid = AdtnRemoveFlowTask.default_tpid
+
+        is_upstream = flow_entry.flow_direction in FlowEntry.upstream_flow_types
+        uni_port = flow_entry.in_port if is_upstream else flow_entry.out_port
+        pon_port = flow_entry.out_port if is_upstream else flow_entry.in_port
+
+        self._uni = handler.uni_port(uni_port)
+        self._pon = handler.pon_port(pon_port)
+
+        self._vid = OMCI.DEFAULT_UNTAGGED_VLAN
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+        #
+        # TODO: Probably need to store many of these in the appropriate object (UNI, PON,...)
+        #
+        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
+
+        # Next to are specific
+        self._mac_bridge_service_profile_entity_id = handler.mac_bridge_service_profile_entity_id
+
+    def cancel_deferred(self):
+        super(AdtnRemoveFlowTask, 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 flow installation
+        """
+        super(AdtnRemoveFlowTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_flow_removal)
+
+    def stop(self):
+        """
+        Shutdown flow install task
+        """
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(AdtnRemoveFlowTask, 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)
+        """
+        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(operation, 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 ServiceRemovalFailure(
+            '{} failed with a status of {}, error_mask: {}, failed_mask: {}, unsupported_mask: {}'
+            .format(operation, status, error_mask, failed_mask, unsupported_mask))
+
+    @inlineCallbacks
+    def perform_flow_removal(self):
+        """
+        Send the commands to configure the flow
+        """
+        self.log.info('perform-flow-removal')
+
+        # TODO: This has not been fully implemented
+
+        def resources_available():
+            return (len(self._handler.uni_ports) > 0 and
+                    len(self._pon.tconts) and
+                    len(self._pon.gem_ports))
+
+        if self._handler.enabled and resources_available():
+            omci = self._onu_device.omci_cc
+            try:
+                # TODO: make this a member of the onu gem port or the uni port
+                set_vlan_vid = self._flow_entry.set_vlan_vid
+
+                # # Delete bridge ani side vlan filter
+                # msg = VlanTaggingFilterDataFrame(self._mac_bridge_port_ani_entity_id)
+                # frame = msg.delete()
+                #
+                # results = yield omci.send(frame)
+                # self.check_status_and_state(results, 'flow-delete-vlan-tagging-filter-data')
+                #
+                # # Re-Create bridge ani side vlan filter
+                # msg = VlanTaggingFilterDataFrame(
+                #         self._mac_bridge_port_ani_entity_id,  # Entity ID
+                #         vlan_tcis=[self._vlan_tcis_1],  # VLAN IDs
+                #         forward_operation=0x10
+                # )
+                # frame = msg.create()
+                # results = yield omci.send(frame)
+                # self.check_status_and_state(results, 'flow-create-vlan-tagging-filter-data')
+
+                # Update uni side extended vlan filter
+                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=15,    # This is a no-tag rule, ignore all other VLAN tag filter fields
+                                filter_inner_vid=0x1000,     # Do not filter on the inner VID
+                                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=0,  # Remove 0 tags
+
+                                treatment_outer_priority=15,  # Do not add an outer tag
+                                treatment_outer_vid=0,        # n/a
+                                treatment_outer_tpid_de=0,    # n/a
+
+                                treatment_inner_priority=0,     # Add an inner tag and insert this value as the priority
+                                treatment_inner_vid=self._vid,  # use this value as the VID in the inner VLAN tag
+                                treatment_inner_tpid_de=4,      # set TPID
+                        )
+                )
+                msg = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                        self._mac_bridge_service_profile_entity_id +
+                        self._uni.mac_bridge_port_num,  # Bridge Entity ID
+                        attributes=attributes           # See above
+                )
+                frame = msg.set()
+                results = yield omci.send(frame)
+                self.check_status_and_state(results,
+                                            'flow-set-ext-vlan-tagging-op-config-data-untagged')
+
+                self.deferred.callback('flow-remove-success')
+
+            except Exception as e:
+                # TODO: Better context info for this exception output...
+                self.log.exception('failed-to-remove-flow', e=e)
+                self.deferred.errback(failure.Failure(e))
+
+        else:
+            # TODO: Provide better error reason, what was missing...
+            e = ServiceRemovalFailure('Required resources are not available')
+            self.deferred.errback(failure.Failure(e))
diff --git a/adapters/adtran_onu/omci/adtn_tp_service_specific_task.py b/adapters/adtran_onu/omci/adtn_tp_service_specific_task.py
new file mode 100644
index 0000000..66a86b4
--- /dev/null
+++ b/adapters/adtran_onu/omci/adtn_tp_service_specific_task.py
@@ -0,0 +1,484 @@
+#
+# 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 twisted.internet import reactor
+from twisted.internet.defer import inlineCallbacks, TimeoutError, failure, returnValue
+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.adtran_onu.omci.omci import OMCI
+from voltha.adapters.adtran_onu.uni_port import *
+from voltha.adapters.adtran_onu.onu_tcont import OnuTCont
+from voltha.adapters.adtran_onu.onu_gem_port import OnuGemPort
+
+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 AdtnTpServiceSpecificTask(Task):
+    """
+    Adtran OpenOMCI Tech-Profile Download Task
+    """
+    name = "Adtran Tech-Profile Download Task"
+    task_priority = Task.DEFAULT_PRIORITY + 10
+    default_tpid = 0x8100                       # TODO: Move to a better location
+    default_gem_payload = 48
+
+    def __init__(self, omci_agent, handler, uni_id):
+        """
+        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, uni_id=uni_id)
+
+        super(AdtnTpServiceSpecificTask, self).__init__(AdtnTpServiceSpecificTask.name,
+                                                        omci_agent,
+                                                        handler.device_id,
+                                                        priority=AdtnTpServiceSpecificTask.task_priority,
+                                                        exclusive=False)
+
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+
+        pon_port = handler.pon_port()
+        self._uni_port = handler.uni_ports[uni_id]
+        assert self._uni_port.uni_id == uni_id
+
+        self._input_tpid = AdtnTpServiceSpecificTask.default_tpid
+        self._output_tpid = AdtnTpServiceSpecificTask.default_tpid
+
+        self._vlan_tcis_1 = OMCI.DEFAULT_UNTAGGED_VLAN
+        self._cvid = OMCI.DEFAULT_UNTAGGED_VLAN
+        self._vlan_config_entity_id = self._vlan_tcis_1
+        self._max_gem_payload = AdtnTpServiceSpecificTask.default_gem_payload
+
+        # 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 = pon_port.ieee_mapper_service_profile_entity_id
+        self._mac_bridge_port_ani_entity_id = 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 = [tcont for tcont in pon_port.tconts.itervalues()
+                        if tcont.uni_id == self._uni_port.uni_id]
+
+        self._gem_ports = [gem_port for gem_port in pon_port.gem_ports.itervalues()
+                           if gem_port.uni_id == self._uni_port.uni_id]
+
+        self.tcont_me_to_queue_map = dict()
+        self.uni_port_to_queue_map = dict()
+
+    def cancel_deferred(self):
+        self.log.debug('function-entry')
+        super(AdtnTpServiceSpecificTask, 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(AdtnTpServiceSpecificTask, 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(AdtnTpServiceSpecificTask, 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           # For Creates issued during task retries
+
+        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):
+        """
+        Install the Technology Profile specific ME instances into the ONU. The
+        initial bridge setup was performed after the capabilities were discovered.
+
+        This task is called near the end of the ONU Tech profile setup when the
+        ONU receives technology profile info from the OLT over the inter-adapter channel
+        """
+        self.log.debug('setting-up-tech-profile-me-instances')
+
+        if len(self._tconts) == 0:
+            self.deferred.errback(failure.Failure(TechProfileResourcesFailure('No TCONTs assigned')))
+            returnValue('no-resources')
+
+        if len(self._gem_ports) == 0:
+            self.deferred.errback(failure.Failure(TechProfileResourcesFailure('No GEM Ports assigned')))
+            returnValue('no-resources')
+
+        omci_cc = self._onu_device.omci_cc
+        self.strobe_watchdog()
+
+        try:
+            ################################################################################
+            # TCONTS
+            #
+            #  EntityID will be referenced by:
+            #            - GemPortNetworkCtp
+            #  References:
+            #            - ONU created TCONT (created on ONU tech profile 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:
+                if tcont.entity_id is not None:
+                    continue             # Already installed
+
+                free_alloc_ids = {OnuTCont.FREE_TCONT_ALLOC_ID,
+                                  OnuTCont.FREE_GPON_TCONT_ALLOC_ID}
+
+                free_entity_id = next((k for k, v in tcont_idents.items()
+                                       if isinstance(k, int) and
+                                       v.get('attributes', {}).get('alloc_id', 0) in
+                                       free_alloc_ids), None)
+
+                if free_entity_id is None:
+                    self.log.error('no-available-tconts')
+                    raise TechProfileResourcesFailure('No Available TConts')
+
+                try:
+                    prev_alloc_id = tcont_idents[free_entity_id].get('attributes').get('alloc_id')
+                    results = yield tcont.add_to_hardware(omci_cc, free_entity_id, prev_alloc_id=prev_alloc_id)
+                    self.check_status_and_state(results, 'create-tcont')
+
+                except Exception as e:
+                    self.log.exception('tcont-set', e=e, eid=free_entity_id)
+                    raise
+
+            ################################################################################
+            # 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)
+            traffic_mgmt_opt = self._onu_device.configuration.traffic_management_option
+            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)
+                self.strobe_watchdog()
+
+                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:
+                self.strobe_watchdog()
+                if gem_port.entity_id is not None:
+                    continue                        # Already installed
+
+                # 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 in {OnuGemPort.UPSTREAM, OnuGemPort.BIDIRECTIONAL}:
+
+                    # 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, 'create-gem-port')
+
+                elif gem_port.direction == OnuGemPort.DOWNSTREAM:
+                    # Downstream is inverse of upstream
+                    # TODO: could also be a case of multicast. Not supported for now
+                    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.strobe_watchdog()
+                self.log.debug("tp-gem-port", entity_id=gem_port.entity_id, uni_id=gem_port.uni_id)
+
+                if gem_port.direction in {OnuGemPort.UPSTREAM, OnuGemPort.BIDIRECTIONAL}:
+                    for i, p in enumerate(gem_port.pbit_map):
+                        if p == '1':
+                            gem_entity_ids[i] = gem_port.entity_id
+
+                elif gem_port.direction == OnuGemPort.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
+                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,  # This is a no-tag rule, ignore all other VLAN tag filter fields
+                    filter_inner_vid=0x1000,   # Do not filter on the inner VID
+                    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=0,  # Remove 0 tags
+
+                    treatment_outer_priority=15,  # Do not add an outer tag
+                    treatment_outer_vid=0,        # n/a
+                    treatment_outer_tpid_de=0,    # n/a
+
+                    treatment_inner_priority=0,      # Add an inner tag and insert this value as the priority
+                    treatment_inner_vid=self._cvid,  # use this value as the VID in the inner VLAN tag
+                    treatment_inner_tpid_de=4,       # set TPID
+                )
+            )
+            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/adapters/adtran_onu/omci/deprecated/adtn_service_download_task.py b/adapters/adtran_onu/omci/deprecated/adtn_service_download_task.py
new file mode 100644
index 0000000..a272e3d
--- /dev/null
+++ b/adapters/adtran_onu/omci/deprecated/adtn_service_download_task.py
@@ -0,0 +1,464 @@
+#
+# 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 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.adtran_onu.omci.omci import OMCI
+
+OP = EntityOperations
+RC = ReasonCodes
+
+
+class ServiceDownloadFailure(Exception):
+    """
+    This error is raised by default when the download fails
+    """
+
+
+class ServiceResourcesFailure(Exception):
+    """
+    This error is raised by when one or more resources required is not available
+    """
+
+
+class AdtnServiceDownloadTask(Task):
+    """
+    OpenOMCI MIB Download Example - Service specific
+
+    This task takes the legacy OMCI 'script' for provisioning the Adtran 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.
+    """
+    task_priority = Task.DEFAULT_PRIORITY + 10
+    default_tpid = 0x8100                       # TODO: Move to a better location
+    name = "ADTRAN Service Download Task"
+    free_tcont_alloc_id = 0xFFFF
+    free_gpon_tcont_alloc_id = 0xFF
+
+    def __init__(self, omci_agent, handler):
+        """
+        Class initialization
+
+        :param omci_agent: (OpenOMCIAgent) OMCI Adapter agent
+        :param device_id: (str) ONU Device ID
+        """
+        super(AdtnServiceDownloadTask, self).__init__(AdtnServiceDownloadTask.name,
+                                                      omci_agent,
+                                                      handler.device_id,
+                                                      priority=AdtnServiceDownloadTask.task_priority,
+                                                      exclusive=False)
+        self._handler = handler
+        self._onu_device = omci_agent.get_device(handler.device_id)
+        self._local_deferred = None
+        self._pon = handler.pon_port()
+        self._extended_vlan_me_created = False
+
+        self._input_tpid = AdtnServiceDownloadTask.default_tpid
+        self._output_tpid = AdtnServiceDownloadTask.default_tpid
+
+        # TODO: TCIS below is just a test, may need 0x900...as in the xPON mode
+        # self._vlan_tcis_1 = OMCI.DEFAULT_UNTAGGED_VLAN
+        self._vid = OMCI.DEFAULT_UNTAGGED_VLAN
+
+        # Entity IDs. IDs with values can probably be most anything for most ONUs,
+        #             IDs set to None are discovered/set
+        #
+        # TODO: Probably need to store many of these in the appropriate object (UNI, PON,...)
+        #
+        self._ieee_mapper_service_profile_entity_id = self._pon.ieee_mapper_service_profile_entity_id
+        self._gal_enet_profile_entity_id = self._handler.gal_enet_profile_entity_id
+
+        # Next to are specific
+        self._ethernet_uni_entity_id = self._handler.uni_ports[0].entity_id
+        self._mac_bridge_service_profile_entity_id = self._handler.mac_bridge_service_profile_entity_id
+
+    def cancel_deferred(self):
+        super(AdtnServiceDownloadTask, 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 Service Download
+        """
+        super(AdtnServiceDownloadTask, self).start()
+        self._local_deferred = reactor.callLater(0, self.perform_service_download)
+
+    def stop(self):
+        """
+        Shutdown MIB Service download
+        """
+        self.log.debug('stopping')
+
+        self.cancel_deferred()
+        super(AdtnServiceDownloadTask, 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)
+        """
+        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(operation, 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 ServiceDownloadFailure('{} failed with a status of {}, error_mask: {}, failed_mask: {}, unsupported_mask: {}'
+                                     .format(operation, status, error_mask, failed_mask, unsupported_mask))
+
+    @inlineCallbacks
+    def perform_service_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 once resources (gem-ports, tconts, ...)
+        have been defined.
+        """
+        self.log.debug('perform-service-download')
+        device = self._handler.adapter_agent.get_device(self.device_id)
+
+        def resources_available():
+            return (len(self._handler.uni_ports) > 0 and
+                    len(self._pon.tconts) and
+                    len(self._pon.gem_ports))
+
+        if self._handler.enabled and resources_available():
+            device.reason = 'Performing Service OMCI 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_service_specific_steps()
+
+                # And re-enable the UNIs if needed
+                yield self.enable_unis(self._handler.uni_ports, False)
+
+                # If here, we are done
+                device = self._handler.adapter_agent.get_device(self.device_id)
+                device.reason = ''
+                self._handler.adapter_agent.update_device(device)
+                self.deferred.callback('service-download-success')
+
+            except TimeoutError as e:
+                self.deferred.errback(failure.Failure(e))
+
+            except Exception as e:
+                self.deferred.errback(failure.Failure(e))
+        else:
+            # TODO: Provide better error reason, what was missing...
+            e = ServiceResourcesFailure('Required resources are not available')
+            self.deferred.errback(failure.Failure(e))
+
+    @inlineCallbacks
+    def perform_service_specific_steps(self):
+        omci_cc = self._onu_device.omci_cc
+        frame = None
+
+        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._pon.tconts.itervalues():
+                if tcont.entity_id is None:
+                    free_ids = {AdtnServiceDownloadTask.free_tcont_alloc_id,
+                                AdtnServiceDownloadTask.free_gpon_tcont_alloc_id}
+
+                    free_entity_id = next((k for k, v in tcont_idents.items()
+                                           if isinstance(k, int) and
+                                           v.get('attributes', {}).get('alloc_id', 0) in
+                                           free_ids), None)
+
+                    if free_entity_id is None:
+                        self.log.error('no-available-tconts')
+                        raise ServiceResourcesFailure('No Available TConts')
+
+                    try:
+                        prev_alloc_id = tcont_idents[free_entity_id].get('attributes').get('alloc_id')
+                        yield tcont.add_to_hardware(omci_cc, free_entity_id, prev_alloc_id=prev_alloc_id)
+
+                    except Exception as e:
+                        self.log.exception('tcont-set', e=e, eid=free_entity_id)
+                        raise
+
+            ################################################################################
+            # 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.
+            #
+            #  TODO: In the GEM Port routine to add, it has a hardcoded upstream TM ID of 0x8000
+            #        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
+            #
+            for gem_port in self._pon.gem_ports.itervalues():
+                if not gem_port.in_hardware:
+                    tcont = gem_port.tcont
+                    if tcont is None:
+                        raise Exception('unknown-tcont-reference', gem_id=gem_port.gem_id)
+
+                    try:
+                        yield gem_port.add_to_hardware(omci_cc,
+                                                       tcont.entity_id,
+                                                       self._ieee_mapper_service_profile_entity_id,
+                                                       self._gal_enet_profile_entity_id)
+                    except Exception as e:
+                        self.log.exception('gem-add-failed', e=e, gem=gem_port)
+                        raise
+
+            ################################################################################
+            # Update the IEEE 802.1p Mapper Service Profile config
+            #
+            #  EntityID was created prior to this call. This is a set
+            #
+            #  References:
+            #            - Gem Interworking TPs are set here
+            #
+            # TODO: All p-bits currently go to the one and only GEMPORT ID for now
+            gem_ports = self._pon.gem_ports
+
+            if len(gem_ports):
+                gem_entity_ids = [gem_port.entity_id for _, gem_port in gem_ports.items()]
+            else:
+                gem_entity_ids = [OmciNullPointer]
+
+            frame = Ieee8021pMapperServiceProfileFrame(
+                self._ieee_mapper_service_profile_entity_id,  # 802.1p mapper Service Mapper Profile ID
+                interwork_tp_pointers=gem_entity_ids          # Interworking TP IDs
+            ).set()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-8021p-mapper-service-profile')
+
+            ################################################################################
+            # 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 UNI
+            #
+            # TODO: add entry here for additional UNI interfaces
+
+            attributes = dict(
+                association_type=2,                                 # Assoc Type, PPTP Ethernet UNI
+                associated_me_pointer=self._ethernet_uni_entity_id  # Assoc ME, PPTP Entity Id
+            )
+
+            frame = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id,
+                attributes=attributes
+            ).create()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'create-extended-vlan-tagging-operation-configuration-data')
+            self._extended_vlan_me_created = True
+
+            ################################################################################
+            # Update Extended VLAN Tagging Operation Config Data
+            #
+            # Specifies the TPIDs in use and that operations in the downstream direction are
+            # inverse to the operations in the upstream direction
+            # TODO: Downstream mode may need to be modified once we work more on the flow rules
+
+            attributes = dict(
+                input_tpid=self._input_tpid,    # input TPID
+                output_tpid=self._output_tpid,  # output TPID
+                downstream_mode=0,              # inverse of upstream
+            )
+            frame = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id,
+                attributes=attributes
+            ).set()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data')
+
+            ################################################################################
+            # Update Extended VLAN Tagging Operation Config Data
+            #
+            # parameters: Entity Id ( 0x900), Filter Inner Vlan Id(0x1000-4096,do not filter on Inner vid,
+            #             Treatment Inner Vlan Id : 2
+
+            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=15,  # This is a no-tag rule, ignore all other VLAN tag filter fields
+                    filter_inner_vid=0x1000,   # Do not filter on the inner VID
+                    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=0,  # Remove 0 tags
+
+                    treatment_outer_priority=15,  # Do not add an outer tag
+                    treatment_outer_vid=0,        # n/a
+                    treatment_outer_tpid_de=0,    # n/a
+
+                    treatment_inner_priority=0,      # Add an inner tag and insert this value as the priority
+                    treatment_inner_vid=self._vid,   # use this value as the VID in the inner VLAN tag
+                    treatment_inner_tpid_de=4,       # set TPID
+                )
+            )
+            frame = ExtendedVlanTaggingOperationConfigurationDataFrame(
+                self._mac_bridge_service_profile_entity_id,  # Entity ID
+                attributes=attributes                        # See above
+            ).set()
+            results = yield omci_cc.send(frame)
+            self.check_status_and_state(results, 'set-extended-vlan-tagging-operation-configuration-data-untagged')
+
+            ###############################################################################
+
+        except TimeoutError as e:
+            self.log.warn('rx-timeout-download', frame=hexlify(frame))
+            self.cleanup_on_error()
+            raise
+
+        except Exception as e:
+            self.log.exception('omci-setup-2', e=e)
+            self.cleanup_on_error()
+            raise
+
+        returnValue(None)
+
+    @inlineCallbacks
+    def enable_unis(self, unis, force_lock):
+        """
+        Lock or unlock one or more UNI ports
+
+        :param unis: (list) of UNI objects
+        :param force_lock: (boolean) If True, force lock regardless of enabled state
+        """
+        omci_cc = self._onu_device.omci_cc
+        frame = None
+
+        for uni in unis:
+            ################################################################################
+            #  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.enabled else 0
+                frame = PptpEthernetUniFrame(uni.entity_id,
+                                             attributes=dict(administrative_state=state)).set()
+                results = yield omci_cc.send(frame)
+                self.check_status_and_state(results, 'set-pptp-ethernet-uni-lock-restore')
+
+            except TimeoutError:
+                self.log.warn('rx-timeout-unis', frame=hexlify(frame))
+                raise
+
+            except Exception as e:
+                self.log.exception('omci-failure', e=e)
+                raise
+
+        returnValue(None)
+
+    @inlineCallbacks
+    def cleanup_on_error(self):
+
+        omci_cc = self._onu_device.omci_cc
+
+        if self._extended_vlan_me_created:
+            try:
+                eid = self._mac_bridge_service_profile_entity_id
+                frame = ExtendedVlanTaggingOperationConfigurationDataFrame(eid).delete()
+                results = yield omci_cc.send(frame)
+                status = results.fields['omci_message'].fields['success_code']
+                self.log.debug('delete-extended-vlan-me', status=status)
+
+            except Exception as e:
+                self.log.exception('extended-vlan-cleanup', e=e)
+                # Continue processing
+
+        for gem_port in self._pon.gem_ports.itervalues():
+            if gem_port.in_hardware:
+                try:
+                    yield gem_port.remove_from_hardware(omci_cc)
+
+                except Exception as e:
+                    self.log.exception('gem-port-cleanup', e=e)
+                    # Continue processing
+
+        for tcont in self._pon.tconts.itervalues():
+            if tcont.entity_id != AdtnServiceDownloadTask.free_tcont_alloc_id:
+                try:
+                    yield tcont.remove_from_hardware(omci_cc)
+
+                except Exception as e:
+                    self.log.exception('tcont-cleanup', e=e)
+                    # Continue processing
+
+        returnValue('Cleanup Complete')
diff --git a/adapters/adtran_onu/omci/omci.py b/adapters/adtran_onu/omci/omci.py
new file mode 100644
index 0000000..8469a3f
--- /dev/null
+++ b/adapters/adtran_onu/omci/omci.py
@@ -0,0 +1,367 @@
+# Copyright 2018-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.defer import inlineCallbacks, returnValue, TimeoutError
+from twisted.internet import reactor
+
+from voltha.protos.device_pb2 import Image
+
+from voltha.protos.common_pb2 import OperStatus, ConnectStatus
+from voltha.extensions.omci.onu_configuration import OMCCVersion
+
+from omci_entities import onu_custom_me_entities
+from voltha.extensions.omci.omci_me import *
+
+_STARTUP_RETRY_WAIT = 5
+# abbreviations
+OP = EntityOperations
+
+
+class OMCI(object):
+    """
+    OpenOMCI Support
+    """
+    DEFAULT_UNTAGGED_VLAN = 4091      # To be equivalent to BroadCom Defaults
+
+    def __init__(self, handler, omci_agent):
+        self.log = structlog.get_logger(device_id=handler.device_id)
+        self._handler = handler
+        self._openomci_agent = omci_agent
+        self._enabled = False
+        self._connected = False
+        self._deferred = None
+        self._bridge_initialized = False
+        self._in_sync_reached = False
+        self._omcc_version = OMCCVersion.Unknown
+        self._total_tcont_count = 0                    # From ANI-G ME
+        self._qos_flexibility = 0                      # From ONT2_G ME
+
+        self._in_sync_subscription = None
+        self._connectivity_subscription = None
+        self._capabilities_subscription = None
+
+        # self._service_downloaded = False
+        self._mib_downloaded = False
+        self._mib_download_task = None
+        self._mib_download_deferred = None
+
+        self._onu_omci_device = omci_agent.add_device(handler.device_id,
+                                                      handler.adapter_agent,
+                                                      custom_me_map=onu_custom_me_entities(),
+                                                      support_classes=handler.adapter.adtran_omci)
+
+    def __str__(self):
+        return "OMCI"
+
+    @property
+    def omci_agent(self):
+        return self._openomci_agent
+
+    @property
+    def omci_cc(self):
+        # TODO: Decrement access to Communications channel at this point?  What about current PM stuff?
+        return self.onu_omci_device.omci_cc if self._onu_omci_device is not None else None
+
+    def receive_message(self, msg):
+        if self.enabled:
+            # TODO: Have OpenOMCI actually receive the messages
+            self.omci_cc.receive_message(msg)
+
+    def _start(self):
+        self._cancel_deferred()
+
+        # Subscriber to events of interest in OpenOMCI
+        self._subscribe_to_events()
+        self._onu_omci_device.start()
+
+        device = self._handler.adapter_agent.get_device(self._handler.device_id)
+        device.reason = 'Performing MIB Upload'
+        self._handler.adapter_agent.update_device(device)
+
+        if self._onu_omci_device.mib_db_in_sync:
+            self._deferred = reactor.callLater(0, self._mib_in_sync)
+
+    def _stop(self):
+        self._cancel_deferred()
+
+        # Unsubscribe to OpenOMCI Events
+        self._unsubscribe_to_events()
+        self._onu_omci_device.stop()        # Will also cancel any running tasks/state-machines
+
+        self._mib_downloaded = False
+        self._mib_download_task = None
+        self._bridge_initialized = False
+        self._in_sync_reached = False
+
+    def _cancel_deferred(self):
+        d1, self._deferred = self._deferred, None
+        d2, self._mib_download_deferred = self._mib_download_deferred, None
+
+        for d in [d1, d2]:
+            try:
+                if d is not None and not d.called:
+                    d.cancel()
+            except:
+                pass
+
+    def delete(self):
+        self.enabled = False
+
+        agent, self._openomci_agent = self._openomci_agent, None
+        device_id = self._handler.device_id
+        self._onu_omci_device = None
+        self._handler = None
+
+        if agent is not None:
+            agent.remove_device(device_id, cleanup=True)
+
+    @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 connected(self):
+        return self._connected
+
+    @property
+    def onu_omci_device(self):
+        return self._onu_omci_device
+
+    def set_pm_config(self, pm_config):
+        """
+        Set PM interval configuration
+
+        :param pm_config: (OnuPmIntervalMetrics) PM Interval configuration
+        :return:
+        """
+        self.onu_omci_device.set_pm_config(pm_config)
+
+    def _mib_in_sync(self):
+        """
+        This method is ran whenever the ONU MIB database is in-sync. This is often after
+        the initial MIB Upload during ONU startup, or after it has gone out-of-sync and
+        then back in. This second case could be due a reboot of the ONU and a new version
+        of firmware is running on the ONU hardware.
+        """
+        self.log.info('mib-in-sync')
+
+        device = self._handler.adapter_agent.get_device(self._handler.device_id)
+        device.oper_status = OperStatus.ACTIVE
+        device.connect_status = ConnectStatus.REACHABLE
+        device.reason = ''
+        self._handler.adapter_agent.update_device(device)
+
+        omci_dev = self._onu_omci_device
+        config = omci_dev.configuration
+
+        # 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:
+            device = self._handler.adapter_agent.get_device(self._handler.device_id)
+
+            ani_g = config.ani_g_entities
+            uni_g = config.uni_g_entities
+            pon_ports = len(ani_g) if ani_g is not None else 0
+            uni_ports = len(uni_g) if uni_g is not None else 0
+
+            # For the UNI ports below, they are created after the MIB Sync event occurs
+            # and the onu handler adds the ONU
+            assert pon_ports == 1, 'Expected one PON/ANI port, got {}'.format(pon_ports)
+            assert uni_ports == len(self._handler.uni_ports), \
+                'Expected {} UNI port(s), got {}'.format(len(self._handler.uni_ports), uni_ports)
+
+            # serial_number = omci_dev.configuration.serial_number
+            # self.log.info('serial-number', serial_number=serial_number)
+
+            # Save entity_id of PON ports
+            self._handler.pon_ports[0].entity_id = ani_g.keys()[0]
+
+            self._total_tcont_count = ani_g.get('total-tcont-count')
+            self._qos_flexibility = config.qos_configuration_flexibility or 0
+            self._omcc_version = config.omcc_version or OMCCVersion.Unknown
+
+            # vendorProductCode = str(config.vendor_product_code or 'unknown').rstrip('\0')
+
+            host_info = omci_dev.query_mib(IpHostConfigData.class_id)
+            mgmt_mac_address = next((host_info[inst].get('attributes').get('mac_address')
+                                     for inst in host_info
+                                     if isinstance(inst, int)), 'unknown')
+            device.mac_address = str(mgmt_mac_address)
+            device.model = str(config.version or 'unknown').rstrip('\0')
+
+            equipment_id = config.equipment_id or " unknown    unknown "
+            eqpt_boot_version = str(equipment_id).rstrip('\0')
+            # eqptId = eqpt_boot_version[:10]         # ie) BVMDZ10DRA
+            boot_version = eqpt_boot_version[12:]     # ie) CML.D55~
+
+            images = [Image(name='boot-code',
+                            version=boot_version.rstrip('\0'),
+                            is_active=False,
+                            is_committed=True,
+                            is_valid=True,
+                            install_datetime='Not Available',
+                            hash='Not Available')] + \
+                config.software_images
+
+            del (device.images.image[:])       # Clear previous entries
+            device.images.image.extend(images)
+
+            # Save our device information
+            self._handler.adapter_agent.update_device(device)
+
+            # Start MIB download  TODO: This will be replaced with a MIB Download task soon
+            self._in_sync_reached = True
+
+        except Exception as e:
+            self.log.exception('device-info-load', e=e)
+            self._deferred = reactor.callLater(_STARTUP_RETRY_WAIT, self._mib_in_sync)
+
+    def _subscribe_to_events(self):
+        from voltha.extensions.omci.onu_device_entry import OnuDeviceEvents, \
+            OnuDeviceEntry
+        from voltha.extensions.omci.omci_cc import OMCI_CC, OmciCCRxEvents
+
+        # OMCI MIB Database sync status
+        bus = self._onu_omci_device.event_bus
+        topic = OnuDeviceEntry.event_bus_topic(self._handler.device_id,
+                                               OnuDeviceEvents.MibDatabaseSyncEvent)
+        self._in_sync_subscription = bus.subscribe(topic, self.in_sync_handler)
+
+        # OMCI Capabilities (MEs and Message Types
+        bus = self._onu_omci_device.event_bus
+        topic = OnuDeviceEntry.event_bus_topic(self._handler.device_id,
+                                               OnuDeviceEvents.OmciCapabilitiesEvent)
+        self._capabilities_subscription = bus.subscribe(topic, self.capabilities_handler)
+
+        # OMCI-CC Connectivity Events (for reachability/heartbeat)
+        bus = self._onu_omci_device.omci_cc.event_bus
+        topic = OMCI_CC.event_bus_topic(self._handler.device_id,
+                                        OmciCCRxEvents.Connectivity)
+        self._connectivity_subscription = bus.subscribe(topic, self.onu_is_reachable)
+
+        # TODO: Watch for any MIB RESET events or detection of an ONU reboot.
+        #       If it occurs, set _service_downloaded and _mib_download to false
+        #       and make sure that we get 'new' capabilities
+
+    def _unsubscribe_to_events(self):
+        insync, self._in_sync_subscription = self._in_sync_subscription, None
+        connect, self._connectivity_subscription = self._connectivity_subscription, None
+        caps, self._capabilities_subscription = self._capabilities_subscription, None
+
+        if insync is not None:
+            bus = self._onu_omci_device.event_bus
+            bus.unsubscribe(insync)
+
+        if connect is not None:
+            bus = self._onu_omci_device.omci_cc.event_bus
+            bus.unsubscribe(connect)
+
+        if caps is not None:
+            bus = self._onu_omci_device.event_bus
+            bus.unsubscribe(caps)
+
+    def in_sync_handler(self, _topic, msg):
+        if self._in_sync_subscription is not None:
+            try:
+                from voltha.extensions.omci.onu_device_entry import IN_SYNC_KEY
+
+                if msg[IN_SYNC_KEY]:
+                    # Start up device_info load from MIB DB
+                    reactor.callLater(0, self._mib_in_sync)
+                else:
+                    # Cancel any running/scheduled MIB download task
+                    try:
+                        d, self._mib_download_deferred = self._mib_download_deferred, None
+                        d.cancel()
+                    except:
+                        pass
+
+            except Exception as e:
+                self.log.exception('in-sync', e=e)
+
+    def capabilities_handler(self, _topic, _msg):
+        """
+        This event occurs after an ONU reaches the In-Sync state and the OMCI ME has
+        been queried for supported ME and message types.
+
+        At this point, we can act upon any download device and/or service Technology
+        profiles (when they exist).  For now, just run our somewhat fixed script
+        """
+        if self._capabilities_subscription is not None:
+            from adtn_mib_download_task import AdtnMibDownloadTask
+            self._mib_download_task = None
+
+            def success(_results):
+                dev = self._handler.adapter_agent.get_device(self._handler.device_id)
+                dev.reason = ''
+                self._handler.adapter_agent.update_device(dev)
+                self._mib_downloaded = True
+                self._mib_download_task = None
+
+            def failure(reason):
+                self.log.error('mib-download-failure', reason=reason)
+                self._mib_download_task = None
+                dev = self._handler.adapter_agent.get_device(self._handler.device_id)
+                self._handler.adapter_agent.update_device(dev)
+                self._mib_download_deferred = reactor.callLater(_STARTUP_RETRY_WAIT,
+                                                                self.capabilities_handler,
+                                                                None, None)
+            if not self._mib_downloaded:
+                device = self._handler.adapter_agent.get_device(self._handler.device_id)
+                device.reason = 'Initial MIB Download'
+                self._handler.adapter_agent.update_device(device)
+                self._mib_download_task = AdtnMibDownloadTask(self.omci_agent,
+                                                              self._handler)
+            if self._mib_download_task is not None:
+                self._mib_download_deferred = \
+                    self._onu_omci_device.task_runner.queue_task(self._mib_download_task)
+                self._mib_download_deferred.addCallbacks(success, failure)
+
+    def onu_is_reachable(self, _topic, msg):
+        """
+        Reach-ability change event
+        :param _topic: (str) subscription topic, not used
+        :param msg: (dict) 'connected' key holds True if reachable
+        """
+        from voltha.extensions.omci.omci_cc import CONNECTED_KEY
+        if self._connectivity_subscription is not None:
+            try:
+                connected = msg[CONNECTED_KEY]
+
+                # TODO: For now, only care about the first connect occurrence.
+                # Later we could use this for a heartbeat, but may want some hysteresis
+                # Cancel any 'reachable' subscriptions
+                if connected:
+                    evt_bus = self._onu_omci_device.omci_cc.event_bus
+                    evt_bus.unsubscribe(self._connectivity_subscription)
+                    self._connectivity_subscription = None
+                    self._connected = True
+
+                    device = self._handler.adapter_agent.get_device(self._handler.device_id)
+                    device.oper_status = OperStatus.ACTIVE
+                    device.connect_status = ConnectStatus.REACHABLE
+                    self._handler.adapter_agent.update_device(device)
+
+            except Exception as e:
+                self.log.exception('onu-reachable', e=e)
diff --git a/adapters/adtran_onu/omci/omci_entities.py b/adapters/adtran_onu/omci/omci_entities.py
new file mode 100644
index 0000000..654078d
--- /dev/null
+++ b/adapters/adtran_onu/omci/omci_entities.py
@@ -0,0 +1,265 @@
+# 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.
+#
+""" Adtran vendor-specific OMCI Entities"""
+
+import inspect
+import sys
+import json
+from binascii import hexlify
+from bitstring import BitArray
+from scapy.fields import ByteField, ShortField,  BitField
+from scapy.fields import IntField, StrFixedLenField, FieldListField, PacketLenField
+from scapy.packet import Packet
+from voltha.extensions.omci.omci_entities import EntityClassAttribute, \
+    AttributeAccess, EntityOperations, EntityClass
+
+# abbreviations
+ECA = EntityClassAttribute
+AA = AttributeAccess
+OP = EntityOperations
+
+
+class OntSystem(EntityClass):
+    class_id = 65300
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(StrFixedLenField("time_of_day", None, 8), {AA.R, AA.W}),
+    ]
+    mandatory_operations = {OP.Get}
+
+
+class VerizonOpenOMCI(EntityClass):
+    class_id = 65400
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(IntField("supported_specification_version", None), {AA.R}),
+        ECA(ShortField("pon_device_type", None), {AA.R}),
+        ECA(IntField("specification_in_use", None), {AA.R, AA.W})
+    ]
+    mandatory_operations = {OP.Get, OP.Set}
+
+
+class TwdmSystemProfile(EntityClass):
+    class_id = 65401
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(ByteField("total_twdm_channel_number", None), {AA.R}),
+        ECA(ByteField("channel_partition_index", None), {AA.R, AA.W}),
+        ECA(IntField("channel_partion_waiver_timer", None), {AA.R, AA.W}),
+        ECA(IntField("lods_re_initialization_timer", None), {AA.R, AA.W}),
+        ECA(IntField("lods_protection_timer", None), {AA.R, AA.W}),
+        ECA(IntField("downstream_tuning_timer", None), {AA.R, AA.W}),
+        ECA(IntField("upstream_tuning_timer", None), {AA.R, AA.W}),
+        ECA(StrFixedLenField("location_label_1", None, 24), {AA.R, AA.W}),
+        ECA(StrFixedLenField("location_label_2", None, 24), {AA.R, AA.W}),
+    ]
+    mandatory_operations = {OP.Get, OP.Set}
+
+
+class TwdmChannel(EntityClass):
+    class_id = 65402
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(ByteField("active_channel_indication", None), {AA.R}),
+        ECA(ByteField("operational_channel_indication", None), {AA.R}),
+        ECA(ByteField("downstream_wavelength_channel", None), {AA.R}),
+        ECA(ByteField("upstream_wavelength_channel", None), {AA.R}),
+    ]
+    mandatory_operations = {OP.Get}
+
+
+class WatchdogConfigData(EntityClass):
+    class_id = 65403
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(IntField("upstream_transmission_timing_drift_self_monitoring_capability", None), {AA.R}),
+        ECA(IntField("upstream_transmission_wavelength_drift_self_monitoring_capability", None), {AA.R}),
+        ECA(IntField("upstream_transmission_optical_power_self_monitoring_capability", None), {AA.R}),
+        ECA(IntField("mean_out_of_channel_optical_power_spectral_density_self_monitoring_capability", None), {AA.R}),
+        ECA(IntField("mean_optical_power_spectral_density_self_monitoring_capability", None), {AA.R}),
+    ]
+    mandatory_operations = {OP.Get}
+
+
+class FlexibleConfigurationStatusPortal(EntityClass):
+    class_id = 65420
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(IntField("service_instance", None), {AA.R, AA.W}),
+        ECA(ShortField("configuration_method", None), {AA.R, AA.W}),
+        ECA(ShortField("network_address", None), {AA.R, AA.W}),
+        ECA(ByteField("administrative_state", None), {AA.R, AA}),
+        ECA(ByteField("operational_state", None), {AA.R}, avc=True),
+        ECA(ShortField("cause_for_last_abnormal_halt", None), {AA.R}),
+        ECA(ShortField("configuration_portal_update_available", None), {AA.R, AA.W}),
+        ECA(StrFixedLenField("configuration_portal_table", None, 25), {AA.R, AA.W}),
+        ECA(ByteField("configuration_portal_result", None), {AA.R, AA.W}, avc=True),
+        ECA(ShortField("status_message_available", None), {AA.R, AA.W}, avc=True),
+        ECA(ByteField("status_message", None), {AA.R, AA.W}),
+        ECA(ByteField("status_message_result", None), {AA.R, AA.W}),
+        ECA(ShortField("associated_me_class", None), {AA.R}),
+        ECA(ShortField("associated_me_class_instance", None), {AA.R}),
+    ]
+    mandatory_operations = {OP.Get, OP.Set, OP.Create, OP.Delete, OP.GetNext, OP.SetTable}
+
+
+class Onu3G(EntityClass):
+    class_id = 65422
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(ByteField("flash_memory_performance_value", None), {AA.R}),
+        ECA(ByteField("latest_restart_reason", None), {AA.R}),
+        ECA(ShortField("total_number_of_status_snapshots", None), {AA.R}),
+        ECA(ShortField("number_of_valid_status_snapshots", None), {AA.R}),
+        ECA(ShortField("next_status_snapshot_index", None), {AA.R}),
+        ECA(ByteField("status_snapshot_record_table", None), {AA.R}),      # TODO: MxN field
+        ECA(ByteField("snap_action", None), {AA.W}),
+        ECA(ByteField("most_recent_status_snapshot", None), {AA.R}),        # TODO: N field
+        ECA(ByteField("reset_action", None), {AA.W}),
+    ]
+    mandatory_operations = {OP.Get, OP.Set, OP.GetNext}
+
+
+class AdtnVlanTaggingOperation(Packet):
+    name = "VlanTaggingOperation"
+    fields_desc = [
+        BitField("filter_outer_priority", 0, 4),
+        BitField("filter_outer_vid", 0, 13),
+        BitField("filter_outer_tpid_de", 0, 3),
+        BitField("pad1", 0, 12),
+
+        BitField("filter_inner_priority", 0, 4),
+        BitField("filter_inner_vid", 0, 13),
+        BitField("filter_inner_tpid_de", 0, 3),
+        BitField("pad2", 0, 8),
+        BitField("filter_ether_type", 0, 4),
+
+        BitField("treatment_tags_to_remove", 0, 2),
+        BitField("pad3", 0, 10),
+        BitField("treatment_outer_priority", 0, 4),
+        BitField("treatment_outer_vid", 0, 13),
+        BitField("treatment_outer_tpid_de", 0, 3),
+
+        BitField("pad4", 0, 12),
+        BitField("treatment_inner_priority", 0, 4),
+        BitField("treatment_inner_vid", 0, 13),
+        BitField("treatment_inner_tpid_de", 0, 3),
+    ]
+
+    def to_json(self):
+        return json.dumps(self.fields, separators=(',', ':'))
+
+    @staticmethod
+    def json_from_value(value):
+        bits = BitArray(hex=hexlify(value))
+        temp = AdtnVlanTaggingOperation(
+            filter_outer_priority=bits[0:4].uint,         # 4  <-size
+            filter_outer_vid=bits[4:17].uint,             # 13
+            filter_outer_tpid_de=bits[17:20].uint,        # 3
+                                                          # pad 12
+            filter_inner_priority=bits[32:36].uint,       # 4
+            filter_inner_vid=bits[36:49].uint,            # 13
+            filter_inner_tpid_de=bits[49:52].uint,        # 3
+                                                          # pad 8
+            filter_ether_type=bits[60:64].uint,           # 4
+            treatment_tags_to_remove=bits[64:66].uint,    # 2
+                                                          # pad 10
+            treatment_outer_priority=bits[76:80].uint,    # 4
+            treatment_outer_vid=bits[80:93].uint,         # 13
+            treatment_outer_tpid_de=bits[93:96].uint,     # 3
+                                                          # pad 12
+            treatment_inner_priority=bits[108:112].uint,  # 4
+            treatment_inner_vid=bits[112:125].uint,       # 13
+            treatment_inner_tpid_de=bits[125:128].uint,   # 3
+        )
+        return json.dumps(temp.fields, separators=(',', ':'))
+
+    def index(self):
+        return '{:02}'.format(self.fields.get('filter_outer_priority',0)) + \
+               '{:03}'.format(self.fields.get('filter_outer_vid',0)) + \
+               '{:01}'.format(self.fields.get('filter_outer_tpid_de',0)) + \
+               '{:03}'.format(self.fields.get('filter_inner_priority',0)) + \
+               '{:04}'.format(self.fields.get('filter_inner_vid',0)) + \
+               '{:01}'.format(self.fields.get('filter_inner_tpid_de',0)) + \
+               '{:02}'.format(self.fields.get('filter_ether_type',0))
+
+    def is_delete(self):
+        return self.fields.get('treatment_tags_to_remove',0) == 0x3 and \
+            self.fields.get('pad3',0) == 0x3ff and \
+            self.fields.get('treatment_outer_priority',0) == 0xf and \
+            self.fields.get('treatment_outer_vid',0) == 0x1fff and \
+            self.fields.get('treatment_outer_tpid_de',0) == 0x7 and \
+            self.fields.get('pad4',0) == 0xfff and \
+            self.fields.get('treatment_inner_priority',0) == 0xf and \
+            self.fields.get('treatment_inner_vid',0) == 0x1fff and \
+            self.fields.get('treatment_inner_tpid_de',0) == 0x7
+
+    def delete(self):
+        self.fields['treatment_tags_to_remove'] = 0x3
+        self.fields['pad3'] = 0x3ff
+        self.fields['treatment_outer_priority'] = 0xf
+        self.fields['treatment_outer_vid'] = 0x1fff
+        self.fields['treatment_outer_tpid_de'] = 0x7
+        self.fields['pad4'] = 0xfff
+        self.fields['treatment_inner_priority'] = 0xf
+        self.fields['treatment_inner_vid'] = 0x1fff
+        self.fields['treatment_inner_tpid_de'] = 0x7
+        return self
+
+
+class AdtnExtendedVlanTaggingOperationConfigurationData(EntityClass):
+    class_id = 171
+    attributes = [
+        ECA(ShortField("managed_entity_id", None), {AA.R, AA.SBC}),
+        ECA(ByteField("association_type", None), {AA.R, AA.W, AA.SBC},
+            range_check=lambda x: 0 <= x <= 11),
+        ECA(ShortField("received_vlan_tagging_operation_table_max_size", None),
+            {AA.R}),
+        ECA(ShortField("input_tpid", None), {AA.R, AA.W}),
+        ECA(ShortField("output_tpid", None), {AA.R, AA.W}),
+        ECA(ByteField("downstream_mode", None), {AA.R, AA.W},
+            range_check=lambda x: 0 <= x <= 8),
+        ECA(StrFixedLenField("received_frame_vlan_tagging_operation_table",
+                             AdtnVlanTaggingOperation, 16), {AA.R, AA.W}),
+        ECA(ShortField("associated_me_pointer", None), {AA.R, AA.W, AA.SBC}),
+        ECA(FieldListField("dscp_to_p_bit_mapping", None,
+                           BitField('',  0, size=3), count_from=lambda _: 64),
+            {AA.R, AA.W}),
+    ]
+    mandatory_operations = {OP.Create, OP.Delete, OP.Set, OP.Get, OP.GetNext}
+    optional_operations = {OP.SetTable}
+
+
+
+
+#################################################################################
+# entity class lookup table from entity_class values
+_onu_entity_classes_name_map = dict(
+    inspect.getmembers(sys.modules[__name__], lambda o:
+    inspect.isclass(o) and issubclass(o, EntityClass) and o is not EntityClass)
+)
+_onu_custom_entity_classes = [c for c in _onu_entity_classes_name_map.itervalues()]
+_onu_custom_entity_id_to_class_map = dict()
+
+
+def onu_custom_me_entities():
+    if len(_onu_custom_entity_id_to_class_map) == 0:
+        for entity_class in _onu_custom_entity_classes:
+            assert entity_class.class_id not in _onu_custom_entity_id_to_class_map, \
+                "Class ID '{}' already exists in the class map".format(entity_class.class_id)
+            _onu_custom_entity_id_to_class_map[entity_class.class_id] = entity_class
+
+    return _onu_custom_entity_id_to_class_map
+