Fix incorrect indentations found by Pep 1.4.6+

Pep 1.4.5 had several bugs with checking indentation of
hanging and nested sets. Fix fallout.

Change-Id: Ibcb1679e0bd283feb3c1568ba214bc525575fd43
This commit is contained in:
Dirk Mueller 2013-10-19 10:50:16 +02:00
parent 71b5ccf8b2
commit 64c0d5d272
39 changed files with 145 additions and 151 deletions

View File

@ -403,9 +403,9 @@ class DhcpPluginApi(proxy.RpcProxy):
"""Make a remote process call to get the dhcp port."""
return dhcp.DictModel(self.call(self.context,
self.make_msg('get_dhcp_port',
network_id=network_id,
device_id=device_id,
host=self.host),
network_id=network_id,
device_id=device_id,
host=self.host),
topic=self.topic))
def create_dhcp_port(self, port):

View File

@ -263,8 +263,7 @@ class ExtensionMiddleware(wsgi.Middleware):
def __init__(self, application,
ext_mgr=None):
self.ext_mgr = (ext_mgr
or ExtensionManager(
get_extensions_path()))
or ExtensionManager(get_extensions_path()))
mapper = routes.Mapper()
# extended resources

View File

@ -46,19 +46,19 @@ def upgrade(active_plugins=None, options=None):
### commands auto generated by Alembic - please adjust! ###
op.create_table('networksecuritybindings',
sa.Column('network_id', sa.String(length=36),
nullable=False),
nullable=False),
sa.Column('port_security_enabled', sa.Boolean(),
nullable=False),
nullable=False),
sa.ForeignKeyConstraint(['network_id'], ['networks.id'],
ondelete='CASCADE'),
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('network_id'))
op.create_table('portsecuritybindings',
sa.Column('port_id', sa.String(length=36),
nullable=False),
nullable=False),
sa.Column('port_security_enabled', sa.Boolean(),
nullable=False),
nullable=False),
sa.ForeignKeyConstraint(['port_id'], ['ports.id'],
ondelete='CASCADE'),
ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'))
### end Alembic commands ###

View File

@ -55,8 +55,9 @@ def upgrade(active_plugins=None, options=None):
sa.Column('network_id', sa.String(length=36),
primary_key=True),
sa.Column('binding_type',
sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=(
sa.Enum(
'flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=(
'nvp_network_bindings_binding_type')),
nullable=False, primary_key=True),
sa.Column('phy_uuid', sa.String(36), primary_key=True,
@ -80,18 +81,15 @@ def downgrade(active_plugins=None, options=None):
"(SELECT network_id from nvp_multi_provider_networks)")
# create table with previous contains
op.create_table('rename_nvp_network_bindings',
sa.Column('network_id', sa.String(length=36),
primary_key=True),
sa.Column('binding_type',
sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=(
'nvp_network_bindings_binding_type')),
nullable=False),
sa.Column('phy_uuid', sa.String(36),
nullable=True),
sa.Column('vlan_id', sa.Integer,
nullable=True, autoincrement=False))
op.create_table(
'rename_nvp_network_bindings',
sa.Column('network_id', sa.String(length=36), primary_key=True),
sa.Column('binding_type',
sa.Enum('flat', 'vlan', 'stt', 'gre', 'l3_ext',
name=('nvp_network_bindings_binding_type')),
nullable=False),
sa.Column('phy_uuid', sa.String(36), nullable=True),
sa.Column('vlan_id', sa.Integer, nullable=True, autoincrement=False))
# copy data from nvp_network_bindings into rename_nvp_network_bindings
op.execute("INSERT INTO rename_nvp_network_bindings SELECT network_id, "

View File

@ -49,7 +49,7 @@ def upgrade(active_plugins=None, options=None):
sa.Column('port_id', sa.String(length=36), nullable=False),
sa.Column('mac_learning_enabled', sa.Boolean(), nullable=False),
sa.ForeignKeyConstraint(
['port_id'], ['ports.id'], ondelete='CASCADE'),
['port_id'], ['ports.id'], ondelete='CASCADE'),
sa.PrimaryKeyConstraint('port_id'))

