Merge "Replace six.iteritems with dict.items(Part-1)"
This commit is contained in:
commit
84f9ad6bfe
@ -20,7 +20,6 @@ import functools
|
||||
from neutron_lib import constants
|
||||
import pecan
|
||||
from pecan import request
|
||||
import six
|
||||
|
||||
from neutron.api import api_common
|
||||
from neutron.api.v2 import attributes as api_attributes
|
||||
@ -201,7 +200,7 @@ class NeutronPecanController(object):
|
||||
def _get_primary_key(self, default_primary_key='id'):
|
||||
if not self.resource_info:
|
||||
return default_primary_key
|
||||
for key, value in six.iteritems(self.resource_info):
|
||||
for key, value in self.resource_info.items():
|
||||
if value.get('primary_key', False):
|
||||
return key
|
||||
return default_primary_key
|
||||
|
@ -16,7 +16,6 @@
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron._i18n import _, _LI, _LW
|
||||
from neutron.common import exceptions as n_exc
|
||||
@ -81,7 +80,7 @@ class FlatTypeDriver(helpers.BaseTypeDriver):
|
||||
% physical_network)
|
||||
raise exc.InvalidInput(error_message=msg)
|
||||
|
||||
for key, value in six.iteritems(segment):
|
||||
for key, value in segment.items():
|
||||
if value and key not in [api.NETWORK_TYPE,
|
||||
api.PHYSICAL_NETWORK]:
|
||||
msg = _("%s prohibited for flat provider network") % key
|
||||
|
@ -15,7 +15,6 @@
|
||||
|
||||
from neutron_lib import exceptions as exc
|
||||
from oslo_log import log
|
||||
import six
|
||||
|
||||
from neutron._i18n import _, _LI
|
||||
from neutron.plugins.common import constants as p_const
|
||||
@ -47,7 +46,7 @@ class LocalTypeDriver(api.ML2TypeDriver):
|
||||
return False
|
||||
|
||||
def validate_provider_segment(self, segment):
|
||||
for key, value in six.iteritems(segment):
|
||||
for key, value in segment.items():
|
||||
if value and key != api.NETWORK_TYPE:
|
||||
msg = _("%s prohibited for local provider network") % key
|
||||
raise exc.InvalidInput(error_message=msg)
|
||||
|
@ -17,7 +17,6 @@ import copy
|
||||
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from neutron.agent.l3 import agent as neutron_l3_agent
|
||||
@ -58,7 +57,7 @@ class L3HATestCase(framework.L3AgentTestFramework):
|
||||
# Get the last state reported for each router
|
||||
actual_router_states = {}
|
||||
for call in calls:
|
||||
for router_id, state in six.iteritems(call):
|
||||
for router_id, state in call.items():
|
||||
actual_router_states[router_id] = state
|
||||
|
||||
return actual_router_states == expected
|
||||
|
@ -19,7 +19,6 @@ from operator import attrgetter
|
||||
from neutron_lib.api.definitions import provider_net as providernet
|
||||
from neutron_lib import constants
|
||||
from neutron_lib import context
|
||||
import six
|
||||
import testscenarios
|
||||
|
||||
from neutron.db import agents_db
|
||||
@ -401,7 +400,7 @@ class TestAutoSchedule(test_dhcp_sch.TestDhcpSchedulerBaseTestCase,
|
||||
|
||||
# pre schedule the networks to the agents defined in
|
||||
# self.hosted_networks before calling auto_schedule_network
|
||||
for agent, networks in six.iteritems(self.hosted_networks):
|
||||
for agent, networks in self.hosted_networks.items():
|
||||
agent_index = self._extract_index(agent)
|
||||
for net in networks:
|
||||
net_index = self._extract_index(net)
|
||||
|
@ -13,7 +13,6 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import six
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest.lib import exceptions as lib_exc
|
||||
@ -83,7 +82,7 @@ class QuotasTest(QuotasTestBase):
|
||||
|
||||
# Change quotas for tenant
|
||||
quota_set = self._setup_quotas(tenant_id, **new_quotas)
|
||||
for key, value in six.iteritems(new_quotas):
|
||||
for key, value in new_quotas.items():
|
||||
self.assertEqual(value, quota_set[key])
|
||||
|
||||
# Confirm our tenant is listed among tenants with non default quotas
|
||||
@ -97,7 +96,7 @@ class QuotasTest(QuotasTestBase):
|
||||
# Confirm from API quotas were changed as requested for tenant
|
||||
quota_set = self.admin_client.show_quotas(tenant_id)
|
||||
quota_set = quota_set['quota']
|
||||
for key, value in six.iteritems(new_quotas):
|
||||
for key, value in new_quotas.items():
|
||||
self.assertEqual(value, quota_set[key])
|
||||
|
||||
# Reset quotas to default and confirm
|
||||
|
@ -14,7 +14,6 @@
|
||||
# under the License.
|
||||
|
||||
import netaddr
|
||||
import six
|
||||
from tempest.lib.common.utils import data_utils
|
||||
from tempest.lib import decorators
|
||||
from tempest import test
|
||||
@ -91,7 +90,7 @@ class RoutersTest(base_routers.BaseRouterTest):
|
||||
self.assertIsNone(actual_ext_gw_info)
|
||||
return
|
||||
# Verify only keys passed in exp_ext_gw_info
|
||||
for k, v in six.iteritems(exp_ext_gw_info):
|
||||
for k, v in exp_ext_gw_info.items():
|
||||
self.assertEqual(v, actual_ext_gw_info[k])
|
||||
|
||||
def _verify_gateway_port(self, router_id):
|
||||
|
@ -29,7 +29,6 @@ from neutron_lib.utils import helpers
|
||||
from neutron_lib.utils import net
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import timeutils
|
||||
import six
|
||||
import unittest2
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
@ -59,7 +58,7 @@ class AttributeMapMemento(fixtures.Fixture):
|
||||
# to result in test failures. A compromise is to copy one level
|
||||
# deeper than a shallow copy.
|
||||
self.contents_backup = {}
|
||||
for res, attrs in six.iteritems(attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
for res, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.items():
|
||||
self.contents_backup[res] = attrs.copy()
|
||||
self.addCleanup(self.restore)
|
||||
|
||||
|
@ -28,7 +28,6 @@ from oslo_log import log
|
||||
import oslo_messaging
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.agent.l3 import agent as l3_agent
|
||||
@ -2700,7 +2699,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
|
||||
def pd_notifier(context, prefix_update):
|
||||
self.pd_update = prefix_update
|
||||
for subnet_id, prefix in six.iteritems(prefix_update):
|
||||
for subnet_id, prefix in prefix_update.items():
|
||||
for intf in intfs:
|
||||
for subnet in intf['subnets']:
|
||||
if subnet['id'] == subnet_id:
|
||||
@ -2823,7 +2822,7 @@ class TestBasicRouterOperations(BasicRouterOperationsFramework):
|
||||
|
||||
def pd_notifier(context, prefix_update):
|
||||
self.pd_update = prefix_update
|
||||
for subnet_id, prefix in six.iteritems(prefix_update):
|
||||
for subnet_id, prefix in prefix_update.items():
|
||||
gateway_ip = '%s1' % netaddr.IPNetwork(prefix).network
|
||||
for intf in new_intfs:
|
||||
for fip in intf['fixed_ips']:
|
||||
|
@ -18,7 +18,6 @@ import copy
|
||||
import mock
|
||||
from neutron_lib import constants
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
import testtools
|
||||
|
||||
from neutron.agent import firewall
|
||||
@ -1849,7 +1848,7 @@ class IptablesFirewallEnhancedIpsetTestCase(BaseIptablesFirewallTestCase):
|
||||
remote_groups = remote_groups or {_IPv4: [FAKE_SGID],
|
||||
_IPv6: [FAKE_SGID]}
|
||||
rules = []
|
||||
for ip_version, remote_group_list in six.iteritems(remote_groups):
|
||||
for ip_version, remote_group_list in remote_groups.items():
|
||||
for remote_group in remote_group_list:
|
||||
rules.append(self._fake_sg_rule_for_ethertype(ip_version,
|
||||
remote_group))
|
||||
|
@ -25,7 +25,6 @@ from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_service import wsgi as base_wsgi
|
||||
import routes
|
||||
import six
|
||||
import testtools
|
||||
import webob
|
||||
import webob.exc as webexc
|
||||
@ -968,7 +967,7 @@ class ExtensionExtendedAttributeTestCase(base.BaseTestCase):
|
||||
self._tenant_id = "8c70909f-b081-452d-872b-df48e6c355d1"
|
||||
# Save the global RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for res, attrs in six.iteritems(attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
for res, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.items():
|
||||
self.saved_attr_map[res] = attrs.copy()
|
||||
# Add the resources to the global attribute map
|
||||
# This is done here as the setup process won't
|
||||
|
@ -547,7 +547,7 @@ class JSONV2TestCase(APIv2TestBase, testlib_api.WebTestCase):
|
||||
output_dict = res['networks'][0]
|
||||
input_dict['shared'] = False
|
||||
self.assertEqual(len(input_dict), len(output_dict))
|
||||
for k, v in six.iteritems(input_dict):
|
||||
for k, v in input_dict.items():
|
||||
self.assertEqual(v, output_dict[k])
|
||||
else:
|
||||
# expect no results
|
||||
|
@ -32,7 +32,6 @@ from oslo_config import cfg
|
||||
from oslo_utils import importutils
|
||||
from oslo_utils import netutils
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from sqlalchemy import orm
|
||||
import testtools
|
||||
from testtools import matchers
|
||||
@ -125,7 +124,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
|
||||
cfg.CONF.set_override(
|
||||
'service_plugins',
|
||||
[test_lib.test_config.get(key, default)
|
||||
for key, default in six.iteritems(service_plugins or {})]
|
||||
for key, default in (service_plugins or {}).items()]
|
||||
)
|
||||
|
||||
cfg.CONF.set_override('base_mac', "12:34:56:78:00:00")
|
||||
|
@ -12,7 +12,6 @@
|
||||
# under the License.
|
||||
|
||||
from neutron_lib import constants
|
||||
import six
|
||||
|
||||
from neutron.db.availability_zone import router as router_az_db
|
||||
from neutron.db import common_db_mixin
|
||||
@ -63,7 +62,7 @@ class TestAZRouterCase(test_az.AZTestCommon, test_l3.L3NatTestCaseMixin):
|
||||
|
||||
def _backup(self):
|
||||
self.contents_backup = {}
|
||||
for res, attrs in six.iteritems(l3.RESOURCE_ATTRIBUTE_MAP):
|
||||
for res, attrs in l3.RESOURCE_ATTRIBUTE_MAP.items():
|
||||
self.contents_backup[res] = attrs.copy()
|
||||
self.addCleanup(self._restore)
|
||||
|
||||
|
@ -23,7 +23,6 @@ from neutron_lib.db import constants as db_const
|
||||
from neutron_lib.plugins import directory
|
||||
from oslo_config import cfg
|
||||
import oslo_db.exception as exc
|
||||
import six
|
||||
import testtools
|
||||
import webob.exc
|
||||
|
||||
@ -187,7 +186,7 @@ class SecurityGroupsTestCase(test_db_base_plugin_v2.NeutronDbPluginV2TestCase):
|
||||
"""Asserts that the sg rule has expected key/value pairs passed
|
||||
in as expected_kvs dictionary
|
||||
"""
|
||||
for k, v in six.iteritems(expected_kvs):
|
||||
for k, v in expected_kvs.items():
|
||||
self.assertEqual(security_group_rule[k], v)
|
||||
|
||||
|
||||
@ -539,7 +538,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase):
|
||||
test_addr = {'192.168.1.1/24': 'IPv6',
|
||||
'2001:db8:1234::/48': 'IPv4',
|
||||
'192.168.2.1/24': 'BadEthertype'}
|
||||
for remote_ip_prefix, ethertype in six.iteritems(test_addr):
|
||||
for remote_ip_prefix, ethertype in test_addr.items():
|
||||
with self.security_group(name, description) as sg:
|
||||
sg_id = sg['security_group']['id']
|
||||
rule = self._build_security_group_rule(
|
||||
@ -1776,7 +1775,7 @@ class TestConvertIPPrefixToCIDR(base.BaseTestCase):
|
||||
|
||||
def test_convert_ip_prefix_no_netmask_to_cidr(self):
|
||||
addr = {'10.1.2.3': '32', 'fe80::2677:3ff:fe7d:4c': '128'}
|
||||
for k, v in six.iteritems(addr):
|
||||
for k, v in addr.items():
|
||||
self.assertEqual(ext_sg.convert_ip_prefix_to_cidr(k),
|
||||
'%s/%s' % (k, v))
|
||||
|
||||
|
@ -13,7 +13,6 @@
|
||||
# under the License.
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
from webob import exc as web_exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
@ -68,7 +67,7 @@ class VlanTransparentExtensionTestCase(test_db_base_plugin_v2.TestNetworksV2):
|
||||
|
||||
# Save the global RESOURCE_ATTRIBUTE_MAP
|
||||
self.saved_attr_map = {}
|
||||
for res, attrs in six.iteritems(attributes.RESOURCE_ATTRIBUTE_MAP):
|
||||
for res, attrs in attributes.RESOURCE_ATTRIBUTE_MAP.items():
|
||||
self.saved_attr_map[res] = attrs.copy()
|
||||
|
||||
# Update the plugin and extensions path
|
||||
|
@ -17,7 +17,6 @@ import functools
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import six
|
||||
import testtools
|
||||
import webob
|
||||
|
||||
@ -251,7 +250,7 @@ class TestMl2NetworksV2(test_plugin.TestNetworksV2,
|
||||
network = self.deserialize(self.fmt,
|
||||
req.get_response(self.api))['network']
|
||||
if mpnet.SEGMENTS not in net:
|
||||
for k, v in six.iteritems(net):
|
||||
for k, v in net.items():
|
||||
self.assertEqual(net[k], network[k])
|
||||
self.assertNotIn(mpnet.SEGMENTS, network)
|
||||
else:
|
||||
|
Loading…
Reference in New Issue
Block a user