[VOL-2241] Python 3 refactor of pyvoltha

Majority of work was manual fixes to bytes and strings types, which are
different in py3, but same in py2. As the OMCI library does a lot of
these comparisons and scapy then renders packets, this was frequently
nontrival to debug.

Also:

- Removed grpc dep which wasn't being used, not py3 compatible
- s/Alarms/Events/ to work with protobuf changes per VOL-2224
- Automatic fixes via modernize tooling
- Removed unused OrderedWeakValueDict code
- Removed frameio send_frame specific to Darwin (MacOS), which had no
  corresponding linux code
- Use library functions for hex and unicode conversions
- Various other cleanups and fixes (EOL whitespace, etc.)

Also more (Matt):

 - handle stringify better, check if already string
 - use binary string for binary work
 - import new thread paths
 - update requirements.txt for newer libraries needed with newer python
 - return proper tuple for unpacking
 - bytes string formatting fixed
 - fix mock task unit test

Even more (Zack):

- Python 2/3 compat for _thread by using 'future'
- Bump version to 2.3.0

Change-Id: I53b596d374a944bfb80d0b112f21bcc1f8bcee6e
diff --git a/Makefile b/Makefile
index eece9ac..43bab9e 100644
--- a/Makefile
+++ b/Makefile
@@ -44,10 +44,9 @@
 VENVDIR := venv-pyvoltha
 
 venv:
-	virtualenv ${VENVDIR};\
-        source ./${VENVDIR}/bin/activate ; set -u ;\
-        rm ${VENVDIR}/local/bin ${VENVDIR}/local/lib ${VENVDIR}/local/include ;\
-        pip install -r requirements.txt
+	virtualenv --python=python3.6 ${VENVDIR};\
+    source ./${VENVDIR}/bin/activate ; set -u ;\
+    pip install -r requirements.txt
 
 test:
 	@ echo "Executing unit tests w/tox"
@@ -57,7 +56,7 @@
 	find . -name '*.pyc' | xargs rm -f
 	rm -rf \
     .tox \
-		.coverage \
+    .coverage \
     coverage.xml \
     dist \
     nose-results.xml \
diff --git a/VERSION b/VERSION
index fb76694..276cbf9 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-2.2.6-dev0
+2.3.0
diff --git a/pyvoltha/adapters/common/frameio/frameio.py b/pyvoltha/adapters/common/frameio/frameio.py
index d97a269..45b2a96 100644
--- a/pyvoltha/adapters/common/frameio/frameio.py
+++ b/pyvoltha/adapters/common/frameio/frameio.py
@@ -23,6 +23,7 @@
 thread.
 """
 
+from __future__ import absolute_import
 import os
 import socket
 import struct
@@ -30,6 +31,7 @@
 from pcapy import BPFProgram
 from threading import Thread, Condition
 
+import codecs
 import fcntl
 
 import select
@@ -43,18 +45,19 @@
 from pyvoltha.common.utils.registry import IComponent
 
 if sys.platform.startswith('linux'):
-    from third_party.oftest import afpacket, netutils
+    from .third_party.oftest import afpacket, netutils
 elif sys.platform == 'darwin':
-    from scapy.arch import pcapdnet, BIOCIMMEDIATE, dnet
+    # config is per https://scapy.readthedocs.io/en/latest/installation.html#mac-os-x
+    from scapy.config import conf
+    conf.use_pcap = True
+    from scapy.arch import pcapdnet, BIOCIMMEDIATE
 
 log = structlog.get_logger()
 
 
-def hexify(buffer):
-    """
-    Return a hexadecimal string encoding of input buffer
-    """
-    return ''.join('%02x' % ord(c) for c in buffer)
+def hexify(frame):
+    """Return a hexadecimal string encoding of input buffer"""
+    return codecs.encode(bytes(frame),'hex')
 
 
 class _SelectWakerDescriptor(object):
@@ -189,8 +192,8 @@
     def send_frame(self, frame):
         try:
             return self.socket.send(frame)
-        except socket.error, err:
-            if err[0] == os.errno.EINVAL:
+        except socket.error as err:
+            if err.args[0] == os.errno.EINVAL:
                 if len(frame) < self.MIN_PKT_SIZE:
                     padding = '\x00' * (self.MIN_PKT_SIZE - len(frame))
                     frame = frame + padding
@@ -239,16 +242,10 @@
         except:
             pass
 
-        # need a different kind of socket for sending out
-        self.sout = dnet.eth(iface_name)
-
         return sin
 
-    def send_frame(self, frame):
-        return self.sout.send(frame)
-
     def rcv_frame(self):
-        pkt = self.socket.next()
+        pkt = next(self.socket)
         if pkt is not None:
             ts, pkt = pkt
         return pkt
@@ -403,7 +400,7 @@
 
         # outer loop constructs sockets list for select
         while not self.stopped:
-            sockets = [self.waker] + self.ports.values()
+            sockets = [self.waker] + list(self.ports.values())
             self.ports_changed = False
             empty = []
             # inner select loop
diff --git a/pyvoltha/adapters/common/frameio/third_party/oftest/afpacket.py b/pyvoltha/adapters/common/frameio/third_party/oftest/afpacket.py
index 9ae8075..ba54da7 100644
--- a/pyvoltha/adapters/common/frameio/third_party/oftest/afpacket.py
+++ b/pyvoltha/adapters/common/frameio/third_party/oftest/afpacket.py
@@ -21,6 +21,7 @@
 the VLAN tag if it was offloaded.
 """
 
+from __future__ import absolute_import
 import struct
 from ctypes import *
 
diff --git a/pyvoltha/adapters/common/frameio/third_party/oftest/netutils.py b/pyvoltha/adapters/common/frameio/third_party/oftest/netutils.py
index 092d490..ea48d27 100644
--- a/pyvoltha/adapters/common/frameio/third_party/oftest/netutils.py
+++ b/pyvoltha/adapters/common/frameio/third_party/oftest/netutils.py
@@ -34,6 +34,7 @@
 ##                                                                         ##
 #############################################################################
 
+from __future__ import absolute_import
 import socket
 from fcntl import ioctl
 import struct
diff --git a/pyvoltha/adapters/common/kvstore/consul_client.py b/pyvoltha/adapters/common/kvstore/consul_client.py
index 88afb1c..ec4a01c 100644
--- a/pyvoltha/adapters/common/kvstore/consul_client.py
+++ b/pyvoltha/adapters/common/kvstore/consul_client.py
@@ -12,7 +12,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from kv_client import DEFAULT_TIMEOUT, Event, KVClient, KVPair, RETRY_BACKOFF
+from __future__ import absolute_import
+from .kv_client import DEFAULT_TIMEOUT, Event, KVClient, KVPair, RETRY_BACKOFF
 from pyvoltha.common.utils.asleep import asleep
 from pyvoltha.common.utils.deferred_utils import DeferredWithTimeout, TimeOutError
 from consul import ConsulException
diff --git a/pyvoltha/adapters/common/kvstore/etcd_client.py b/pyvoltha/adapters/common/kvstore/etcd_client.py
index e1850e7..c1d7864 100644
--- a/pyvoltha/adapters/common/kvstore/etcd_client.py
+++ b/pyvoltha/adapters/common/kvstore/etcd_client.py
@@ -23,7 +23,8 @@
 #
 ################################################################################
 
-from kv_client import DEFAULT_TIMEOUT, Event, KVClient, KVPair
+from __future__ import absolute_import
+from .kv_client import DEFAULT_TIMEOUT, Event, KVClient, KVPair
 from structlog import get_logger
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, returnValue, Deferred
diff --git a/pyvoltha/adapters/common/kvstore/kv_client.py b/pyvoltha/adapters/common/kvstore/kv_client.py
index 01a1fcc..7d2201b 100644
--- a/pyvoltha/adapters/common/kvstore/kv_client.py
+++ b/pyvoltha/adapters/common/kvstore/kv_client.py
@@ -12,9 +12,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from pyvoltha.common.utils.asleep import asleep
 from structlog import get_logger
 from twisted.internet.defer import inlineCallbacks, returnValue
+from six.moves import range
 
 log = get_logger()
 
