Python3: replace dict.iteritems with six.iteritems
Use six.iteritems() instead of dict.iteritems for Python3 compatibility Change-Id: Ie4f6a5acc6f494487cffd7b728f93bdb94e65682 Blueprint: neutron-python3
This commit is contained in:
@@ -18,6 +18,7 @@ from neutron.common import exceptions as n_exc
|
||||
from neutron.extensions import multiprovidernet as mpnet
|
||||
from neutron.extensions import providernet as pnet
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import client
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
@@ -241,7 +242,7 @@ def get_nsx_device_statuses(cluster, tenant_id):
|
||||
return dict((nsx_device_id,
|
||||
networkgw_db.STATUS_ACTIVE if connected
|
||||
else networkgw_db.STATUS_DOWN) for
|
||||
(nsx_device_id, connected) in status_dict.iteritems())
|
||||
(nsx_device_id, connected) in six.iteritems(status_dict))
|
||||
except api_exc.NsxApiException:
|
||||
# Do not make a NSX API exception fatal
|
||||
if tenant_id:
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.common import nsx_utils
|
||||
|
||||
@@ -82,7 +83,7 @@ def get_security_group_rules_nsx_format(session, cluster,
|
||||
'port_range_min', 'port_range_max', 'protocol', 'ethertype']
|
||||
if with_id:
|
||||
_fields.append('id')
|
||||
return dict((k, v) for k, v in rule.iteritems() if k in _fields)
|
||||
return dict((k, v) for k, v in six.iteritems(rule) if k in _fields)
|
||||
|
||||
ingress_rules = []
|
||||
egress_rules = []
|
||||
|
||||
@@ -18,6 +18,7 @@ import random
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions
|
||||
@@ -117,7 +118,7 @@ class NsxCache(object):
|
||||
def _delete_resources(self, resources):
|
||||
# Mark for removal all the elements which have not been visited.
|
||||
# And clear the 'hit' attribute.
|
||||
for to_delete in [k for (k, v) in resources.iteritems()
|
||||
for to_delete in [k for (k, v) in six.iteritems(resources)
|
||||
if not v.pop('hit', False)]:
|
||||
resources[to_delete]['changed'] = True
|
||||
resources[to_delete]['data_bk'] = (
|
||||
@@ -125,7 +126,7 @@ class NsxCache(object):
|
||||
|
||||
def _get_resource_ids(self, resources, changed_only):
|
||||
if changed_only:
|
||||
return [k for (k, v) in resources.iteritems()
|
||||
return [k for (k, v) in six.iteritems(resources)
|
||||
if v.get('changed')]
|
||||
return resources.keys()
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import hashlib
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron import version
|
||||
from oslo_log import log
|
||||
|
||||
import six
|
||||
|
||||
LOG = log.getLogger(__name__)
|
||||
MAX_DISPLAY_NAME_LEN = 40
|
||||
@@ -47,7 +47,7 @@ class NsxVNetworkTypes:
|
||||
|
||||
def get_tags(**kwargs):
|
||||
tags = ([dict(tag=value, scope=key)
|
||||
for key, value in kwargs.iteritems()])
|
||||
for key, value in six.iteritems(kwargs)])
|
||||
tags.append({"tag": NEUTRON_VERSION, "scope": "quantum"})
|
||||
return sorted(tags)
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ from neutron.plugins.vmware.dbexts import nsx_models
|
||||
from neutron.plugins.vmware.extensions import networkgw
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
DEVICE_OWNER_NET_GW_INTF = 'network:gateway-interface'
|
||||
@@ -155,7 +156,7 @@ class NetworkGatewayMixin(networkgw.NetworkGatewayPluginBase):
|
||||
def _retrieve_gateway_connections(self, context, gateway_id,
|
||||
mapping_info={}, only_one=False):
|
||||
filters = {'network_gateway_id': [gateway_id]}
|
||||
for k, v in mapping_info.iteritems():
|
||||
for k, v in six.iteritems(mapping_info):
|
||||
if v and k != NETWORK_ID:
|
||||
filters[k] = [v]
|
||||
query = self._get_collection_query(context,
|
||||
|
||||
@@ -14,15 +14,15 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import neutron.db.api as db
|
||||
from neutron.plugins.vmware.dbexts import nsxv_models
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
from sqlalchemy.orm import exc
|
||||
from sqlalchemy.sql import expression as expr
|
||||
|
||||
import neutron.db.api as db
|
||||
from neutron.plugins.vmware.dbexts import nsxv_models
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import nsxv_constants
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import constants
|
||||
@@ -33,12 +33,12 @@ LOG = logging.getLogger(__name__)
|
||||
|
||||
def _apply_filters_to_query(query, model, filters, like_filters=None):
|
||||
if filters:
|
||||
for key, value in filters.iteritems():
|
||||
for key, value in six.iteritems(filters):
|
||||
column = getattr(model, key, None)
|
||||
if column:
|
||||
query = query.filter(column.in_(value))
|
||||
if like_filters:
|
||||
for key, search_term in like_filters.iteritems():
|
||||
for key, search_term in six.iteritems(like_filters):
|
||||
column = getattr(model, key, None)
|
||||
if column:
|
||||
query = query.filter(column.like(search_term))
|
||||
@@ -87,7 +87,7 @@ def update_nsxv_router_binding(session, router_id, **kwargs):
|
||||
with session.begin(subtransactions=True):
|
||||
binding = (session.query(nsxv_models.NsxvRouterBinding).
|
||||
filter_by(router_id=router_id).one())
|
||||
for key, value in kwargs.iteritems():
|
||||
for key, value in six.iteritems(kwargs):
|
||||
binding[key] = value
|
||||
return binding
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions
|
||||
from vmware_nsx.openstack.common._i18n import _LI
|
||||
@@ -46,7 +47,7 @@ class NSXCluster(object):
|
||||
self._deprecated_attributes = {}
|
||||
self._sanity_check(kwargs)
|
||||
|
||||
for opt, val in self._deprecated_attributes.iteritems():
|
||||
for opt, val in six.iteritems(self._deprecated_attributes):
|
||||
LOG.deprecated(_("Attribute '%s' has been deprecated or moved "
|
||||
"to a new section. See new configuration file "
|
||||
"for details."), opt)
|
||||
|
||||
@@ -13,11 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from neutron.common import exceptions as exception
|
||||
from neutron import version
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||
|
||||
@@ -82,7 +83,7 @@ def format_exception(etype, e, exception_locals):
|
||||
"""
|
||||
msg = [_("Error. %(type)s exception: %(exc)s.") %
|
||||
{'type': etype, 'exc': e}]
|
||||
l = dict((k, v) for k, v in exception_locals.iteritems()
|
||||
l = dict((k, v) for k, v in six.iteritems(exception_locals)
|
||||
if k != 'request')
|
||||
msg.append(_("locals=[%s]") % str(l))
|
||||
return ' '.join(msg)
|
||||
|
||||
@@ -13,10 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import exceptions as exception
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from neutron.common import exceptions as exception
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||
@@ -213,7 +214,7 @@ def _get_opts(name, value):
|
||||
def lsn_port_dhcp_configure(
|
||||
cluster, lsn_id, lsn_port_id, is_enabled=True, dhcp_options=None):
|
||||
dhcp_options = dhcp_options or {}
|
||||
opts = [_get_opts(key, val) for key, val in dhcp_options.iteritems()]
|
||||
opts = [_get_opts(key, val) for key, val in six.iteritems(dhcp_options)]
|
||||
dhcp_obj = {'options': opts}
|
||||
_lsn_port_configure_action(
|
||||
cluster, lsn_id, lsn_port_id, 'dhcp', is_enabled, dhcp_obj)
|
||||
|
||||
@@ -13,12 +13,13 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import exceptions as exception
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import exceptions as exception
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import utils
|
||||
from vmware_nsx.neutron.plugins.vmware import nsxlib
|
||||
@@ -41,7 +42,7 @@ def create_lqueue(cluster, queue_data):
|
||||
}
|
||||
queue_obj = dict(
|
||||
(nsx_name, queue_data.get(api_name))
|
||||
for api_name, nsx_name in params.iteritems()
|
||||
for api_name, nsx_name in six.iteritems(params)
|
||||
if attr.is_attr_set(queue_data.get(api_name))
|
||||
)
|
||||
if 'display_name' in queue_obj:
|
||||
|
||||
@@ -13,12 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from neutron.common import exceptions as exception
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import excutils
|
||||
|
||||
from neutron.common import exceptions as exception
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||
@@ -566,7 +566,7 @@ def delete_nat_rules_by_match(cluster, router_id, rule_type,
|
||||
if (r['type'] != rule_type):
|
||||
continue
|
||||
|
||||
for key, value in kwargs.iteritems():
|
||||
for key, value in six.iteritems(kwargs):
|
||||
if not (key in r['match'] and r['match'][key] == value):
|
||||
break
|
||||
else:
|
||||
|
||||
@@ -20,6 +20,7 @@ from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils import excutils
|
||||
import six
|
||||
from sqlalchemy import exc as sql_exc
|
||||
from sqlalchemy.orm import exc as sa_exc
|
||||
import webob.exc
|
||||
@@ -904,7 +905,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
provider_type = self._convert_to_transport_zones_dict(net_data)
|
||||
self._validate_provider_create(context, net_data)
|
||||
# Replace ATTR_NOT_SPECIFIED with None before sending to NSX
|
||||
for key, value in network['network'].iteritems():
|
||||
for key, value in six.iteritems(network['network']):
|
||||
if value is attr.ATTR_NOT_SPECIFIED:
|
||||
net_data[key] = None
|
||||
# FIXME(arosen) implement admin_state_up = False in NSX
|
||||
|
||||
@@ -16,6 +16,7 @@ import base64
|
||||
|
||||
import eventlet
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions
|
||||
|
||||
@@ -34,7 +35,7 @@ def _xmldump(obj):
|
||||
config = ""
|
||||
attr = ""
|
||||
if isinstance(obj, dict):
|
||||
for key, value in obj.iteritems():
|
||||
for key, value in six.iteritems(obj):
|
||||
if (key.startswith('_')):
|
||||
attr += ' %s="%s"' % (key[1:], value)
|
||||
else:
|
||||
|
||||
@@ -20,6 +20,7 @@ from eventlet import event
|
||||
from eventlet import greenthread
|
||||
from neutron.common import exceptions
|
||||
from oslo_log import log as logging
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import constants
|
||||
from vmware_nsx.openstack.common._i18n import _LE, _LI
|
||||
@@ -348,7 +349,7 @@ class TaskManager():
|
||||
def show_pending_tasks(self):
|
||||
for task in self._tasks_queue:
|
||||
LOG.info(str(task))
|
||||
for resource, tasks in self._tasks.iteritems():
|
||||
for resource, tasks in six.iteritems(self._tasks):
|
||||
for task in tasks:
|
||||
LOG.info(str(task))
|
||||
if self._main_thread_exec_task:
|
||||
@@ -356,7 +357,7 @@ class TaskManager():
|
||||
|
||||
def count(self):
|
||||
count = 0
|
||||
for resource_id, tasks in self._tasks.iteritems():
|
||||
for resource_id, tasks in six.iteritems(self._tasks):
|
||||
count += len(tasks)
|
||||
return count
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import six.moves.urllib.parse as urlparse
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
@@ -388,7 +389,7 @@ class FakeClient:
|
||||
if not attr_filter:
|
||||
return True
|
||||
item = res_dict[res_uuid]
|
||||
for (attr, value) in attr_filter.iteritems():
|
||||
for (attr, value) in six.iteritems(attr_filter):
|
||||
if item.get(attr) != value:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -14,13 +14,14 @@
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import test_lib
|
||||
from neutron import context
|
||||
from neutron.extensions import agent
|
||||
from neutron.tests.unit.db import test_db_base_plugin_v2 as test_db_plugin
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import version
|
||||
from vmware_nsx.neutron.plugins.vmware.common import sync
|
||||
from vmware_nsx.neutron.tests.unit import vmware
|
||||
@@ -54,7 +55,8 @@ class MacLearningDBTestCase(test_db_plugin.NeutronDbPluginV2TestCase):
|
||||
cfg.CONF.set_override('api_extensions_path', vmware.NSXEXT_PATH)
|
||||
# Save the original RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for resource, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.iteritems():
|
||||
for resource, attrs in six.iteritems(
|
||||
attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
self.saved_attr_map[resource] = attrs.copy()
|
||||
ext_mgr = MacLearningExtensionManager()
|
||||
# mock api client
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from neutron.common import exceptions
|
||||
from neutron.tests import base
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.common import exceptions as nsx_exc
|
||||
@@ -252,7 +252,7 @@ class LSNTestCase(base.BaseTestCase):
|
||||
self.cluster, lsn_id, lsn_port_id, is_enabled, opts)
|
||||
opt_array = [
|
||||
{"name": key, "value": val}
|
||||
for key, val in opts.iteritems()
|
||||
for key, val in six.iteritems(opts)
|
||||
]
|
||||
self.mock_request.assert_has_calls([
|
||||
mock.call("PUT", "/ws.v1/lservices-node/%s/dhcp" % lsn_id,
|
||||
|
||||
@@ -16,11 +16,12 @@
|
||||
import fixtures
|
||||
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from neutron import manager
|
||||
from neutron.tests import base
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import client
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import version
|
||||
from vmware_nsx.neutron.plugins.vmware.common import config # noqa
|
||||
@@ -53,14 +54,14 @@ class NSXClusterTest(base.BaseTestCase):
|
||||
|
||||
def test_create_cluster(self):
|
||||
cluster = nsx_cluster.NSXCluster(**self.cluster_opts)
|
||||
for (k, v) in self.cluster_opts.iteritems():
|
||||
for (k, v) in six.iteritems(self.cluster_opts):
|
||||
self.assertEqual(v, getattr(cluster, k))
|
||||
|
||||
def test_create_cluster_default_port(self):
|
||||
opts = self.cluster_opts.copy()
|
||||
opts['nsx_controllers'] = ['1.1.1.1']
|
||||
cluster = nsx_cluster.NSXCluster(**opts)
|
||||
for (k, v) in self.cluster_opts.iteritems():
|
||||
for (k, v) in six.iteritems(self.cluster_opts):
|
||||
self.assertEqual(v, getattr(cluster, k))
|
||||
|
||||
def test_create_cluster_missing_required_attribute_raises(self):
|
||||
|
||||
@@ -17,13 +17,6 @@ import uuid
|
||||
|
||||
import mock
|
||||
import netaddr
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
from sqlalchemy import exc as sql_exc
|
||||
import webob.exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as ntn_exc
|
||||
@@ -43,6 +36,13 @@ import neutron.tests.unit.extensions.test_l3 as test_l3_plugin
|
||||
import neutron.tests.unit.extensions.test_l3_ext_gw_mode as test_ext_gw_mode
|
||||
import neutron.tests.unit.extensions.test_securitygroup as ext_sg
|
||||
from neutron.tests.unit import testlib_api
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_log import log
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from sqlalchemy import exc as sql_exc
|
||||
import webob.exc
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import exception as api_exc
|
||||
from vmware_nsx.neutron.plugins.vmware.api_client import version as ver_module
|
||||
@@ -452,7 +452,7 @@ class TestL3SecGrpExtensionManager(TestL3ExtensionManager):
|
||||
def backup_l3_attribute_map():
|
||||
"""Return a backup of the original l3 attribute map."""
|
||||
return dict((res, attrs.copy()) for
|
||||
(res, attrs) in l3.RESOURCE_ATTRIBUTE_MAP.iteritems())
|
||||
(res, attrs) in six.iteritems(l3.RESOURCE_ATTRIBUTE_MAP))
|
||||
|
||||
|
||||
def restore_l3_attribute_map(map_to_restore):
|
||||
|
||||
@@ -16,11 +16,6 @@
|
||||
import contextlib
|
||||
from eventlet import greenthread
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_utils import uuidutils
|
||||
import webob.exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as n_exc
|
||||
@@ -48,6 +43,11 @@ import neutron.tests.unit.extensions.test_l3_ext_gw_mode as test_ext_gw_mode
|
||||
import neutron.tests.unit.extensions.test_portsecurity as test_psec
|
||||
import neutron.tests.unit.extensions.test_securitygroup as ext_sg
|
||||
from neutron.tests.unit import testlib_api
|
||||
from oslo_config import cfg
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import webob.exc
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.dbexts import nsxv_db
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import (
|
||||
@@ -1099,7 +1099,7 @@ class TestL3ExtensionManager(object):
|
||||
def backup_l3_attribute_map():
|
||||
"""Return a backup of the original l3 attribute map."""
|
||||
return dict((res, attrs.copy()) for
|
||||
(res, attrs) in l3.RESOURCE_ATTRIBUTE_MAP.iteritems())
|
||||
(res, attrs) in six.iteritems(l3.RESOURCE_ATTRIBUTE_MAP))
|
||||
|
||||
|
||||
def restore_l3_attribute_map(map_to_restore):
|
||||
|
||||
@@ -16,6 +16,7 @@ import copy
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import exceptions
|
||||
@@ -71,7 +72,7 @@ class FakeVcns(object):
|
||||
self._fake_nsx_api = fake_nsx_api
|
||||
|
||||
def _validate_edge_name(self, name):
|
||||
for edge_id, edge in self._edges.iteritems():
|
||||
for edge_id, edge in six.iteritems(self._edges):
|
||||
if edge['name'] == name:
|
||||
return False
|
||||
return True
|
||||
|
||||
@@ -17,6 +17,8 @@ from eventlet import greenthread
|
||||
import mock
|
||||
|
||||
from neutron.tests import base
|
||||
import six
|
||||
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.common import (
|
||||
constants as vcns_const)
|
||||
from vmware_nsx.neutron.plugins.vmware.vshield.tasks import (
|
||||
@@ -241,7 +243,7 @@ class VcnsDriverTaskManagerTestCase(base.BaseTestCase):
|
||||
# if _thread is None it means it was killed in stop()
|
||||
self.assertIsNone(manager._thread)
|
||||
|
||||
for res, tasks in alltasks.iteritems():
|
||||
for res, tasks in six.iteritems(alltasks):
|
||||
for task in tasks:
|
||||
self.assertEqual(task.status, ts_const.TaskStatus.ABORT)
|
||||
|
||||
@@ -424,7 +426,7 @@ class VcnsDriverTestCase(base.BaseTestCase):
|
||||
self._deploy_edge()
|
||||
edges = self.vcns_driver.get_edges_statuses()
|
||||
found = False
|
||||
for edge_id, status in edges.iteritems():
|
||||
for edge_id, status in six.iteritems(edges):
|
||||
if edge_id == self.edge_id:
|
||||
found = True
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user