[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/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])
-
-