diff --git a/pyvoltha/adapters/common/kvstore/kvstore.py b/pyvoltha/adapters/common/kvstore/kvstore.py
index ed7f246..82ce082 100644
--- a/pyvoltha/adapters/common/kvstore/kvstore.py
+++ b/pyvoltha/adapters/common/kvstore/kvstore.py
@@ -12,8 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from consul_client import ConsulClient
-from etcd_client import EtcdClient
+from __future__ import absolute_import
+from .consul_client import ConsulClient
+from .etcd_client import EtcdClient
 
 def create_kv_client(kv_store, host, port):
     '''
diff --git a/pyvoltha/adapters/common/pon_resource_manager/resource_kv_store.py b/pyvoltha/adapters/common/pon_resource_manager/resource_kv_store.py
index 6f0a88c..07adcad 100644
--- a/pyvoltha/adapters/common/pon_resource_manager/resource_kv_store.py
+++ b/pyvoltha/adapters/common/pon_resource_manager/resource_kv_store.py
@@ -15,6 +15,7 @@
 #
 
 """Resource KV store - interface between Resource Manager and backend store."""
+from __future__ import absolute_import
 import structlog
 
 from pyvoltha.common.config.config_backend import ConsulStore
diff --git a/pyvoltha/adapters/common/pon_resource_manager/resource_manager.py b/pyvoltha/adapters/common/pon_resource_manager/resource_manager.py
index 2bf6794..07b7414 100644
--- a/pyvoltha/adapters/common/pon_resource_manager/resource_manager.py
+++ b/pyvoltha/adapters/common/pon_resource_manager/resource_manager.py
@@ -20,6 +20,7 @@
 It exposes APIs to create/free alloc_ids/onu_ids/gemport_ids. Resource Manager
 uses a KV store in backend to ensure resiliency of the data.
 """
+from __future__ import absolute_import
 import json
 import ast
 import structlog
@@ -27,8 +28,9 @@
 import shlex
 from argparse import ArgumentParser, ArgumentError
 
-from resource_kv_store import ResourceKvStore
+from .resource_kv_store import ResourceKvStore
 from pyvoltha.common.tech_profile.tech_profile import TechProfile
+from six.moves import range
 
 
 # Used to parse extra arguments to OpenOlt adapter from the NBI
@@ -329,7 +331,7 @@
                            uni_id_start_idx, uni_id_end_idx)
 
         if intf_ids is None:
-            intf_ids = range(0, num_of_pon_ports)
+            intf_ids = list(range(0, num_of_pon_ports))
 
         self.intf_ids = intf_ids
 
diff --git a/pyvoltha/adapters/extensions/events/adapter_events.py b/pyvoltha/adapters/extensions/events/adapter_events.py
index a5fd977..c7e80d2 100644
--- a/pyvoltha/adapters/extensions/events/adapter_events.py
+++ b/pyvoltha/adapters/extensions/events/adapter_events.py
@@ -13,11 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 import arrow
 import structlog
 from twisted.internet.task import LoopingCall
 from twisted.internet.defer import inlineCallbacks, returnValue
 from voltha_protos.events_pb2 import Event, EventType, EventCategory, EventSubCategory, DeviceEvent, EventHeader
+import six
 
 log = structlog.get_logger()
 
@@ -169,7 +171,7 @@
 
         current_context = {}
         if isinstance(context_data, dict):
-            for key, value in context_data.iteritems():
+            for key, value in six.iteritems(context_data):
                 current_context[key] = str(value)
         # Always insert serial number of the OLT, ONU serial number comes in the context
         current_context["serial-number"] = self.event_mgr.serial_number
diff --git a/pyvoltha/adapters/extensions/events/device_events/heartbeat_events.py b/pyvoltha/adapters/extensions/events/device_events/heartbeat_events.py
index 39386f2..0298715 100644
--- a/pyvoltha/adapters/extensions/events/device_events/heartbeat_events.py
+++ b/pyvoltha/adapters/extensions/events/device_events/heartbeat_events.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventCategory, EventSubCategory
 from adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/olt/olt_los_alarm.py b/pyvoltha/adapters/extensions/events/device_events/olt/olt_los_alarm.py
index 8afcfb1..0963f1d 100644
--- a/pyvoltha/adapters/extensions/events/device_events/olt/olt_los_alarm.py
+++ b/pyvoltha/adapters/extensions/events/device_events/olt/olt_los_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_activation_fail_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_activation_fail_event.py
index ab07d0e..b0b7c9f 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_activation_fail_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_activation_fail_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_active_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_active_event.py
index 2eb7252..6927f7e 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_active_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_active_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventCategory, EventSubCategory, EventType
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_discovery_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_discovery_event.py
index 0e9c484..82a639b 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_discovery_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_discovery_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_dying_gasp_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_dying_gasp_event.py
index a149aa4..747e366 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_dying_gasp_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_dying_gasp_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_equipment_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_equipment_event.py
index 63be391..cc28ebb 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_equipment_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_equipment_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_rx_optical_power_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_rx_optical_power_event.py
index adc67c7..65f1e57 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_rx_optical_power_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_rx_optical_power_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_tx_optical_power_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_tx_optical_power_event.py
index 66fa16f..b5e3df2 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_tx_optical_power_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_high_tx_optical_power_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_bias_current_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_bias_current_event.py
index 1d62a9c..1e81b62 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_bias_current_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_bias_current_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_eol_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_eol_event.py
index d0e636a..58d5791 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_eol_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_laser_eol_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lob_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lob_event.py
index 8fcf1a2..dda3bc9 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lob_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lob_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_mic_error_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_mic_error_event.py
index 1463ee4..71985bb 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_mic_error_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_mic_error_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_miss_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_miss_event.py
index f387b14..38d3364 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_miss_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_lopc_miss_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_los_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_los_event.py
index ba80836..08e7edd 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_los_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_los_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_rx_optical_power_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_rx_optical_power_event.py
index c177c89..eb952cf 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_rx_optical_power_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_rx_optical_power_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_tx_optical_power_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_tx_optical_power_event.py
index 63c0582..db2f684 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_tx_optical_power_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_low_tx_optical_power_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventCategory, EventSubCategory, EventType
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_selftest_failure_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_selftest_failure_event.py
index 00a5fd3..0ec0d27 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_selftest_failure_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_selftest_failure_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_degrade_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_degrade_event.py
index 13a812f..5f9078e 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_degrade_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_degrade_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_fail_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_fail_event.py
index d49b27a..6f475e6 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_fail_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_signal_fail_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_startup_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_startup_event.py
index f041c91..7ccea77 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_startup_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_startup_event.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_red_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_red_event.py
index 51d1a3b..e1a144d 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_red_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_red_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_yellow_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_yellow_event.py
index 9285eb4..1f3da45 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_yellow_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_temp_yellow_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_red_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_red_event.py
index 7cde4ce..53e3cf8 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_red_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_red_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_yellow_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_yellow_event.py
index d39647b..ffd4587 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_yellow_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_voltage_yellow_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/device_events/onu/onu_window_drift_event.py b/pyvoltha/adapters/extensions/events/device_events/onu/onu_window_drift_event.py
index 175ce10..7fc1364 100644
--- a/pyvoltha/adapters/extensions/events/device_events/onu/onu_window_drift_event.py
+++ b/pyvoltha/adapters/extensions/events/device_events/onu/onu_window_drift_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import EventType, EventCategory, EventSubCategory
 from pyvoltha.adapters.extensions.events.adapter_events import DeviceEventBase
 
diff --git a/pyvoltha/adapters/extensions/events/heartbeat_event.py b/pyvoltha/adapters/extensions/events/heartbeat_event.py
index 74b8c7f..bcf2dc5 100644
--- a/pyvoltha/adapters/extensions/events/heartbeat_event.py
+++ b/pyvoltha/adapters/extensions/events/heartbeat_event.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
index 3a3a95f..9f41f90 100644
--- a/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/adapter_pm_metrics.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import, division
 import structlog
 import arrow
 from twisted.internet.task import LoopingCall
diff --git a/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
index ee0a4e9..5107e0f 100644
--- a/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/olt/olt_pm_metrics.py
@@ -12,8 +12,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import, division
 from voltha_protos.device_pb2 import PmConfig, PmConfigs, PmGroupConfig
 from pyvoltha.adapters.extensions.kpi.adapter_pm_metrics import AdapterPmMetrics
+import six
 
 
 class OltPmMetrics(AdapterPmMetrics):
@@ -226,7 +228,7 @@
                                                       enabled=pm.enabled)])
         if self.grouped:
             pm_config.groups.extend([stats for stats in
-                                     self.pm_group_metrics.itervalues()])
+                                     six.itervalues(self.pm_group_metrics)])
 
         return pm_config
 
diff --git a/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py b/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
index 0e2af4f..11f45cd 100644
--- a/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
+++ b/pyvoltha/adapters/extensions/events/kpi/onu/onu_omci_pm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import, division
 import arrow
 from voltha_protos.device_pb2 import PmConfig, PmGroupConfig
 from voltha_protos.events_pb2 import MetricInformation, MetricMetaData
@@ -222,7 +223,7 @@
 
         # Scan all ANI-G ports
         ani_g_entities = self._omci_onu_device.configuration.ani_g_entities
-        ani_g_entities_ids = ani_g_entities.keys() if ani_g_entities is not None else None
+        ani_g_entities_ids = list(ani_g_entities.keys()) if ani_g_entities is not None else None
         metrics_info = []
 
         if ani_g_entities_ids is not None and len(ani_g_entities_ids):
@@ -269,9 +270,9 @@
 
         # Scan all UNI-G and PPTP ports
         uni_g_entities = self._omci_onu_device.configuration.uni_g_entities
-        uni_g_entities_ids = uni_g_entities.keys() if uni_g_entities is not None else None
+        uni_g_entities_ids = list(uni_g_entities.keys()) if uni_g_entities is not None else None
         pptp_entities = self._omci_onu_device.configuration.pptp_entities
-        pptp_entities_ids = pptp_entities.keys() if pptp_entities is not None else None
+        pptp_entities_ids = list(pptp_entities.keys()) if pptp_entities is not None else None
 
         metrics_info = []
 
diff --git a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_interval_metrics.py b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_interval_metrics.py
index 2a3337f..fc5b417 100644
--- a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_interval_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_interval_metrics.py
@@ -12,8 +12,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import, division
 import arrow
-from twisted.internet.defer import inlineCallbacks, returnValue 
+from twisted.internet.defer import inlineCallbacks, returnValue
 from voltha_protos.device_pb2 import PmConfig, PmGroupConfig
 from voltha_protos.events_pb2 import KpiEvent2, MetricInformation, MetricMetaData, KpiEventType
 from voltha_protos.events_pb2 import Event, EventType
@@ -27,6 +28,7 @@
     GemPortNetworkCtpMonitoringHistoryData, XgPonTcPerformanceMonitoringHistoryData, \
     XgPonDownstreamPerformanceMonitoringHistoryData, \
     XgPonUpstreamPerformanceMonitoringHistoryData
+import six
 
 
 class OnuPmIntervalMetrics(AdapterPmMetrics):
@@ -322,7 +324,7 @@
                                                                type=pm.type,
                                                                enabled=pm.enabled)])
 
-        pm_config.groups.extend([stats for stats in self.pm_group_metrics.itervalues()])
+        pm_config.groups.extend([stats for stats in six.itervalues(self.pm_group_metrics)])
 
         return pm_config
 
@@ -377,10 +379,10 @@
                                               context=context)
                     slice_data = [MetricInformation(metadata=metadata, metrics=metrics)]
                     raised_ts = arrow.utcnow().timestamp
-                    event_header = self.event_mgr.get_event_header(EventType.KPI_EVENT2, 
+                    event_header = self.event_mgr.get_event_header(EventType.KPI_EVENT2,
                                                                    self._category,
                                                                    self._sub_category,
-                                                                   self._event, 
+                                                                   self._event,
                                                                    raised_ts)
 
                     event_body = KpiEvent2(type=KpiEventType.slice,
diff --git a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
index 61f1c98..fddfc49 100644
--- a/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
+++ b/pyvoltha/adapters/extensions/events/kpi/onu/onu_pm_metrics.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import, division
 from voltha_protos.device_pb2 import PmConfig, PmConfigs, PmGroupConfig
 from pyvoltha.adapters.extensions.events.kpi.adapter_pm_metrics import AdapterPmMetrics
 from pyvoltha.adapters.extensions.events.kpi.onu.onu_omci_pm import OnuOmciPmMetrics
diff --git a/pyvoltha/adapters/extensions/events/olt/olt_los_alarm.py b/pyvoltha/adapters/extensions/events/olt/olt_los_alarm.py
index f6145c5..2193b7a 100644
--- a/pyvoltha/adapters/extensions/events/olt/olt_los_alarm.py
+++ b/pyvoltha/adapters/extensions/events/olt/olt_los_alarm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_activation_fail_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_activation_fail_alarm.py
index 58dbf9c..3678ab3 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_activation_fail_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_activation_fail_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_active_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_active_alarm.py
index c675b9a..0856706 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_active_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_active_alarm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_discovery_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_discovery_alarm.py
index a9f90ee..bd977d6 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_discovery_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_discovery_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_dying_gasp_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_dying_gasp_alarm.py
index 6e702a5..2db9bdd 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_dying_gasp_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_dying_gasp_alarm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_equipment_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_equipment_alarm.py
index 0c5fee4..e624ba0 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_equipment_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_equipment_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_high_rx_optical_power_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_high_rx_optical_power_alarm.py
index 217db10..bafe649 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_high_rx_optical_power_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_high_rx_optical_power_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_high_tx_optical_power_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_high_tx_optical_power_alarm.py
index 623e0c5..ffcfe30 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_high_tx_optical_power_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_high_tx_optical_power_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_laser_bias_current_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_laser_bias_current_alarm.py
index 129340e..4b96719 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_laser_bias_current_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_laser_bias_current_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_laser_eol_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_laser_eol_alarm.py
index cbf8a87..9cc5f5b 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_laser_eol_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_laser_eol_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_lob_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_lob_alarm.py
index 4b898a1..6eae3d0 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_lob_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_lob_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_lopc_mic_error_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_lopc_mic_error_alarm.py
index 01871ca..2403c21 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_lopc_mic_error_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_lopc_mic_error_alarm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_lopc_miss_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_lopc_miss_alarm.py
index 550f616..b354ca8 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_lopc_miss_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_lopc_miss_alarm.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_los_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_los_alarm.py
index 8c86372..11bb1bf 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_los_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_los_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_low_rx_optical_power_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_low_rx_optical_power_alarm.py
index 881f9d6..30f7338 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_low_rx_optical_power_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_low_rx_optical_power_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_low_tx_optical_power_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_low_tx_optical_power_alarm.py
index 48a408a..4be3b7c 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_low_tx_optical_power_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_low_tx_optical_power_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_selftest_failure_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_selftest_failure_alarm.py
index f411f9d..6b2f1e2 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_selftest_failure_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_selftest_failure_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_signal_degrade_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_signal_degrade_alarm.py
index 8c74eac..7a0b1a1 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_signal_degrade_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_signal_degrade_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_signal_fail_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_signal_fail_alarm.py
index d24c688..38e5e18 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_signal_fail_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_signal_fail_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_startup_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_startup_alarm.py
index d81d947..5286947 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_startup_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_startup_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_temp_red_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_temp_red_alarm.py
index 62a8293..2ac4f78 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_temp_red_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_temp_red_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_temp_yellow_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_temp_yellow_alarm.py
index 4182bfe..4b028fb 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_temp_yellow_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_temp_yellow_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_voltage_red_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_voltage_red_alarm.py
index f428e2e..49f4e37 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_voltage_red_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_voltage_red_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_voltage_yellow_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_voltage_yellow_alarm.py
index 2555078..3b0d22c 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_voltage_yellow_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_voltage_yellow_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/onu/onu_window_drift_alarm.py b/pyvoltha/adapters/extensions/events/onu/onu_window_drift_alarm.py
index c00195b..4f9ad04 100644
--- a/pyvoltha/adapters/extensions/events/onu/onu_window_drift_alarm.py
+++ b/pyvoltha/adapters/extensions/events/onu/onu_window_drift_alarm.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from voltha_protos.events_pb2 import AlarmEventType, AlarmEventSeverity, AlarmEventCategory
 from pyvoltha.adapters.extensions.alarms.adapter_alarms import AlarmBase
 
diff --git a/pyvoltha/adapters/extensions/events/simulator/simulate_alarms.py b/pyvoltha/adapters/extensions/events/simulator/simulate_alarms.py
index 5a416de..33a0295 100644
--- a/pyvoltha/adapters/extensions/events/simulator/simulate_alarms.py
+++ b/pyvoltha/adapters/extensions/events/simulator/simulate_alarms.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.alarms.olt.olt_los_alarm import OltLosAlarm
 from pyvoltha.adapters.extensions.alarms.onu.onu_dying_gasp_alarm import OnuDyingGaspAlarm
 from pyvoltha.adapters.extensions.alarms.onu.onu_los_alarm import OnuLosAlarm
diff --git a/pyvoltha/adapters/extensions/events/simulator/simulate_events.py b/pyvoltha/adapters/extensions/events/simulator/simulate_events.py
index 06c327e..29e5bb3 100644
--- a/pyvoltha/adapters/extensions/events/simulator/simulate_events.py
+++ b/pyvoltha/adapters/extensions/events/simulator/simulate_events.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 import arrow
 from pyvoltha.adapters.extensions.events.device_events.olt.olt_los_event import OltLosEvent
 from pyvoltha.adapters.extensions.events.device_events.device_events.onu.onu_dying_gasp_event import OnuDyingGaspEvent
diff --git a/pyvoltha/adapters/extensions/omci/database/alarm_db_ext.py b/pyvoltha/adapters/extensions/omci/database/alarm_db_ext.py
index ed1a228..6159c21 100644
--- a/pyvoltha/adapters/extensions/omci/database/alarm_db_ext.py
+++ b/pyvoltha/adapters/extensions/omci/database/alarm_db_ext.py
@@ -13,11 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from mib_db_api import *
+from __future__ import absolute_import
+from .mib_db_api import *
 from voltha_protos.omci_alarm_db_pb2 import AlarmInstanceData, AlarmClassData, \
     AlarmDeviceData, AlarmAttributeData
 from pyvoltha.common.config.config_backend import EtcdStore
 from pyvoltha.common.utils.registry import registry
+import six
+from six.moves import range
 
 class AlarmDbExternal(MibDbApi):
     """
@@ -94,7 +97,7 @@
         :raises KeyError: Device, Class ID, or Attribute does not exist
         """
         # Alarms are always a bitmap which is a long
-        return long(str_value) if len(str_value) else 0L
+        return int(str_value) if len(str_value) else 0
 
     def add(self, device_id, overwrite=False):
         """
@@ -151,7 +154,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         try:
@@ -185,7 +188,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID is a string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -373,7 +376,7 @@
         self.log.debug('set', device_id=device_id, class_id=class_id,
                        instance_id=instance_id, attributes=attributes)
         try:
-            if not isinstance(device_id, basestring):
+            if not isinstance(device_id, six.string_types):
                 raise TypeError('Device ID should be a string')
 
             if not 0 <= class_id <= 0xFFFF:
@@ -403,7 +406,7 @@
                     exist_attr_indexes = dict()
                     attr_len = len(inst_data.attributes)
 
-                    for index in xrange(0, attr_len):
+                    for index in range(0, attr_len):
                         exist_attr_indexes[inst_data.attributes[index].name] = index
 
                     str_value = ''
@@ -471,7 +474,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -553,7 +556,7 @@
                         self.log.debug('query-result-all', data=data)
                     else:
                         # Specific attribute(s)
-                        if isinstance(attributes, basestring):
+                        if isinstance(attributes, six.string_types):
                             attributes = {attributes}
 
                         data = {
diff --git a/pyvoltha/adapters/extensions/omci/database/mib_db_api.py b/pyvoltha/adapters/extensions/omci/database/mib_db_api.py
index eb93323..9aa414f 100644
--- a/pyvoltha/adapters/extensions/omci/database/mib_db_api.py
+++ b/pyvoltha/adapters/extensions/omci/database/mib_db_api.py
@@ -18,6 +18,7 @@
 OpenOMCI MIB Database API
 """
 
+from __future__ import absolute_import
 import structlog
 from datetime import datetime
 
diff --git a/pyvoltha/adapters/extensions/omci/database/mib_db_dict.py b/pyvoltha/adapters/extensions/omci/database/mib_db_dict.py
index dbf23cc..92eaaec 100644
--- a/pyvoltha/adapters/extensions/omci/database/mib_db_dict.py
+++ b/pyvoltha/adapters/extensions/omci/database/mib_db_dict.py
@@ -13,9 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import copy
-from mib_db_api import *
+from .mib_db_api import *
 import json
+import six
 
 
 class MibDbVolatileDict(MibDbApi):
@@ -66,7 +68,7 @@
         """
         self.log.debug('add-device', device_id=device_id, overwrite=overwrite)
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not self._started:
@@ -95,7 +97,7 @@
         """
         self.log.debug('remove-device', device_id=device_id)
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not self._started:
@@ -116,7 +118,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         device_db = self._data[device_id]
@@ -139,7 +141,7 @@
         :param device_id: (str) ONU Device ID
         :param value: (int) Value to save
         """
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not isinstance(value, int):
@@ -159,7 +161,7 @@
         :param device_id: (str) ONU Device ID
         :return: (int) The Value or None if not found
         """
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if device_id not in self._data:
@@ -174,7 +176,7 @@
         :param device_id: (str) ONU Device ID
         :param value: (DateTime) Value to save
         """
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not isinstance(value, datetime):
@@ -191,7 +193,7 @@
         :param device_id: (str) ONU Device ID
         :return: (int) The Value or None if not found
         """
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if device_id not in self._data:
@@ -215,7 +217,7 @@
         :raises KeyError: If device does not exist
         :raises DatabaseStateError: If the database is not enabled
         """
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be a string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -261,14 +263,14 @@
             entity = me_map.get(class_id)
 
             for attribute, value in attributes.items():
-                assert isinstance(attribute, basestring)
+                assert isinstance(attribute, six.string_types)
                 assert value is not None, "Attribute '{}' value cannot be 'None'".\
                     format(attribute)
 
                 db_value = instance_db[ATTRIBUTES_KEY].get(attribute) \
                     if ATTRIBUTES_KEY in instance_db else None
 
-                if entity is not None and isinstance(value, basestring):
+                if entity is not None and isinstance(value, six.string_types):
                     from scapy.fields import StrFixedLenField
                     attr_index = entity.attribute_name_to_index_map[attribute]
                     eca = entity.attributes[attr_index]
@@ -336,7 +338,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -392,7 +394,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID is a string')
 
         device_db = self._data.get(device_id, dict())
@@ -416,13 +418,13 @@
         if attributes is None or len(instance_db) == 0:
             return self._fix_inst_json_attributes(copy.deepcopy(instance_db), entity)
 
-        if not isinstance(attributes, (basestring, list, set)):
+        if not isinstance(attributes, (six.string_types, list, set)):
             raise TypeError('Attributes should be a string or list/set of strings')
 
         if not isinstance(attributes, (list, set)):
             attributes = [attributes]
 
-        results = {attr: val for attr, val in instance_db[ATTRIBUTES_KEY].iteritems()
+        results = {attr: val for attr, val in six.iteritems(instance_db[ATTRIBUTES_KEY])
                    if attr in attributes}
 
         for attr, attr_data in results.items():
@@ -471,7 +473,7 @@
                     value = field.load_json(attr_data)
                     return value
 
-            return json.loads(attr_data) if isinstance(attr_data, basestring) else attr_data
+            return json.loads(attr_data) if isinstance(attr_data, six.string_types) else attr_data
 
         except ValueError:
             return attr_data
diff --git a/pyvoltha/adapters/extensions/omci/database/mib_db_ext.py b/pyvoltha/adapters/extensions/omci/database/mib_db_ext.py
index 7120dde..375894b 100644
--- a/pyvoltha/adapters/extensions/omci/database/mib_db_ext.py
+++ b/pyvoltha/adapters/extensions/omci/database/mib_db_ext.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from mib_db_api import *
+from __future__ import absolute_import, division
+from .mib_db_api import *
 from voltha_protos.omci_mib_db_pb2 import MibInstanceData, MibClassData, \
     MibDeviceData, MibAttributeData, MessageType, ManagedEntity
 from pyvoltha.adapters.extensions.omci.omci_entities import *
@@ -21,6 +22,9 @@
 from pyvoltha.common.config.config_backend import EtcdStore
 from scapy.fields import StrField, FieldListField, PacketField
 from pyvoltha.common.utils.registry import registry
+import six
+import codecs
+from six.moves import range
 
 class MibDbStatistic(object):
     """
@@ -125,7 +129,7 @@
 
         if not self._started:
             super(MibDbExternal, self).start()
-            
+
             try:
                 self.log.info('db-exists')
             except Exception as e:
@@ -175,7 +179,7 @@
 
             if isinstance(field, StrFixedLenField):
                 from scapy.base_classes import Packet_metaclass
-                if hasattr(value, 'to_json') and not isinstance(value, basestring):
+                if hasattr(value, 'to_json') and not isinstance(value, six.string_types):
                     # Packet Class to string
                     str_value = value.to_json()
                 elif isinstance(field.default, Packet_metaclass) \
@@ -266,7 +270,7 @@
                 value = int(str_value)
 
             elif isinstance(field, BitField):
-                value = long(str_value)
+                value = int(str_value)
 
             elif hasattr(field, 'load_json'):
                 value = field.load_json(str_value)
@@ -342,7 +346,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         try:
@@ -361,7 +365,7 @@
     def _get_device_path(self, device_id):
         return MibDbExternal.DEVICE_PATH.format(device_id)
 
-    def _get_class_path(self, device_id, class_id):        
+    def _get_class_path(self, device_id, class_id):
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
@@ -411,7 +415,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID is a string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -522,7 +526,7 @@
                                  format(value))
             data = MibDeviceData()
             path = self._get_device_path(device_id)
-                                    
+
             data.ParseFromString(self._kv_store[path])
 
             now = datetime.utcnow()
@@ -630,8 +634,8 @@
         for k, v in attributes.items():
             if k == 'serial_number':
                 vendor_id = str(v[0:4])
-                vendor_specific = v[4:]
-                vendor_specific = str(vendor_specific.encode('hex'))
+                vendor_specific_ext = v[4:]
+                vendor_specific = codecs.encode(vendor_specific_ext, 'hex')
                 str_value = vendor_id + vendor_specific
                 attrs.append(MibAttributeData(name=k, value=str_value))
             else:
@@ -669,8 +673,8 @@
         for k, v in attributes.items():
             if k == 'serial_number':
                 vendor_id = str(v[0:4])
-                vendor_specific = v[4:]
-                vendor_specific = str(vendor_specific.encode('hex'))
+                vendor_specific_ext = v[4:]
+                vendor_specific = codecs.encode(vendor_specific_ext, 'hex')
                 str_value = vendor_id+vendor_specific
                 attrs.append(MibAttributeData(name=k, value=str_value))
             else:
@@ -686,7 +690,7 @@
         #class_path = self._get_class_path(device_id, class_id)
         #class_data = MibClassData()
         #class_data.ParseFromString(self._kv_store[class_path])
-        
+
         #class_data.instances.extend([instance_data])
 
         #self._kv_store[class_path] = class_data.SerializeToString()
@@ -714,7 +718,7 @@
         self.log.debug('set', device_id=device_id, class_id=class_id,
                        instance_id=instance_id, attributes=attributes)
         try:
-            if not isinstance(device_id, basestring):
+            if not isinstance(device_id, six.string_types):
                 raise TypeError('Device ID should be a string')
 
             if not 0 <= class_id <= 0xFFFF:
@@ -753,7 +757,7 @@
                     exist_attr_indexes = dict()
                     attr_len = len(inst_data.attributes)
 
-                    for index in xrange(0, attr_len):
+                    for index in range(0, attr_len):
                         name = inst_data.attributes[index].name
                         value = inst_data.attributes[index].value
                         exist_attr_indexes[name] = index
@@ -831,7 +835,7 @@
         if not self._started:
             raise DatabaseStateError('The Database is not currently active')
 
-        if not isinstance(device_id, basestring):
+        if not isinstance(device_id, six.string_types):
             raise TypeError('Device ID should be an string')
 
         if not 0 <= class_id <= 0xFFFF:
@@ -851,7 +855,7 @@
             classpath = self._get_class_path(device_id, class_id)
             class_data = MibClassData()
             class_data.ParseFromString(self._kv_store[classpath])
-            
+
             if len(class_data.instances) == 0:
                 del self._kv_store[classpath]
 
@@ -937,7 +941,7 @@
 
                     else:
                         # Specific attribute(s)
-                        if isinstance(attributes, basestring):
+                        if isinstance(attributes, six.string_types):
                             attributes = {attributes}
 
                         data = {
@@ -1067,7 +1071,7 @@
                              for msg_type in msg_types]
             data = MibDeviceData()
             device_path = self._get_device_path(device_id)
-            data.ParseFromString(self._kv_store[device_path]) 
+            data.ParseFromString(self._kv_store[device_path])
             data.message_types.extend(msg_type_list)
 
             # Update
diff --git a/pyvoltha/adapters/extensions/omci/me_frame.py b/pyvoltha/adapters/extensions/omci/me_frame.py
index 71e342f..b69447a 100644
--- a/pyvoltha/adapters/extensions/omci/me_frame.py
+++ b/pyvoltha/adapters/extensions/omci/me_frame.py
@@ -16,7 +16,9 @@
 """
 OMCI Managed Entity Message support base class
 """
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.omci.omci import *
+import six
 
 # abbreviations
 OP = EntityOperations
@@ -76,7 +78,7 @@
                                                                       self.entity_class_name)
 
     def _check_attributes(self, attributes, access):
-        keys = attributes.keys() if isinstance(attributes, dict) else attributes
+        keys = list(attributes.keys()) if isinstance(attributes, dict) else attributes
         for attr_name in keys:
             # Bad attribute name (invalid or spelling error)?
             index = self.entity_class.attribute_name_to_index_map.get(attr_name)
@@ -90,7 +92,7 @@
                                                                               self.entity_class_name)
 
         if access.value in [AA.W.value, AA.SBC.value] and isinstance(attributes, dict):
-            for attr_name, value in attributes.iteritems():
+            for attr_name, value in six.iteritems(attributes):
                 index = self.entity_class.attribute_name_to_index_map.get(attr_name)
                 attribute = self.entity_class.attributes[index]
                 if not attribute.valid(value):
@@ -115,19 +117,19 @@
 
         :return: (set, dict) set for get/deletes, dict for create/set
         """
-        if isinstance(attributes, basestring):
+        if isinstance(attributes, six.string_types):
             # data = [str(attributes)]
             data = set()
             data.add(str(attributes))
 
         elif isinstance(attributes, list):
-            assert all(isinstance(attr, basestring) for attr in attributes),\
+            assert all(isinstance(attr, six.string_types) for attr in attributes),\
                 'attribute list must be strings'
             data = {str(attr) for attr in attributes}
             assert len(data) == len(attributes), 'Attributes were not unique'
 
         elif isinstance(attributes, set):
-            assert all(isinstance(attr, basestring) for attr in attributes),\
+            assert all(isinstance(attr, six.string_types) for attr in attributes),\
                 'attribute set must be strings'
             data = {str(attr) for attr in attributes}
 
@@ -198,7 +200,7 @@
             omci_message=OmciSet(
                 entity_class=getattr(self.entity_class, 'class_id'),
                 entity_id=getattr(self, 'entity_id'),
-                attributes_mask=self.entity_class.mask_for(*data.keys()),
+                attributes_mask=self.entity_class.mask_for(*list(data.keys())),
                 data=data
             ))
 
@@ -212,7 +214,7 @@
         MEFrame.check_type(data, (list, set, dict))
         assert len(data) > 0, 'No attributes supplied'
 
-        mask_set = data.keys() if isinstance(data, dict) else data
+        mask_set = list(data.keys()) if isinstance(data, dict) else data
 
         self._check_operation(OP.Get)
         self._check_attributes(mask_set, AA.Readable)
@@ -306,7 +308,7 @@
         MEFrame.check_type(data, dict)
         assert len(data) == 1, 'Only one attribute should be specified'
 
-        mask_set = data.keys() if isinstance(data, dict) else data
+        mask_set = list(data.keys()) if isinstance(data, dict) else data
 
         self._check_operation(OP.GetNext)
         self._check_attributes(mask_set, AA.Readable)
@@ -318,7 +320,7 @@
                 entity_class=getattr(self.entity_class, 'class_id'),
                 entity_id=getattr(self, 'entity_id'),
                 attributes_mask=self.entity_class.mask_for(*mask_set),
-                command_sequence_number=data.values()[0]
+                command_sequence_number=list(data.values())[0]
             ))
 
     def synchronize_time(self, time=None):
diff --git a/pyvoltha/adapters/extensions/omci/omci.py b/pyvoltha/adapters/extensions/omci/omci.py
index 5a94146..67923b8 100644
--- a/pyvoltha/adapters/extensions/omci/omci.py
+++ b/pyvoltha/adapters/extensions/omci/omci.py
@@ -18,6 +18,7 @@
 Omci message generator and parser implementation using scapy
 """
 
-from omci_frame import OmciFrame
-from omci_messages import *
-from omci_entities import *
+from __future__ import absolute_import
+from .omci_frame import OmciFrame
+from .omci_messages import *
+from .omci_entities import *
diff --git a/pyvoltha/adapters/extensions/omci/omci_cc.py b/pyvoltha/adapters/extensions/omci/omci_cc.py
index 76aa41e..f689cd0 100644
--- a/pyvoltha/adapters/extensions/omci/omci_cc.py
+++ b/pyvoltha/adapters/extensions/omci/omci_cc.py
@@ -17,6 +17,7 @@
 OMCI Message support
 """
 
+from __future__ import absolute_import, division
 import sys
 import arrow
 from twisted.internet import reactor, defer
@@ -31,12 +32,7 @@
 from voltha_protos.inter_container_pb2 import InterAdapterMessageType, InterAdapterOmciMessage
 from enum import IntEnum
 from binascii import hexlify
-
-
-def hexify(buffer):
-    """Return a hexadecimal string encoding of input buffer"""
-    return ''.join('%02x' % ord(c) for c in buffer)
-
+import codecs
 
 DEFAULT_OMCI_TIMEOUT = 10       # 3               # Seconds
 MAX_OMCI_REQUEST_AGE = 60                          # Seconds
@@ -139,7 +135,7 @@
         self._rx_unknown_me = 0       # Number of managed entities Rx without a decode definition
         self._tx_errors = 0           # Exceptions during tx request
         self._consecutive_errors = 0  # Rx & Tx errors in a row, a good RX resets this to 0
-        self._reply_min = sys.maxint  # Fastest successful tx -> rx
+        self._reply_min = sys.maxsize # Fastest successful tx -> rx
         self._reply_max = 0           # Longest successful tx -> rx
         self._reply_sum = 0.0         # Total seconds for successful tx->rx (float for average)
         self._max_hp_tx_queue = 0     # Maximum size of high priority tx pending queue
@@ -240,16 +236,16 @@
 
     @property
     def reply_min(self):
-        return int(round(self._reply_min * 1000.0))     # Milliseconds
+        return int(self._reply_min * 1000.0)     # Milliseconds
 
     @property
     def reply_max(self):
-        return int(round(self._reply_max * 1000.0))     # Milliseconds
+        return int(self._reply_max * 1000.0)     # Milliseconds
 
     @property
     def reply_average(self):
         avg = self._reply_sum / self._rx_frames if self._rx_frames > 0 else 0.0
-        return int(round(avg * 1000.0))     # Milliseconds
+        return int(avg * 1000.0)     # Milliseconds
 
     @property
     def hp_tx_queue_len(self):
@@ -843,7 +839,7 @@
                                        errbackArgs=(tx_tid, high_priority))
 
                     omci_msg = InterAdapterOmciMessage(
-                        message=hexify(str(frame)),
+                        message=hexify(frame),
                         proxy_address=self._proxy_address,
                         connect_status=self._device.connect_status)
 
@@ -924,7 +920,7 @@
     def send_start_software_download(self, image_inst_id, image_size, window_size, timeout=DEFAULT_OMCI_TIMEOUT, high_priority=False):
         frame = SoftwareImageFrame(image_inst_id).start_software_download(image_size, window_size-1)
         return self.send(frame, timeout, 3, high_priority=high_priority)
-        
+
     def send_download_section(self, image_inst_id, section_num, data, size=DEFAULT_OMCI_DOWNLOAD_SECTION_SIZE, timeout=0, high_priority=False):
         """
         # timeout=0 indicates no repons needed
@@ -935,10 +931,10 @@
         else:
             frame = SoftwareImageFrame(image_inst_id).download_section(False, section_num, data)
         return self.send(frame, timeout, high_priority=high_priority)
-        
+
         # if timeout > 0:
-        #     self.reactor.callLater(0, self.sim_receive_download_section_resp, 
-        #                            frame.fields["transaction_id"], 
+        #     self.reactor.callLater(0, self.sim_receive_download_section_resp,
+        #                            frame.fields["transaction_id"],
         #                            frame.fields["omci_message"].fields["section_number"])
         # return d
 
diff --git a/pyvoltha/adapters/extensions/omci/omci_defs.py b/pyvoltha/adapters/extensions/omci/omci_defs.py
index 64fefc5..430c1d3 100644
--- a/pyvoltha/adapters/extensions/omci/omci_defs.py
+++ b/pyvoltha/adapters/extensions/omci/omci_defs.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from enum import Enum, IntEnum
 
 class OmciUninitializedFieldError(Exception):
diff --git a/pyvoltha/adapters/extensions/omci/omci_entities.py b/pyvoltha/adapters/extensions/omci/omci_entities.py
index 95bad37..e6b5ea0 100644
--- a/pyvoltha/adapters/extensions/omci/omci_entities.py
+++ b/pyvoltha/adapters/extensions/omci/omci_entities.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import, division
 import inspect
 
 import sys
@@ -27,6 +28,8 @@
     AttributeAccess, OmciNullPointer, EntityOperations, OmciInvalidTypeError
 from pyvoltha.adapters.extensions.omci.omci_fields import OmciSerialNumberField, OmciTableField
 from pyvoltha.adapters.extensions.omci.omci_defs import bitpos_from_mask
+import six
+from six.moves import range
 
 
 class EntityClassAttribute(object):
@@ -85,11 +88,11 @@
         return self._deprecated
 
     _type_checker_map = {
-        'ByteField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFF,
-        'ShortField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFF,
-        'IntField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFFFFFF,
-        'LongField': lambda val: isinstance(val, (int, long)) and 0 <= val <= 0xFFFFFFFFFFFFFFFF,
-        'StrFixedLenField': lambda val: isinstance(val, basestring),
+        'ByteField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFF,
+        'ShortField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFF,
+        'IntField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFFFFFF,
+        'LongField': lambda val: isinstance(val, (int, int)) and 0 <= val <= 0xFFFFFFFFFFFFFFFF,
+        'StrFixedLenField': lambda val: isinstance(val, six.string_types),
         'MACField': lambda val: True,   # TODO: Add a constraint for this field type
         'BitField': lambda val: True,   # TODO: Add a constraint for this field type
         'IPField': lambda val: True,    # TODO: Add a constraint for this field type
@@ -133,7 +136,7 @@
             (a._fld.name, idx) for idx, a in enumerate(cls.attributes))
 
 
-class EntityClass(object):
+class EntityClass(six.with_metaclass(EntityClassMeta, object)):
 
     class_id = 'to be filled by subclass'
     attributes = []
@@ -147,16 +150,15 @@
 
     # will be map of attr_name -> index in attributes, initialized by metaclass
     attribute_name_to_index_map = None
-    __metaclass__ = EntityClassMeta
 
     def __init__(self, **kw):
         assert(isinstance(kw, dict))
-        for k, v in kw.iteritems():
+        for k, v in six.iteritems(kw):
             assert(k in self.attribute_name_to_index_map)
         self._data = kw
 
     def serialize(self, mask=None, operation=None):
-        octets = ''
+        octets = b''
 
         # generate ordered list of attribute indices needed to be processed
         # if mask is provided, we use that explicitly
@@ -189,7 +191,7 @@
     def attribute_indices_from_data(self):
         return sorted(
             self.attribute_name_to_index_map[attr_name]
-            for attr_name in self._data.iterkeys())
+            for attr_name in six.iterkeys(self._data))
 
     byte1_mask_to_attr_indices = dict(
         (m, bitpos_from_mask(m, 8, -1)) for m in range(256))
@@ -620,13 +622,13 @@
         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))
+        return b'%02d' % (self.fields.get('filter_outer_priority',0)) + \
+               b'%03d' % (self.fields.get('filter_outer_vid',0)) + \
+               b'%01d' % (self.fields.get('filter_outer_tpid_de',0)) + \
+               b'%03d' % (self.fields.get('filter_inner_priority',0)) + \
+               b'%04d' % (self.fields.get('filter_inner_vid',0)) + \
+               b'%01d' % (self.fields.get('filter_inner_tpid_de',0)) + \
+               b'%02d' % (self.fields.get('filter_ether_type',0))
 
     def is_delete(self):
         return self.fields.get('treatment_tags_to_remove',0) == 0x3 and \
@@ -1181,7 +1183,7 @@
         return json.dumps(temp.fields, separators=(',', ':'))
 
     def index(self):
-        return '{:04}'.format(self.fields.get('me_type', 0))
+        return b'%04d' % (self.fields.get('me_type', 0))
 
     def is_delete(self):
         return self.fields.get('me_type', 0) == 0
@@ -1210,7 +1212,7 @@
         return json.dumps(temp.fields, separators=(',', ':'))
 
     def index(self):
-        return '{:02}'.format(self.fields.get('msg_type', 0))
+        return b'%02d' % (self.fields.get('msg_type', 0))
 
     def is_delete(self):
         return self.fields.get('me_type', 0) == 0
@@ -1614,5 +1616,5 @@
               o is not EntityClass)
 )
 
-entity_classes = [c for c in entity_classes_name_map.itervalues()]
+entity_classes = [c for c in six.itervalues(entity_classes_name_map)]
 entity_id_to_class_map = dict((c.class_id, c) for c in entity_classes)
diff --git a/pyvoltha/adapters/extensions/omci/omci_fields.py b/pyvoltha/adapters/extensions/omci/omci_fields.py
index 8fc8a4c..3637b6d 100644
--- a/pyvoltha/adapters/extensions/omci/omci_fields.py
+++ b/pyvoltha/adapters/extensions/omci/omci_fields.py
@@ -13,23 +13,25 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import binascii
 import json
 from scapy.fields import Field, StrFixedLenField, PadField, IntField, FieldListField, ByteField, StrField, \
     StrFixedLenField, PacketField
 from scapy.packet import Raw
+import six
 
 class FixedLenField(PadField):
     """
     This Pad field limits parsing of its content to its size
     """
-    def __init__(self, fld, align, padwith='\x00'):
+    def __init__(self, fld, align, padwith=b'\x00'):
         super(FixedLenField, self).__init__(fld, align, padwith)
 
     def getfield(self, pkt, s):
         remain, val = self._fld.getfield(pkt, s[:self._align])
         if isinstance(val.payload, Raw) and \
-                not val.payload.load.replace(self._padwith, ''):
+                not val.payload.load.replace(self._padwith, b''):
             # raw payload is just padding
             val.remove_payload()
         return remain + s[self._align:], val
@@ -47,7 +49,7 @@
     def addfield(self, pkt, s, val):
         for fld in self.flds:
             # run though fake add/get to consume the relevant portion of the input value for this field
-            x, extracted = fld.getfield(pkt, fld.addfield(pkt, '', val))
+            x, extracted = fld.getfield(pkt, fld.addfield(pkt, b'', val))
             l = len(extracted)
             s = fld.addfield(pkt, s, val[0:l])
             val = val[l:]
@@ -226,7 +228,7 @@
                 key_value_pairs[index] = new
 
         new_table = []
-        for k, v in sorted(key_value_pairs.iteritems()):
+        for k, v in sorted(six.iteritems(key_value_pairs)):
             assert isinstance(v, self.default.cls), 'object type for Omci Table row object invalid'
             new_table.append(v.fields)
 
@@ -247,7 +249,7 @@
             key_value_pairs[index] = v
 
         table = []
-        for k, v in sorted(key_value_pairs.iteritems()):
+        for k, v in sorted(six.iteritems(key_value_pairs)):
             table.append(v)
 
         return table
diff --git a/pyvoltha/adapters/extensions/omci/omci_frame.py b/pyvoltha/adapters/extensions/omci/omci_frame.py
index d9a957f..9f378d5 100644
--- a/pyvoltha/adapters/extensions/omci/omci_frame.py
+++ b/pyvoltha/adapters/extensions/omci/omci_frame.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from scapy.fields import ByteField, PacketField, IntField
 from scapy.fields import ShortField, ConditionalField
 from scapy.packet import Packet
diff --git a/pyvoltha/adapters/extensions/omci/omci_me.py b/pyvoltha/adapters/extensions/omci/omci_me.py
index 4a28d27..1c12266 100644
--- a/pyvoltha/adapters/extensions/omci/omci_me.py
+++ b/pyvoltha/adapters/extensions/omci/omci_me.py
@@ -16,10 +16,13 @@
 """
 OMCI Managed Entity Frame support
 """
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.omci.omci import *
 from pyvoltha.adapters.extensions.omci.me_frame import MEFrame
 from pyvoltha.adapters.extensions.omci.omci_entities import PriorityQueueG
 from pyvoltha.adapters.extensions.omci.omci_entities import *
+import six
+from six.moves import range
 
 
 
@@ -293,7 +296,7 @@
         # Validate
         self.check_type(port_id, (int, type(None)))
         self.check_type(tcont_id, (int, type(None)))
-        self.check_type(direction, (basestring, type(None)))
+        self.check_type(direction, (six.string_types, type(None)))
         self.check_type(upstream_tm, (int, type(None)))
 
         if port_id is not None and not 0 <= port_id <= 0xFFFE:  # TODO: Verify max
@@ -303,7 +306,7 @@
             raise ValueError('tcont_id should be 0..0xFFFE')
 
         if direction is not None and str(direction).lower() not in _directions:
-            raise ValueError('direction should one of {}'.format(_directions.keys()))
+            raise ValueError('direction should one of {}'.format(list(_directions.keys())))
 
         if upstream_tm is not None and not 0 <= upstream_tm <= 0xFFFE:  # TODO: Verify max
             raise ValueError('upstream_tm should be 0..0xFFFE')
diff --git a/pyvoltha/adapters/extensions/omci/omci_messages.py b/pyvoltha/adapters/extensions/omci/omci_messages.py
index 2b51bf8..bdcc24b 100644
--- a/pyvoltha/adapters/extensions/omci/omci_messages.py
+++ b/pyvoltha/adapters/extensions/omci/omci_messages.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from scapy.fields import ByteField, ThreeBytesField, StrFixedLenField, ConditionalField, IntField, Field
 from scapy.fields import ShortField, BitField
@@ -93,13 +94,13 @@
         for index in indices:
             try:
                 fld = entity_class.attributes[index].field
-            except IndexError, e:
+            except IndexError as e:
                 log.error("attribute-decode-failure", attribute_index=index,
                           entity_class=entity_class, e=e)
                 continue
             try:
                 s, value = fld.getfield(pkt, s)
-            except Exception, _e:
+            except Exception as _e:
                 raise
             if isinstance(pkt, OmciGetResponse) and isinstance(fld, OmciTableField):
                 data[fld.name + '_size'] = value
diff --git a/pyvoltha/adapters/extensions/omci/onu_configuration.py b/pyvoltha/adapters/extensions/omci/onu_configuration.py
index 69823ef..4664120 100644
--- a/pyvoltha/adapters/extensions/omci/onu_configuration.py
+++ b/pyvoltha/adapters/extensions/omci/onu_configuration.py
@@ -13,11 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 
 from voltha_protos.device_pb2 import Image
-from omci_entities import *
-from database.mib_db_api import *
+from .omci_entities import *
+from .database.mib_db_api import *
 from enum import IntEnum
 
 
diff --git a/pyvoltha/adapters/extensions/omci/onu_device_entry.py b/pyvoltha/adapters/extensions/omci/onu_device_entry.py
index 40cb834..68a3e04 100644
--- a/pyvoltha/adapters/extensions/omci/onu_device_entry.py
+++ b/pyvoltha/adapters/extensions/omci/onu_device_entry.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 import structlog
 from copy import deepcopy
 from voltha_protos.device_pb2 import ImageDownload
@@ -30,6 +31,7 @@
 
 from twisted.internet import reactor, defer
 from enum import IntEnum
+import six
 
 OP = EntityOperations
 RC = ReasonCodes
@@ -545,7 +547,7 @@
         """
         self.log.debug('query-single', class_id=class_id,
                        instance_id=instance_id, attributes=attribute)
-        assert isinstance(attribute, basestring), \
+        assert isinstance(attribute, six.string_types), \
             'Only a single attribute value can be retrieved'
 
         entry = self.mib_synchronizer.query_mib(class_id=class_id,
diff --git a/pyvoltha/adapters/extensions/omci/openomci_agent.py b/pyvoltha/adapters/extensions/omci/openomci_agent.py
index b927621..5595816 100644
--- a/pyvoltha/adapters/extensions/omci/openomci_agent.py
+++ b/pyvoltha/adapters/extensions/omci/openomci_agent.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from twisted.internet import reactor
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import MibDbVolatileDict
@@ -36,6 +37,7 @@
 from pyvoltha.adapters.extensions.omci.state_machines.image_agent import ImageDownloadeSTM, OmciSoftwareImageDownloadSTM
 from pyvoltha.adapters.extensions.omci.tasks.file_download_task import FileDownloadTask
 from pyvoltha.adapters.extensions.omci.tasks.omci_sw_image_upgrade_task import OmciSwImageUpgradeTask
+import six
 
 OpenOmciAgentDefaults = {
     'mib-synchronizer': {
@@ -171,7 +173,7 @@
             self._mib_db.start()
             self._alarm_db.start()
 
-            for device in self._devices.itervalues():
+            for device in six.itervalues(self._devices):
                 device.start()
 
         except Exception as e:
@@ -189,7 +191,7 @@
         self._event_bus = None
 
         # ONUs OMCI shutdown
-        for device in self._devices.itervalues():
+        for device in six.itervalues(self._devices):
             device.stop()
 
         # DB shutdown
@@ -272,7 +274,7 @@
 
         :return: (frozenset) Set of device IDs (str)
         """
-        return frozenset(self._devices.keys())
+        return frozenset(list(self._devices.keys()))
 
     def get_device(self, device_id):
         """
diff --git a/pyvoltha/adapters/extensions/omci/openomci_event_bus.py b/pyvoltha/adapters/extensions/omci/openomci_event_bus.py
index 1df33ee..fca9389 100644
--- a/pyvoltha/adapters/extensions/omci/openomci_event_bus.py
+++ b/pyvoltha/adapters/extensions/omci/openomci_event_bus.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from google.protobuf.json_format import MessageToDict
 from google.protobuf.message import Message
 from simplejson import dumps
diff --git a/pyvoltha/adapters/extensions/omci/state_machines/alarm_sync.py b/pyvoltha/adapters/extensions/omci/state_machines/alarm_sync.py
index b0c76ff..364bc58 100644
--- a/pyvoltha/adapters/extensions/omci/state_machines/alarm_sync.py
+++ b/pyvoltha/adapters/extensions/omci/state_machines/alarm_sync.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 import arrow
 from datetime import datetime
@@ -28,6 +29,8 @@
 
 from pyvoltha.common.event_bus import EventBusClient
 from voltha_protos.omci_alarm_db_pb2 import AlarmOpenOmciEventType
+import six
+from six.moves import range
 
 RxEvent = OmciCCRxEvents
 RC = ReasonCodes
@@ -218,7 +221,7 @@
             task.stop()
 
         # Drop Response and Autonomous notification subscriptions
-        for event, sub in self._omci_cc_subscriptions.iteritems():
+        for event, sub in six.iteritems(self._omci_cc_subscriptions):
             if sub is not None:
                 self._omci_cc_subscriptions[event] = None
                 self._device.omci_cc.event_bus.unsubscribe(sub)
@@ -252,7 +255,7 @@
 
         # Set up Response and Autonomous notification subscriptions
         try:
-            for event, sub in self._omci_cc_sub_mapping.iteritems():
+            for event, sub in six.iteritems(self._omci_cc_sub_mapping):
                 if self._omci_cc_subscriptions[event] is None:
                     self._omci_cc_subscriptions[event] = \
                         self._device.omci_cc.event_bus.subscribe(
@@ -363,7 +366,7 @@
         """
         for cid_eid in olt_only:
             # First process the alarm clearing
-            self.process_alarm_data(cid_eid[0], cid_eid[1], 0L, -1)
+            self.process_alarm_data(cid_eid[0], cid_eid[1], 0, -1)
             # Now remove from alarm DB so we match the ONU alarm table
             self._database.delete(self._device_id, cid_eid[0], cid_eid[1])
 
@@ -466,7 +469,7 @@
         prev_entry = self._database.query(self._device_id, class_id, entity_id)
         try:
             # Need to access the bit map structure which is nested in dict attributes
-            prev_bitmap = 0 if len(prev_entry) == 0 else long(prev_entry['attributes'][key])
+            prev_bitmap = 0 if len(prev_entry) == 0 else int(prev_entry['attributes'][key])
         except Exception as e:
             self.log.exception('alarm-prev-entry-collection-failure', class_id=class_id,
                                device_id=self._device_id, entity_id=entity_id, value=bitmap, e=e)
@@ -480,11 +483,11 @@
 
         if self._alarm_manager is not None:
             # Generate a set of alarm number that are raised in current and previous
-            previously_raised = {alarm_no for alarm_no in xrange(224)
-                                 if prev_bitmap & (1L << (223-alarm_no)) != 0L}
+            previously_raised = {alarm_no for alarm_no in range(224)
+                                 if prev_bitmap & (1 << (223-alarm_no)) != 0}
 
-            currently_raised = {alarm_no for alarm_no in xrange(224)
-                                if bitmap & (1L << (223-alarm_no)) != 0L}
+            currently_raised = {alarm_no for alarm_no in range(224)
+                                if bitmap & (1 << (223-alarm_no)) != 0}
 
             newly_cleared = previously_raised - currently_raised
             newly_raised = currently_raised - previously_raised
diff --git a/pyvoltha/adapters/extensions/omci/state_machines/image_agent.py b/pyvoltha/adapters/extensions/omci/state_machines/image_agent.py
old mode 100755
new mode 100644
index 08e2a04..5edf06e
--- a/pyvoltha/adapters/extensions/omci/state_machines/image_agent.py
+++ b/pyvoltha/adapters/extensions/omci/state_machines/image_agent.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import, division
 import os
 import structlog
 from datetime import datetime
@@ -27,6 +28,7 @@
 from pyvoltha.adapters.extensions.omci.omci_entities import SoftwareImage
 from pyvoltha.adapters.extensions.omci.omci_cc import DEFAULT_OMCI_TIMEOUT
 from pyvoltha.adapters.extensions.omci.omci_messages import OmciEndSoftwareDownloadResponse, OmciActivateImageResponse
+from six.moves import range
 
 ###################################################################################
 ##              OLT out-of-band download image procedure
diff --git a/pyvoltha/adapters/extensions/omci/state_machines/mib_sync.py b/pyvoltha/adapters/extensions/omci/state_machines/mib_sync.py
index a128816..919f921 100644
--- a/pyvoltha/adapters/extensions/omci/state_machines/mib_sync.py
+++ b/pyvoltha/adapters/extensions/omci/state_machines/mib_sync.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from datetime import datetime, timedelta
 from transitions import Machine
@@ -28,6 +29,7 @@
 from pyvoltha.adapters.extensions.omci.omci_entities import OntData, Omci
 from pyvoltha.common.event_bus import EventBusClient
 from voltha_protos.omci_mib_db_pb2 import OpenOmciEventType
+import six
 
 RxEvent = OmciCCRxEvents
 DevEvent = OnuDeviceEvents
@@ -287,12 +289,12 @@
             task.stop()
 
         # Drop Response and Autonomous notification subscriptions
-        for event, sub in self._omci_cc_subscriptions.iteritems():
+        for event, sub in six.iteritems(self._omci_cc_subscriptions):
             if sub is not None:
                 self._omci_cc_subscriptions[event] = None
                 self._device.omci_cc.event_bus.unsubscribe(sub)
 
-        for event, sub in self._onu_dev_subscriptions.iteritems():
+        for event, sub in six.iteritems(self._onu_dev_subscriptions):
             if sub is not None:
                 self._onu_dev_subscriptions[event] = None
                 self._device.event_bus.unsubscribe(sub)
@@ -331,7 +333,7 @@
 
         # Set up Response and Autonomous notification subscriptions
         try:
-            for event, sub in self._omci_cc_sub_mapping.iteritems():
+            for event, sub in six.iteritems(self._omci_cc_sub_mapping):
                 if self._omci_cc_subscriptions[event] is None:
                     self._omci_cc_subscriptions[event] = \
                         self._device.omci_cc.event_bus.subscribe(
@@ -343,7 +345,7 @@
 
         # Set up ONU device subscriptions
         try:
-            for event, sub in self._onu_dev_sub_mapping.iteritems():
+            for event, sub in six.iteritems(self._onu_dev_sub_mapping):
                 if self._onu_dev_subscriptions[event] is None:
                     self._onu_dev_subscriptions[event] = \
                         self._device.event_bus.subscribe(
@@ -631,7 +633,7 @@
                 class_id = omci_msg['entity_class']
                 instance_id = omci_msg['entity_id']
                 data = omci_msg['data']
-                attributes = [data.keys()]
+                attributes = [list(data.keys())]
 
                 # Look up ME Instance in Database. Not-found can occur if a MIB
                 # reset has occurred
@@ -756,7 +758,7 @@
                                      if (AA.SBC in attr.access or AA.W in attr.access)
                                      and attr.field.name != 'managed_entity_id'}
 
-                        missing = sbc_w_set - {k for k in attributes.iterkeys()}
+                        missing = sbc_w_set - {k for k in six.iterkeys(attributes)}
 
                         if len(missing):
                             # Request the missing attributes
diff --git a/pyvoltha/adapters/extensions/omci/state_machines/omci_onu_capabilities.py b/pyvoltha/adapters/extensions/omci/state_machines/omci_onu_capabilities.py
index 3cf6ac3..31134dc 100644
--- a/pyvoltha/adapters/extensions/omci/state_machines/omci_onu_capabilities.py
+++ b/pyvoltha/adapters/extensions/omci/state_machines/omci_onu_capabilities.py
@@ -13,11 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from transitions import Machine
 from twisted.internet import reactor
 from pyvoltha.adapters.extensions.omci.onu_device_entry import OnuDeviceEntry, OnuDeviceEvents, IN_SYNC_KEY
 from voltha_protos.omci_mib_db_pb2 import OpenOmciEventType
+import six
 
 
 class OnuOmciCapabilities(object):
@@ -174,7 +176,7 @@
         self._supported_msg_types = frozenset()
 
         # Drop Response and Autonomous notification subscriptions
-        for event, sub in self._subscriptions.iteritems():
+        for event, sub in six.iteritems(self._subscriptions):
             if sub is not None:
                 self._subscriptions[event] = None
                 self._device.event_bus.unsubscribe(sub)
@@ -190,7 +192,7 @@
 
         # Subscribe to events of interest
         try:
-            for event, sub in self._sub_mapping.iteritems():
+            for event, sub in six.iteritems(self._sub_mapping):
                 if self._subscriptions[event] is None:
                     self._subscriptions[event] = \
                         self._device.event_bus.subscribe(
diff --git a/pyvoltha/adapters/extensions/omci/state_machines/performance_intervals.py b/pyvoltha/adapters/extensions/omci/state_machines/performance_intervals.py
index 70be6d8..81c11d0 100644
--- a/pyvoltha/adapters/extensions/omci/state_machines/performance_intervals.py
+++ b/pyvoltha/adapters/extensions/omci/state_machines/performance_intervals.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 import arrow
 from transitions import Machine
@@ -36,6 +37,7 @@
     EthernetFrameDownstreamPerformanceMonitoringHistoryData, \
     EthernetFrameExtendedPerformanceMonitoring, \
     EthernetFrameExtendedPerformanceMonitoring64Bit, AniG
+import six
 
 
 RxEvent = OmciCCRxEvents
@@ -339,7 +341,7 @@
         self._next_interval = None
 
         # Drop OMCI ME Response subscriptions
-        for event, sub in self._omci_cc_subscriptions.iteritems():
+        for event, sub in six.iteritems(self._omci_cc_subscriptions):
             if sub is not None:
                 self._omci_cc_subscriptions[event] = None
                 self._device.omci_cc.event_bus.unsubscribe(sub)
@@ -350,14 +352,14 @@
         unis = config.uni_g_entities
 
         if anis is not None:
-            for entity_id in anis.iterkeys():
+            for entity_id in six.iterkeys(anis):
                 self.delete_pm_me(FecPerformanceMonitoringHistoryData.class_id, entity_id)
                 self.delete_pm_me(XgPonTcPerformanceMonitoringHistoryData.class_id, entity_id)
                 self.delete_pm_me(XgPonDownstreamPerformanceMonitoringHistoryData.class_id, entity_id)
                 self.delete_pm_me(XgPonUpstreamPerformanceMonitoringHistoryData.class_id, entity_id)
 
         if unis is not None:
-            for entity_id in config.uni_g_entities.iterkeys():
+            for entity_id in six.iterkeys(config.uni_g_entities):
                 self.delete_pm_me(EthernetPMMonitoringHistoryData.class_id, entity_id)
 
     def on_enter_starting(self):
@@ -369,7 +371,7 @@
 
         # Set up OMCI ME Response subscriptions
         try:
-            for event, sub in self._omci_cc_sub_mapping.iteritems():
+            for event, sub in six.iteritems(self._omci_cc_sub_mapping):
                 if self._omci_cc_subscriptions[event] is None:
                     self._omci_cc_subscriptions[event] = \
                         self._device.omci_cc.event_bus.subscribe(
@@ -386,7 +388,7 @@
             unis = config.uni_g_entities
 
             if anis is not None:
-                for entity_id in anis.iterkeys():
+                for entity_id in six.iterkeys(anis):
                     self.add_pm_me(FecPerformanceMonitoringHistoryData.class_id,
                                    entity_id)
                     self.add_pm_me(XgPonTcPerformanceMonitoringHistoryData.class_id,
@@ -397,12 +399,12 @@
                                    entity_id)
 
             if unis is not None:
-                for entity_id in config.uni_g_entities.iterkeys():
+                for entity_id in six.iterkeys(config.uni_g_entities):
                     self.add_pm_me(EthernetPMMonitoringHistoryData.class_id, entity_id)
 
             # Look for existing instances of dynamically created ME's that have PM
             # associated with them and add them now
-            for class_id in self._me_watch_list.iterkeys():
+            for class_id in six.iterkeys(self._me_watch_list):
                 instances = {k: v for k, v in
                              self._device.query_mib(class_id=class_id).items()
                              if isinstance(k, int)}
@@ -477,7 +479,7 @@
 
             # Scan all ANI-G ports
             ani_g_entities = self._device.configuration.ani_g_entities
-            ani_g_entities_ids = ani_g_entities.keys() if ani_g_entities is not None else None
+            ani_g_entities_ids = list(ani_g_entities.keys()) if ani_g_entities is not None else None
 
             if ani_g_entities_ids is not None and len(ani_g_entities_ids):
                 for entity_id in ani_g_entities_ids:
@@ -577,7 +579,7 @@
         self.advertise(OpenOmciEventType.state_change, self.state)
         self._cancel_deferred()
         self._cancel_tasks()
-        keys = self._pm_me_collect_retries.keys()
+        keys = list(self._pm_me_collect_retries.keys())
         shuffle(keys)
 
         for key in keys:
@@ -713,7 +715,7 @@
             status = omci_msg['success_code']
 
             if status == RC.Success:
-                for class_id in self._me_watch_list.iterkeys():
+                for class_id in six.iterkeys(self._me_watch_list):
                     # BP entity_id -> (PM class_id, PM entity_id)
                     instances = self._me_watch_list[class_id]['instances']
                     for _, me_pair in instances.items():
@@ -736,7 +738,7 @@
         def valid_request(stat, c_id, e_id):
             return self._omci_cc_subscriptions[RxEvent.Delete] is not None\
                 and stat in (RC.Success, RC.InstanceExists) \
-                and c_id in self._me_watch_list.keys() \
+                and c_id in list(self._me_watch_list.keys()) \
                 and e_id not in self._me_watch_list[c_id]['instances']
 
         response = msg[RX_RESPONSE_KEY]
@@ -767,7 +769,7 @@
         def valid_request(stat, cid, eid):
             return self._omci_cc_subscriptions[RxEvent.Delete] is not None\
                 and stat in (RC.Success, RC.UnknownInstance) \
-                and cid in self._me_watch_list.keys() \
+                and cid in list(self._me_watch_list.keys()) \
                 and eid in self._me_watch_list[cid]['instances']
 
         response = msg[RX_RESPONSE_KEY]
@@ -850,7 +852,7 @@
                 3: upstream_types,
                 5: downstream_types,
                 6: downstream_types,
-            }.get(tp, None)
+            }.get(tp, [None, False])
 
         if request is not None:
             assert class_id == MacBridgePortConfigurationData.class_id
@@ -882,7 +884,7 @@
             pm_class_ids = [class_id]
 
         if pm_class_ids is None:
-            return False     # Unable to select a supported ME for this ONU
+            return 0, 0     # Unable to select a supported ME for this ONU
 
         if add:
             for pm_class_id in pm_class_ids:
diff --git a/pyvoltha/adapters/extensions/omci/tasks/alarm_resync_task.py b/pyvoltha/adapters/extensions/omci/tasks/alarm_resync_task.py
index f524326..c3af2df 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/alarm_resync_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/alarm_resync_task.py
@@ -13,13 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure, returnValue
 from twisted.internet import reactor
 from pyvoltha.common.utils.asleep import asleep
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import *
 from pyvoltha.adapters.extensions.omci.omci_defs import AttributeAccess
 from pyvoltha.adapters.extensions.omci.database.alarm_db_ext import AlarmDbExternal
+import six
+from six.moves import range
 
 AA = AttributeAccess
 
@@ -184,7 +187,7 @@
         try:
             max_tries = AlarmResyncTask.max_retries - 1
 
-            for retries in xrange(0, max_tries + 1):
+            for retries in range(0, max_tries + 1):
                 # Send ALARM Upload so ONU snapshots its ALARM
                 try:
                     command_sequence_number = yield self.send_alarm_upload()
@@ -250,10 +253,10 @@
         # Begin ALARM Upload
         seq_no = None
 
-        for seq_no in xrange(command_sequence_number):
+        for seq_no in range(command_sequence_number):
             max_tries = AlarmResyncTask.max_alarm_upload_next_retries
 
-            for retries in xrange(0, max_tries):
+            for retries in range(0, max_tries):
                 try:
                     response = yield self._device.omci_cc.send_get_all_alarm_next(seq_no)
                     self.strobe_watchdog()
@@ -378,8 +381,8 @@
                         if isinstance(inst_id, int) and inst_id in onu_cls}
 
             for inst_id in inst_ids:
-                omci_attributes = {k for k in olt_cls[inst_id][ATTRIBUTES_KEY].iterkeys()}
-                onu_attributes = {k for k in onu_cls[inst_id][ATTRIBUTES_KEY].iterkeys()}
+                omci_attributes = {k for k in six.iterkeys(olt_cls[inst_id][ATTRIBUTES_KEY])}
+                onu_attributes = {k for k in six.iterkeys(onu_cls[inst_id][ATTRIBUTES_KEY])}
 
                 # Get attributes that exist in one database, but not the other
                 sym_diffs = (omci_attributes ^ onu_attributes)
diff --git a/pyvoltha/adapters/extensions/omci/tasks/file_download_task.py b/pyvoltha/adapters/extensions/omci/tasks/file_download_task.py
old mode 100755
new mode 100644
index 4412f49..b0da89d
--- a/pyvoltha/adapters/extensions/omci/tasks/file_download_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/file_download_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet.defer import inlineCallbacks, failure
 from twisted.internet import reactor
 import requests
diff --git a/pyvoltha/adapters/extensions/omci/tasks/get_mds_task.py b/pyvoltha/adapters/extensions/omci/tasks/get_mds_task.py
index ae9d49a..41f39e0 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/get_mds_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/get_mds_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure
 from pyvoltha.adapters.extensions.omci.omci_me import OntDataFrame
diff --git a/pyvoltha/adapters/extensions/omci/tasks/interval_data_task.py b/pyvoltha/adapters/extensions/omci/tasks/interval_data_task.py
index 89e5de3..a9ae84d 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/interval_data_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/interval_data_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from datetime import datetime
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure
@@ -116,7 +117,7 @@
                       entity_id=self._entity_id)
 
         device = self.omci_agent.get_device(self.device_id)
-        attr_names = self._counter_attributes.keys()
+        attr_names = list(self._counter_attributes.keys())
 
         final_results = {
             'class_id': self._class_id,
diff --git a/pyvoltha/adapters/extensions/omci/tasks/mib_reconcile_task.py b/pyvoltha/adapters/extensions/omci/tasks/mib_reconcile_task.py
index bd3fe08..f377863 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/mib_reconcile_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/mib_reconcile_task.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 from pyvoltha.common.utils.asleep import asleep
 from pyvoltha.adapters.extensions.omci.tasks.task import Task
 from twisted.internet import reactor
@@ -435,7 +436,7 @@
                                         writeable_data[key] = value
 
                     if len(writeable_data):
-                        attributes_mask = me_entry.mask_for(*writeable_data.keys())
+                        attributes_mask = me_entry.mask_for(*list(writeable_data.keys()))
                         frame = OmciFrame(transaction_id=None,
                                           message_type=OmciSet.message_id,
                                           omci_message=OmciSet(entity_class=cid,
@@ -449,7 +450,7 @@
                     for key, value in table_data.items():
                         for row in value:
                             setvalue = { key : row }
-                            attributes_mask = me_entry.mask_for(*setvalue.keys())
+                            attributes_mask = me_entry.mask_for(*list(setvalue.keys()))
                             frame = OmciFrame(transaction_id=None,
                                               message_type=OmciSet.message_id,
                                               omci_message=OmciSet(entity_class=cid,
@@ -560,7 +561,7 @@
         failures = 0
         try:
             # Get current and verify same as during audit it is missing from our DB
-            attributes = mib_data.keys()
+            attributes = list(mib_data.keys())
             current_entry = self._device.query_mib(cid, eid, attributes)
 
             if current_entry is not None and len(current_entry):
@@ -603,9 +604,9 @@
             # update on the ONU. Verify the data for the OLT is the same as
             # at time of audit
             olt_db_entries = {k: v for k, v in olt_db[cid][eid][ATTRIBUTES_KEY].items()
-                              if k in onu_data.keys()}
+                              if k in list(onu_data.keys())}
             current_entries = self._sync_sm.query_mib(class_id=cid, instance_id=eid,
-                                                      attributes=onu_data.keys())
+                                                      attributes=list(onu_data.keys()))
 
             still_the_same = all(current_entries.get(k) == v for k, v in olt_db_entries.items())
             if not still_the_same:
@@ -624,7 +625,7 @@
             # OLT data still matches, do the set operations now
             # while len(onu_data):
             if len(writeable_data):
-                attributes_mask = me_entry.mask_for(*writeable_data.keys())
+                attributes_mask = me_entry.mask_for(*list(writeable_data.keys()))
                 frame = OmciFrame(transaction_id=None,
                                   message_type=OmciSet.message_id,
                                   omci_message=OmciSet(entity_class=cid,
@@ -639,7 +640,7 @@
             for key, value in table_data.items():
                 for row in value:
                     setvalue = {key: row}
-                    attributes_mask = me_entry.mask_for(*setvalue.keys())
+                    attributes_mask = me_entry.mask_for(*list(setvalue.keys()))
                     frame = OmciFrame(transaction_id=None,
                                       message_type=OmciSet.message_id,
                                       omci_message=OmciSet(entity_class=cid,
diff --git a/pyvoltha/adapters/extensions/omci/tasks/mib_resync_task.py b/pyvoltha/adapters/extensions/omci/tasks/mib_resync_task.py
index fdce7e6..1e822b7 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/mib_resync_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/mib_resync_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure, returnValue
 from twisted.internet import reactor
 from pyvoltha.common.utils.asleep import asleep
@@ -22,6 +23,8 @@
 from pyvoltha.adapters.extensions.omci.omci_defs import AttributeAccess, EntityOperations
 from pyvoltha.adapters.extensions.omci.omci_fields import OmciTableField
 from pyvoltha.adapters.extensions.omci.omci_me import OntDataFrame
+import six
+from six.moves import range
 
 AA = AttributeAccess
 OP = EntityOperations
@@ -178,7 +181,7 @@
         try:
             max_tries = MibResyncTask.max_db_copy_retries - 1
 
-            for retries in xrange(0, max_tries + 1):
+            for retries in range(0, max_tries + 1):
                 # Send MIB Upload so ONU snapshots its MIB
                 try:
                     self.strobe_watchdog()
@@ -252,10 +255,10 @@
         # Begin MIB Upload
         seq_no = None
 
-        for seq_no in xrange(number_of_commands):
+        for seq_no in range(number_of_commands):
             max_tries = MibResyncTask.max_mib_upload_next_retries
 
-            for retries in xrange(0, max_tries):
+            for retries in range(0, max_tries):
                 try:
                     self.strobe_watchdog()
                     response = yield self._device.omci_cc.send_mib_upload_next(seq_no)
@@ -425,8 +428,8 @@
                         if isinstance(inst_id, int) and inst_id in onu_cls}
 
             for inst_id in inst_ids:
-                omci_attributes = {k for k in olt_cls[inst_id][ATTRIBUTES_KEY].iterkeys()}
-                onu_attributes = {k for k in onu_cls[inst_id][ATTRIBUTES_KEY].iterkeys()}
+                omci_attributes = {k for k in six.iterkeys(olt_cls[inst_id][ATTRIBUTES_KEY])}
+                onu_attributes = {k for k in six.iterkeys(onu_cls[inst_id][ATTRIBUTES_KEY])}
 
                 # Get attributes that exist in one database, but not the other
                 sym_diffs = (omci_attributes ^ onu_attributes) - ro_attrs
diff --git a/pyvoltha/adapters/extensions/omci/tasks/mib_upload.py b/pyvoltha/adapters/extensions/omci/tasks/mib_upload.py
index 3714016..d25acae 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/mib_upload.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/mib_upload.py
@@ -13,10 +13,12 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure, AlreadyCalledError
 from twisted.internet import reactor
 from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes
+from six.moves import range
 
 
 class MibUploadFailure(Exception):
@@ -110,7 +112,7 @@
 
             number_of_commands = results.fields['omci_message'].fields['number_of_commands']
 
-            for seq_no in xrange(number_of_commands):
+            for seq_no in range(number_of_commands):
                 if not device.active or not device.omci_cc.enabled:
                     raise MibUploadFailure('OMCI and/or ONU is not active')
 
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_create_pm_task.py b/pyvoltha/adapters/extensions/omci/tasks/omci_create_pm_task.py
index 4620b94..e0243e3 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_create_pm_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_create_pm_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, failure, TimeoutError
 from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_delete_pm_task.py b/pyvoltha/adapters/extensions/omci/tasks/omci_delete_pm_task.py
index dfcc63a..2cd7786 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_delete_pm_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_delete_pm_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, failure
 from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_get_request.py b/pyvoltha/adapters/extensions/omci/tasks/omci_get_request.py
index 4f21154..4e4f142 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_get_request.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_get_request.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import failure, inlineCallbacks, TimeoutError, returnValue
 from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
@@ -21,6 +22,7 @@
 from pyvoltha.adapters.extensions.omci.omci_frame import OmciFrame
 from pyvoltha.adapters.extensions.omci.omci_messages import OmciGet, OmciGetNext
 from pyvoltha.adapters.extensions.omci.omci_fields import OmciTableField
+from six.moves import range
 
 RC = ReasonCodes
 OP = EntityOperations
@@ -382,9 +384,9 @@
 
                 # Start the loop
                 seq_no = 0
-                data_buffer = ''
+                data_buffer = b''
 
-                for offset in xrange(0, attr_size, OmciTableField.PDU_SIZE):
+                for offset in range(0, attr_size, OmciTableField.PDU_SIZE):
                     frame = OmciFrame(
                         transaction_id=None,                    # OMCI-CC will set
                         message_type=OmciGetNext.message_id,
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_modify_request.py b/pyvoltha/adapters/extensions/omci/tasks/omci_modify_request.py
index b0acfbf..5f12ec5 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_modify_request.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_modify_request.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, failure, returnValue
 from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_sw_image_upgrade_task.py b/pyvoltha/adapters/extensions/omci/tasks/omci_sw_image_upgrade_task.py
index fbea4ad..86d01a7 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_sw_image_upgrade_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_sw_image_upgrade_task.py
@@ -13,8 +13,9 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
-from task import Task
+from .task import Task
 from twisted.internet import reactor
 from voltha_protos.voltha_pb2 import ImageDownload
 
diff --git a/pyvoltha/adapters/extensions/omci/tasks/omci_test_request.py b/pyvoltha/adapters/extensions/omci/tasks/omci_test_request.py
index 4ee8502..8176bc4 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/omci_test_request.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/omci_test_request.py
@@ -14,8 +14,9 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import, division
 import arrow
-from task import Task
+from .task import Task
 from twisted.internet.task import LoopingCall
 from twisted.internet.defer import failure, inlineCallbacks, TimeoutError, \
     returnValue
@@ -28,6 +29,7 @@
 from voltha_protos.events_pb2 import Event, EventType, EventCategory, \
     EventSubCategory, EventHeader
 from voltha_protos.events_pb2 import Event
+import six
 
 RC = ReasonCodes
 OP = EntityOperations
@@ -201,8 +203,8 @@
         event_name = topic.split(':')[-1]
         onu_device_id = topic.split(':')[-2]
         frame = msg['rx-response']
-        for key, value in (frame.fields['omci_message'].fields).iteritems():
-            result_frame[key] = long(value)
+        for key, value in six.iteritems((frame.fields['omci_message'].fields)):
+            result_frame[key] = int(value)
         self.publish_metrics(result_frame, event_name, onu_device_id)
 
     @inlineCallbacks
@@ -211,7 +213,7 @@
         Perform the initial test request
         """
         ani_g_entities = self._device.configuration.ani_g_entities
-        ani_g_entities_ids = ani_g_entities.keys() if ani_g_entities \
+        ani_g_entities_ids = list(ani_g_entities.keys()) if ani_g_entities \
                                                       is not None else None
         self._entity_id = ani_g_entities_ids[0]
         self.log.info('perform-test', entity_class=self._entity_class,
diff --git a/pyvoltha/adapters/extensions/omci/tasks/onu_capabilities_task.py b/pyvoltha/adapters/extensions/omci/tasks/onu_capabilities_task.py
index 9b7c5ab..1ca76c3 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/onu_capabilities_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/onu_capabilities_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from binascii import hexlify
 from twisted.internet.defer import inlineCallbacks, failure, returnValue
 from twisted.internet import reactor
diff --git a/pyvoltha/adapters/extensions/omci/tasks/reboot_task.py b/pyvoltha/adapters/extensions/omci/tasks/reboot_task.py
index 39b17e4..a8deac1 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/reboot_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/reboot_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from enum import IntEnum
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, failure, TimeoutError
diff --git a/pyvoltha/adapters/extensions/omci/tasks/sync_time_task.py b/pyvoltha/adapters/extensions/omci/tasks/sync_time_task.py
index a6e26df..e041556 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/sync_time_task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/sync_time_task.py
@@ -13,7 +13,8 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
-from task import Task
+from __future__ import absolute_import
+from .task import Task
 from twisted.internet import reactor
 from twisted.internet.defer import inlineCallbacks, TimeoutError, failure
 from pyvoltha.adapters.extensions.omci.omci_me import OntGFrame
diff --git a/pyvoltha/adapters/extensions/omci/tasks/task.py b/pyvoltha/adapters/extensions/omci/tasks/task.py
index 36020c0..130e164 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/task.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/task.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from twisted.internet import defer, reactor
 from twisted.internet.defer import failure
diff --git a/pyvoltha/adapters/extensions/omci/tasks/task_runner.py b/pyvoltha/adapters/extensions/omci/tasks/task_runner.py
index 2dd3be4..6175d3f 100644
--- a/pyvoltha/adapters/extensions/omci/tasks/task_runner.py
+++ b/pyvoltha/adapters/extensions/omci/tasks/task_runner.py
@@ -13,8 +13,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from twisted.internet import reactor
+import six
 
 
 class TaskRunner(object):
@@ -48,7 +50,7 @@
         Get the number of tasks pending to run
         """
         count = 0
-        for tasks in self._pending_queue.itervalues():
+        for tasks in six.itervalues(self._pending_queue):
             count += len(tasks)
         return count
 
@@ -102,14 +104,14 @@
             rq, self._running_queue = self._running_queue, dict()
 
             # Stop running tasks
-            for task in rq.itervalues():
+            for task in six.itervalues(rq):
                 try:
                     task.stop()
                 except:
                     pass
 
             # Kill pending tasks
-            for d in pq.iterkeys():
+            for d in six.iterkeys(pq):
                 try:
                     d.cancel()
                 except:
@@ -127,12 +129,12 @@
         if self._active and len(self._pending_queue) > 0:
             # Cannot run a new task if a running one needs the OMCI_CC exclusively
 
-            if any(task.exclusive for task in self._running_queue.itervalues()):
+            if any(task.exclusive for task in six.itervalues(self._running_queue)):
                 self.log.debug('exclusive-running')
                 return    # An exclusive task is already running
 
             try:
-                priorities = [k for k in self._pending_queue.iterkeys()]
+                priorities = [k for k in six.iterkeys(self._pending_queue)]
                 priorities.sort(reverse=True)
                 highest_priority = priorities[0] if len(priorities) else None
 
@@ -216,7 +218,7 @@
         except Exception as e:
             # Check the pending queue
 
-            for priority, tasks in self._pending_queue.iteritems():
+            for priority, tasks in six.iteritems(self._pending_queue):
                 found = next((t for t in tasks if t.task_id == task.task_id), None)
 
                 if found is not None:
@@ -273,7 +275,7 @@
             reactor.callLater(0, self._run_next_task)
 
         else:
-            for priority, tasks in self._pending_queue.iteritems():
+            for priority, tasks in six.iteritems(self._pending_queue):
                 task = next((t for t in tasks if t.task_id == task_id), None)
 
                 if task is not None:
diff --git a/pyvoltha/adapters/iadapter.py b/pyvoltha/adapters/iadapter.py
index 07930ec..21a2404 100644
--- a/pyvoltha/adapters/iadapter.py
+++ b/pyvoltha/adapters/iadapter.py
@@ -18,11 +18,12 @@
 Adapter abstract base class
 """
 
+from __future__ import absolute_import
 import structlog
 from twisted.internet import reactor
 from zope.interface import implementer
 
-from interface import IAdapterInterface
+from .interface import IAdapterInterface
 from voltha_protos.adapter_pb2 import Adapter
 from voltha_protos.adapter_pb2 import AdapterConfig
 from voltha_protos.common_pb2 import AdminState
@@ -266,7 +267,7 @@
                 # basic children data structures
                 self.core_proxy.reconcile_child_devices(device.id)
             return device
-        except Exception, e:
+        except Exception as e:
             log.exception('Exception', e=e)
 
     def send_proxied_message(self, proxy_address, msg):
@@ -295,7 +296,7 @@
             handler = self.devices_handlers[device_id]
             if handler:
                 reactor.callLater(0, handler.packet_out, egress_port_no, msg.data)
-        except Exception, e:
+        except Exception as e:
             log.exception('packet-out-failure', e=e)
 
 
diff --git a/pyvoltha/adapters/interface.py b/pyvoltha/adapters/interface.py
index b0390d8..e7ba52e 100644
--- a/pyvoltha/adapters/interface.py
+++ b/pyvoltha/adapters/interface.py
@@ -17,6 +17,7 @@
 """
 Interface definition for Voltha Adapters
 """
+from __future__ import absolute_import
 from zope.interface import Interface
 
 
diff --git a/pyvoltha/adapters/kafka/adapter_proxy.py b/pyvoltha/adapters/kafka/adapter_proxy.py
index 4f6945f..cc69a28 100644
--- a/pyvoltha/adapters/kafka/adapter_proxy.py
+++ b/pyvoltha/adapters/kafka/adapter_proxy.py
@@ -18,13 +18,16 @@
 Agent to play gateway between adapters.
 """
 
+from __future__ import absolute_import
 import structlog
 from uuid import uuid4
 from twisted.internet.defer import inlineCallbacks, returnValue
-from container_proxy import ContainerProxy
+from .container_proxy import ContainerProxy
 from voltha_protos.inter_container_pb2 import InterAdapterHeader, \
     InterAdapterMessage
 import time
+import codecs
+import six
 
 log = structlog.get_logger()
 
@@ -38,12 +41,12 @@
 
     def _to_string(self, unicode_str):
         if unicode_str is not None:
-            if type(unicode_str) == unicode:
-                return unicode_str.encode('ascii', 'ignore')
-            else:
+            if isinstance(unicode_str, six.string_types):
                 return unicode_str
+            else:
+                return codecs.encode(unicode_str, 'ascii')
         else:
-            return ""
+            return None
 
     @ContainerProxy.wrap_request(None)
     @inlineCallbacks
diff --git a/pyvoltha/adapters/kafka/adapter_request_facade.py b/pyvoltha/adapters/kafka/adapter_request_facade.py
old mode 100755
new mode 100644
index 27dd5e7..b27e740
--- a/pyvoltha/adapters/kafka/adapter_request_facade.py
+++ b/pyvoltha/adapters/kafka/adapter_request_facade.py
@@ -18,6 +18,7 @@
 This facade handles kafka-formatted messages from the Core, extracts the kafka
 formatting and forwards the request to the concrete handler.
 """
+from __future__ import absolute_import
 import structlog
 from twisted.internet.defer import inlineCallbacks
 from zope.interface import implementer
diff --git a/pyvoltha/adapters/kafka/container_proxy.py b/pyvoltha/adapters/kafka/container_proxy.py
index 2a71027..8b622d0 100644
--- a/pyvoltha/adapters/kafka/container_proxy.py
+++ b/pyvoltha/adapters/kafka/container_proxy.py
@@ -18,6 +18,7 @@
 The superclass for all kafka proxy subclasses.
 """
 
+from __future__ import absolute_import
 import structlog
 from twisted.internet.defer import inlineCallbacks, returnValue
 from twisted.python import failure
diff --git a/pyvoltha/adapters/kafka/core_proxy.py b/pyvoltha/adapters/kafka/core_proxy.py
index 38a746b..8244ad3 100644
--- a/pyvoltha/adapters/kafka/core_proxy.py
+++ b/pyvoltha/adapters/kafka/core_proxy.py
@@ -17,19 +17,21 @@
 """
 Agent to play gateway between CORE and an adapter.
 """
+from __future__ import absolute_import
 import structlog
 import arrow
 from google.protobuf.message import Message
 from twisted.internet.defer import inlineCallbacks, returnValue
 
-from container_proxy import ContainerProxy
+from .container_proxy import ContainerProxy
 
 from voltha_protos.common_pb2 import ID, ConnectStatus, OperStatus
 from voltha_protos.inter_container_pb2 import StrType, BoolType, IntType, Packet
 from voltha_protos.device_pb2 import Device, Ports, Devices
-from voltha_protos.voltha_pb2 import CoreInstance, AlarmFilterRuleKey
+from voltha_protos.voltha_pb2 import CoreInstance, EventFilterRuleKey
 from voltha_protos.events_pb2 import Event
 from voltha_protos.events_pb2 import KpiEvent2, KpiEventType, MetricInformation, MetricMetaData
+import six
 
 log = structlog.get_logger()
 
@@ -161,7 +163,7 @@
 
     def _to_proto(self, **kwargs):
         encoded = {}
-        for k, v in kwargs.iteritems():
+        for k, v in six.iteritems(kwargs):
             if isinstance(v, Message):
                 encoded[k] = v
             elif type(v) == int:
@@ -472,19 +474,19 @@
                                 device_reason=rsn)
 
         returnValue(res)
-                
+
     # ~~~~~~~~~~~~~~~~~~~ Handle event submissions ~~~~~~~~~~~~~~~~~~~~~
 
     def filter_alarm(self, device_id, alarm_event):
         '''
         TODO
         alarm filtering functionality is not implemented