View File

@ -58,9 +58,7 @@ def upgrade(active_plugins=None, options=None):
)
op.add_column(
u'nsxrouterextattributess',
sa.Column('service_router',
sa.Boolean(),
nullable=False))
sa.Column('service_router', sa.Boolean(), nullable=False))
op.execute("UPDATE nsxrouterextattributess set service_router=False")

View File

@ -55,7 +55,7 @@ def upgrade(active_plugins=None, options=None):
sa.Column(
'encryption_algorithm',
sa.Enum('3des', 'aes-128', 'aes-256', 'aes-192',
name='vpn_encrypt_algorithms'), nullable=False),
name='vpn_encrypt_algorithms'), nullable=False),
sa.Column(
'phase1_negotiation_mode',
sa.Enum('main', name='ike_phase1_mode'), nullable=False),

View File

@ -41,7 +41,7 @@ COMMAND_V2 = {
'neutron.debug.commands.ExecProbe'),
'ping-all': utils.import_class(
'neutron.debug.commands.PingAll'),
#TODO(nati) ping, netcat , nmap, bench
#TODO(nati) ping, netcat , nmap, bench
}
COMMANDS = {'2.0': COMMAND_V2}

View File

@ -27,16 +27,16 @@ FLAVOR_ROUTER = 'flavor:router'
FLAVOR_ATTRIBUTE = {
'networks': {
FLAVOR_NETWORK: {'allow_post': True,
'allow_put': False,
'is_visible': True,
'default': attributes.ATTR_NOT_SPECIFIED}
FLAVOR_NETWORK: {'allow_post': True,
'allow_put': False,
'is_visible': True,
'default': attributes.ATTR_NOT_SPECIFIED}
},
'routers': {
FLAVOR_ROUTER: {'allow_post': True,
'allow_put': False,
'is_visible': True,
'default': attributes.ATTR_NOT_SPECIFIED}
FLAVOR_ROUTER: {'allow_post': True,
'allow_put': False,
'is_visible': True,
'default': attributes.ATTR_NOT_SPECIFIED}
}
}

View File

@ -76,9 +76,9 @@ def del_multi_segment_binding(db_session, multi_segment_id, segment_pairs):
for (segment1_id, segment2_id) in segment_pairs:
(db_session.query(n1kv_models_v2.
N1kvMultiSegmentNetworkBinding).filter_by(
multi_segment_id=multi_segment_id,
segment1_id=segment1_id,
segment2_id=segment2_id).delete())
multi_segment_id=multi_segment_id,
segment1_id=segment1_id,
segment2_id=segment2_id).delete())
def add_trunk_segment_binding(db_session, trunk_segment_id, segment_pairs):
@ -1490,7 +1490,7 @@ class PolicyProfile_db_mixin(object):
with db_session.begin(subtransactions=True):
a_set_q = (db_session.query(n1kv_models_v2.ProfileBinding).
filter_by(tenant_id=c_const.TENANT_ID_NOT_SET,
profile_type=c_const.POLICY))
profile_type=c_const.POLICY))
a_set = set(i.profile_id for i in a_set_q)
b_set_q = (db_session.query(n1kv_models_v2.ProfileBinding).
filter(and_(n1kv_models_v2.ProfileBinding.

View File

@ -157,7 +157,7 @@ class N1kvTrunkSegmentBinding(model_base.BASEV2):
trunk_segment_id = sa.Column(sa.String(36),
sa.ForeignKey('networks.id',
ondelete="CASCADE"),
ondelete="CASCADE"),
primary_key=True)
segment_id = sa.Column(sa.String(36), nullable=False, primary_key=True)
dot1qtag = sa.Column(sa.String(36), nullable=False, primary_key=True)
@ -170,7 +170,7 @@ class N1kvMultiSegmentNetworkBinding(model_base.BASEV2):
multi_segment_id = sa.Column(sa.String(36),
sa.ForeignKey('networks.id',
ondelete="CASCADE"),
ondelete="CASCADE"),
primary_key=True)
segment1_id = sa.Column(sa.String(36), nullable=False, primary_key=True)
segment2_id = sa.Column(sa.String(36), nullable=False, primary_key=True)

View File

@ -464,7 +464,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
n1kv_db_v2.add_multi_segment_encap_profile_name(session,
net_id,
(segment1,
segment2),
segment2),
encap_profile)
else:
raise cisco_exceptions.NoClusterFound
@ -491,7 +491,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
binding = (
n1kv_db_v2.get_multi_segment_network_binding(session, net_id,
(segment1,
segment2)))
segment2)))
encap_profile = binding['encap_profile_name']
if encap_profile in encap_dict:
profile_dict = encap_dict[encap_profile]

