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