-        in Voltha 1.x 
+        in Voltha 1.x
         '''
         log.warn('filter_alarm is not implemented')
-        return 
+        return
         #alarm_filters = self.root_proxy.get('/alarm_filters')
-        
+
         rule_values = {
             'id': alarm_event.id,
             'type': AlarmEventType.AlarmEventType.Name(alarm_event.type),
@@ -501,15 +503,15 @@
                 exclude = True
                 for rule in alarm_filter.rules:
                     log.debug("compare-alarm-event",
-                                   key=AlarmFilterRuleKey.AlarmFilterRuleKey.Name(
+                                   key=EventFilterRuleKey.EventFilterRuleKey.Name(
                                        rule.key),
                                    actual=rule_values[
-                                       AlarmFilterRuleKey.AlarmFilterRuleKey.Name(
+                                       EventFilterRuleKey.EventFilterRuleKey.Name(
                                            rule.key)].lower(),
                                    expected=rule.value.lower())
                     exclude = exclude and \
                               (rule_values[
-                                   AlarmFilterRuleKey.AlarmFilterRuleKey.Name(
+                                   EventFilterRuleKey.EventFilterRuleKey.Name(
                                        rule.key)].lower() == rule.value.lower())
                     if not exclude:
                         break
diff --git a/pyvoltha/adapters/kafka/event_bus_publisher.py b/pyvoltha/adapters/kafka/event_bus_publisher.py
index 85362eb..40d1fb4 100644
--- a/pyvoltha/adapters/kafka/event_bus_publisher.py
+++ b/pyvoltha/adapters/kafka/event_bus_publisher.py
@@ -20,12 +20,14 @@
 to publish select topics and messages posted to the Voltha-internal event
 bus toward the external world.
 """
+from __future__ import absolute_import
 import structlog
 from google.protobuf.json_format import MessageToDict
 from google.protobuf.message import Message
 from simplejson import dumps
 
 from pyvoltha.common.event_bus import EventBusClient
+import six
 
 log = structlog.get_logger()
 
@@ -53,13 +55,13 @@
                 for subscription in self.subscriptions:
                     self.event_bus.unsubscribe(subscription)
             log.info('stopped-event-bus')
-        except Exception, e:
+        except Exception as e:
             log.exception('failed-stopping-event-bus', e=e)
             return
 
     def _setup_subscriptions(self, mappings):
 
-        for event_bus_topic, mapping in mappings.iteritems():
+        for event_bus_topic, mapping in six.iteritems(mappings):
 
             kafka_topic = mapping.get('kafka_topic', None)
 
@@ -85,6 +87,6 @@
                 msg = dumps(MessageToDict(msg, True, True))
             log.debug('forward-event-bus-publisher')
             self.kafka_proxy.send_message(kafka_topic, msg)
-        except Exception, e:
+        except Exception as e:
             log.exception('failed-forward-event-bus-publisher', e=e)
 
diff --git a/pyvoltha/adapters/kafka/kafka_inter_container_library.py b/pyvoltha/adapters/kafka/kafka_inter_container_library.py
index 4ef3262..f6d76f0 100644
--- a/pyvoltha/adapters/kafka/kafka_inter_container_library.py
+++ b/pyvoltha/adapters/kafka/kafka_inter_container_library.py
@@ -14,6 +14,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+from __future__ import absolute_import
 import time
 from uuid import uuid4
 
@@ -25,10 +26,12 @@
 
 from pyvoltha.common.utils import asleep
 from pyvoltha.common.utils.registry import IComponent
-from kafka_proxy import KafkaProxy, get_kafka_proxy
+from .kafka_proxy import KafkaProxy, get_kafka_proxy
 from voltha_protos.inter_container_pb2 import MessageType, Argument, \
     InterContainerRequestBody, InterContainerMessage, Header, \
     InterContainerResponseBody, StrType
+import six
+import codecs
 
 log = structlog.get_logger()
 
@@ -299,10 +302,10 @@
 
     def _to_string(self, unicode_str):
         if unicode_str is not None:
-            if type(unicode_str) == unicode:
-                return unicode_str.encode('ascii', 'ignore')
-            else:
+            if isinstance(unicode_str, six.string_types):
                 return unicode_str
+            else:
+                return codecs.encode(unicode_str, 'ascii')
         else:
             return None
 
@@ -338,7 +341,7 @@
 
             request.header.timestamp = int(round(time.time() * 1000))
             request_body.rpc = rpc
-            for a, b in kwargs.iteritems():
+            for a, b in six.iteritems(kwargs):
                 arg = Argument()
                 arg.key = a
                 try:
@@ -428,7 +431,7 @@
                 result[arg.key] = arg.value
             return result
 
-        current_time = int(round(time.time() * 1000))
+        current_time = int(time.time() * 1000)
         # log.debug("Got Message", message=m)
         try:
             val = m.value()
@@ -503,7 +506,7 @@
     def _send_kafka_message(self, topic, msg):
         try:
             yield self.kafka_proxy.send_message(topic, msg.SerializeToString())
-        except Exception, e:
+        except Exception as e:
             log.exception("Failed-sending-message", message=msg, e=e)
 
     @inlineCallbacks
diff --git a/pyvoltha/adapters/kafka/kafka_proxy.py b/pyvoltha/adapters/kafka/kafka_proxy.py
index 2885226..a6591cf 100644
--- a/pyvoltha/adapters/kafka/kafka_proxy.py
+++ b/pyvoltha/adapters/kafka/kafka_proxy.py
@@ -15,6 +15,7 @@
 #
 
 
+from __future__ import absolute_import
 from confluent_kafka import Producer as _kafkaProducer
 from structlog import get_logger
 from twisted.internet import reactor
@@ -23,10 +24,11 @@
 from zope.interface import implementer
 
 from pyvoltha.common.utils.consulhelpers import get_endpoint_from_consul
-from event_bus_publisher import EventBusPublisher
+from .event_bus_publisher import EventBusPublisher
 from pyvoltha.common.utils.registry import IComponent
 from confluent_kafka import Consumer, KafkaError
 import threading
+import six
 
 log = get_logger()
 
@@ -93,7 +95,7 @@
                     yield self.kclient.close()
                     self.kclient = None
                     log.debug('stopped-kclient-kafka-proxy')
-            except Exception, e:
+            except Exception as e:
                 log.exception('failed-stopped-kclient-kafka-proxy', e=e)
 
             try:
@@ -101,19 +103,19 @@
                     yield self.kproducer.flush()
                     self.kproducer = None
                     log.debug('stopped-kproducer-kafka-proxy')
-            except Exception, e:
+            except Exception as e:
                 log.exception('failed-stopped-kproducer-kafka-proxy', e=e)
 
             # Stop all consumers
             try:
                 self.topic_any_map_lock.acquire()
                 log.debug('stopping-consumers-kafka-proxy')
-                for _, c in self.topic_consumer_map.iteritems():
+                for _, c in six.iteritems(self.topic_consumer_map):
                     yield deferToThread(c.close)
                 self.topic_consumer_map.clear()
                 self.topic_callbacks_map.clear()
                 log.debug('stopped-consumers-kafka-proxy')
-            except Exception, e:
+            except Exception as e:
                 log.exception('failed-stopped-consumers-kafka-proxy', e=e)
             finally:
                 self.topic_any_map_lock.release()
@@ -130,7 +132,7 @@
 
             log.debug('stopped-kafka-proxy')
 
-        except Exception, e:
+        except Exception as e:
             self.kclient = None
             self.kproducer = None
             # self.event_bus_publisher = None
@@ -161,7 +163,7 @@
                  }
             )
             pass
-        except Exception, e:
+        except Exception as e:
             log.exception('failed-get-kafka-producer', e=e)
             return
 
@@ -226,7 +228,7 @@
             self.topic_callbacks_map[topic] = [callback]
             # Start the consumer
             reactor.callLater(0, self._wait_for_messages, c, topic)
-        except Exception, e:
+        except Exception as e:
             log.exception("topic-subscription-error", e=e)
         finally:
             self.topic_any_map_lock.release()
@@ -267,7 +269,7 @@
                 else:
                     log.debug("consumers-for-topic-still-exist", topic=topic,
                               num=len(self.topic_callbacks_map[topic]))
-        except Exception, e:
+        except Exception as e:
             log.exception("topic-unsubscription-error", e=e)
         finally:
             self.topic_any_map_lock.release()
@@ -305,7 +307,7 @@
                 else:
                     return
 
-        except Exception, e:
+        except Exception as e:
             self.faulty = True
             log.error('failed-to-send-kafka-msg', topic=topic,
                       e=e)
@@ -321,7 +323,7 @@
                     self.stopping = False
                     self.faulty = False
                     log.debug('stopped-kafka-proxy')
-                except Exception, e:
+                except Exception as e:
                     log.exception('failed-stopping-kafka-proxy', e=e)
                     pass
             else:
diff --git a/pyvoltha/common/config/config_backend.py b/pyvoltha/common/config/config_backend.py
index 700c2e7..d357fcf 100644
--- a/pyvoltha/common/config/config_backend.py
+++ b/pyvoltha/common/config/config_backend.py
@@ -12,6 +12,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from consul import Consul, ConsulException
 from pyvoltha.common.utils.asleep import asleep
 from requests import ConnectionError
@@ -19,6 +20,8 @@
 
 import etcd3
 import structlog
+import six
+import codecs
 
 
 class ConsulStore(object):
@@ -71,10 +74,10 @@
 
     def __setitem__(self, key, value):
         try:
-            assert isinstance(value, basestring)
+            assert isinstance(value, six.string_types)
             self._cache[key] = value
             self._kv_put(self.make_path(key), value)
-        except Exception, e:
+        except Exception as e:
             self.log.exception('cannot-set-item', e=e)
 
     def __delitem__(self, key):
@@ -128,13 +131,13 @@
                     result = operation(*args, **kw)
                 self._clear_backoff()
                 break
-            except ConsulException, e:
+            except ConsulException as e:
                 self.log.exception('consul-not-up', e=e)
                 self._backoff('consul-not-up')
-            except ConnectionError, e:
+            except ConnectionError as e:
                 self.log.exception('cannot-connect-to-consul', e=e)
                 self._backoff('cannot-connect-to-consul')
-            except Exception, e:
+            except Exception as e:
                 self.log.exception(e)
                 self._backoff('unknown-error')
             self._redo_consul_connection()
@@ -191,10 +194,10 @@
 
     def __setitem__(self, key, value):
         try:
-            assert isinstance(value, basestring)
+            assert isinstance(value, six.string_types)
             self._cache[key] = value
             self._kv_put(self.make_path(key), value)
-        except Exception, e:
+        except Exception as e:
             self.log.exception('cannot-set-item', e=e)
 
     def __delitem__(self, key):
@@ -236,14 +239,14 @@
         # etcd data sometimes contains non-utf8 sequences, replace
         self.log.debug('backend-op',
                   operation=operation,
-                  args=map(lambda x : unicode(x,'utf8','replace'), args),
+                  args=[codecs.encode(x,'utf8','replace') for x in args],
                   kw=kw)
 
         while 1:
             try:
                 etcd = self._get_etcd()
                 self.log.debug('etcd', etcd=etcd, operation=operation,
-                    args=map(lambda x : unicode(x,'utf8','replace'), args))
+                    args=[codecs.encode(x,'utf8','replace') for x in args])
                 if operation == 'GET':
                     (value, meta) = etcd.get(*args, **kw)
                     result = (value, meta)
@@ -256,7 +259,7 @@
                     result = operation(*args, **kw)
                 self._clear_backoff()
                 break
-            except Exception, e:
+            except Exception as e:
                 self.log.exception(e)
                 self._backoff('unknown-error-with-etcd')
             self._redo_etcd_connection()
diff --git a/pyvoltha/common/config/config_branch.py b/pyvoltha/common/config/config_branch.py
index 207818b..d441b32 100644
--- a/pyvoltha/common/config/config_branch.py
+++ b/pyvoltha/common/config/config_branch.py
@@ -19,6 +19,7 @@
 for the active committed revisions or revisions part of a transaction.
 """
 
+from __future__ import absolute_import
 from collections import OrderedDict
 from weakref import WeakValueDictionary
 
diff --git a/pyvoltha/common/config/config_event_bus.py b/pyvoltha/common/config/config_event_bus.py
index cfd1252..336ae8b 100644
--- a/pyvoltha/common/config/config_event_bus.py
+++ b/pyvoltha/common/config/config_event_bus.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 import structlog
 from enum import Enum
 from google.protobuf.json_format import MessageToDict
diff --git a/pyvoltha/common/config/config_node.py b/pyvoltha/common/config/config_node.py
index 68ef717..a23c8af 100644
--- a/pyvoltha/common/config/config_node.py
+++ b/pyvoltha/common/config/config_node.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from copy import copy
 
 from jsonpatch import JsonPatch
@@ -29,6 +30,7 @@
 from voltha_protos import meta_pb2
 
 import structlog
+import six
 
 log = structlog.get_logger()
 
@@ -40,7 +42,7 @@
     """Raise ValueError if attempt is made to change a read-only field"""
     access_map = access_rights(new_msg.__class__)
     violated_fields = []
-    for field_name, access in access_map.iteritems():
+    for field_name, access in six.iteritems(access_map):
         if access == meta_pb2.READ_ONLY:
             if getattr(new_msg, field_name) != getattr(old_msg, field_name):
                 violated_fields.append(field_name)
@@ -104,7 +106,7 @@
         # separate external children data away from locally stored data
         # based on child_node annotations in protobuf
         children = {}
-        for field_name, field in children_fields(self._type).iteritems():
+        for field_name, field in six.iteritems(children_fields(self._type)):
             field_value = getattr(data, field_name)
             if field.is_container:
                 if field.key:
@@ -135,7 +137,7 @@
 
     @property
     def revisions(self):
-        return [r._hash for r in self._branches[None]._revs.itervalues()]
+        return [r._hash for r in six.itervalues(self._branches[None]._revs)]
 
     @property
     def latest(self):
@@ -506,7 +508,7 @@
 
     @property
     def tags(self):
-        return sorted(self._tags.iterkeys())
+        return sorted(six.iterkeys(self._tags))
 
     def by_tag(self, tag):
         """
@@ -530,7 +532,7 @@
 
     def prune_untagged(self):
         branch = self._branches[None]
-        keep = set(rev.hash for rev in self._tags.itervalues())
+        keep = set(rev.hash for rev in six.itervalues(self._tags))
         keep.add(branch._latest.hash)
         for hash in branch._revs.keys():
             if hash not in keep:
diff --git a/pyvoltha/common/config/config_proxy.py b/pyvoltha/common/config/config_proxy.py
index eed6c6a..06908cc 100644
--- a/pyvoltha/common/config/config_proxy.py
+++ b/pyvoltha/common/config/config_proxy.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 from enum import Enum
 
@@ -145,7 +146,7 @@
         for callback, args, kw in lst:
             try:
                 context = callback(context, *args, **kw)
-            except Exception, e:
+            except Exception as e:
                 if proceed_on_errors:
                     log.exception(
                         'call-back-error', callback_type=callback_type,
diff --git a/pyvoltha/common/config/config_rev.py b/pyvoltha/common/config/config_rev.py
index 8e6472f..5f1dcec 100644
--- a/pyvoltha/common/config/config_rev.py
+++ b/pyvoltha/common/config/config_rev.py
@@ -21,6 +21,7 @@
 classes directly must obey the rules.
 """
 
+from __future__ import absolute_import
 import weakref
 from copy import copy
 from hashlib import md5
@@ -32,6 +33,7 @@
 from voltha_protos import meta_pb2
 
 import structlog
+import six
 
 log = structlog.get_logger()
 
@@ -300,7 +302,7 @@
         data.CopyFrom(orig_data)
         if depth:
             # collect children
-            cfields = children_fields(self.type).iteritems()
+            cfields = six.iteritems(children_fields(self.type))
             for field_name, field in cfields:
                 if field.is_container:
                     for rev in self._children[field_name]:
diff --git a/pyvoltha/common/config/config_rev_persisted.py b/pyvoltha/common/config/config_rev_persisted.py
index b69c2e8..0a2c12d 100644
--- a/pyvoltha/common/config/config_rev_persisted.py
+++ b/pyvoltha/common/config/config_rev_persisted.py
@@ -17,12 +17,14 @@
 """
 A config rev object that persists itself
 """
+from __future__ import absolute_import
 from bz2 import compress, decompress
 
 import structlog
 from simplejson import dumps, loads
 
 from pyvoltha.common.config.config_rev import ConfigRevision, children_fields
+import six
 
 log = structlog.get_logger()
 
@@ -50,7 +52,7 @@
                 assert self.__weakref__ is None
                 if self._hash in self._kv_store:
                     del self._kv_store[self._hash]
-        except Exception, e:
+        except Exception as e:
             # this should never happen
             log.exception('del-error', hash=self.hash, e=e)
 
@@ -64,7 +66,7 @@
             self.store_config()
 
             children_lists = {}
-            for field_name, children in self._children.iteritems():
+            for field_name, children in six.iteritems(self._children):
                 hashes = [rev.hash for rev in children]
                 children_lists[field_name] = hashes
 
@@ -78,7 +80,7 @@
 
             self._kv_store[self._hash] = blob
 
-        except Exception, e:
+        except Exception as e:
             log.exception('store-error', e=e)
 
     @classmethod
@@ -95,7 +97,7 @@
         children_list = data['children']
         assembled_children = {}
         node = branch._node
-        for field_name, meta in children_fields(msg_cls).iteritems():
+        for field_name, meta in six.iteritems(children_fields(msg_cls)):
             child_msg_cls = tmp_cls_loader(meta.module, meta.type)
             children = []
             for child_hash in children_list[field_name]:
diff --git a/pyvoltha/common/config/config_root.py b/pyvoltha/common/config/config_root.py
index 4b1006d..747b6a5 100644
--- a/pyvoltha/common/config/config_root.py
+++ b/pyvoltha/common/config/config_root.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from uuid import uuid4
 
 import structlog
@@ -22,6 +23,7 @@
 from voltha.core.config.config_rev import ConfigRevision
 from voltha.core.config.config_rev_persisted import PersistedConfigRevision
 from voltha.core.config.merge_3way import MergeConflictException
+import six
 
 log = structlog.get_logger()
 
@@ -199,7 +201,7 @@
         if self._kv_store is not None and branch._txid is None:
             root_data = dict(
                 latest=branch._latest._hash,
-                tags=dict((k, v._hash) for k, v in self._tags.iteritems())
+                tags=dict((k, v._hash) for k, v in six.iteritems(self._tags))
             )
             blob = dumps(root_data)
             self._kv_store['root'] = blob
@@ -209,7 +211,7 @@
             root_data = loads(self.kv_store['root'])
             root_data = dict(
                 latest=root_data['latest'],
-                tags=dict((k, v._hash) for k, v in self._tags.iteritems())
+                tags=dict((k, v._hash) for k, v in six.iteritems(self._tags))
             )
             blob = dumps(root_data)
             self._kv_store['root'] = blob
@@ -219,7 +221,7 @@
         blob = self._kv_store['root']
         root_data = loads(blob)
 
-        for tag, hash in root_data['tags'].iteritems():
+        for tag, hash in six.iteritems(root_data['tags']):
             self.load_latest(hash)
             self._tags[tag] = self.latest
 
diff --git a/pyvoltha/common/config/merge_3way.py b/pyvoltha/common/config/merge_3way.py
index 9327894..64f01e4 100644
--- a/pyvoltha/common/config/merge_3way.py
+++ b/pyvoltha/common/config/merge_3way.py
@@ -17,11 +17,13 @@
 """
 3-way merge function for config rev objects.
 """
+from __future__ import absolute_import
 from collections import OrderedDict
 from copy import copy
 
 from pyvoltha.common.config.config_proxy import CallbackType, OperationContext
 from pyvoltha.common.config.config_rev import children_fields
+import six
 
 
 class MergeConflictException(Exception):
@@ -59,11 +61,11 @@
             self.keymap2 = OrderedDict((getattr(rev._config._data, keyname), i)
                                        for i, rev in enumerate(lst2))
             self.added_keys = [
-                k for k in self.keymap2.iterkeys() if k not in self.keymap1]
+                k for k in six.iterkeys(self.keymap2) if k not in self.keymap1]
             self.removed_keys = [
-                k for k in self.keymap1.iterkeys() if k not in self.keymap2]
+                k for k in six.iterkeys(self.keymap1) if k not in self.keymap2]
             self.changed_keys = [
-                k for k in self.keymap1.iterkeys()
+                k for k in six.iterkeys(self.keymap1)
                 if k in self.keymap2 and
                     lst1[self.keymap1[k]]._hash != lst2[self.keymap2[k]]._hash
             ]
@@ -85,7 +87,7 @@
     new_children = dst_rev._children.copy()
     _children_fields = children_fields(fork_rev.data.__class__)
 
-    for field_name, field in _children_fields.iteritems():
+    for field_name, field in six.iteritems(_children_fields):
 
         fork_list = fork_rev._children[field_name]
         src_list = src_rev._children[field_name]
diff --git a/pyvoltha/common/event_bus.py b/pyvoltha/common/event_bus.py
index e717c16..08c4595 100644
--- a/pyvoltha/common/event_bus.py
+++ b/pyvoltha/common/event_bus.py
@@ -17,9 +17,11 @@
 """
 A simple internal pub/sub event bus with topics and filter-based registration.
 """
+from __future__ import absolute_import
 import re
 
 import structlog
+import six
 
 
 log = structlog.get_logger()
@@ -44,7 +46,7 @@
 
     def list_subscribers(self, topic=None):
         if topic is None:
-            return sum(self.subscriptions.itervalues(), [])
+            return sum(six.itervalues(self.subscriptions), [])
         else:
             if topic in self.subscriptions:
                 return self.subscriptions[topic]
@@ -96,7 +98,7 @@
         def passes(msg, predicate):
             try:
                 return predicate(msg)
-            except Exception, e:
+            except Exception as e:
                 return False  # failed predicate function treated as no match
 
         # lookup subscribers with explicit topic subscriptions
@@ -112,7 +114,7 @@
             if predicate is None or passes(msg, predicate):
                 try:
                     candidate.callback(topic, msg)
-                except Exception, e:
+                except Exception as e:
                     log.exception('callback-failed', e=repr(e), topic=topic)
 
 
diff --git a/pyvoltha/common/manhole.py b/pyvoltha/common/manhole.py
index c00c900..ce7b639 100644
--- a/pyvoltha/common/manhole.py
+++ b/pyvoltha/common/manhole.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import, division
 import os
 import rlcompleter
 from pprint import pprint
@@ -24,6 +25,7 @@
 from twisted.cred.checkers import InMemoryUsernamePasswordDatabaseDontUse
 from twisted.cred.portal import Portal
 from twisted.internet import reactor
+from six.moves import range
 
 log = structlog.get_logger()
 
@@ -43,13 +45,13 @@
         private_key_str = rsa_key.exportKey()
 
         # save keys for next time
-        file(MANHOLE_SERVER_RSA_PUBLIC, 'w+b').write(public_key_str)
-        file(MANHOLE_SERVER_RSA_PRIVATE, 'w+b').write(private_key_str)
+        open(MANHOLE_SERVER_RSA_PUBLIC, 'w+b').write(public_key_str)
+        open(MANHOLE_SERVER_RSA_PRIVATE, 'w+b').write(private_key_str)
         log.debug('saved-rsa-keypair', public=MANHOLE_SERVER_RSA_PUBLIC,
                   private=MANHOLE_SERVER_RSA_PRIVATE)
     else:
-        public_key_str = file(MANHOLE_SERVER_RSA_PUBLIC).read()
-        private_key_str = file(MANHOLE_SERVER_RSA_PRIVATE).read()
+        public_key_str = open(MANHOLE_SERVER_RSA_PUBLIC).read()
+        private_key_str = open(MANHOLE_SERVER_RSA_PRIVATE).read()
     return public_key_str, private_key_str
 
 
@@ -69,7 +71,7 @@
         buffer = ''.join(self.lineBuffer)
         completions = []
         maxlen = 3
-        for c in xrange(1000):
+        for c in range(1000):
             candidate = self.completer.complete(buffer, c)
             if not candidate:
                 break
diff --git a/pyvoltha/common/openflow/utils.py b/pyvoltha/common/openflow/utils.py
index d2a9677..362b081 100644
--- a/pyvoltha/common/openflow/utils.py
+++ b/pyvoltha/common/openflow/utils.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import structlog
 
 from voltha_protos import openflow_13_pb2 as ofp
diff --git a/pyvoltha/common/structlog_setup.py b/pyvoltha/common/structlog_setup.py
index cbbda89..a5ce4a3 100644
--- a/pyvoltha/common/structlog_setup.py
+++ b/pyvoltha/common/structlog_setup.py
@@ -16,6 +16,9 @@
 
 """Setting up proper logging for Voltha"""
 
+from __future__ import absolute_import
+import builtins # bring in python 2 to 3 compat imports: https://python-future.org/imports.html
+
 import logging
 import logging.config
 from collections import OrderedDict
@@ -24,9 +27,9 @@
 from structlog.stdlib import BoundLogger, INFO
 
 try:
-    from thread import get_ident as _get_ident
+    from _thread import get_ident as _get_ident
 except ImportError:
-    from dummy_thread import get_ident as _get_ident
+    from _dummy_thread import get_ident as _get_ident
 
 
 class StructuredLogRenderer(object):
diff --git a/pyvoltha/common/tech_profile/tech_profile.py b/pyvoltha/common/tech_profile/tech_profile.py
index b6ce42b..162b476 100644
--- a/pyvoltha/common/tech_profile/tech_profile.py
+++ b/pyvoltha/common/tech_profile/tech_profile.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import json
 import ast
 from collections import namedtuple
@@ -23,6 +24,7 @@
 from pyvoltha.common.config.config_backend import EtcdStore
 from pyvoltha.common.utils.registry import registry
 from voltha_protos import openolt_pb2
+from six.moves import range
 
 # logger
 log = structlog.get_logger()
@@ -250,7 +252,7 @@
             tech_profile_instance = json.loads(tech_profile_instance,
                                                object_hook=lambda d:
                                                namedtuple('tech_profile_instance',
-                                                          d.keys())(*d.values()))
+                                                          list(d.keys()))(*list(d.values())))
             log.debug("Tech-profile-instance-after-json-to-object-conversion", path=path,
                       tech_profile_instance=tech_profile_instance)
             return tech_profile_instance
diff --git a/pyvoltha/common/utils/asleep.py b/pyvoltha/common/utils/asleep.py
index 10d1ce3..1b1aa0f 100644
--- a/pyvoltha/common/utils/asleep.py
+++ b/pyvoltha/common/utils/asleep.py
@@ -16,6 +16,7 @@
 
 """ Async sleep (asleep) method and other twisted goodies """
 
+from __future__ import absolute_import
 from twisted.internet import reactor
 from twisted.internet.defer import Deferred
 
diff --git a/pyvoltha/common/utils/consulhelpers.py b/pyvoltha/common/utils/consulhelpers.py
index 853143b..1e861a9 100644
--- a/pyvoltha/common/utils/consulhelpers.py
+++ b/pyvoltha/common/utils/consulhelpers.py
@@ -18,10 +18,12 @@
 Some consul related convenience functions
 """
 
+from __future__ import absolute_import
 from structlog import get_logger
 from consul import Consul
 from random import randint
-from nethelpers import get_my_primary_local_ipv4
+from .nethelpers import get_my_primary_local_ipv4
+from six.moves import range
 
 log = get_logger()
 
@@ -56,7 +58,7 @@
 
     services = get_all_services(consul_endpoint)
 
-    items = services.keys()
+    items = list(services.keys())
 
     if number_of_expected_services is not None and \
                     len(items) != number_of_expected_services:
@@ -158,7 +160,7 @@
 
     services = get_all_services(consul_endpoint)
 
-    items = services.keys()
+    items = list(services.keys())
 
     if number_of_expected_services is not None and \
                     len(items) != number_of_expected_services:
diff --git a/pyvoltha/common/utils/deferred_utils.py b/pyvoltha/common/utils/deferred_utils.py
index 3c55c1a..7268f4e 100644
--- a/pyvoltha/common/utils/deferred_utils.py
+++ b/pyvoltha/common/utils/deferred_utils.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from twisted.internet import reactor
 from twisted.internet.defer import Deferred
 from twisted.internet.error import AlreadyCalled
diff --git a/pyvoltha/common/utils/dockerhelpers.py b/pyvoltha/common/utils/dockerhelpers.py
index 4620aef..ad6244d 100644
--- a/pyvoltha/common/utils/dockerhelpers.py
+++ b/pyvoltha/common/utils/dockerhelpers.py
@@ -17,6 +17,7 @@
 """
 Some docker related convenience functions
 """
+from __future__ import absolute_import
 from datetime import datetime
 from concurrent.futures import ThreadPoolExecutor
 
@@ -44,7 +45,7 @@
         docker_cli = Client(base_url=docker_socket)
         info = docker_cli.inspect_container(my_container_id)
 
-    except Exception, e:
+    except Exception as e:
         log.exception('failed', my_container_id=my_container_id, e=e)
         raise
 
@@ -57,7 +58,7 @@
         docker_cli = Client(base_url=docker_socket)
         containers = docker_cli.containers()
 
-    except Exception, e:
+    except Exception as e:
         log.exception('failed', e=e)
         raise
 
@@ -67,7 +68,7 @@
     try:
         docker_cli = Client(base_url=docker_socket)
         info = docker_cli.inspect_container(id)
-    except Exception, e:
+    except Exception as e:
         log.exception('failed-inspect-container', id=id, e=e)
         raise
 
diff --git a/pyvoltha/common/utils/grpc_utils.py b/pyvoltha/common/utils/grpc_utils.py
index 8df630e..c7b1671 100644
--- a/pyvoltha/common/utils/grpc_utils.py
+++ b/pyvoltha/common/utils/grpc_utils.py
@@ -17,6 +17,7 @@
 """
 Utilities to handle gRPC server and client side code in a Twisted environment
 """
+from __future__ import absolute_import
 import structlog
 from concurrent.futures import Future
 from twisted.internet import reactor
@@ -91,14 +92,14 @@
                     f.set_result(d)
                     f.done()
 
-            except Exception, e:
+            except Exception as e:
                 f.set_exception(e)
                 f.done()
 
         reactor.callFromThread(twisted_wrapper)
         try:
             result = f.result()
-        except Exception, e:
+        except Exception as e:
             log.exception(e=e, func=func, args=args, kw=kw)
             raise
 
diff --git a/pyvoltha/common/utils/id_generation.py b/pyvoltha/common/utils/id_generation.py
index e0fea1c..9341ee4 100644
--- a/pyvoltha/common/utils/id_generation.py
+++ b/pyvoltha/common/utils/id_generation.py
@@ -15,6 +15,7 @@
 #
 # """ ID generation utils """
 
+from __future__ import absolute_import
 from uuid import uuid4
 
 
diff --git a/pyvoltha/common/utils/indexpool.py b/pyvoltha/common/utils/indexpool.py
index 858cb3a..8870abb 100644
--- a/pyvoltha/common/utils/indexpool.py
+++ b/pyvoltha/common/utils/indexpool.py
@@ -11,8 +11,10 @@
 # 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 __future__ import absolute_import
 from bitstring import BitArray
 import structlog
+from six.moves import range
 
 log = structlog.get_logger()
 
diff --git a/pyvoltha/common/utils/json_format.py b/pyvoltha/common/utils/json_format.py
index c18d013..705e75b 100644
--- a/pyvoltha/common/utils/json_format.py
+++ b/pyvoltha/common/utils/json_format.py
@@ -18,6 +18,7 @@
 module fot the strict behavior.
 """
 
+from __future__ import absolute_import
 from google.protobuf import json_format
 
 class _PatchedPrinter(json_format._Printer):
diff --git a/pyvoltha/common/utils/message_queue.py b/pyvoltha/common/utils/message_queue.py
index 2b4257a..d4635b7 100644
--- a/pyvoltha/common/utils/message_queue.py
+++ b/pyvoltha/common/utils/message_queue.py
@@ -13,8 +13,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from twisted.internet.defer import Deferred
 from twisted.internet.defer import succeed
+from six.moves import range
 
 
 class MessageQueue(object):
diff --git a/pyvoltha/common/utils/nethelpers.py b/pyvoltha/common/utils/nethelpers.py
index bed433b..8db73e4 100644
--- a/pyvoltha/common/utils/nethelpers.py
+++ b/pyvoltha/common/utils/nethelpers.py
@@ -18,6 +18,8 @@
 Some network related convenience functions
 """
 
+from __future__ import absolute_import
+from __future__ import print_function
 from netifaces import AF_INET
 
 import netifaces as ni
@@ -36,7 +38,7 @@
     assert 'default' in gateways, \
         ("No default gateway on host/container, "
          "cannot determine primary interface")
-    default_gw_index = gateways['default'].keys()[0]
+    default_gw_index = list(gateways['default'].keys())[0]
     # gateways[default_gw_index] has the format (example):
     # [('10.15.32.1', 'en0', True)]
     interface_name = gateways[default_gw_index][0][1]
@@ -88,4 +90,4 @@
 
 
 if __name__ == '__main__':
-    print get_my_primary_local_ipv4()
+    print(get_my_primary_local_ipv4())
diff --git a/pyvoltha/common/utils/ordered_weakvalue_dict.py b/pyvoltha/common/utils/ordered_weakvalue_dict.py
deleted file mode 100644
index 9ea739a..0000000
--- a/pyvoltha/common/utils/ordered_weakvalue_dict.py
+++ /dev/null
@@ -1,48 +0,0 @@
-#
-# 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 _weakref import ref
-from weakref import KeyedRef
-from collections import OrderedDict
-
-
-class OrderedWeakValueDict(OrderedDict):
-    """
-    Modified OrderedDict to use weak references as values. Entries disappear
-    automatically if the referred value has no more strong reference pointing
-    ot it.
-
-    Warning, this is not a complete implementation, only what is needed for
-    now. See test_ordered_wealvalue_dict.py to see what is tested behavior.
-    """
-    def __init__(self, *args, **kw):
-        def remove(wr, selfref=ref(self)):
-            self = selfref()
-            if self is not None:
-                super(OrderedWeakValueDict, self).__delitem__(wr.key)
-        self._remove = remove
-        super(OrderedWeakValueDict, self).__init__(*args, **kw)
-
-    def __setitem__(self, key, value):
-        super(OrderedWeakValueDict, self).__setitem__(
-            key, KeyedRef(value, self._remove, key))
-
-    def __getitem__(self, key):
-        o = super(OrderedWeakValueDict, self).__getitem__(key)()
-        if o is None:
-            raise KeyError, key
-        else:
-            return o
-
diff --git a/pyvoltha/common/utils/registry.py b/pyvoltha/common/utils/registry.py
index 270bd71..9b1bc18 100644
--- a/pyvoltha/common/utils/registry.py
+++ b/pyvoltha/common/utils/registry.py
@@ -19,6 +19,7 @@
 Simple component registry to provide centralized access to any registered
 components.
 """
+from __future__ import absolute_import
 from collections import OrderedDict
 from zope.interface import Interface
 
@@ -62,7 +63,7 @@
         return self.components[name]
 
     def iterate(self):
-        return self.components.values()
+        return list(self.components.values())
 
 
 # public shared registry
diff --git a/requirements.txt b/requirements.txt
index 0dc586a..ab3dceb 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,11 +4,11 @@
 cmd2==0.7.0
 colorama==0.3.9
 confluent-kafka==0.11.5
-cython==0.24.1
+cython==0.29.14
 decorator==4.1.2
 docker-py==1.10.6
 fluent-logger==0.6.0
-grpc==0.3.post19
+future==0.18.2
 grpcio==1.16.0
 grpcio-tools==1.16.0
 hash_ring==1.3.1
@@ -32,23 +32,23 @@
 pyOpenSSL==17.3.0
 PyYAML==3.12
 requests==2.18.4
-scapy==2.3.3
-service-identity==17.0.0
+scapy==2.4.3
+service-identity==18.1.0
 simplejson==3.12.0
 jsonschema==2.6.0
 six==1.12.0
-structlog==17.2.0
+structlog==19.2.0
 termcolor==1.1.0
 transitions==0.6.4
 treq==17.8.0
-Twisted==18.7.0
+Twisted==19.10.0
 txaioetcd==0.3.0
 urllib3==1.22
 pyang==1.7.3
-lxml==3.6.4
+lxml==4.4.1
 nosexcover==1.0.11
 zmq==0.0.0
-pyzmq==16.0.3
+pyzmq==18.1.1
 txZMQ==0.8.0
 ncclient==0.5.3
 xmltodict==0.11.0
diff --git a/test/unit/common/test_event_bus.py b/test/unit/common/test_event_bus.py
index be325e8..c833bf0 100644
--- a/test/unit/common/test_event_bus.py
+++ b/test/unit/common/test_event_bus.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import re
 
 from mock import Mock
@@ -21,6 +22,7 @@
 from twisted.trial.unittest import TestCase
 
 from pyvoltha.common.event_bus import EventBusClient, EventBus
+from six.moves import range
 
 
 class TestEventBus(TestCase):
@@ -187,11 +189,11 @@
 
         ebc.subscribe('', lambda _, msg: queue.put(msg))
 
-        for i in xrange(10):
+        for i in range(10):
             ebc.publish('', i)
 
         self.assertEqual(len(queue.pending), 10)
-        for i in xrange(10):
+        for i in range(10):
             msg = yield queue.get()
             self.assertEqual(msg, i)
         self.assertEqual(len(queue.pending), 0)
diff --git a/test/unit/common/utils/test_bpf.py b/test/unit/common/utils/test_bpf.py
index 21a80da..6cb2a00 100644
--- a/test/unit/common/utils/test_bpf.py
+++ b/test/unit/common/utils/test_bpf.py
@@ -11,6 +11,7 @@
 # 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 __future__ import absolute_import
 from unittest import TestCase, main
 
 from scapy.layers.l2 import Ether, Dot1Q
@@ -25,8 +26,8 @@
         pcp = 7
         frame_match = 'ether[14:2] = 0x{:01x}{:03x}'.format(pcp << 1, vid)
         filter = BpfProgramFilter(frame_match)
-        self.assertTrue(filter(str(Ether()/Dot1Q(prio=pcp, vlan=vid))))
-        self.assertFalse(filter(str(Ether()/Dot1Q(prio=pcp, vlan=4000))))
+        self.assertTrue(filter(bytes(Ether()/Dot1Q(prio=pcp, vlan=vid))))
+        self.assertFalse(filter(bytes(Ether()/Dot1Q(prio=pcp, vlan=4000))))
 
     def test_bpf2(self):
         vid1 = 4090
@@ -39,9 +40,9 @@
 
         filter = BpfProgramFilter('{} or {}'.format(
             frame_match_case1, frame_match_case2))
-        self.assertTrue(filter(str(Ether()/Dot1Q(prio=pcp1, vlan=vid1))))
-        self.assertTrue(filter(str(Ether()/Dot1Q(vlan=vid2))))
-        self.assertFalse(filter(str(Ether()/Dot1Q(vlan=4001))))
+        self.assertTrue(filter(bytes(Ether()/Dot1Q(prio=pcp1, vlan=vid1))))
+        self.assertTrue(filter(bytes(Ether()/Dot1Q(vlan=vid2))))
+        self.assertFalse(filter(bytes(Ether()/Dot1Q(vlan=4001))))
 
 
 if __name__ == '__main__':
diff --git a/test/unit/common/utils/test_indexpool.py b/test/unit/common/utils/test_indexpool.py
index 7eb1050..eb6ea50 100644
--- a/test/unit/common/utils/test_indexpool.py
+++ b/test/unit/common/utils/test_indexpool.py
@@ -11,8 +11,10 @@
 # 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 __future__ import absolute_import
 from unittest import TestCase, main
 from pyvoltha.common.utils.indexpool import IndexPool
+from six.moves import range
 
 class TestIndexPool(TestCase):
     pool = IndexPool(8, 0)
diff --git a/test/unit/common/utils/test_ordered_weakvalue_dict.py b/test/unit/common/utils/test_ordered_weakvalue_dict.py
deleted file mode 100644
index a8ce47c..0000000
--- a/test/unit/common/utils/test_ordered_weakvalue_dict.py
+++ /dev/null
@@ -1,51 +0,0 @@
-# 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.
-from unittest import TestCase, main
-
-from pyvoltha.common.utils.ordered_weakvalue_dict import OrderedWeakValueDict
-
-
-class O(object):
-    def __init__(self, a):
-        self.a = a
-
-
-class TestOrderedWeakValueDict(TestCase):
-
-    def test_standard_behavior(self):
-        holder = dict()  # a real dict so we can control which object real ref
-        def mk(k):
-            o = O(k)
-            holder[k] = o
-            return o
-        o = OrderedWeakValueDict((k, mk(k)) for k in xrange(10))
-        self.assertEqual(len(o), 10)
-        self.assertEqual(o[3].a, 3)
-        o[3] = mk(-3)
-        self.assertEqual(o[3].a, -3)
-        del o[3]
-        self.assertEqual(len(o), 9)
-        o[100] = mk(100)
-        self.assertEqual(len(o), 10)
-        self.assertEqual(o.keys(), [0, 1, 2, 4, 5, 6, 7, 8, 9, 100])
-
-        # remove a few items from the holder, they should be gone from o too
-        del holder[1]
-        del holder[5]
-        del holder[6]
-
-        self.assertEqual(o.keys(), [0, 2, 4, 7, 8, 9, 100])
-        self.assertEqual([v.a for v in o.values()], [0, 2, 4, 7, 8, 9, 100])
-
-
diff --git a/test/unit/extensions/events/device_events/onu/test_onu_events.py b/test/unit/extensions/events/device_events/onu/test_onu_events.py
index b86aacc..f6c1e50 100644
--- a/test/unit/extensions/events/device_events/onu/test_onu_events.py
+++ b/test/unit/extensions/events/device_events/onu/test_onu_events.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 import arrow
 from unittest import TestCase, main
 from pyvoltha.adapters.kafka.core_proxy import CoreProxy
diff --git a/test/unit/extensions/omci/mock/__init__.py b/test/unit/extensions/omci/mock/__init__.py
index 2792694..133c6d8 100644
--- a/test/unit/extensions/omci/mock/__init__.py
+++ b/test/unit/extensions/omci/mock/__init__.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from nose.twistedtools import threaded_reactor, stop_reactor
 
 
diff --git a/test/unit/extensions/omci/mock/mock_adapter_agent.py b/test/unit/extensions/omci/mock/mock_adapter_agent.py
index ebe94e2..15bbd60 100644
--- a/test/unit/extensions/omci/mock/mock_adapter_agent.py
+++ b/test/unit/extensions/omci/mock/mock_adapter_agent.py
@@ -14,7 +14,9 @@
 # limitations under the License.
 #
 # import binascii
+from __future__ import absolute_import
 import structlog
+import six
 # from twisted.internet.defer import Deferred
 # from voltha.core.config.config_root import ConfigRoot
 # from pyvoltha.protos.voltha_pb2 import VolthaInstance
@@ -85,7 +87,7 @@
     
     def tearDown(self):
         """Test case cleanup"""
-        for device in self._devices.itervalues():
+        for device in six.itervalues(self._devices):
             device.tearDown()
         self._devices.clear()
 
@@ -115,7 +117,7 @@
             return None
 
         # Get all child devices with the same parent ID
-        children_ids = set(d.id for d in self._devices.itervalues()
+        children_ids = set(d.id for d in six.itervalues(self._devices)
                            if d.parent_id == parent_device_id)
 
         # Loop through all the child devices with this parent ID
diff --git a/test/unit/extensions/omci/mock/mock_olt_handler.py b/test/unit/extensions/omci/mock/mock_olt_handler.py
index 142dbd8..9a51082 100644
--- a/test/unit/extensions/omci/mock/mock_olt_handler.py
+++ b/test/unit/extensions/omci/mock/mock_olt_handler.py
@@ -14,9 +14,11 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 import sys
-from mock_adapter_agent import MockDevice
+from .mock_adapter_agent import MockDevice
 from nose.twistedtools import reactor
+from six.moves import range
 
 
 class MockOltHandler(MockDevice):
@@ -45,7 +47,7 @@
 
         self.enabled = True                # OLT is enabled/active
         self.activated_onus = set()        # Activated ONU serial numbers
-        self.enabled_pons = range(0, 16)   # Enabled PONs
+        self.enabled_pons = list(range(0, 16))   # Enabled PONs
         self.max_tx = sys.maxint           # Fail after this many tx requests
         self.latency = 0.0                 # OMCI response latency (keep small)
 
@@ -101,7 +103,7 @@
     def _deliver_proxy_message(self, proxy_address, response):
         from common.frameio.frameio import hexify
         self._adapter_agent.receive_proxied_message(proxy_address,
-                                                    hexify(str(response)))
+                                                    hexify(response))
 
     def receive_proxied_message(self, _, __):
         assert False, 'This is never called on the OLT side of proxy messaging'
diff --git a/test/unit/extensions/omci/mock/mock_onu.py b/test/unit/extensions/omci/mock/mock_onu.py
index e63c5cd..7102519 100644
--- a/test/unit/extensions/omci/mock/mock_onu.py
+++ b/test/unit/extensions/omci/mock/mock_onu.py
@@ -13,6 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.omci.omci_frame import OmciFrame
 from pyvoltha.adapters.extensions.omci.omci_defs import *
 from pyvoltha.adapters.extensions.omci.omci_entities import *
diff --git a/test/unit/extensions/omci/mock/mock_onu_handler.py b/test/unit/extensions/omci/mock/mock_onu_handler.py
index 9ebe1f6..cbb814a 100644
--- a/test/unit/extensions/omci/mock/mock_onu_handler.py
+++ b/test/unit/extensions/omci/mock/mock_onu_handler.py
@@ -14,7 +14,8 @@
 # limitations under the License.
 #
 
-from mock_adapter_agent import MockProxyAddress, MockDevice
+from __future__ import absolute_import
+from .mock_adapter_agent import MockProxyAddress, MockDevice
 from pyvoltha.adapters.extensions.omci.omci_cc import *
 from pyvoltha.adapters.extensions.omci.omci_entities import entity_id_to_class_map
 
diff --git a/test/unit/extensions/omci/mock/mock_task.py b/test/unit/extensions/omci/mock/mock_task.py
index aad0c60..7bafc17 100644
--- a/test/unit/extensions/omci/mock/mock_task.py
+++ b/test/unit/extensions/omci/mock/mock_task.py
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from pyvoltha.adapters.extensions.omci.tasks.task import Task
 from pyvoltha.common.utils.asleep import asleep
-from twisted.internet.defer import inlineCallbacks, failure
+from twisted.internet.defer import inlineCallbacks, failure, AlreadyCalledError, CancelledError
 from twisted.internet import reactor
 
 
@@ -87,8 +88,10 @@
 
             if self._success:
                 self.deferred.callback(self._value)
+            else:
+                self.deferred.errback(failure.Failure(self._value))
 
-            self.deferred.errback(failure.Failure(self._value))
-
+        except AlreadyCalledError as all:
+            pass
         except Exception as e:
             self.deferred.errback(failure.Failure(e))
diff --git a/test/unit/extensions/omci/test_image_agent.py b/test/unit/extensions/omci/test_image_agent.py
index 0e500cb..a889be7 100644
--- a/test/unit/extensions/omci/test_image_agent.py
+++ b/test/unit/extensions/omci/test_image_agent.py
@@ -14,6 +14,7 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 import binascii
 import structlog
 from unittest import TestCase, TestSuite, skip
@@ -52,9 +53,9 @@
         'trailer'     : '00000028',
         'mic'         : '00000000'
     }
-    
+
     # sw_dwld_resp = '0001330A000700000000001f010000'
-     
+
     ### Test Functions ###
     def sim_receive_start_sw_download_resp(self, tid, eid, r=0):
         msg = OmciFrame(
@@ -120,7 +121,7 @@
                         result = r
                     ))
         self.device.omci_cc.receive_message(msg)
-        
+
     def cb_after_send_omci(self, msg):
         self.log.debug("cb_after_send_omci")
         dmsg = OmciFrame(binascii.unhexlify(msg))
@@ -148,7 +149,7 @@
             self.log.debug("receive download section, not respond")
         elif mid == OmciDownloadSectionLast.message_id:
             self.log.debug("response download last section")
-            self.reactor.callLater(0, self.sim_receive_download_section_resp, tid, eid, 
+            self.reactor.callLater(0, self.sim_receive_download_section_resp, tid, eid,
                                    section=dmsg_body.fields["section_number"])
         elif mid == OmciActivateImage.message_id:
             self.log.debug("response activate image")
@@ -163,11 +164,11 @@
             self.reactor.callLater(0, self.sim_receive_commit_image_resp, tid, eid)
         else:
             self.log.debug("Unsupported message type", message_type=mid)
-            
+
         self.defer = Deferred()
         self.defer.addCallback(self.cb_after_send_omci)
         self.adapter_agent.send_omci_defer = self.defer
-        
+
     def setUp(self):
         self.log = structlog.get_logger()
         self.log.debug("do setup")
@@ -196,7 +197,7 @@
         self.omci_agent.database.add('1')
         self.omci_agent.database.set('1', SoftwareImage.class_id, 0, {"is_committed": 1, "is_active": 1, "is_valid": 1})
         self.omci_agent.database.set('1', SoftwareImage.class_id, 1, {"is_committed": 0, "is_active": 0, "is_valid": 1})
-        
+
     def tearDown(self):
         self.log.debug("Test is Done")
         self.omci_agent.database.remove('1')
@@ -214,10 +215,10 @@
         return m + kargs['trailer'] + kargs['mic']
 
     def sim_receive_sw_download_resp2(self):
-        r = self.get_omci_msg(self.sw_dwld_resp['tid'], self.sw_dwld_resp['mid'], 
-                              self.sw_dwld_resp['did'], self.sw_dwld_resp['entity_class'], 
-                              self.sw_dwld_resp['entity_id'], self.sw_dwld_resp['reason'], 
-                              self.sw_dwld_resp['window_size'], self.sw_dwld_resp['inst_num'], self.sw_dwld_resp['inst_id'], 
+        r = self.get_omci_msg(self.sw_dwld_resp['tid'], self.sw_dwld_resp['mid'],
+                              self.sw_dwld_resp['did'], self.sw_dwld_resp['entity_class'],
+                              self.sw_dwld_resp['entity_id'], self.sw_dwld_resp['reason'],
+                              self.sw_dwld_resp['window_size'], self.sw_dwld_resp['inst_num'], self.sw_dwld_resp['inst_id'],
                               trailer=self.sw_dwld_resp['trailer'], mic=self.sw_dwld_resp['mic'])
         data = binascii.unhexlify(r)
         #msg = OmciFrame(data)
@@ -228,22 +229,22 @@
     def sw_action_success(self, instance_id, device_id):
         self.log.debug("Action Success", device_id=device_id, entity_id=instance_id)
         self.reactor.callLater(0, self.onu_do_activate)
-        
+
     def sw_action2_success(self, instance_id, device_id):
         self.log.debug("Action2 Success", device_id=device_id, entity_id=instance_id)
 
     def sw_action_fail(self, fail, device_id):
         self.log.debug("Finally Failed", device_id=device_id)
         self.log.debug(fail)
-        
+
     # def test_onu_do_activate(self):
     def onu_do_activate(self):
-        self.log.debug("do test_onu_do_activate") 
+        self.log.debug("do test_onu_do_activate")
         self.defer = self.device.do_onu_image_activate(self._image_dnld.name)
         self.defer.addCallbacks(self.sw_action2_success, self.sw_action_fail, callbackArgs=(self.device_id,), errbackArgs=(self.device_id,))
         self.reactor.callLater(100, self.stop)
         # self.reactor.run()
-        
+
     @skip("for Jenkins Verification")
     def test_onu_do_software_upgrade(self):
         self.log.debug("do test_onu_do_software_upgrade", download=self._image_dnld)
@@ -254,14 +255,14 @@
         # self.reactor.callLater(1, self.sim_receive_start_sw_download_resp)
         # self.reactor.callLater(12, self.stop)
         self.reactor.run()
-        
+
     @skip("Not used")
     def test_omci_message(self):
-        self.log.debug("do test_omci_message") 
-        r = self.get_omci_msg(self.sw_dwld_resp['tid'], self.sw_dwld_resp['mid'], 
-                              self.sw_dwld_resp['did'], self.sw_dwld_resp['entity_class'], 
-                              self.sw_dwld_resp['entity_id'], self.sw_dwld_resp['reason'], 
-                              self.sw_dwld_resp['window_size'], self.sw_dwld_resp['inst_num'], self.sw_dwld_resp['inst_id'], 
+        self.log.debug("do test_omci_message")
+        r = self.get_omci_msg(self.sw_dwld_resp['tid'], self.sw_dwld_resp['mid'],
+                              self.sw_dwld_resp['did'], self.sw_dwld_resp['entity_class'],
+                              self.sw_dwld_resp['entity_id'], self.sw_dwld_resp['reason'],
+                              self.sw_dwld_resp['window_size'], self.sw_dwld_resp['inst_num'], self.sw_dwld_resp['inst_id'],
                               trailer=self.sw_dwld_resp['trailer'], mic=self.sw_dwld_resp['mic'])
         data = binascii.unhexlify(r)
         msg = OmciFrame(data)
@@ -273,7 +274,7 @@
 
     @skip("Not used")
     def test_omci_message2(self):
-        self.log.debug("do test_omci_message2") 
+        self.log.debug("do test_omci_message2")
         msg = OmciFrame(
                     transaction_id=0x0001,
                     message_type=OmciStartSoftwareDownloadResponse.message_id,
@@ -287,7 +288,7 @@
                     )
               )
         self.log.debug(binascii.hexlify(str(msg)))
-        
+
 this_suite = TestSuite()
 # this_suite.addTest(TestOmciDownload('test_onu_do_software_upgrade'))
 # this_suite.addTest(TestOmciDownload('test_onu_do_activate'))
diff --git a/test/unit/extensions/omci/test_me_frame.py b/test/unit/extensions/omci/test_me_frame.py
index 74e2b78..89047dc 100644
--- a/test/unit/extensions/omci/test_me_frame.py
+++ b/test/unit/extensions/omci/test_me_frame.py
@@ -13,23 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import TestCase, main
 from nose.tools import assert_raises
 from pyvoltha.adapters.extensions.omci.me_frame import *
 from pyvoltha.adapters.extensions.omci.omci_me import *
 from pyvoltha.adapters.extensions.omci.omci import *
+import codecs
 
 
-def hexify(buffer):
+def hexify(frame):
     """Return a hexadecimal string encoding of input buffer"""
-    return ''.join('%02x' % ord(c) for c in buffer)
-
+    return codecs.encode(bytes(frame),'hex')
 
 class TestSelectMeFrameGeneration(TestCase):
 
     def assertGeneratedFrameEquals(self, frame, ref):
         assert isinstance(frame, Packet)
-        serialized_hexified_frame = hexify(str(frame)).upper()
+        serialized_hexified_frame = hexify(frame).upper()
         ref = ref.upper()
         if serialized_hexified_frame != ref:
             self.fail('Mismatch:\nReference:\n{}\nGenerated (bad):\n{}'.format(
@@ -37,46 +38,46 @@
             ))
 
     def test_mib_reset_message_serialization(self):
-        ref = '00004F0A000200000000000000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'00004F0A000200000000000000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OntDataFrame().mib_reset()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gal_ethernet_profile(self):
-        ref = '0000440A011000010030000000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A011000010030000000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = GalEthernetProfileFrame(1, max_gem_payload_size=48).create()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_tcont_1(self):
-        ref = '0000480A010680008000040000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A010680008000040000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
 
         frame = TcontFrame(0x8000, alloc_id=0x400).set()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_tcont_2(self):
-        ref = '0000480A010680018000040100000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A010680018000040100000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
 
         frame = TcontFrame(0x8001, alloc_id=0x401).set()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_8021p_mapper_service_profile(self):
-        ref = '0000440A00828000ffffffffffffffff' \
-              'ffffffffffffffffffff000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A00828000ffffffffffffffff' \
+              b'ffffffffffffffffffff000000000000' \
+              b'000000000000000000000028'
         frame = Ieee8021pMapperServiceProfileFrame(0x8000).create()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_service_profile(self):
-        ref = '0000440A002D02010001008000140002' \
-              '000f0001000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A002D02010001008000140002' \
+              b'000f0001000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             spanning_tree_ind=False,
             learning_ind=True,
@@ -90,9 +91,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gem_port_network_ctp(self):
-        ref = '0000440A010C01000400800003010000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A010C01000400800003010000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
 
         data = dict(
             port_id=0x400,
@@ -111,9 +112,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gem_inteworking_tp(self):
-        ref = '0000440A010A80010100058000000000' \
-              '01000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A010A80010100058000000000' \
+              b'01000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = GemInterworkingTpFrame(0x8001,
                                        gem_port_network_ctp_pointer=0x100,
                                        interworking_option=5,
@@ -124,9 +125,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_8021p_mapper_service_profile(self):
-        ref = '0000480A008280007F80800100000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A008280007F80800100000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         ptrs = [0x8001, 0, 0, 0, 0, 0, 0, 0]
         frame = Ieee8021pMapperServiceProfileFrame(0x8000,
                                                    interwork_tp_pointers=ptrs).set()
@@ -140,9 +141,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_port_configuration_data(self):
-        ref = '0000440A002F21010201020380000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A002F21010201020380000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
 
         frame = MacBridgePortConfigurationDataFrame(0x2101,
                                                     bridge_id_pointer=0x201,
@@ -152,18 +153,18 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_vlan_tagging_filter_data(self):
-        ref = '0000440A005421010400000000000000' \
-              '00000000000000000000000000000000' \
-              '100100000000000000000028'
+        ref = b'0000440A005421010400000000000000' \
+              b'00000000000000000000000000000000' \
+              b'100100000000000000000028'
         frame = VlanTaggingFilterDataFrame(0x2101,
                                            vlan_tcis=[0x400],
                                            forward_operation=0x10).create()
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_extended_vlan_tagging_operation_configuration_data(self):
-        ref = '0000440A00AB02020A04010000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A00AB02020A04010000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             association_type=10,
             associated_me_pointer=0x401
@@ -176,9 +177,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_operation_configuration_data(self):
-        ref = '0000480A00AB02023800810081000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A00AB02023800810081000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             input_tpid=0x8100,
             output_tpid=0x8100,
@@ -192,9 +193,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_1(self):
-        ref = '0000480A00AB02020400f00000008200' \
-              '5000402f000000082004000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A00AB02020400f00000008200' \
+              b'5000402f000000082004000000000000' \
+              b'000000000000000000000028'
         data = dict(
             received_frame_vlan_tagging_operation_table=\
                 VlanTaggingOperation(
@@ -219,9 +220,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_2(self):
-        ref = '0000480A00AB02020400F00000008200' \
-              'd000402f00000008200c000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A00AB02020400F00000008200' \
+              b'd000402f00000008200c000000000000' \
+              b'000000000000000000000028'
         data = dict(
             received_frame_vlan_tagging_operation_table=
                 VlanTaggingOperation(
@@ -247,9 +248,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_port_configuration_data2(self):
-        ref = '0000440A002F02010201010b04010000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000440A002F02010201010b04010000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             bridge_id_pointer=0x201,
             encapsulation_methods=0,
@@ -268,9 +269,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_pptp_ethernet_uni_frame(self):
-        ref = '0000480A000B020109000005EE000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0000480A000B020109000005EE000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             administrative_state=0,  # 0 - Unlock
             max_frame_size=1518      # two-octet field
diff --git a/test/unit/extensions/omci/test_mib_db_dict.py b/test/unit/extensions/omci/test_mib_db_dict.py
index 2f7f26d..6cf1e1d 100644
--- a/test/unit/extensions/omci/test_mib_db_dict.py
+++ b/test/unit/extensions/omci/test_mib_db_dict.py
@@ -13,15 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import main, TestCase
 
 from pyvoltha.adapters.extensions.omci.omci_entities import *
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import *
 from pyvoltha.adapters.extensions.omci.database.mib_db_api import MODIFIED_KEY, CREATED_KEY,\
     DEVICE_ID_KEY, MDS_KEY, LAST_SYNC_KEY
-from mock.mock_adapter_agent import MockAdapterAgent, MockDevice
+from .mock.mock_adapter_agent import MockAdapterAgent, MockDevice
 from nose.tools import raises, assert_raises
 import time
+import six
 
 _DEVICE_ID = 'br-549'
 
@@ -373,7 +375,7 @@
         self.assertLessEqual(dev_data[CREATED_KEY], set_time)
         self.assertLessEqual(self.db.created, set_time)
 
-        self.assertFalse(any(isinstance(cls, int) for cls in dev_data.iterkeys()))
+        self.assertFalse(any(isinstance(cls, int) for cls in six.iterkeys(dev_data)))
 
     def test_str_field_serialization(self):
         self.db.start()
@@ -385,8 +387,8 @@
             'olt_vendor_id': 'ABCD',             # StrFixedLenField(4)
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
-        self.assertTrue(all(isinstance(data[k], basestring) for k in attributes.keys()))
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
+        self.assertTrue(all(isinstance(data[k], six.string_types) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
     def test_mac_address_ip_field_serialization(self):
@@ -400,8 +402,8 @@
             'ip_address': '1.2.3.4',                        # IPField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
-        self.assertTrue(all(isinstance(data[k], basestring) for k in attributes.keys()))
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
+        self.assertTrue(all(isinstance(data[k], six.string_types) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
     def test_byte_and_short_field_serialization(self):
@@ -415,7 +417,7 @@
             'non_omci_management_identifier': int(12345)   # IPField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -429,7 +431,7 @@
             'related_port': int(1234567)    # IntField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -443,7 +445,7 @@
             'packet_drop_queue_thresholds': int(0x1234)        # LongField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -454,10 +456,10 @@
         class_id = OntG.class_id
         inst_id = 0
         attributes = {
-            'extended_tc_layer_options': long(0x1234),        # BitField(16)
+            'extended_tc_layer_options': int(0x1234),        # BitField(16)
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -476,7 +478,7 @@
             'number_of_entries': 1
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -504,7 +506,7 @@
         )
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
 
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         table_as_dict = json.loads(table_data.to_json())
 
         self.assertTrue(all(isinstance(data['received_frame_vlan_tagging_operation_table'][0].fields[k],
diff --git a/test/unit/extensions/omci/test_mib_db_ext.py b/test/unit/extensions/omci/test_mib_db_ext.py
index 925e81f..e1ad39b 100644
--- a/test/unit/extensions/omci/test_mib_db_ext.py
+++ b/test/unit/extensions/omci/test_mib_db_ext.py
@@ -13,15 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import main, TestCase
 
 from pyvoltha.adapters.extensions.omci.database.mib_db_ext import *
 from pyvoltha.adapters.extensions.omci.database.mib_db_api import MODIFIED_KEY, CREATED_KEY,\
     DEVICE_ID_KEY, MDS_KEY, LAST_SYNC_KEY
 from pyvoltha.adapters.extensions.omci.omci_cc import UNKNOWN_CLASS_ATTRIBUTE_KEY
-from mock.mock_adapter_agent import MockAdapterAgent, MockDevice
+from .mock.mock_adapter_agent import MockAdapterAgent, MockDevice
 from nose.tools import raises, assert_raises
 import time
+import six
 
 _DEVICE_ID = 'br-549'
 
@@ -372,7 +374,7 @@
         self.assertLessEqual(dev_data[CREATED_KEY], set_time)
         self.assertLessEqual(self.db.created, set_time)
 
-        self.assertFalse(any(isinstance(cls, int) for cls in dev_data.iterkeys()))
+        self.assertFalse(any(isinstance(cls, int) for cls in six.iterkeys(dev_data)))
 
     def test_str_field_serialization(self):
         self.db.start()
@@ -384,8 +386,8 @@
             'olt_vendor_id': 'ABCD',             # StrFixedLenField(4)
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
-        self.assertTrue(all(isinstance(data[k], basestring) for k in attributes.keys()))
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
+        self.assertTrue(all(isinstance(data[k], six.string_types) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
     def test_mac_address_ip_field_serialization(self):
@@ -399,8 +401,8 @@
             'ip_address': '1.2.3.4',                        # IPField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
-        self.assertTrue(all(isinstance(data[k], basestring) for k in attributes.keys()))
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
+        self.assertTrue(all(isinstance(data[k], six.string_types) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
     def test_byte_and_short_field_serialization(self):
@@ -414,7 +416,7 @@
             'non_omci_management_identifier': int(12345)   # IPField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -428,7 +430,7 @@
             'related_port': int(1234567)    # IntField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -442,7 +444,7 @@
             'packet_drop_queue_thresholds': int(0x1234)        # LongField
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -453,10 +455,10 @@
         class_id = OntG.class_id
         inst_id = 0
         attributes = {
-            'extended_tc_layer_options': long(0x1234),        # BitField(16)
+            'extended_tc_layer_options': int(0x1234),        # BitField(16)
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -475,7 +477,7 @@
             'number_of_entries': 1
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         self.assertTrue(all(isinstance(data[k], type(attributes[k])) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
@@ -503,7 +505,7 @@
         )
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
 
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
         table_as_dict = json.loads(table_data.to_json())
 
         self.assertTrue(all(isinstance(data['received_frame_vlan_tagging_operation_table'][0].fields[k],
@@ -527,9 +529,9 @@
         }
         self.db.set(_DEVICE_ID, class_id, inst_id, attributes)
 
-        data = self.db.query(_DEVICE_ID, class_id, inst_id, attributes.keys())
-        self.assertTrue(isinstance(UNKNOWN_CLASS_ATTRIBUTE_KEY, basestring))
-        self.assertTrue(all(isinstance(attributes[k], basestring) for k in attributes.keys()))
+        data = self.db.query(_DEVICE_ID, class_id, inst_id, list(attributes.keys()))
+        self.assertTrue(isinstance(UNKNOWN_CLASS_ATTRIBUTE_KEY, six.string_types))
+        self.assertTrue(all(isinstance(attributes[k], six.string_types) for k in attributes.keys()))
         self.assertTrue(all(data[k] == attributes[k] for k in attributes.keys()))
 
 
diff --git a/test/unit/extensions/omci/test_mib_resync_task.py b/test/unit/extensions/omci/test_mib_resync_task.py
index 892cd97..7294309 100644
--- a/test/unit/extensions/omci/test_mib_resync_task.py
+++ b/test/unit/extensions/omci/test_mib_resync_task.py
@@ -13,12 +13,13 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import main, TestCase
 from pyvoltha.adapters.extensions.omci.omci_entities import *
 from pyvoltha.adapters.extensions.omci.tasks.mib_resync_task import MibResyncTask
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import MibDbVolatileDict as OnuDB
 from pyvoltha.adapters.extensions.omci.database.mib_db_ext import MibDbExternal as OltDB
-from mock.mock_adapter_agent import MockAdapterAgent, MockDevice
+from .mock.mock_adapter_agent import MockAdapterAgent, MockDevice
 
 _DEVICE_ID = 'br-549'
 
@@ -145,7 +146,7 @@
         class_id = OntG.class_id
         inst_id = 0
         attributes = {
-            'extended_tc_layer_options': long(0x1234),        # BitField(16)
+            'extended_tc_layer_options': int(0x1234),        # BitField(16)
         }
         self.onu_db.set(_DEVICE_ID, class_id, inst_id, attributes)
         self.olt_db.set(_DEVICE_ID, class_id, inst_id, attributes)
diff --git a/test/unit/extensions/omci/test_mib_sync.py b/test/unit/extensions/omci/test_mib_sync.py
index 10a1172..2a60a0b 100644
--- a/test/unit/extensions/omci/test_mib_sync.py
+++ b/test/unit/extensions/omci/test_mib_sync.py
@@ -14,8 +14,9 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 from unittest import TestCase, main
-from mock.mock_adapter_agent import MockAdapterAgent
+from .mock.mock_adapter_agent import MockAdapterAgent
 
 
 
diff --git a/test/unit/extensions/omci/test_mib_upload.py b/test/unit/extensions/omci/test_mib_upload.py
index c372819..90d16e3 100644
--- a/test/unit/extensions/omci/test_mib_upload.py
+++ b/test/unit/extensions/omci/test_mib_upload.py
@@ -14,8 +14,9 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 from unittest import TestCase, main
-from mock.mock_adapter_agent import MockAdapterAgent
+from .mock.mock_adapter_agent import MockAdapterAgent
 
 
 class TestMibUpload(TestCase):
diff --git a/test/unit/extensions/omci/test_omci.py b/test/unit/extensions/omci/test_omci.py
index b6397a8..c33b796 100644
--- a/test/unit/extensions/omci/test_omci.py
+++ b/test/unit/extensions/omci/test_omci.py
@@ -13,15 +13,24 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
+from __future__ import print_function
 from unittest import TestCase, main
 from binascii import unhexlify
 
 from pyvoltha.adapters.extensions.omci.omci import *
+from six.moves import range
+import codecs
 
 
-def hexify(buffer):
+def hexify(frame):
     """Return a hexadecimal string encoding of input buffer"""
-    return ''.join('%02x' % ord(c) for c in buffer)
+    return codecs.encode(bytes(frame),'hex')
+
+
+def hex2raw(hex_string):
+    """ convert a string or bytes containing a hexadecimal as raw bytes"""
+    return codecs.decode(hex_string,'hex')
 
 
 def chunk(indexable, chunk_size):
@@ -29,10 +38,6 @@
         yield indexable[i:i + chunk_size]
 
 
-def hex2raw(hex_string):
-    return ''.join(chr(int(byte, 16)) for byte in chunk(hex_string, 2))
-
-
 class TestOmciFundamentals(TestCase):
 
     def test_bitpos_from_mask(self):
@@ -63,31 +68,31 @@
     def test_entity_attribute_serialization(self):
 
         e = CircuitPack(vendor_id='F')
-        self.assertEqual(e.serialize(), 'F\x00\x00\x00')
+        self.assertEqual(e.serialize(), b'F\x00\x00\x00')
 
         e = CircuitPack(vendor_id='FOOX')
-        self.assertEqual(e.serialize(), 'FOOX')
+        self.assertEqual(e.serialize(), b'FOOX')
 
         e = CircuitPack(vendor_id='FOOX', number_of_ports=16)
-        self.assertEqual(e.serialize(), '\x10FOOX')
+        self.assertEqual(e.serialize(), b'\x10FOOX')
 
     def test_entity_attribute_serialization_mask_based(self):
 
         e = CircuitPack(
             number_of_ports=4,
-            serial_number='BCMX31323334', # serial number is 4 ascii + 4 hex. 8 octets on the wire
-            version='a1c12fba91de',
-            vendor_id='BCM',
+            serial_number=b'BCMX31323334', # serial number is 4 ascii + 4 hex. 8 octets on the wire
+            version=b'a1c12fba91de',
+            vendor_id=b'BCM',
             total_tcont_buffer_number=128
         )
 
         # Full object
         self.assertEqual(e.serialize(),
-                         '\x04BCMX1234a1c12fba91de\x00\x00BCM\x00\x80')
+                         b'\x04BCMX1234a1c12fba91de\x00\x00BCM\x00\x80')
 
         # Explicit mask with valid values
-        self.assertEqual(e.serialize(0x800), 'BCM\x00')
-        self.assertEqual(e.serialize(0x6800), '\x04BCMX1234BCM\x00')
+        self.assertEqual(e.serialize(0x800), b'BCM\x00')
+        self.assertEqual(e.serialize(0x6800), b'\x04BCMX1234BCM\x00')
 
         # Referring to an unfilled field is regarded as error
         self.assertRaises(OmciUninitializedFieldError, e.serialize, 0xc00)
@@ -99,32 +104,32 @@
             cls.mask_for('vendor_id', 'bridged_or_ip_ind'), 0x900)
 
     reference_get_request_hex = (
-        '00 00 49 0a'
-        '00 06 01 01'
-        '08 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 28'.replace(' ', '')
+        b'0000490a'
+        b'00060101'
+        b'08000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000028'
     )
     reference_get_request_raw = hex2raw(reference_get_request_hex)
 
     reference_get_response_hex = (
-        '00 00 29 0a'
-        '00 06 01 01'
-        '00 08 00 50'
-        '4d 43 53 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 00'
-        '00 00 00 28'.replace(' ', '')
+        b'0000290a'
+        b'00060101'
+        b'00080050'
+        b'4d435300'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000000'
+        b'00000028'
     )
     reference_get_response_raw = hex2raw(reference_get_response_hex)
 
@@ -139,7 +144,7 @@
                 attributes_mask=CircuitPack.mask_for('vendor_id')
             )
         )
-        self.assertEqual(hexify(str(frame)), self.reference_get_request_hex)
+        self.assertEqual(hexify(frame), self.reference_get_request_hex)
 
     def test_omci_frame_deserialization_no_data(self):
         frame = OmciFrame(self.reference_get_request_raw)
@@ -170,7 +175,7 @@
 
     def assertGeneratedFrameEquals(self, frame, ref):
         assert isinstance(frame, Packet)
-        serialized_hexified_frame = hexify(str(frame)).upper()
+        serialized_hexified_frame = hexify(frame).upper()
         ref = ref.upper()
         if serialized_hexified_frame != ref:
             self.fail('Mismatch:\nReference:\n{}\nGenerated (bad):\n{}'.format(
@@ -178,9 +183,9 @@
             ))
 
     def test_mib_reset_message_serialization(self):
-        ref = '00014F0A000200000000000000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'00014F0A000200000000000000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=1,
             message_type=OmciMibReset.message_id,
@@ -191,9 +196,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gal_ethernet_profile(self):
-        ref = '0002440A011000010030000000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0002440A011000010030000000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=2,
             message_type=OmciCreate.message_id,
@@ -208,9 +213,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_tcont_1(self):
-        ref = '0003480A010680008000040000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0003480A010680008000040000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             alloc_id=0x400
         )
@@ -220,16 +225,16 @@
             omci_message=OmciSet(
                 entity_class=Tcont.class_id,
                 entity_id=0x8000,
-                attributes_mask=Tcont.mask_for(*data.keys()),
+                attributes_mask=Tcont.mask_for(*list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_tcont_2(self):
-        ref = '0004480A010680018000040100000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0004480A010680018000040100000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             alloc_id=0x401
         )
@@ -239,16 +244,16 @@
             omci_message=OmciSet(
                 entity_class=Tcont.class_id,
                 entity_id=0x8001,
-                attributes_mask=Tcont.mask_for(*data.keys()),
+                attributes_mask=Tcont.mask_for(*list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_8021p_mapper_service_profile(self):
-        ref = '0007440A00828000ffffffffffffffff' \
-              'ffffffffffffffffffff000000000000' \
-              '000000000000000000000028'
+        ref = b'0007440A00828000ffffffffffffffff' \
+              b'ffffffffffffffffffff000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=7,
             message_type=OmciCreate.message_id,
@@ -264,9 +269,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_service_profile(self):
-        ref = '000B440A002D02010001008000140002' \
-              '000f0001000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'000B440A002D02010001008000140002' \
+              b'000f0001000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=11,
             message_type=OmciCreate.message_id,
@@ -287,9 +292,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gem_port_network_ctp(self):
-        ref = '000C440A010C01000400800003010000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'000C440A010C01000400800003010000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=12,
             message_type=OmciCreate.message_id,
@@ -307,9 +312,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_multicast_gem_interworking_tp(self):
-        ref = '0011440A011900060104000001000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0011440A011900060104000001000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=17,
             message_type=OmciCreate.message_id,
@@ -326,9 +331,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_gem_inteworking_tp(self):
-        ref = '0012440A010A80010100058000000000' \
-              '01000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0012440A010A80010100058000000000' \
+              b'01000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=18,
             message_type=OmciCreate.message_id,
@@ -347,9 +352,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_8021p_mapper_service_profile(self):
-        ref = '0016480A008280004000800100000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0016480A008280004000800100000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             interwork_tp_pointer_for_p_bit_priority_0=0x8001
         )
@@ -360,16 +365,16 @@
                 entity_class=Ieee8021pMapperServiceProfile.class_id,
                 entity_id=0x8000,
                 attributes_mask=Ieee8021pMapperServiceProfile.mask_for(
-                    *data.keys()),
+                    *list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_port_configuration_data(self):
-        ref = '001A440A002F21010201020380000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'001A440A002F21010201020380000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=26,
             message_type=OmciCreate.message_id,
@@ -387,9 +392,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_vlan_tagging_filter_data(self):
-        ref = '001F440A005421010400000000000000' \
-              '00000000000000000000000000000000' \
-              '100100000000000000000028'
+        ref = b'001F440A005421010400000000000000' \
+              b'00000000000000000000000000000000' \
+              b'100100000000000000000028'
         vlan_filter_list = [0] * 12
         vlan_filter_list[0] = 0x0400
 
@@ -409,9 +414,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_extended_vlan_tagging_operation_configuration_data(self):
-        ref = '0023440A00AB02020A04010000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0023440A00AB02020A04010000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=35,
             message_type=OmciCreate.message_id,
@@ -428,9 +433,9 @@
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_operation_configuration_data(self):
-        ref = '0024480A00AB02023800810081000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0024480A00AB02023800810081000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         data = dict(
             input_tpid=0x8100,
             output_tpid=0x8100,
@@ -445,16 +450,16 @@
                 entity_id=0x202,
                 attributes_mask= \
                     ExtendedVlanTaggingOperationConfigurationData.mask_for(
-                        *data.keys()),
+                        *list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_1(self):
-        ref = '0025480A00AB02020400f00000008200' \
-              '5000402f000000082004000000000000' \
-              '000000000000000000000028'
+        ref = b'0025480A00AB02020400f00000008200' \
+              b'5000402f000000082004000000000000' \
+              b'000000000000000000000028'
         data = dict(
             received_frame_vlan_tagging_operation_table=\
                 VlanTaggingOperation(
@@ -480,16 +485,16 @@
                 entity_id=0x202,
                 attributes_mask= \
                     ExtendedVlanTaggingOperationConfigurationData.mask_for(
-                        *data.keys()),
+                        *list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_set_extended_vlan_tagging_2(self):
-        ref = '0026480A00AB02020400F00000008200' \
-              'd000402f00000008200c000000000000' \
-              '000000000000000000000028'
+        ref = b'0026480A00AB02020400F00000008200' \
+              b'd000402f00000008200c000000000000' \
+              b'000000000000000000000028'
         data = dict(
             received_frame_vlan_tagging_operation_table=
                 VlanTaggingOperation(
@@ -515,16 +520,16 @@
                 entity_id=0x202,
                 attributes_mask=
                     ExtendedVlanTaggingOperationConfigurationData.mask_for(
-                        *data.keys()),
+                        *list(data.keys())),
                 data=data
             )
         )
         self.assertGeneratedFrameEquals(frame, ref)
 
     def test_create_mac_bridge_port_configuration_data2(self):
-        ref = '0029440A002F02010201010b04010000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'0029440A002F02010201010b04010000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=41,
             message_type=OmciCreate.message_id,
@@ -550,9 +555,9 @@
         self.assertEqual(frame2, frame)
 
     def test_mib_upload(self):
-        ref = '00304D0A000200000000000000000000' \
-              '00000000000000000000000000000000' \
-              '000000000000000000000028'
+        ref = b'00304D0A000200000000000000000000' \
+              b'00000000000000000000000000000000' \
+              b'000000000000000000000028'
         frame = OmciFrame(
             transaction_id=48,
             message_type=OmciMibUpload.message_id,
@@ -564,8 +569,8 @@
 
     def test_parse_enh_security_avc(self):
         refs = [
-            "0000110a014c0000008000202020202020202020202020202020202020202020"
-            "2020202020202020000000280be43cf4"
+            b"0000110a014c0000008000202020202020202020202020202020202020202020"
+            b"2020202020202020000000280be43cf4"
         ]
         for i, data in enumerate(refs):
             frame = OmciFrame(hex2raw(data))
@@ -574,8 +579,8 @@
 
     def test_parse_alarm_message(self):
         refs = [
-            "0000100a00050101000000000000000000000000000000000000000000000000"
-            "0000000220000000000000280be43cf4"
+            b"0000100a00050101000000000000000000000000000000000000000000000000"
+            b"0000000220000000000000280be43cf4"
         ]
         for i, data in enumerate(refs):
             frame = OmciFrame(hex2raw(data))
@@ -584,8 +589,8 @@
 
     def test_parse_results(self):
         refs = [
-            "00001B0a014c0000008000202020202020202020202020202020202020202020"
-            "2020202020202020000000280be43cf4"
+            b"00001B0a014c0000008000202020202020202020202020202020202020202020"
+            b"2020202020202020000000280be43cf4"
         ]
         for i, data in enumerate(refs):
             frame = OmciFrame(hex2raw(data))
@@ -594,543 +599,543 @@
 
     def test_parsing_mib_upload_next_responses(self):
         refs = [
-            "00032e0a00020000000200008000000000000000000000000000000000000000"
-            "00000000000000000000002828ce00e2",
-            "00042e0a0002000000050101f0002f2f05202020202020202020202020202020"
-            "202020202000000000000028d4eb4bdf",
-            "00052e0a00020000000501010f80202020202020202020202020202020202020"
-            "2020000000000000000000282dbe4b44",
-            "00062e0a0002000000050104f000303001202020202020202020202020202020"
-            "202020202000000000000028ef1b035b",
-            "00072e0a00020000000501040f80202020202020202020202020202020202020"
-            "202000000000000000000028fec29135",
-            "00082e0a0002000000050180f000f8f801202020202020202020202020202020"
-            "202020202000000000000028fd4e0b07",
-            "00092e0a00020000000501800f80202020202020202020202020202020202020"
-            "2020000000000000000000283306b3c0",
-            "000a2e0a0002000000060101f0002f054252434d123456780000000000000000"
-            "00000000000c000000000028585c2083",
-            "000b2e0a00020000000601010f004252434d0000000000000000000000000000"
-            "0000000000000000000000284f0e82b9",
-            "000c2e0a000200000006010100f8202020202020202020202020202020202020"
-            "202000000000000000000028e68bdb63",
-            "000d2e0a00020000000601010004000000000000000000000000000000000000"
-            "00000000000000000000002857bc2730",
-            "000e2e0a0002000000060104f00030014252434d123456780000000000000000"
-            "00000000000c000000000028afe656f5",
-            "000f2e0a00020000000601040f004252434d0000000000000000000000000000"
-            "000000000000000000000028f8f6db74",
-            "00102e0a000200000006010400f8202020202020202020202020202020202020"
-            "202000000800000000000028064fc177",
-            "00112e0a00020000000601040004000000000000000000000000000000000000"
-            "0000000000000000000000285a5c0841",
-            "00122e0a0002000000060180f000f8014252434d123456780000000000000000"
-            "00000000000c0000000000286826eafe",
-            "00132e0a00020000000601800f004252434d0000000000000000000000000000"
-            "0000000000000000000000281c4b7033",
-            "00142e0a000200000006018000f8202020202020202020202020202020202020"
-            "202000084040000000000028ac144eb3",
-            "00152e0a00020000000601800004000000000000000000000000000000000000"
-            "0000000000000000000000280a81a9a7",
-            "00162e0a0002000000070000f0003530323247574f3236363230303301010100"
-            "0000000000000000000000287ea42d51",
-            "00172e0a0002000000070001f0003530323247574f3236363230303300000100"
-            "000000000000000000000028b17f567f",
-            "00182e0a0002000000830000c000202020202020202020202020202020202020"
-            "2020202020200000000000280e7eebaa",
-            "00192e0a00020000008300002000202020202020202020202020202000000000"
-            "000000000000000000000028a95c03b3",
-            "001a2e0a00020000008300001000000000000000000000000000000000000000"
-            "000000000000000000000028f30515a1",
-            "001b2e0a0002000000850000ffe0000000000000000000000000000000000000"
-            "000000000000000000000028764c18de",
-            "001c2e0a0002000000860001c00000001018aaaa000000000000000000000000"
-            "000000000000000000000028ea220ce0",
-            "001d2e0a00020000008600012000000000000000000000000000000000000000"
-            "000000000000000000000028fbdb571a",
-            "001e2e0a00020000008600011f80000000000000000000000000000000000000"
-            "000000000000000000000028c2682282",
-            "001f2e0a00020000008600010078000000000000000000000000000000000000"
-            "0000000000000000000000289c4809b1",
-            "00202e0a00020000008600010004000000000000000000000000000000000000"
-            "000000000000000000000028d174a7d6",
-            "00212e0a00020000008600010002000000000000000000000000000000000000"
-            "0000000000000000000000288f353976",
-            "00222e0a0002000001000000e0004252434d0000000000000000000000000000"
-            "4252434d123456780000002803bbceb6",
-            "00232e0a00020000010000001f80000000000000000000000000000000000000"
-            "0000000000000000000000281b9674db",
-            "00242e0a00020000010000000040000000000000000000000000000000000000"
-            "000000000000000000000028b1050b9b",
-            "00252e0a00020000010000000038000000000000000000000000000003000000"
-            "0000000000000000000000288266645e",
-            "00262e0a0002000001010000f80042564d344b3030425241303931352d303038"
-            "3300b3000001010000000028837d624f",
-            "00272e0a000200000101000007f8000000010020027c85630016000030000000"
-            "00000000000000000000002896c707e1",
-            "00282e0a0002000001068000e00000ff01010000000000000000000000000000"
-            "00000000000000000000002811acb324",
-            "00292e0a0002000001068001e00000ff01010000000000000000000000000000"
-            "00000000000000000000002823ad6aa9",
-            "002a2e0a0002000001068002e00000ff01010000000000000000000000000000"
-            "000000000000000000000028a290efd9",
-            "002b2e0a0002000001068003e00000ff01010000000000000000000000000000"
-            "000000000000000000000028af893357",
-            "002c2e0a0002000001068004e00000ff01010000000000000000000000000000"
-            "000000000000000000000028901141a3",
-            "002d2e0a0002000001068005e00000ff01010000000000000000000000000000"
-            "000000000000000000000028c4398bcc",
-            "002e2e0a0002000001068006e00000ff01010000000000000000000000000000"
-            "000000000000000000000028e60acd99",
-            "002f2e0a0002000001068007e00000ff01010000000000000000000000000000"
-            "0000000000000000000000284b5faf23",
-            "00302e0a0002000001078001ffff01000800300000050900000000ffff000000"
-            "008181000000000000000028bef89455",
-            "00312e0a0002000001080401f000000000000401000000000000000000000000"
-            "0000000000000000000000287dc5183d",
-            "00322e0a0002000001150401fff0000080008000000000040100000000010000"
-            "000000000000000000000028cc0a46a9",
-            "00332e0a0002000001150401000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000288c42acdd",
-            "00342e0a0002000001150402fff0000080008000000000040100010000010000"
-            "000000000000000000000028de9f625a",
-            "00352e0a0002000001150402000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000280587860b",
-            "00362e0a0002000001150403fff0000080008000000000040100020000010000"
-            "000000000000000000000028a49cc820",
-            "00372e0a0002000001150403000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028b4e4a2b9",
-            "00382e0a0002000001150404fff0000080008000000000040100030000010000"
-            "0000000000000000000000288233147b",
-            "00392e0a0002000001150404000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002881b706b0",
-            "003a2e0a0002000001150405fff0000080008000000000040100040000010000"
-            "000000000000000000000028be8efc9f",
-            "003b2e0a0002000001150405000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028d944804b",
-            "003c2e0a0002000001150406fff0000080008000000000040100050000010000"
-            "000000000000000000000028725c3864",
-            "003d2e0a0002000001150406000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000284e2d5cd2",
-            "003e2e0a0002000001150407fff0000080008000000000040100060000010000"
-            "000000000000000000000028464b03ba",
-            "003f2e0a0002000001150407000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000287006cfd0",
-            "00402e0a0002000001150408fff0000080008000000000040100070000010000"
-            "000000000000000000000028cd88ebeb",
-            "00412e0a0002000001150408000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000285a5905e2",
-            "00422e0a0002000001158000fff0000100010000000000800000000000010000"
-            "000000000000000000000028e61b19d1",
-            "00432e0a0002000001158000000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028b0cc5937",
-            "00442e0a0002000001158001fff0000100010000000000800000010000010000"
-            "0000000000000000000000285386bbf2",
-            "00452e0a0002000001158001000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028c06723ab",
-            "00462e0a0002000001158002fff0000100010000000000800000020000010000"
-            "000000000000000000000028ab49704a",
-            "00472e0a0002000001158002000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002857432f25",
-            "00482e0a0002000001158003fff0000100010000000000800000030000010000"
-            "000000000000000000000028b383c057",
-            "00492e0a0002000001158003000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028dca40d66",
-            "004a2e0a0002000001158004fff0000100010000000000800000040000010000"
-            "0000000000000000000000286b7ba0e2",
-            "004b2e0a0002000001158004000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028fd442363",
-            "004c2e0a0002000001158005fff0000100010000000000800000050000010000"
-            "0000000000000000000000280ee9a0b8",
-            "004d2e0a0002000001158005000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028bc1b9843",
-            "004e2e0a0002000001158006fff0000100010000000000800000060000010000"
-            "0000000000000000000000280c535114",
-            "004f2e0a0002000001158006000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002887032f2b",
-            "00502e0a0002000001158007fff0000100010000000000800000070000010000"
-            "000000000000000000000028a77d7f61",
-            "00512e0a0002000001158007000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002835e9f567",
-            "00522e0a0002000001158008fff0000100010000000000800100000000010000"
-            "000000000000000000000028ff4ca94b",
-            "00532e0a0002000001158008000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000281e2f1e33",
-            "00542e0a0002000001158009fff0000100010000000000800100010000010000"
-            "0000000000000000000000283c473db0",
-            "00552e0a0002000001158009000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002869f51dda",
-            "00562e0a000200000115800afff0000100010000000000800100020000010000"
-            "000000000000000000000028046b8feb",
-            "00572e0a000200000115800a000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002868b1495e",
-            "00582e0a000200000115800bfff0000100010000000000800100030000010000"
-            "0000000000000000000000282b927566",
-            "00592e0a000200000115800b000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028cd43de96",
-            "005a2e0a000200000115800cfff0000100010000000000800100040000010000"
-            "000000000000000000000028c49617dd",
-            "005b2e0a000200000115800c000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028fbbb972a",
-            "005c2e0a000200000115800dfff0000100010000000000800100050000010000"
-            "00000000000000000000002893d4c2b5",
-            "005d2e0a000200000115800d000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028dc9d97ca",
-            "005e2e0a000200000115800efff0000100010000000000800100060000010000"
-            "0000000000000000000000280e1ec245",
-            "005f2e0a000200000115800e000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028be3d56f1",
-            "00602e0a000200000115800ffff0000100010000000000800100070000010000"
-            "0000000000000000000000280c046099",
-            "00612e0a000200000115800f000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028d770e4ea",
-            "00622e0a0002000001158010fff0000100010000000000800200000000010000"
-            "0000000000000000000000281b449092",
-            "00632e0a0002000001158010000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000282b7a8604",
-            "00642e0a0002000001158011fff0000100010000000000800200010000010000"
-            "000000000000000000000028ad498068",
-            "00652e0a0002000001158011000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028a114b304",
-            "00662e0a0002000001158012fff0000100010000000000800200020000010000"
-            "000000000000000000000028c091715d",
-            "00672e0a0002000001158012000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028d4ab49e7",
-            "00682e0a0002000001158013fff0000100010000000000800200030000010000"
-            "000000000000000000000028e39dd5dd",
-            "00692e0a0002000001158013000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000288779ebf0",
-            "006a2e0a0002000001158014fff0000100010000000000800200040000010000"
-            "000000000000000000000028c47a741f",
-            "006b2e0a0002000001158014000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028ce765fcd",
-            "006c2e0a0002000001158015fff0000100010000000000800200050000010000"
-            "0000000000000000000000288f732591",
-            "006d2e0a0002000001158015000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028920b6f5e",
-            "006e2e0a0002000001158016fff0000100010000000000800200060000010000"
-            "000000000000000000000028f072e1c3",
-            "006f2e0a0002000001158016000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028b47ea00f",
-            "00702e0a0002000001158017fff0000100010000000000800200070000010000"
-            "00000000000000000000002813461627",
-            "00712e0a0002000001158017000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002809013378",
-            "00722e0a0002000001158018fff0000100010000000000800300000000010000"
-            "0000000000000000000000286168e200",
-            "00732e0a0002000001158018000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028eccc81f7",
-            "00742e0a0002000001158019fff0000100010000000000800300010000010000"
-            "00000000000000000000002855fe8072",
-            "00752e0a0002000001158019000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028c159c496",
-            "00762e0a000200000115801afff0000100010000000000800300020000010000"
-            "00000000000000000000002872652aca",
-            "00772e0a000200000115801a000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000283ba1c255",
-            "00782e0a000200000115801bfff0000100010000000000800300030000010000"
-            "0000000000000000000000286b2ecb95",
-            "00792e0a000200000115801b000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028441fbe05",
-            "007a2e0a000200000115801cfff0000100010000000000800300040000010000"
-            "000000000000000000000028f07ad5d8",
-            "007b2e0a000200000115801c000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028237d6a28",
-            "007c2e0a000200000115801dfff0000100010000000000800300050000010000"
-            "000000000000000000000028e47dfdca",
-            "007d2e0a000200000115801d000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000280ca941be",
-            "007e2e0a000200000115801efff0000100010000000000800300060000010000"
-            "0000000000000000000000283a1ef4d4",
-            "007f2e0a000200000115801e000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000289c905cd5",
-            "00802e0a000200000115801ffff0000100010000000000800300070000010000"
-            "000000000000000000000028384ae4c6",
-            "00812e0a000200000115801f000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028be87eb55",
-            "00822e0a0002000001158020fff0000100010000000000800400000000010000"
-            "000000000000000000000028f0412282",
-            "00832e0a0002000001158020000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028842ada0c",
-            "00842e0a0002000001158021fff0000100010000000000800400010000010000"
-            "000000000000000000000028a6eed1bc",
-            "00852e0a0002000001158021000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000280f3dd903",
-            "00862e0a0002000001158022fff0000100010000000000800400020000010000"
-            "000000000000000000000028474a0823",
-            "00872e0a0002000001158022000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028e00456b3",
-            "00882e0a0002000001158023fff0000100010000000000800400030000010000"
-            "00000000000000000000002851cbe1a6",
-            "00892e0a0002000001158023000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002869a99563",
-            "008a2e0a0002000001158024fff0000100010000000000800400040000010000"
-            "00000000000000000000002867705534",
-            "008b2e0a0002000001158024000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000286f9570c0",
-            "008c2e0a0002000001158025fff0000100010000000000800400050000010000"
-            "000000000000000000000028450ef70e",
-            "008d2e0a0002000001158025000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002847588afa",
-            "008e2e0a0002000001158026fff0000100010000000000800400060000010000"
-            "000000000000000000000028c8218600",
-            "008f2e0a0002000001158026000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028391a6ba7",
-            "00902e0a0002000001158027fff0000100010000000000800400070000010000"
-            "000000000000000000000028afc0878b",
-            "00912e0a0002000001158027000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002819130d66",
-            "00922e0a0002000001158028fff0000100010000000000800500000000010000"
-            "0000000000000000000000289afa4cf7",
-            "00932e0a0002000001158028000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002873a4e20b",
-            "00942e0a0002000001158029fff0000100010000000000800500010000010000"
-            "000000000000000000000028633debd9",
-            "00952e0a0002000001158029000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000280397eb28",
-            "00962e0a000200000115802afff0000100010000000000800500020000010000"
-            "0000000000000000000000280ed5ee7a",
-            "00972e0a000200000115802a000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028f886ba59",
-            "00982e0a000200000115802bfff0000100010000000000800500030000010000"
-            "00000000000000000000002888ff79b1",
-            "00992e0a000200000115802b000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002846baf278",
-            "009a2e0a000200000115802cfff0000100010000000000800500040000010000"
-            "0000000000000000000000281fd1e68f",
-            "009b2e0a000200000115802c000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028d99760f9",
-            "009c2e0a000200000115802dfff0000100010000000000800500050000010000"
-            "000000000000000000000028557aaf84",
-            "009d2e0a000200000115802d000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028064210fd",
-            "009e2e0a000200000115802efff0000100010000000000800500060000010000"
-            "0000000000000000000000285fd6c061",
-            "009f2e0a000200000115802e000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028299efbb5",
-            "00a02e0a000200000115802ffff0000100010000000000800500070000010000"
-            "00000000000000000000002834f127c4",
-            "00a12e0a000200000115802f000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028edd30591",
-            "00a22e0a0002000001158030fff0000100010000000000800600000000010000"
-            "000000000000000000000028183183f2",
-            "00a32e0a0002000001158030000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028a27e71f6",
-            "00a42e0a0002000001158031fff0000100010000000000800600010000010000"
-            "000000000000000000000028bd64dfc0",
-            "00a52e0a0002000001158031000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002839e2f37e",
-            "00a62e0a0002000001158032fff0000100010000000000800600020000010000"
-            "0000000000000000000000283e72282e",
-            "00a72e0a0002000001158032000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028cef19baa",
-            "00a82e0a0002000001158033fff0000100010000000000800600030000010000"
-            "0000000000000000000000281c1caf44",
-            "00a92e0a0002000001158033000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002814712e27",
-            "00aa2e0a0002000001158034fff0000100010000000000800600040000010000"
-            "000000000000000000000028f02a30a4",
-            "00ab2e0a0002000001158034000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028068fcbf5",
-            "00ac2e0a0002000001158035fff0000100010000000000800600050000010000"
-            "000000000000000000000028436bd783",
-            "00ad2e0a0002000001158035000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000288da3200f",
-            "00ae2e0a0002000001158036fff0000100010000000000800600060000010000"
-            "000000000000000000000028c26a02ca",
-            "00af2e0a0002000001158036000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028147a41ee",
-            "00b02e0a0002000001158037fff0000100010000000000800600070000010000"
-            "0000000000000000000000287c2bbec0",
-            "00b12e0a0002000001158037000f0200020002000200ffff0900000000000000"
-            "0000000000000000000000284c86c11f",
-            "00b22e0a0002000001158038fff0000100010000000000800700000000010000"
-            "00000000000000000000002895b94e06",
-            "00b32e0a0002000001158038000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028a2b34012",
-            "00b42e0a0002000001158039fff0000100010000000000800700010000010000"
-            "00000000000000000000002804b205a3",
-            "00b52e0a0002000001158039000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002886856d76",
-            "00b62e0a000200000115803afff0000100010000000000800700020000010000"
-            "0000000000000000000000282a22752c",
-            "00b72e0a000200000115803a000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028488e67db",
-            "00b82e0a000200000115803bfff0000100010000000000800700030000010000"
-            "000000000000000000000028a55f79ea",
-            "00b92e0a000200000115803b000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002842d77ba7",
-            "00ba2e0a000200000115803cfff0000100010000000000800700040000010000"
-            "000000000000000000000028da65268a",
-            "00bb2e0a000200000115803c000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028c58443ec",
-            "00bc2e0a000200000115803dfff0000100010000000000800700050000010000"
-            "000000000000000000000028997aca59",
-            "00bd2e0a000200000115803d000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028a2670b7d",
-            "00be2e0a000200000115803efff0000100010000000000800700060000010000"
-            "00000000000000000000002813e904cb",
-            "00bf2e0a000200000115803e000f0200020002000200ffff0900000000000000"
-            "000000000000000000000028c387a9e5",
-            "00c02e0a000200000115803ffff0000100010000000000800700070000010000"
-            "000000000000000000000028d556a6b2",
-            "00c12e0a000200000115803f000f0200020002000200ffff0900000000000000"
-            "00000000000000000000002868d9961a",
-            "00c22e0a0002000001168000f000800000000200000000000000000000000000"
-            "000000000000000000000028b69b53c1",
-            "00c32e0a0002000001168001f000800000000200000000000000000000000000"
-            "000000000000000000000028537705d4",
-            "00c42e0a0002000001168002f000800000000200000000000000000000000000"
-            "000000000000000000000028db171b7b",
-            "00c52e0a0002000001168003f000800000000200000000000000000000000000"
-            "000000000000000000000028f9b3fa54",
-            "00c62e0a0002000001168004f000800000000200000000000000000000000000"
-            "000000000000000000000028cdacda4e",
-            "00c72e0a0002000001168005f000800000000200000000000000000000000000"
-            "00000000000000000000002837133b6e",
-            "00c82e0a0002000001168006f000800000000200000000000000000000000000"
-            "000000000000000000000028d6447905",
-            "00c92e0a0002000001168007f000800000000200000000000000000000000000"
-            "000000000000000000000028021a3910",
-            "00ca2e0a0002000001168008f000800100000200000000000000000000000000"
-            "00000000000000000000002835d3cf43",
-            "00cb2e0a0002000001168009f000800100000200000000000000000000000000"
-            "00000000000000000000002887ad76fc",
-            "00cc2e0a000200000116800af000800100000200000000000000000000000000"
-            "00000000000000000000002895e3d838",
-            "00cd2e0a000200000116800bf000800100000200000000000000000000000000"
-            "000000000000000000000028a07489ac",
-            "00ce2e0a000200000116800cf000800100000200000000000000000000000000"
-            "0000000000000000000000285d08821d",
-            "00cf2e0a000200000116800df000800100000200000000000000000000000000"
-            "000000000000000000000028302249a4",
-            "00d02e0a000200000116800ef000800100000200000000000000000000000000"
-            "0000000000000000000000283966d3bc",
-            "00d12e0a000200000116800ff000800100000200000000000000000000000000"
-            "0000000000000000000000289519cdb5",
-            "00d22e0a0002000001168010f000800200000200000000000000000000000000"
-            "0000000000000000000000281bc99b7b",
-            "00d32e0a0002000001168011f000800200000200000000000000000000000000"
-            "000000000000000000000028e483b1a0",
-            "00d42e0a0002000001168012f000800200000200000000000000000000000000"
-            "0000000000000000000000286885d8bd",
-            "00d52e0a0002000001168013f000800200000200000000000000000000000000"
-            "000000000000000000000028cbe7afd8",
-            "00d62e0a0002000001168014f000800200000200000000000000000000000000"
-            "00000000000000000000002809009846",
-            "00d72e0a0002000001168015f000800200000200000000000000000000000000"
-            "0000000000000000000000285bee86c4",
-            "00d82e0a0002000001168016f000800200000200000000000000000000000000"
-            "0000000000000000000000281f25725c",
-            "00d92e0a0002000001168017f000800200000200000000000000000000000000"
-            "00000000000000000000002872e94fe1",
-            "00da2e0a0002000001168018f000800300000200000000000000000000000000"
-            "000000000000000000000028e39d572f",
-            "00db2e0a0002000001168019f000800300000200000000000000000000000000"
-            "0000000000000000000000281c9dcadd",
-            "00dc2e0a000200000116801af000800300000200000000000000000000000000"
-            "0000000000000000000000287c5b8405",
-            "00dd2e0a000200000116801bf000800300000200000000000000000000000000"
-            "00000000000000000000002826334420",
-            "00de2e0a000200000116801cf000800300000200000000000000000000000000"
-            "00000000000000000000002871ee1536",
-            "00df2e0a000200000116801df000800300000200000000000000000000000000"
-            "0000000000000000000000289dfeeeb9",
-            "00e02e0a000200000116801ef000800300000200000000000000000000000000"
-            "000000000000000000000028954d55b3",
-            "00e12e0a000200000116801ff000800300000200000000000000000000000000"
-            "000000000000000000000028930c564e",
-            "00e22e0a0002000001168020f000800400000200000000000000000000000000"
-            "000000000000000000000028b9cec3bf",
-            "00e32e0a0002000001168021f000800400000200000000000000000000000000"
-            "0000000000000000000000284263f268",
-            "00e42e0a0002000001168022f000800400000200000000000000000000000000"
-            "000000000000000000000028913e5219",
-            "00e52e0a0002000001168023f000800400000200000000000000000000000000"
-            "000000000000000000000028efe86fe1",
-            "00e62e0a0002000001168024f000800400000200000000000000000000000000"
-            "000000000000000000000028deb045df",
-            "00e72e0a0002000001168025f000800400000200000000000000000000000000"
-            "000000000000000000000028255bcd32",
-            "00e82e0a0002000001168026f000800400000200000000000000000000000000"
-            "000000000000000000000028355392ad",
-            "00e92e0a0002000001168027f000800400000200000000000000000000000000"
-            "000000000000000000000028404a6aca",
-            "00ea2e0a0002000001168028f000800500000200000000000000000000000000"
-            "0000000000000000000000281de78f94",
-            "00eb2e0a0002000001168029f000800500000200000000000000000000000000"
-            "000000000000000000000028501a3aae",
-            "00ec2e0a000200000116802af000800500000200000000000000000000000000"
-            "0000000000000000000000282947d976",
-            "00ed2e0a000200000116802bf000800500000200000000000000000000000000"
-            "000000000000000000000028095cfe0d",
-            "00ee2e0a000200000116802cf000800500000200000000000000000000000000"
-            "000000000000000000000028bbcfc27a",
-            "00ef2e0a000200000116802df000800500000200000000000000000000000000"
-            "000000000000000000000028dbb27396",
-            "00f02e0a000200000116802ef000800500000200000000000000000000000000"
-            "000000000000000000000028dbe9b225",
-            "00f12e0a000200000116802ff000800500000200000000000000000000000000"
-            "000000000000000000000028840c0b08",
-            "00f22e0a0002000001168030f000800600000200000000000000000000000000"
-            "0000000000000000000000287683e4f8",
-            "00f32e0a0002000001168031f000800600000200000000000000000000000000"
-            "00000000000000000000002844d131d1",
-            "00f42e0a0002000001168032f000800600000200000000000000000000000000"
-            "0000000000000000000000284d2c2c6d",
-            "00f52e0a0002000001168033f000800600000200000000000000000000000000"
-            "000000000000000000000028e89a166c",
-            "00f62e0a0002000001168034f000800600000200000000000000000000000000"
-            "0000000000000000000000280f47db8c",
-            "00f72e0a0002000001168035f000800600000200000000000000000000000000"
-            "0000000000000000000000283ede8b3e",
-            "00f82e0a0002000001168036f000800600000200000000000000000000000000"
-            "000000000000000000000028580547db",
-            "00f92e0a0002000001168037f000800600000200000000000000000000000000"
-            "000000000000000000000028d72a270e",
-            "00fa2e0a0002000001168038f000800700000200000000000000000000000000"
-            "000000000000000000000028c25ce712",
-            "00fb2e0a0002000001168039f000800700000200000000000000000000000000"
-            "000000000000000000000028b908637e",
-            "00fc2e0a000200000116803af000800700000200000000000000000000000000"
-            "0000000000000000000000285b66e6fa",
-            "00fd2e0a000200000116803bf000800700000200000000000000000000000000"
-            "00000000000000000000002855c10393",
-            "00fe2e0a000200000116803cf000800700000200000000000000000000000000"
-            "0000000000000000000000283e94c57d",
-            "00ff2e0a000200000116803df000800700000200000000000000000000000000"
-            "0000000000000000000000284347e7f0",
-            "01002e0a000200000116803ef000800700000200000000000000000000000000"
-            "000000000000000000000028be66429d",
-            "01012e0a000200000116803ff000800700000200000000000000000000000000"
-            "0000000000000000000000284f7db145",
-            "01022e0a0002000001490401c000000000000000000000000000000000000000"
-            "000000000000000000000028470aa043",
-            "01032e0a00020000014904012000000000000000000000000000000000000000"
-            "000000000000000000000028a6bc6e48",
-            "01042e0a00020000014904011800ffffffff0000000000000000000000000000"
-            "000000000000000000000028f747c739",
+            b"00032e0a00020000000200008000000000000000000000000000000000000000"
+            b"00000000000000000000002828ce00e2",
+            b"00042e0a0002000000050101f0002f2f05202020202020202020202020202020"
+            b"202020202000000000000028d4eb4bdf",
+            b"00052e0a00020000000501010f80202020202020202020202020202020202020"
+            b"2020000000000000000000282dbe4b44",
+            b"00062e0a0002000000050104f000303001202020202020202020202020202020"
+            b"202020202000000000000028ef1b035b",
+            b"00072e0a00020000000501040f80202020202020202020202020202020202020"
+            b"202000000000000000000028fec29135",
+            b"00082e0a0002000000050180f000f8f801202020202020202020202020202020"
+            b"202020202000000000000028fd4e0b07",
+            b"00092e0a00020000000501800f80202020202020202020202020202020202020"
+            b"2020000000000000000000283306b3c0",
+            b"000a2e0a0002000000060101f0002f054252434d123456780000000000000000"
+            b"00000000000c000000000028585c2083",
+            b"000b2e0a00020000000601010f004252434d0000000000000000000000000000"
+            b"0000000000000000000000284f0e82b9",
+            b"000c2e0a000200000006010100f8202020202020202020202020202020202020"
+            b"202000000000000000000028e68bdb63",
+            b"000d2e0a00020000000601010004000000000000000000000000000000000000"
+            b"00000000000000000000002857bc2730",
+            b"000e2e0a0002000000060104f00030014252434d123456780000000000000000"
+            b"00000000000c000000000028afe656f5",
+            b"000f2e0a00020000000601040f004252434d0000000000000000000000000000"
+            b"000000000000000000000028f8f6db74",
+            b"00102e0a000200000006010400f8202020202020202020202020202020202020"
+            b"202000000800000000000028064fc177",
+            b"00112e0a00020000000601040004000000000000000000000000000000000000"
+            b"0000000000000000000000285a5c0841",
+            b"00122e0a0002000000060180f000f8014252434d123456780000000000000000"
+            b"00000000000c0000000000286826eafe",
+            b"00132e0a00020000000601800f004252434d0000000000000000000000000000"
+            b"0000000000000000000000281c4b7033",
+            b"00142e0a000200000006018000f8202020202020202020202020202020202020"
+            b"202000084040000000000028ac144eb3",
+            b"00152e0a00020000000601800004000000000000000000000000000000000000"
+            b"0000000000000000000000280a81a9a7",
+            b"00162e0a0002000000070000f0003530323247574f3236363230303301010100"
+            b"0000000000000000000000287ea42d51",
+            b"00172e0a0002000000070001f0003530323247574f3236363230303300000100"
+            b"000000000000000000000028b17f567f",
+            b"00182e0a0002000000830000c000202020202020202020202020202020202020"
+            b"2020202020200000000000280e7eebaa",
+            b"00192e0a00020000008300002000202020202020202020202020202000000000"
+            b"000000000000000000000028a95c03b3",
+            b"001a2e0a00020000008300001000000000000000000000000000000000000000"
+            b"000000000000000000000028f30515a1",
+            b"001b2e0a0002000000850000ffe0000000000000000000000000000000000000"
+            b"000000000000000000000028764c18de",
+            b"001c2e0a0002000000860001c00000001018aaaa000000000000000000000000"
+            b"000000000000000000000028ea220ce0",
+            b"001d2e0a00020000008600012000000000000000000000000000000000000000"
+            b"000000000000000000000028fbdb571a",
+            b"001e2e0a00020000008600011f80000000000000000000000000000000000000"
+            b"000000000000000000000028c2682282",
+            b"001f2e0a00020000008600010078000000000000000000000000000000000000"
+            b"0000000000000000000000289c4809b1",
+            b"00202e0a00020000008600010004000000000000000000000000000000000000"
+            b"000000000000000000000028d174a7d6",
+            b"00212e0a00020000008600010002000000000000000000000000000000000000"
+            b"0000000000000000000000288f353976",
+            b"00222e0a0002000001000000e0004252434d0000000000000000000000000000"
+            b"4252434d123456780000002803bbceb6",
+            b"00232e0a00020000010000001f80000000000000000000000000000000000000"
+            b"0000000000000000000000281b9674db",
+            b"00242e0a00020000010000000040000000000000000000000000000000000000"
+            b"000000000000000000000028b1050b9b",
+            b"00252e0a00020000010000000038000000000000000000000000000003000000"
+            b"0000000000000000000000288266645e",
+            b"00262e0a0002000001010000f80042564d344b3030425241303931352d303038"
+            b"3300b3000001010000000028837d624f",
+            b"00272e0a000200000101000007f8000000010020027c85630016000030000000"
+            b"00000000000000000000002896c707e1",
+            b"00282e0a0002000001068000e00000ff01010000000000000000000000000000"
+            b"00000000000000000000002811acb324",
+            b"00292e0a0002000001068001e00000ff01010000000000000000000000000000"
+            b"00000000000000000000002823ad6aa9",
+            b"002a2e0a0002000001068002e00000ff01010000000000000000000000000000"
+            b"000000000000000000000028a290efd9",
+            b"002b2e0a0002000001068003e00000ff01010000000000000000000000000000"
+            b"000000000000000000000028af893357",
+            b"002c2e0a0002000001068004e00000ff01010000000000000000000000000000"
+            b"000000000000000000000028901141a3",
+            b"002d2e0a0002000001068005e00000ff01010000000000000000000000000000"
+            b"000000000000000000000028c4398bcc",
+            b"002e2e0a0002000001068006e00000ff01010000000000000000000000000000"
+            b"000000000000000000000028e60acd99",
+            b"002f2e0a0002000001068007e00000ff01010000000000000000000000000000"
+            b"0000000000000000000000284b5faf23",
+            b"00302e0a0002000001078001ffff01000800300000050900000000ffff000000"
+            b"008181000000000000000028bef89455",
+            b"00312e0a0002000001080401f000000000000401000000000000000000000000"
+            b"0000000000000000000000287dc5183d",
+            b"00322e0a0002000001150401fff0000080008000000000040100000000010000"
+            b"000000000000000000000028cc0a46a9",
+            b"00332e0a0002000001150401000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000288c42acdd",
+            b"00342e0a0002000001150402fff0000080008000000000040100010000010000"
+            b"000000000000000000000028de9f625a",
+            b"00352e0a0002000001150402000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000280587860b",
+            b"00362e0a0002000001150403fff0000080008000000000040100020000010000"
+            b"000000000000000000000028a49cc820",
+            b"00372e0a0002000001150403000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028b4e4a2b9",
+            b"00382e0a0002000001150404fff0000080008000000000040100030000010000"
+            b"0000000000000000000000288233147b",
+            b"00392e0a0002000001150404000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002881b706b0",
+            b"003a2e0a0002000001150405fff0000080008000000000040100040000010000"
+            b"000000000000000000000028be8efc9f",
+            b"003b2e0a0002000001150405000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028d944804b",
+            b"003c2e0a0002000001150406fff0000080008000000000040100050000010000"
+            b"000000000000000000000028725c3864",
+            b"003d2e0a0002000001150406000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000284e2d5cd2",
+            b"003e2e0a0002000001150407fff0000080008000000000040100060000010000"
+            b"000000000000000000000028464b03ba",
+            b"003f2e0a0002000001150407000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000287006cfd0",
+            b"00402e0a0002000001150408fff0000080008000000000040100070000010000"
+            b"000000000000000000000028cd88ebeb",
+            b"00412e0a0002000001150408000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000285a5905e2",
+            b"00422e0a0002000001158000fff0000100010000000000800000000000010000"
+            b"000000000000000000000028e61b19d1",
+            b"00432e0a0002000001158000000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028b0cc5937",
+            b"00442e0a0002000001158001fff0000100010000000000800000010000010000"
+            b"0000000000000000000000285386bbf2",
+            b"00452e0a0002000001158001000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028c06723ab",
+            b"00462e0a0002000001158002fff0000100010000000000800000020000010000"
+            b"000000000000000000000028ab49704a",
+            b"00472e0a0002000001158002000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002857432f25",
+            b"00482e0a0002000001158003fff0000100010000000000800000030000010000"
+            b"000000000000000000000028b383c057",
+            b"00492e0a0002000001158003000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028dca40d66",
+            b"004a2e0a0002000001158004fff0000100010000000000800000040000010000"
+            b"0000000000000000000000286b7ba0e2",
+            b"004b2e0a0002000001158004000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028fd442363",
+            b"004c2e0a0002000001158005fff0000100010000000000800000050000010000"
+            b"0000000000000000000000280ee9a0b8",
+            b"004d2e0a0002000001158005000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028bc1b9843",
+            b"004e2e0a0002000001158006fff0000100010000000000800000060000010000"
+            b"0000000000000000000000280c535114",
+            b"004f2e0a0002000001158006000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002887032f2b",
+            b"00502e0a0002000001158007fff0000100010000000000800000070000010000"
+            b"000000000000000000000028a77d7f61",
+            b"00512e0a0002000001158007000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002835e9f567",
+            b"00522e0a0002000001158008fff0000100010000000000800100000000010000"
+            b"000000000000000000000028ff4ca94b",
+            b"00532e0a0002000001158008000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000281e2f1e33",
+            b"00542e0a0002000001158009fff0000100010000000000800100010000010000"
+            b"0000000000000000000000283c473db0",
+            b"00552e0a0002000001158009000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002869f51dda",
+            b"00562e0a000200000115800afff0000100010000000000800100020000010000"
+            b"000000000000000000000028046b8feb",
+            b"00572e0a000200000115800a000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002868b1495e",
+            b"00582e0a000200000115800bfff0000100010000000000800100030000010000"
+            b"0000000000000000000000282b927566",
+            b"00592e0a000200000115800b000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028cd43de96",
+            b"005a2e0a000200000115800cfff0000100010000000000800100040000010000"
+            b"000000000000000000000028c49617dd",
+            b"005b2e0a000200000115800c000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028fbbb972a",
+            b"005c2e0a000200000115800dfff0000100010000000000800100050000010000"
+            b"00000000000000000000002893d4c2b5",
+            b"005d2e0a000200000115800d000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028dc9d97ca",
+            b"005e2e0a000200000115800efff0000100010000000000800100060000010000"
+            b"0000000000000000000000280e1ec245",
+            b"005f2e0a000200000115800e000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028be3d56f1",
+            b"00602e0a000200000115800ffff0000100010000000000800100070000010000"
+            b"0000000000000000000000280c046099",
+            b"00612e0a000200000115800f000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028d770e4ea",
+            b"00622e0a0002000001158010fff0000100010000000000800200000000010000"
+            b"0000000000000000000000281b449092",
+            b"00632e0a0002000001158010000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000282b7a8604",
+            b"00642e0a0002000001158011fff0000100010000000000800200010000010000"
+            b"000000000000000000000028ad498068",
+            b"00652e0a0002000001158011000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028a114b304",
+            b"00662e0a0002000001158012fff0000100010000000000800200020000010000"
+            b"000000000000000000000028c091715d",
+            b"00672e0a0002000001158012000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028d4ab49e7",
+            b"00682e0a0002000001158013fff0000100010000000000800200030000010000"
+            b"000000000000000000000028e39dd5dd",
+            b"00692e0a0002000001158013000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000288779ebf0",
+            b"006a2e0a0002000001158014fff0000100010000000000800200040000010000"
+            b"000000000000000000000028c47a741f",
+            b"006b2e0a0002000001158014000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028ce765fcd",
+            b"006c2e0a0002000001158015fff0000100010000000000800200050000010000"
+            b"0000000000000000000000288f732591",
+            b"006d2e0a0002000001158015000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028920b6f5e",
+            b"006e2e0a0002000001158016fff0000100010000000000800200060000010000"
+            b"000000000000000000000028f072e1c3",
+            b"006f2e0a0002000001158016000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028b47ea00f",
+            b"00702e0a0002000001158017fff0000100010000000000800200070000010000"
+            b"00000000000000000000002813461627",
+            b"00712e0a0002000001158017000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002809013378",
+            b"00722e0a0002000001158018fff0000100010000000000800300000000010000"
+            b"0000000000000000000000286168e200",
+            b"00732e0a0002000001158018000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028eccc81f7",
+            b"00742e0a0002000001158019fff0000100010000000000800300010000010000"
+            b"00000000000000000000002855fe8072",
+            b"00752e0a0002000001158019000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028c159c496",
+            b"00762e0a000200000115801afff0000100010000000000800300020000010000"
+            b"00000000000000000000002872652aca",
+            b"00772e0a000200000115801a000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000283ba1c255",
+            b"00782e0a000200000115801bfff0000100010000000000800300030000010000"
+            b"0000000000000000000000286b2ecb95",
+            b"00792e0a000200000115801b000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028441fbe05",
+            b"007a2e0a000200000115801cfff0000100010000000000800300040000010000"
+            b"000000000000000000000028f07ad5d8",
+            b"007b2e0a000200000115801c000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028237d6a28",
+            b"007c2e0a000200000115801dfff0000100010000000000800300050000010000"
+            b"000000000000000000000028e47dfdca",
+            b"007d2e0a000200000115801d000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000280ca941be",
+            b"007e2e0a000200000115801efff0000100010000000000800300060000010000"
+            b"0000000000000000000000283a1ef4d4",
+            b"007f2e0a000200000115801e000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000289c905cd5",
+            b"00802e0a000200000115801ffff0000100010000000000800300070000010000"
+            b"000000000000000000000028384ae4c6",
+            b"00812e0a000200000115801f000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028be87eb55",
+            b"00822e0a0002000001158020fff0000100010000000000800400000000010000"
+            b"000000000000000000000028f0412282",
+            b"00832e0a0002000001158020000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028842ada0c",
+            b"00842e0a0002000001158021fff0000100010000000000800400010000010000"
+            b"000000000000000000000028a6eed1bc",
+            b"00852e0a0002000001158021000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000280f3dd903",
+            b"00862e0a0002000001158022fff0000100010000000000800400020000010000"
+            b"000000000000000000000028474a0823",
+            b"00872e0a0002000001158022000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028e00456b3",
+            b"00882e0a0002000001158023fff0000100010000000000800400030000010000"
+            b"00000000000000000000002851cbe1a6",
+            b"00892e0a0002000001158023000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002869a99563",
+            b"008a2e0a0002000001158024fff0000100010000000000800400040000010000"
+            b"00000000000000000000002867705534",
+            b"008b2e0a0002000001158024000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000286f9570c0",
+            b"008c2e0a0002000001158025fff0000100010000000000800400050000010000"
+            b"000000000000000000000028450ef70e",
+            b"008d2e0a0002000001158025000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002847588afa",
+            b"008e2e0a0002000001158026fff0000100010000000000800400060000010000"
+            b"000000000000000000000028c8218600",
+            b"008f2e0a0002000001158026000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028391a6ba7",
+            b"00902e0a0002000001158027fff0000100010000000000800400070000010000"
+            b"000000000000000000000028afc0878b",
+            b"00912e0a0002000001158027000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002819130d66",
+            b"00922e0a0002000001158028fff0000100010000000000800500000000010000"
+            b"0000000000000000000000289afa4cf7",
+            b"00932e0a0002000001158028000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002873a4e20b",
+            b"00942e0a0002000001158029fff0000100010000000000800500010000010000"
+            b"000000000000000000000028633debd9",
+            b"00952e0a0002000001158029000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000280397eb28",
+            b"00962e0a000200000115802afff0000100010000000000800500020000010000"
+            b"0000000000000000000000280ed5ee7a",
+            b"00972e0a000200000115802a000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028f886ba59",
+            b"00982e0a000200000115802bfff0000100010000000000800500030000010000"
+            b"00000000000000000000002888ff79b1",
+            b"00992e0a000200000115802b000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002846baf278",
+            b"009a2e0a000200000115802cfff0000100010000000000800500040000010000"
+            b"0000000000000000000000281fd1e68f",
+            b"009b2e0a000200000115802c000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028d99760f9",
+            b"009c2e0a000200000115802dfff0000100010000000000800500050000010000"
+            b"000000000000000000000028557aaf84",
+            b"009d2e0a000200000115802d000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028064210fd",
+            b"009e2e0a000200000115802efff0000100010000000000800500060000010000"
+            b"0000000000000000000000285fd6c061",
+            b"009f2e0a000200000115802e000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028299efbb5",
+            b"00a02e0a000200000115802ffff0000100010000000000800500070000010000"
+            b"00000000000000000000002834f127c4",
+            b"00a12e0a000200000115802f000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028edd30591",
+            b"00a22e0a0002000001158030fff0000100010000000000800600000000010000"
+            b"000000000000000000000028183183f2",
+            b"00a32e0a0002000001158030000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028a27e71f6",
+            b"00a42e0a0002000001158031fff0000100010000000000800600010000010000"
+            b"000000000000000000000028bd64dfc0",
+            b"00a52e0a0002000001158031000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002839e2f37e",
+            b"00a62e0a0002000001158032fff0000100010000000000800600020000010000"
+            b"0000000000000000000000283e72282e",
+            b"00a72e0a0002000001158032000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028cef19baa",
+            b"00a82e0a0002000001158033fff0000100010000000000800600030000010000"
+            b"0000000000000000000000281c1caf44",
+            b"00a92e0a0002000001158033000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002814712e27",
+            b"00aa2e0a0002000001158034fff0000100010000000000800600040000010000"
+            b"000000000000000000000028f02a30a4",
+            b"00ab2e0a0002000001158034000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028068fcbf5",
+            b"00ac2e0a0002000001158035fff0000100010000000000800600050000010000"
+            b"000000000000000000000028436bd783",
+            b"00ad2e0a0002000001158035000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000288da3200f",
+            b"00ae2e0a0002000001158036fff0000100010000000000800600060000010000"
+            b"000000000000000000000028c26a02ca",
+            b"00af2e0a0002000001158036000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028147a41ee",
+            b"00b02e0a0002000001158037fff0000100010000000000800600070000010000"
+            b"0000000000000000000000287c2bbec0",
+            b"00b12e0a0002000001158037000f0200020002000200ffff0900000000000000"
+            b"0000000000000000000000284c86c11f",
+            b"00b22e0a0002000001158038fff0000100010000000000800700000000010000"
+            b"00000000000000000000002895b94e06",
+            b"00b32e0a0002000001158038000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028a2b34012",
+            b"00b42e0a0002000001158039fff0000100010000000000800700010000010000"
+            b"00000000000000000000002804b205a3",
+            b"00b52e0a0002000001158039000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002886856d76",
+            b"00b62e0a000200000115803afff0000100010000000000800700020000010000"
+            b"0000000000000000000000282a22752c",
+            b"00b72e0a000200000115803a000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028488e67db",
+            b"00b82e0a000200000115803bfff0000100010000000000800700030000010000"
+            b"000000000000000000000028a55f79ea",
+            b"00b92e0a000200000115803b000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002842d77ba7",
+            b"00ba2e0a000200000115803cfff0000100010000000000800700040000010000"
+            b"000000000000000000000028da65268a",
+            b"00bb2e0a000200000115803c000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028c58443ec",
+            b"00bc2e0a000200000115803dfff0000100010000000000800700050000010000"
+            b"000000000000000000000028997aca59",
+            b"00bd2e0a000200000115803d000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028a2670b7d",
+            b"00be2e0a000200000115803efff0000100010000000000800700060000010000"
+            b"00000000000000000000002813e904cb",
+            b"00bf2e0a000200000115803e000f0200020002000200ffff0900000000000000"
+            b"000000000000000000000028c387a9e5",
+            b"00c02e0a000200000115803ffff0000100010000000000800700070000010000"
+            b"000000000000000000000028d556a6b2",
+            b"00c12e0a000200000115803f000f0200020002000200ffff0900000000000000"
+            b"00000000000000000000002868d9961a",
+            b"00c22e0a0002000001168000f000800000000200000000000000000000000000"
+            b"000000000000000000000028b69b53c1",
+            b"00c32e0a0002000001168001f000800000000200000000000000000000000000"
+            b"000000000000000000000028537705d4",
+            b"00c42e0a0002000001168002f000800000000200000000000000000000000000"
+            b"000000000000000000000028db171b7b",
+            b"00c52e0a0002000001168003f000800000000200000000000000000000000000"
+            b"000000000000000000000028f9b3fa54",
+            b"00c62e0a0002000001168004f000800000000200000000000000000000000000"
+            b"000000000000000000000028cdacda4e",
+            b"00c72e0a0002000001168005f000800000000200000000000000000000000000"
+            b"00000000000000000000002837133b6e",
+            b"00c82e0a0002000001168006f000800000000200000000000000000000000000"
+            b"000000000000000000000028d6447905",
+            b"00c92e0a0002000001168007f000800000000200000000000000000000000000"
+            b"000000000000000000000028021a3910",
+            b"00ca2e0a0002000001168008f000800100000200000000000000000000000000"
+            b"00000000000000000000002835d3cf43",
+            b"00cb2e0a0002000001168009f000800100000200000000000000000000000000"
+            b"00000000000000000000002887ad76fc",
+            b"00cc2e0a000200000116800af000800100000200000000000000000000000000"
+            b"00000000000000000000002895e3d838",
+            b"00cd2e0a000200000116800bf000800100000200000000000000000000000000"
+            b"000000000000000000000028a07489ac",
+            b"00ce2e0a000200000116800cf000800100000200000000000000000000000000"
+            b"0000000000000000000000285d08821d",
+            b"00cf2e0a000200000116800df000800100000200000000000000000000000000"
+            b"000000000000000000000028302249a4",
+            b"00d02e0a000200000116800ef000800100000200000000000000000000000000"
+            b"0000000000000000000000283966d3bc",
+            b"00d12e0a000200000116800ff000800100000200000000000000000000000000"
+            b"0000000000000000000000289519cdb5",
+            b"00d22e0a0002000001168010f000800200000200000000000000000000000000"
+            b"0000000000000000000000281bc99b7b",
+            b"00d32e0a0002000001168011f000800200000200000000000000000000000000"
+            b"000000000000000000000028e483b1a0",
+            b"00d42e0a0002000001168012f000800200000200000000000000000000000000"
+            b"0000000000000000000000286885d8bd",
+            b"00d52e0a0002000001168013f000800200000200000000000000000000000000"
+            b"000000000000000000000028cbe7afd8",
+            b"00d62e0a0002000001168014f000800200000200000000000000000000000000"
+            b"00000000000000000000002809009846",
+            b"00d72e0a0002000001168015f000800200000200000000000000000000000000"
+            b"0000000000000000000000285bee86c4",
+            b"00d82e0a0002000001168016f000800200000200000000000000000000000000"
+            b"0000000000000000000000281f25725c",
+            b"00d92e0a0002000001168017f000800200000200000000000000000000000000"
+            b"00000000000000000000002872e94fe1",
+            b"00da2e0a0002000001168018f000800300000200000000000000000000000000"
+            b"000000000000000000000028e39d572f",
+            b"00db2e0a0002000001168019f000800300000200000000000000000000000000"
+            b"0000000000000000000000281c9dcadd",
+            b"00dc2e0a000200000116801af000800300000200000000000000000000000000"
+            b"0000000000000000000000287c5b8405",
+            b"00dd2e0a000200000116801bf000800300000200000000000000000000000000"
+            b"00000000000000000000002826334420",
+            b"00de2e0a000200000116801cf000800300000200000000000000000000000000"
+            b"00000000000000000000002871ee1536",
+            b"00df2e0a000200000116801df000800300000200000000000000000000000000"
+            b"0000000000000000000000289dfeeeb9",
+            b"00e02e0a000200000116801ef000800300000200000000000000000000000000"
+            b"000000000000000000000028954d55b3",
+            b"00e12e0a000200000116801ff000800300000200000000000000000000000000"
+            b"000000000000000000000028930c564e",
+            b"00e22e0a0002000001168020f000800400000200000000000000000000000000"
+            b"000000000000000000000028b9cec3bf",
+            b"00e32e0a0002000001168021f000800400000200000000000000000000000000"
+            b"0000000000000000000000284263f268",
+            b"00e42e0a0002000001168022f000800400000200000000000000000000000000"
+            b"000000000000000000000028913e5219",
+            b"00e52e0a0002000001168023f000800400000200000000000000000000000000"
+            b"000000000000000000000028efe86fe1",
+            b"00e62e0a0002000001168024f000800400000200000000000000000000000000"
+            b"000000000000000000000028deb045df",
+            b"00e72e0a0002000001168025f000800400000200000000000000000000000000"
+            b"000000000000000000000028255bcd32",
+            b"00e82e0a0002000001168026f000800400000200000000000000000000000000"
+            b"000000000000000000000028355392ad",
+            b"00e92e0a0002000001168027f000800400000200000000000000000000000000"
+            b"000000000000000000000028404a6aca",
+            b"00ea2e0a0002000001168028f000800500000200000000000000000000000000"
+            b"0000000000000000000000281de78f94",
+            b"00eb2e0a0002000001168029f000800500000200000000000000000000000000"
+            b"000000000000000000000028501a3aae",
+            b"00ec2e0a000200000116802af000800500000200000000000000000000000000"
+            b"0000000000000000000000282947d976",
+            b"00ed2e0a000200000116802bf000800500000200000000000000000000000000"
+            b"000000000000000000000028095cfe0d",
+            b"00ee2e0a000200000116802cf000800500000200000000000000000000000000"
+            b"000000000000000000000028bbcfc27a",
+            b"00ef2e0a000200000116802df000800500000200000000000000000000000000"
+            b"000000000000000000000028dbb27396",
+            b"00f02e0a000200000116802ef000800500000200000000000000000000000000"
+            b"000000000000000000000028dbe9b225",
+            b"00f12e0a000200000116802ff000800500000200000000000000000000000000"
+            b"000000000000000000000028840c0b08",
+            b"00f22e0a0002000001168030f000800600000200000000000000000000000000"
+            b"0000000000000000000000287683e4f8",
+            b"00f32e0a0002000001168031f000800600000200000000000000000000000000"
+            b"00000000000000000000002844d131d1",
+            b"00f42e0a0002000001168032f000800600000200000000000000000000000000"
+            b"0000000000000000000000284d2c2c6d",
+            b"00f52e0a0002000001168033f000800600000200000000000000000000000000"
+            b"000000000000000000000028e89a166c",
+            b"00f62e0a0002000001168034f000800600000200000000000000000000000000"
+            b"0000000000000000000000280f47db8c",
+            b"00f72e0a0002000001168035f000800600000200000000000000000000000000"
+            b"0000000000000000000000283ede8b3e",
+            b"00f82e0a0002000001168036f000800600000200000000000000000000000000"
+            b"000000000000000000000028580547db",
+            b"00f92e0a0002000001168037f000800600000200000000000000000000000000"
+            b"000000000000000000000028d72a270e",
+            b"00fa2e0a0002000001168038f000800700000200000000000000000000000000"
+            b"000000000000000000000028c25ce712",
+            b"00fb2e0a0002000001168039f000800700000200000000000000000000000000"
+            b"000000000000000000000028b908637e",
+            b"00fc2e0a000200000116803af000800700000200000000000000000000000000"
+            b"0000000000000000000000285b66e6fa",
+            b"00fd2e0a000200000116803bf000800700000200000000000000000000000000"
+            b"00000000000000000000002855c10393",
+            b"00fe2e0a000200000116803cf000800700000200000000000000000000000000"
+            b"0000000000000000000000283e94c57d",
+            b"00ff2e0a000200000116803df000800700000200000000000000000000000000"
+            b"0000000000000000000000284347e7f0",
+            b"01002e0a000200000116803ef000800700000200000000000000000000000000"
+            b"000000000000000000000028be66429d",
+            b"01012e0a000200000116803ff000800700000200000000000000000000000000"
+            b"0000000000000000000000284f7db145",
+            b"01022e0a0002000001490401c000000000000000000000000000000000000000"
+            b"000000000000000000000028470aa043",
+            b"01032e0a00020000014904012000000000000000000000000000000000000000"
+            b"000000000000000000000028a6bc6e48",
+            b"01042e0a00020000014904011800ffffffff0000000000000000000000000000"
+            b"000000000000000000000028f747c739",
         ]
         mask = "%5s %9s %20s %9s %s"
-        print
-        print mask % ("seq", "class_id", "class", "instance", "attributes")
+        print()
+        print(mask % ("seq", "class_id", "class", "instance", "attributes"))
         for i, data in enumerate(refs):
             frame = OmciFrame(hex2raw(data))
             omci = frame.omci_message
             # frame.show()
-            print mask % (
+            print(mask % (
                 str(i),
                 str(omci.object_entity_class),
                 entity_id_to_class_map[omci.object_entity_class].__name__,
-                '0x%x' % omci.object_entity_id,
+                b'0x%x' % omci.object_entity_id,
                 '\n                                               '.join(
                     '%s: %s' % (k, v) for k, v in omci.object_data.items())
-            )
+            ))
 
     def test_onu_reboot(self):
-        ref = '0016590a01000000000000000000000000000'\
-              '0000000000000000000000000000000000000'\
-              '00000000000028'
+        ref = b'0016590a01000000000000000000000000000'\
+              b'0000000000000000000000000000000000000'\
+              b'00000000000028'
 
         frame = OmciFrame(
             transaction_id=22,
@@ -1173,13 +1178,13 @@
         # since the first rule of interoperability is to be lenient with
         # what you receive and strict with what you transmit.
         #
-        ref = '017d290a008280020000780000000000000000000000' +\
-              '0000000000000000000000000000' +\
-              '01' +\
-              '02' +\
-              '0000' +\
-              '00000028'
-        zeros_24 = '000000000000000000000000000000000000000000000000'
+        ref = b'017d290a008280020000780000000000000000000000' +\
+              b'0000000000000000000000000000' +\
+              b'01' +\
+              b'02' +\
+              b'0000' +\
+              b'00000028'
+        zeros_24 = b'000000000000000000000000000000000000000000000000'
         bytes_24 = unhexlify(zeros_24)
         attributes = {
             "unmarked_frame_option": 0,         # 1 octet
@@ -1194,7 +1199,7 @@
                 entity_class=Ieee8021pMapperServiceProfile.class_id,
                 success_code=0,
                 entity_id=0x8002,
-                attributes_mask=Ieee8021pMapperServiceProfile.mask_for(*attributes.keys()),
+                attributes_mask=Ieee8021pMapperServiceProfile.mask_for(*list(attributes.keys())),
                 data=attributes
             )
         )
@@ -1203,12 +1208,12 @@
     def test_get_response_with_errors_max_data(self):
         # First a frame with maximum data used up. This aligns the fields up perfectly
         # with the simplest definition of a Get Response
-        ref = '017d290a008280020900600000000000000000000000' +\
-              '0000000000000000000000000000' +\
-              '0010' +\
-              '0008' +\
-              '00000028'
-        zeros_24 = '000000000000000000000000000000000000000000000000'
+        ref = b'017d290a008280020900600000000000000000000000' +\
+              b'0000000000000000000000000000' +\
+              b'0010' +\
+              b'0008' +\
+              b'00000028'
+        zeros_24 = b'000000000000000000000000000000000000000000000000'
         bytes_24 = unhexlify(zeros_24)
         good_attributes = {
             "unmarked_frame_option": 0,         # 1 octet
@@ -1225,7 +1230,7 @@
                 entity_class=the_class.class_id,
                 success_code=9,
                 entity_id=0x8002,
-                attributes_mask=the_class.mask_for(*good_attributes.keys()),
+                attributes_mask=the_class.mask_for(*list(good_attributes.keys())),
                 unsupported_attributes_mask=the_class.mask_for(*unsupported_attributes),
                 failed_attributes_mask=the_class.mask_for(*failed_attributes_mask),
                 data=good_attributes
@@ -1237,12 +1242,12 @@
         # Next a frame with only a little data used up. This aligns will require
         # the encoder and decoder to skip to the last 8 octets of the data field
         # and encode the failed masks there
-        ref = '017d290a00828002090040' +\
-              '01' + '00000000000000000000' +\
-              '0000000000000000000000000000' +\
-              '0010' +\
-              '0028' +\
-              '00000028'
+        ref = b'017d290a00828002090040' +\
+              b'01' + b'00000000000000000000' +\
+              b'0000000000000000000000000000' +\
+              b'0010' +\
+              b'0028' +\
+              b'00000028'
 
         good_attributes = {
             "unmarked_frame_option": 1,         # 1 octet
@@ -1258,7 +1263,7 @@
                 entity_class=the_class.class_id,
                 success_code=9,
                 entity_id=0x8002,
-                attributes_mask=the_class.mask_for(*good_attributes.keys()),
+                attributes_mask=the_class.mask_for(*list(good_attributes.keys())),
                 unsupported_attributes_mask=the_class.mask_for(*unsupported_attributes),
                 failed_attributes_mask=the_class.mask_for(*failed_attributes_mask),
                 data=good_attributes
diff --git a/test/unit/extensions/omci/test_omci_cc.py b/test/unit/extensions/omci/test_omci_cc.py
index 992ba2b..7fee9ae 100644
--- a/test/unit/extensions/omci/test_omci_cc.py
+++ b/test/unit/extensions/omci/test_omci_cc.py
@@ -13,20 +13,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 import binascii
 from pyvoltha.adapters.common.frameio.frameio import hexify
 from twisted.python.failure import Failure
 from unittest import TestCase, main, skip
-from mock.mock_adapter_agent import MockAdapterAgent
-from mock.mock_onu_handler import MockOnuHandler
-from mock.mock_olt_handler import MockOltHandler
-from mock.mock_onu import MockOnu
+from .mock.mock_adapter_agent import MockAdapterAgent
+from .mock.mock_onu_handler import MockOnuHandler
+from .mock.mock_olt_handler import MockOltHandler
+from .mock.mock_onu import MockOnu
 from pyvoltha.adapters.extensions.omci.omci_defs import *
 from pyvoltha.adapters.extensions.omci.omci_frame import *
 from pyvoltha.adapters.extensions.omci.omci_entities import *
 from pyvoltha.adapters.extensions.omci.omci_me import ExtendedVlanTaggingOperationConfigurationDataFrame
 from pyvoltha.adapters.extensions.omci.omci_cc import OMCI_CC, UNKNOWN_CLASS_ATTRIBUTE_KEY,\
     MAX_OMCI_REQUEST_AGE
+from six.moves import range
 
 DEFAULT_OLT_DEVICE_ID = 'default_olt_mock'
 DEFAULT_ONU_DEVICE_ID = 'default_onu_mock'
@@ -838,7 +840,6 @@
         self.assertEqual(expected, val)
         return results
 
-    @skip('for unknown omci failure')
     #@deferred()
     def test_rx_table_get_extvlantagging(self):
         self.setup_one_of_each()
diff --git a/test/unit/extensions/omci/test_omci_configuration.py b/test/unit/extensions/omci/test_omci_configuration.py
index 1cdfd21..1a38b1c 100644
--- a/test/unit/extensions/omci/test_omci_configuration.py
+++ b/test/unit/extensions/omci/test_omci_configuration.py
@@ -13,15 +13,16 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from hashlib import md5
 from unittest import TestCase, main
 from nose.tools import raises
 from nose.twistedtools import deferred
 from copy import deepcopy
-from mock.mock_adapter_agent import MockAdapterAgent, MockCore
-from mock.mock_onu_handler import MockOnuHandler
-from mock.mock_olt_handler import MockOltHandler
-from mock.mock_onu import MockOnu
+from .mock.mock_adapter_agent import MockAdapterAgent, MockCore
+from .mock.mock_onu_handler import MockOnuHandler
+from .mock.mock_olt_handler import MockOltHandler
+from .mock.mock_onu import MockOnu
 from pyvoltha.adapters.extensions.omci.openomci_agent import OpenOMCIAgent, OpenOmciAgentDefaults
 from pyvoltha.adapters.extensions.omci.onu_configuration import OMCCVersion
 from pyvoltha.adapters.extensions.omci.omci_defs import *
diff --git a/test/unit/extensions/omci/test_onu_device_entry.py b/test/unit/extensions/omci/test_onu_device_entry.py
index 9e917f6..105813f 100644
--- a/test/unit/extensions/omci/test_onu_device_entry.py
+++ b/test/unit/extensions/omci/test_onu_device_entry.py
@@ -13,20 +13,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import TestCase, main
 from nose.tools import assert_raises
 from nose.twistedtools import deferred
 from copy import deepcopy
-from mock.mock_adapter_agent import MockAdapterAgent, MockCore
-from mock.mock_onu_handler import MockOnuHandler
-from mock.mock_olt_handler import MockOltHandler
-from mock.mock_onu import MockOnu
+from .mock.mock_adapter_agent import MockAdapterAgent, MockCore
+from .mock.mock_onu_handler import MockOnuHandler
+from .mock.mock_olt_handler import MockOltHandler
+from .mock.mock_onu import MockOnu
 from pyvoltha.adapters.extensions.omci.openomci_agent import OpenOMCIAgent, OpenOmciAgentDefaults
 from pyvoltha.adapters.extensions.omci.omci_defs import *
 from pyvoltha.common.utils.asleep import asleep
 from pyvoltha.adapters.extensions.omci.database.mib_db_api import DEVICE_ID_KEY, CLASS_ID_KEY, CREATED_KEY, \
     MODIFIED_KEY, MDS_KEY, LAST_SYNC_KEY, VERSION_KEY, DatabaseStateError
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import MibDbVolatileDict
+from six.moves import range
 
 
 DEFAULT_OLT_DEVICE_ID = 'default_olt_mock'
diff --git a/test/unit/extensions/omci/test_openomci_agent.py b/test/unit/extensions/omci/test_openomci_agent.py
index cef505c..5b0a569 100644
--- a/test/unit/extensions/omci/test_openomci_agent.py
+++ b/test/unit/extensions/omci/test_openomci_agent.py
@@ -13,10 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 #
+from __future__ import absolute_import
 from unittest import TestCase, main
 from nose.tools import assert_raises
 from copy import deepcopy
-from mock.mock_adapter_agent import MockAdapterAgent, MockCore
+from .mock.mock_adapter_agent import MockAdapterAgent, MockCore
 from pyvoltha.adapters.extensions.omci.openomci_agent import OpenOMCIAgent, OpenOmciAgentDefaults
 from pyvoltha.adapters.extensions.omci.database.mib_db_ext import MibDbExternal
 from pyvoltha.adapters.extensions.omci.database.mib_db_dict import MibDbVolatileDict
diff --git a/test/unit/extensions/omci/test_task_runner.py b/test/unit/extensions/omci/test_task_runner.py
index e35e151..66a71e3 100644
--- a/test/unit/extensions/omci/test_task_runner.py
+++ b/test/unit/extensions/omci/test_task_runner.py
@@ -14,11 +14,12 @@
 # limitations under the License.
 #
 
+from __future__ import absolute_import
 from unittest import TestCase, main
 from nose.tools import raises
 from twisted.internet import defer
 from twisted.internet.defer import inlineCallbacks, returnValue, CancelledError
-from mock.mock_task import SimpleTask
+from .mock.mock_task import SimpleTask
 from nose.twistedtools import deferred
 from pyvoltha.adapters.extensions.omci.tasks.task_runner import TaskRunner
 
diff --git a/tox.ini b/tox.ini
index d312d51..7572850 100644
--- a/tox.ini
+++ b/tox.ini
@@ -13,7 +13,8 @@
 ; limitations under the License.
 
 [tox]
-envlist = py27
+envlist = py27,py35,py36
+skip_missing_interpreters = true
 
 [testenv]
 commands =