View File

@ -45,8 +45,8 @@ agent_opts = [
'physical_network_vswitch_mappings',
default=[],
help=_('List of <physical_network>:<vswitch> '
'where the physical networks can be expressed with '
'wildcards, e.g.: ."*:external"')),
'where the physical networks can be expressed with '
'wildcards, e.g.: ."*:external"')),
cfg.StrOpt(
'local_network_vswitch',
default='private',

View File

@ -44,11 +44,11 @@ DEFAULT_VLAN_RANGES = []
hyperv_opts = [
cfg.StrOpt('tenant_network_type', default='local',
help=_("Network type for tenant networks "
"(local, flat, vlan or none)")),
"(local, flat, vlan or none)")),
cfg.ListOpt('network_vlan_ranges',
default=DEFAULT_VLAN_RANGES,
help=_("List of <physical_network>:<vlan_min>:<vlan_max> "
"or <physical_network>")),
"or <physical_network>")),
]
cfg.CONF.register_opts(hyperv_opts, "HYPERV")

View File

@ -263,8 +263,8 @@ class AristaRPCWrapper(object):
"""
cmds = ['auth url %s user %s password %s' %
(self._keystone_url(),
self.keystone_conf.admin_user,
self.keystone_conf.admin_password)]
self.keystone_conf.admin_user,
self.keystone_conf.admin_password)]
self._run_openstack_cmds(cmds)

View File

@ -26,7 +26,7 @@ DEFAULT_INTERFACE_MAPPINGS = []
vlan_opts = [
cfg.StrOpt('tenant_network_type', default='vlan',
help=_("Network type for tenant networks "
"(local, ib, vlan, or none)")),
"(local, ib, vlan, or none)")),
cfg.ListOpt('network_vlan_ranges',
default=DEFAULT_VLAN_RANGES,
help=_("List of <physical_network>:<vlan_min>:<vlan_max> "

View File

@ -135,9 +135,8 @@ def reserve_specific_network(session, physical_network, segmentation_id):
try:
entry = (session.query(mlnx_models_v2.SegmentationIdAllocation).
filter_by(physical_network=physical_network,
segmentation_id=segmentation_id).
with_lockmode('update').
one())
segmentation_id=segmentation_id).
with_lockmode('update').one())
if entry.allocated:
raise q_exc.VlanIdInUse(vlan_id=segmentation_id,
physical_network=physical_network)

View File

@ -2024,7 +2024,7 @@ class NvpPluginV2(addr_pair_db.AllowedAddressPairsMixin,
in securitygroups_db.IP_PROTOCOL_MAP.values())
if (not port_based_proto and
(r['port_range_min'] is not None or
r['port_range_max'] is not None)):
r['port_range_max'] is not None)):
msg = (_("Port values not valid for "
"protocol: %s") % r['protocol'])
raise q_exc.BadRequest(resource='security_group_rule',

View File

@ -96,8 +96,9 @@ def main(argv):
if (default_gateways[svc_type] and
default_gateways[svc_type] not in gateway_services):
print("\t\t\tError: specified default %s gateway (%s) is "
"missing from NVP Gateway Services!" % (svc_type,
default_gateways[svc_type]))
"missing from NVP Gateway Services!" % (
svc_type,
default_gateways[svc_type]))
errors += 1
transport_zones = get_transport_zones(cluster)
print("\tTransport zones: %s" % transport_zones)

View File

@ -218,8 +218,8 @@ class EdgeFirewallDriver(db_base_plugin_v2.NeutronDbPluginV2):
except vcns_exc.VcnsApiException as e:
LOG.exception(_("Failed to get firewall rule: %(rule_id)s "
"with edge_id: %(edge_id)s"), {
'rule_id': id,
'edge_id': edge_id})
'rule_id': id,
'edge_id': edge_id})
raise e
return self._restore_firewall_rule(context, edge_id, response)

View File

@ -232,9 +232,7 @@ class EdgeLbDriver():
context.session, id, edge_id)
if not pool_binding:
msg = (_("pool_binding not found with id: %(id)s "
"edge_id: %(edge_id)s") % {
'id': id,
'edge_id': edge_id})
"edge_id: %(edge_id)s") % {'id': id, 'edge_id': edge_id})
LOG.error(msg)
raise vcns_exc.VcnsNotFound(
resource='router_service_binding', msg=msg)
@ -294,9 +292,7 @@ class EdgeLbDriver():
context.session, id, edge_id)
if not monitor_binding:
msg = (_("monitor_binding not found with id: %(id)s "
"edge_id: %(edge_id)s") % {
'id': id,
'edge_id': edge_id})
"edge_id: %(edge_id)s") % {'id': id, 'edge_id': edge_id})
LOG.error(msg)
raise vcns_exc.VcnsNotFound(
resource='router_service_binding', msg=msg)

View File

@ -245,7 +245,7 @@ class FWaaSL3AgentRpcCallback(api.FWaaSAgentRpcCallbackMixin):
# install
LOG.debug(_("Apply fw on Router List: '%s'"),
[ri.router['id']
for ri in router_info_list])
for ri in router_info_list])
# no need to apply sync data for ACTIVE fw
if fw['status'] != constants.ACTIVE:
self._invoke_driver_for_sync_from_plugin(

View File

@ -353,10 +353,10 @@ class RouterDBTestCase(test_l3_plugin.L3NatDBIntTestCase):
'nexthops': ['4.4.4.4', '4.4.4.5']}]
body1 = self._update('routers', r1_id,
{'router':
{'router_rules': router1_rules}})
{'router_rules': router1_rules}})
body2 = self._update('routers', r2_id,
{'router':
{'router_rules': router2_rules}})
{'router_rules': router2_rules}})
body1 = self._show('routers', r1_id)
body2 = self._show('routers', r2_id)

View File

@ -670,10 +670,11 @@ class NetworkProfileTests(base.BaseTestCase,
_db_profile = (n1kv_db_v2.create_network_profile(
self.session, TEST_NETWORK_PROFILE_MULTI_SEGMENT))
self.assertIsNotNone(_db_profile)
db_profile = (self.session.query(n1kv_models_v2.NetworkProfile).
filter_by(
name=TEST_NETWORK_PROFILE_MULTI_SEGMENT['name']).
one())
db_profile = (
self.session.query(
n1kv_models_v2.NetworkProfile).filter_by(
name=TEST_NETWORK_PROFILE_MULTI_SEGMENT['name'])
.one())
self.assertIsNotNone(db_profile)
self.assertEqual(_db_profile.id, db_profile.id)
self.assertEqual(_db_profile.name, db_profile.name)

View File

@ -386,7 +386,7 @@ class VPNPluginDbTestCase(test_l3_plugin.L3NatTestCaseMixin,
self._delete(
'ipsec-site-connections',
ipsec_site_connection[
'ipsec_site_connection']['id']
'ipsec_site_connection']['id']
)
@ -1359,7 +1359,7 @@ class TestVpnaas(VPNPluginDbTestCase):
req = self.new_show_request(
'ipsec-site-connections',
ipsec_site_connection[
'ipsec_site_connection']['id'],
'ipsec_site_connection']['id'],
fmt=self.fmt
)
res = self.deserialize(
@ -1476,7 +1476,7 @@ class TestVpnaas(VPNPluginDbTestCase):
'192.168.1.10',
'192.168.1.10',
['192.168.2.0/24',
'192.168.3.0/24'],
'192.168.3.0/24'],
1500,
'abcdef',
'bi-directional',
@ -1573,7 +1573,7 @@ class TestVpnaas(VPNPluginDbTestCase):
'192.168.1.10',
'192.168.1.10',
['192.168.2.0/24',
'192.168.3.0/24'],
'192.168.3.0/24'],
1500,
'abcdef',
'bi-directional',

View File

@ -145,9 +145,9 @@ class TestMultiSegmentNetworks(Ml2PluginV2TestCase):
[{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1},
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 2}],
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 2}],
'tenant_id': 'tenant_one'}}
network_req = self.new_create_request('networks', data)
network = self.deserialize(self.fmt,
@ -188,9 +188,9 @@ class TestMultiSegmentNetworks(Ml2PluginV2TestCase):
[{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1},
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1}],
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1}],
'tenant_id': 'tenant_one'}}
network_req = self.new_create_request('networks', data)
res = network_req.get_response(self.api)

View File

@ -99,7 +99,7 @@ class VxlanTypeTest(base.BaseTestCase):
self.assertIsNone(self.driver.
get_vxlan_allocation(self.session,
(TUN_MIN + 5 - 1)))
(TUN_MIN + 5 - 1)))
self.assertFalse(self.driver.
get_vxlan_allocation(self.session, (TUN_MIN + 5)).
allocated)
@ -114,7 +114,7 @@ class VxlanTypeTest(base.BaseTestCase):
allocated)
self.assertIsNone(self.driver.
get_vxlan_allocation(self.session,
(TUN_MAX + 5 + 1)))
(TUN_MAX + 5 + 1)))
def test_reserve_provider_segment(self):
segment = {api.NETWORK_TYPE: 'vxlan',

View File

@ -1458,8 +1458,8 @@ class TestNiciraMultiProviderNetworks(NiciraPluginV2TestCase):
[{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1},
{pnet.NETWORK_TYPE: 'stt',
pnet.PHYSICAL_NETWORK: 'physnet1'}],
{pnet.NETWORK_TYPE: 'stt',
pnet.PHYSICAL_NETWORK: 'physnet1'}],
'tenant_id': 'tenant_one'}}
network_req = self.new_create_request('networks', data)
network = self.deserialize(self.fmt,
@ -1500,9 +1500,9 @@ class TestNiciraMultiProviderNetworks(NiciraPluginV2TestCase):
[{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1},
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1}],
{pnet.NETWORK_TYPE: 'vlan',
pnet.PHYSICAL_NETWORK: 'physnet1',
pnet.SEGMENTATION_ID: 1}],
'tenant_id': 'tenant_one'}}
network_req = self.new_create_request('networks', data)
res = network_req.get_response(self.api)

View File

@ -140,7 +140,7 @@ class NvplibNegativeTests(base.BaseTestCase):
'fake-tenant',
'fake-gateway',
[{'id': _uuid(),
'interface_name': 'xxx'}])
'interface_name': 'xxx'}])
def test_delete_l2_gw_service_on_failure(self):
self.assertRaises(nvplib.NvpApiClient.NvpApiException,
@ -437,7 +437,7 @@ class TestNvplibExplicitLRouters(NvplibTestCase):
'default_route_next_hop':
{'gateway_ip_address': 'fake_address',
'type': 'RouterNextHop'},
'type': 'SingleDefaultRouteImplicitRoutingConfig'},
'type': 'SingleDefaultRouteImplicitRoutingConfig'},
'tags': [{'scope': 'os_tid', 'tag': 'fake_tenant_id'},
{'scope': 'quantum',
'tag': nvplib.NEUTRON_VERSION}],

View File

@ -3409,7 +3409,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
host_routes = [{'destination': '135.207.0.0/16',
'nexthop': '1.2.3.4'},
{'destination': '12.0.0.0/8',
'nexthop': '4.3.2.1'}]
'nexthop': '4.3.2.1'}]
self._test_create_subnet(gateway_ip=gateway_ip,
cidr=cidr,

View File

@ -201,8 +201,8 @@ class TestDebugCommands(base.BaseTestCase):
mock.call.delete_port('fake_port')])
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
mock.call.unplug('tap12345678-12',
namespace=namespace,
bridge=None)])
namespace=namespace,
bridge=None)])
def test_delete_probe_external(self):
fake_network = {'network': {'id': 'fake_net',
@ -222,8 +222,8 @@ class TestDebugCommands(base.BaseTestCase):
mock.call.delete_port('fake_port')])
self.driver.assert_has_calls([mock.call.get_device_name(mock.ANY),
mock.call.unplug('tap12345678-12',
namespace=namespace,
bridge='br-ex')])
namespace=namespace,
bridge='br-ex')])
def test_delete_probe_without_namespace(self):
cfg.CONF.set_override('use_namespaces', False)

View File

@ -110,19 +110,19 @@ fake_network = dhcp.NetModel(True, dict(id='12345678-1234-5678-1234567890ab',
subnets=[fake_subnet1, fake_subnet2],
ports=[fake_port1]))
fake_meta_network = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
admin_state_up=True,
subnets=[fake_meta_subnet],
ports=[fake_meta_port]))
fake_meta_network = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
admin_state_up=True,
subnets=[fake_meta_subnet],
ports=[fake_meta_port]))
fake_down_network = dhcp.NetModel(True,
dict(id='12345678-dddd-dddd-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
admin_state_up=False,
subnets=[],
ports=[]))
fake_down_network = dhcp.NetModel(
True, dict(id='12345678-dddd-dddd-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
admin_state_up=False,
subnets=[],
ports=[]))
class TestDhcpAgent(base.BaseTestCase):
@ -934,11 +934,11 @@ class TestNetworkCache(base.BaseTestCase):
fake_network)
def test_put_port(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1]))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1]))
nc = dhcp_agent.NetworkCache()
nc.put(fake_net)
nc.put_port(fake_port2)
@ -946,11 +946,11 @@ class TestNetworkCache(base.BaseTestCase):
self.assertIn(fake_port2, fake_net.ports)
def test_put_port_existing(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1, fake_port2]))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1, fake_port2]))
nc = dhcp_agent.NetworkCache()
nc.put(fake_net)
nc.put_port(fake_port2)
@ -959,11 +959,11 @@ class TestNetworkCache(base.BaseTestCase):
self.assertIn(fake_port2, fake_net.ports)
def test_remove_port_existing(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1, fake_port2]))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa',
subnets=[fake_subnet1],
ports=[fake_port1, fake_port2]))
nc = dhcp_agent.NetworkCache()
nc.put(fake_net)
nc.remove_port(fake_port2)
@ -1146,12 +1146,13 @@ class TestDeviceManager(base.BaseTestCase):
self.assertFalse(plugin.update_dhcp_port.called)
def test_destroy(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
fake_port = dhcp.DictModel(dict(id='12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff'))
fake_port = dhcp.DictModel(
dict(id='12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff'))
with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
mock_driver = mock.MagicMock()
@ -1172,12 +1173,13 @@ class TestDeviceManager(base.BaseTestCase):
[mock.call.release_dhcp_port(fake_net.id, mock.ANY)])
def test_get_interface_name(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
fake_port = dhcp.DictModel(dict(id='12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff'))
fake_port = dhcp.DictModel(
dict(id='12345678-1234-aaaa-1234567890ab',
mac_address='aa:bb:cc:dd:ee:ff'))
with mock.patch('neutron.agent.linux.interface.NullDriver') as dvr_cls:
mock_driver = mock.MagicMock()
@ -1197,9 +1199,9 @@ class TestDeviceManager(base.BaseTestCase):
self.assertEqual(len(plugin.mock_calls), 0)
def test_get_device_id(self):
fake_net = dhcp.NetModel(True,
dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
fake_net = dhcp.NetModel(
True, dict(id='12345678-1234-5678-1234567890ab',
tenant_id='aaaaaaaa-aaaa-aaaa-aaaaaaaaaaaa'))
expected = ('dhcp1ae5f96c-c527-5079-82ea-371a01645457-12345678-1234-'
'5678-1234567890ab')

View File

@ -139,7 +139,7 @@ class PortSecurityTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
filters = {'port_id': [id]}
security_groups = (super(PortSecurityTestPlugin, self).
_get_port_security_group_bindings(
context, filters))
context, filters))
if security_groups and not delete_security_groups:
raise psec.PortSecurityPortHasSecurityGroup()

View File

@ -1073,7 +1073,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase):
with self.security_group() as sg:
res = self._create_port(self.fmt, n['network']['id'],
security_groups=(
[sg['security_group']['id']]))
[sg['security_group']['id']]))
port = self.deserialize(self.fmt, res)
data = {'port': {'fixed_ips': port['port']['fixed_ips'],
@ -1094,7 +1094,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase):
with self.security_group() as sg:
res = self._create_port(self.fmt, n['network']['id'],
security_groups=(
[sg['security_group']['id']]))
[sg['security_group']['id']]))
port = self.deserialize(self.fmt, res)
data = {'port': {'fixed_ips': port['port']['fixed_ips'],
@ -1124,7 +1124,7 @@ class TestSecurityGroups(SecurityGroupDBTestCase):
with self.security_group() as sg:
res = self._create_port(self.fmt, n['network']['id'],
security_groups=(
[sg['security_group']['id']]))
[sg['security_group']['id']]))
port = self.deserialize(self.fmt, res)
self.assertEqual(port['port'][ext_sg.SECURITYGROUPS][0],
sg['security_group']['id'])

View File

@ -786,8 +786,8 @@ class IptablesFirewallTestCase(base.BaseTestCase):
calls += [call.add_rule(
'ofake_dev', '-m state --state INVALID -j DROP'),
call.add_rule(
'ofake_dev',
'-m state --state RELATED,ESTABLISHED -j RETURN')]
'ofake_dev',
'-m state --state RELATED,ESTABLISHED -j RETURN')]
if egress_expected_call:
calls.append(egress_expected_call)

View File

@ -310,7 +310,7 @@ class TestBasicRouterOperations(base.BaseTestCase):
expected = [['ip', 'route', 'replace', 'to', '110.100.30.0/24',
'via', '10.100.10.30'],
['ip', 'route', 'replace', 'to', '110.100.31.0/24',
'via', '10.100.10.30']]
'via', '10.100.10.30']]
self._check_agent_method_called(agent, expected, namespace)

View File

@ -429,7 +429,7 @@ class TestDhcpLocalProcess(TestBase):
def test_enable(self):
attrs_to_mock = dict(
[(a, mock.DEFAULT) for a in
['active', 'get_conf_file_name', 'interface_name']]
['active', 'get_conf_file_name', 'interface_name']]
)
with mock.patch.multiple(LocalChild, **attrs_to_mock) as mocks:
@ -586,7 +586,7 @@ class TestDnsmasq(TestBase):
attrs_to_mock = dict(
[(a, mock.DEFAULT) for a in
['_output_opts_file', 'get_conf_file_name', 'interface_name']]
['_output_opts_file', 'get_conf_file_name', 'interface_name']]
)
with mock.patch.multiple(dhcp.Dnsmasq, **attrs_to_mock) as mocks:

View File

@ -207,7 +207,7 @@ class TestIpWrapper(base.BaseTestCase):
ip_lib.IPWrapper('sudo').add_veth('tap0', 'tap1')
self.execute.assert_called_once_with('', 'link',
('add', 'tap0', 'type', 'veth',
'peer', 'name', 'tap1'),
'peer', 'name', 'tap1'),
'sudo', None)
def test_add_veth_with_namespaces(self):

View File

@ -610,8 +610,8 @@ class SecurityGroupServerRpcApiTestCase(base.BaseTestCase):
[call(None,
{'args':
{'devices': ['fake_device']},
'method': 'security_group_rules_for_devices',
'namespace': None},
'method': 'security_group_rules_for_devices',
'namespace': None},
version=sg_rpc.SG_RPC_VERSION,
topic='fake_topic')])