VOL-2241: Python 3 migration
- rename adapter class file and remove unneeded __init__ to make imports work without major rearrange
- venv and Dockerfile fixups needed for new pyvoltha (cannot install old first)
- clean up yaml config file as it contained empty entries that failed to parse
- clean up imports
- remove itervalues iter*
- convert to list() as needed
- test with python 3.6
- skip non-dict items in tcont loop
- update to voltha-protos 2.1.0
- migrate socketserver and simplehttpserver to python3 import
Change-Id: Id8efa72b6796a3055b1927716503a33544bb6548
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py
index d56a1d0..b6ca406 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_capabilities_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 pyvoltha.adapters.extensions.omci.tasks.onu_capabilities_task import OnuCapabilitiesTask
from twisted.internet.defer import failure
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
index 76af28b..f09379b 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_mib_download_task.py
@@ -16,11 +16,13 @@
import structlog
from twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError, failure
-from pyvoltha.adapters.extensions.omci.omci_me import *
+from pyvoltha.adapters.extensions.omci.omci_me import PptpEthernetUniFrame, GalEthernetProfileFrame, \
+ MacBridgePortConfigurationDataFrame, MacBridgeServiceProfileFrame, Ieee8021pMapperServiceProfileFrame, \
+ VeipUniFrame, ExtendedVlanTaggingOperationConfigurationDataFrame
from pyvoltha.adapters.extensions.omci.tasks.task import Task
-from pyvoltha.adapters.extensions.omci.omci_defs import *
-from adapters.brcm_openomci_onu.uni_port import *
-from adapters.brcm_openomci_onu.pon_port \
+from pyvoltha.adapters.extensions.omci.omci_defs import EntityOperations, ReasonCodes
+from uni_port import UniType
+from pon_port \
import TASK_PRIORITY, DEFAULT_TPID, DEFAULT_GEM_PAYLOAD
OP = EntityOperations
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py
index 7ba4523..62a1e51 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_tp_service_specific_task.py
@@ -13,15 +13,16 @@
# 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 twisted.internet.defer import inlineCallbacks, returnValue, TimeoutError, failure
-from pyvoltha.adapters.extensions.omci.omci_me import *
+from twisted.internet.defer import inlineCallbacks, TimeoutError, failure
+from pyvoltha.adapters.extensions.omci.omci_me import Ont2G, OmciNullPointer, PriorityQueueFrame, \
+ Ieee8021pMapperServiceProfileFrame
from pyvoltha.adapters.extensions.omci.tasks.task import Task
-from pyvoltha.adapters.extensions.omci.omci_defs import *
-from pyvoltha.adapters.extensions.omci.omci_entities import *
-from adapters.brcm_openomci_onu.uni_port import *
-from adapters.brcm_openomci_onu.pon_port import TASK_PRIORITY, DEFAULT_GEM_PAYLOAD
+from pyvoltha.adapters.extensions.omci.omci_defs import EntityOperations, ReasonCodes
+from pyvoltha.adapters.extensions.omci.omci_entities import OntG, Tcont, PriorityQueueG
+from pon_port import TASK_PRIORITY
OP = EntityOperations
@@ -90,12 +91,12 @@
# due to additional tasks on different UNIs. So, it we cannot use the pon_port affter
# this initializer
self._tconts = []
- for tcont in handler.pon_port.tconts.itervalues():
+ for tcont in list(handler.pon_port.tconts.values()):
if tcont.uni_id is not None and tcont.uni_id != self._uni_port.uni_id: continue
self._tconts.append(tcont)
self._gem_ports = []
- for gem_port in handler.pon_port.gem_ports.itervalues():
+ for gem_port in list(handler.pon_port.gem_ports.values()):
if gem_port.uni_id is not None and gem_port.uni_id != self._uni_port.uni_id: continue
self._gem_ports.append(gem_port)
@@ -189,6 +190,8 @@
if tcont.entity_id is None:
free_entity_id = None
for k, v in tcont_idents.items():
+ if not isinstance(v, dict):
+ continue
alloc_check = v.get('attributes', {}).get('alloc_id', 0)
# Some onu report both to indicate an available tcont
if alloc_check == 0xFF or alloc_check == 0xFFFF:
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
index cbe22fa..aecefc1 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_uni_lock_task.py
@@ -13,6 +13,8 @@
# 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 twisted.internet import reactor
from twisted.internet.defer import inlineCallbacks, failure, returnValue
diff --git a/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py b/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
index eaa3176..2589247 100644
--- a/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
+++ b/python/adapters/brcm_openomci_onu/omci/brcm_vlan_filter_task.py
@@ -14,6 +14,7 @@
# limitations under the License.
#
+from __future__ import absolute_import
import structlog
from pyvoltha.adapters.extensions.omci.tasks.task import Task
from twisted.internet import reactor
@@ -21,8 +22,8 @@
from pyvoltha.adapters.extensions.omci.omci_defs import ReasonCodes, EntityOperations
from pyvoltha.adapters.extensions.omci.omci_me import \
VlanTaggingOperation, VlanTaggingFilterDataFrame, ExtendedVlanTaggingOperationConfigurationDataFrame
-from adapters.brcm_openomci_onu.uni_port import UniType
-from adapters.brcm_openomci_onu.pon_port import DEFAULT_TPID
+from uni_port import UniType
+from pon_port import DEFAULT_TPID
RC = ReasonCodes
OP = EntityOperations