From: Dirk Mueller Date: Sat, 19 Oct 2013 08:50:16 +0000 (+0200) Subject: Fix incorrect indentations found by Pep 1.4.6+ X-Git-Url: https://review.fuel-infra.org/gitweb?a=commitdiff_plain;h=64c0d5d272fd48c84b044a771ca6122700b69a29;p=openstack-build%2Fneutron-build.git 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 --- diff --git a/neutron/agent/dhcp_agent.py b/neutron/agent/dhcp_agent.py index 4fd9f3509..f58b577cd 100644 --- a/neutron/agent/dhcp_agent.py +++ b/neutron/agent/dhcp_agent.py @@ -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): diff --git a/neutron/api/extensions.py b/neutron/api/extensions.py index a3d4e23d9..c34188f46 100644 --- a/neutron/api/extensions.py +++ b/neutron/api/extensions.py @@ -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 diff --git a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py index 2de10aedf..9b3629187 100644 --- a/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py +++ b/neutron/db/migration/alembic_migrations/versions/1149d7de0cfa_port_security.py @@ -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 ### diff --git a/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py b/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py index 72e7200d2..5ccf7ee0d 100644 --- a/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py +++ b/neutron/db/migration/alembic_migrations/versions/3c6e57a23db4_add_multiprovider.py @@ -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, " diff --git a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py index 0864f9a13..2dc9f65cd 100644 --- a/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py +++ b/neutron/db/migration/alembic_migrations/versions/3cbf70257c28_nvp_mac_learning.py @@ -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')) diff --git a/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py b/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py index 580590c56..911182b45 100644 --- a/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py +++ b/neutron/db/migration/alembic_migrations/versions/4a666eb208c2_service_router.py @@ -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") diff --git a/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py b/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py index 41f934d8b..c9f61ff91 100644 --- a/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py +++ b/neutron/db/migration/alembic_migrations/versions/52ff27f7567a_support_for_vpnaas.py @@ -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), diff --git a/neutron/debug/shell.py b/neutron/debug/shell.py index 3b97fb3eb..103c43014 100644 --- a/neutron/debug/shell.py +++ b/neutron/debug/shell.py @@ -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} diff --git a/neutron/extensions/flavor.py b/neutron/extensions/flavor.py index 7d3d5e9ef..4f7be18d1 100644 --- a/neutron/extensions/flavor.py +++ b/neutron/extensions/flavor.py @@ -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} } } diff --git a/neutron/plugins/cisco/db/n1kv_db_v2.py b/neutron/plugins/cisco/db/n1kv_db_v2.py index 7cf36d0d0..9bea96a37 100644 --- a/neutron/plugins/cisco/db/n1kv_db_v2.py +++ b/neutron/plugins/cisco/db/n1kv_db_v2.py @@ -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. diff --git a/neutron/plugins/cisco/db/n1kv_models_v2.py b/neutron/plugins/cisco/db/n1kv_models_v2.py index 4933ff839..f8890bad0 100644 --- a/neutron/plugins/cisco/db/n1kv_models_v2.py +++ b/neutron/plugins/cisco/db/n1kv_models_v2.py @@ -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) diff --git a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py index f2b9149ae..6a21d1315 100644 --- a/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py +++ b/neutron/plugins/cisco/n1kv/n1kv_neutron_plugin.py @@ -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] diff --git a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py index 0944ca39e..5690ac8be 100644 --- a/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py +++ b/neutron/plugins/hyperv/agent/hyperv_neutron_agent.py @@ -45,8 +45,8 @@ agent_opts = [ 'physical_network_vswitch_mappings', default=[], help=_('List of : ' - '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', diff --git a/neutron/plugins/hyperv/hyperv_neutron_plugin.py b/neutron/plugins/hyperv/hyperv_neutron_plugin.py index 07d6c9d3e..b9721c6cf 100644 --- a/neutron/plugins/hyperv/hyperv_neutron_plugin.py +++ b/neutron/plugins/hyperv/hyperv_neutron_plugin.py @@ -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 :: " - "or ")), + "or ")), ] cfg.CONF.register_opts(hyperv_opts, "HYPERV") diff --git a/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py b/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py index 292629a9a..60e132742 100644 --- a/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py +++ b/neutron/plugins/ml2/drivers/mech_arista/mechanism_arista.py @@ -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) diff --git a/neutron/plugins/mlnx/common/config.py b/neutron/plugins/mlnx/common/config.py index fb374b2f5..adf868ea7 100644 --- a/neutron/plugins/mlnx/common/config.py +++ b/neutron/plugins/mlnx/common/config.py @@ -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 :: " diff --git a/neutron/plugins/mlnx/db/mlnx_db_v2.py b/neutron/plugins/mlnx/db/mlnx_db_v2.py index f730824ed..50dd7057a 100644 --- a/neutron/plugins/mlnx/db/mlnx_db_v2.py +++ b/neutron/plugins/mlnx/db/mlnx_db_v2.py @@ -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) diff --git a/neutron/plugins/nicira/NeutronPlugin.py b/neutron/plugins/nicira/NeutronPlugin.py index f9d84d2fd..2e6518a8a 100644 --- a/neutron/plugins/nicira/NeutronPlugin.py +++ b/neutron/plugins/nicira/NeutronPlugin.py @@ -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', diff --git a/neutron/plugins/nicira/check_nvp_config.py b/neutron/plugins/nicira/check_nvp_config.py index 092dfba32..c86343a66 100644 --- a/neutron/plugins/nicira/check_nvp_config.py +++ b/neutron/plugins/nicira/check_nvp_config.py @@ -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) diff --git a/neutron/plugins/nicira/vshield/edge_firewall_driver.py b/neutron/plugins/nicira/vshield/edge_firewall_driver.py index a84a9b5c7..7b903c6e2 100644 --- a/neutron/plugins/nicira/vshield/edge_firewall_driver.py +++ b/neutron/plugins/nicira/vshield/edge_firewall_driver.py @@ -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) diff --git a/neutron/plugins/nicira/vshield/edge_loadbalancer_driver.py b/neutron/plugins/nicira/vshield/edge_loadbalancer_driver.py index 7e3ced5c8..0fef33d47 100644 --- a/neutron/plugins/nicira/vshield/edge_loadbalancer_driver.py +++ b/neutron/plugins/nicira/vshield/edge_loadbalancer_driver.py @@ -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) diff --git a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py index e69982175..393b94b51 100644 --- a/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py +++ b/neutron/services/firewall/agents/l3reference/firewall_l3_agent.py @@ -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( diff --git a/neutron/tests/unit/bigswitch/test_router_db.py b/neutron/tests/unit/bigswitch/test_router_db.py index 827bbdc12..d7e4a97a7 100644 --- a/neutron/tests/unit/bigswitch/test_router_db.py +++ b/neutron/tests/unit/bigswitch/test_router_db.py @@ -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) diff --git a/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py b/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py index ef8ea1192..8e4a0b40f 100644 --- a/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py +++ b/neutron/tests/unit/cisco/n1kv/test_n1kv_db.py @@ -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) diff --git a/neutron/tests/unit/db/vpn/test_db_vpnaas.py b/neutron/tests/unit/db/vpn/test_db_vpnaas.py index 23c4fcd19..70f72ee29 100644 --- a/neutron/tests/unit/db/vpn/test_db_vpnaas.py +++ b/neutron/tests/unit/db/vpn/test_db_vpnaas.py @@ -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', diff --git a/neutron/tests/unit/ml2/test_ml2_plugin.py b/neutron/tests/unit/ml2/test_ml2_plugin.py index 46b7550d3..5334262a7 100644 --- a/neutron/tests/unit/ml2/test_ml2_plugin.py +++ b/neutron/tests/unit/ml2/test_ml2_plugin.py @@ -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) diff --git a/neutron/tests/unit/ml2/test_type_vxlan.py b/neutron/tests/unit/ml2/test_type_vxlan.py index 7f4fd8baa..96a5b7656 100644 --- a/neutron/tests/unit/ml2/test_type_vxlan.py +++ b/neutron/tests/unit/ml2/test_type_vxlan.py @@ -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', diff --git a/neutron/tests/unit/nicira/test_nicira_plugin.py b/neutron/tests/unit/nicira/test_nicira_plugin.py index dbbbf8f1d..4d2b2f652 100644 --- a/neutron/tests/unit/nicira/test_nicira_plugin.py +++ b/neutron/tests/unit/nicira/test_nicira_plugin.py @@ -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) diff --git a/neutron/tests/unit/nicira/test_nvplib.py b/neutron/tests/unit/nicira/test_nvplib.py index eb0823f7b..4dfbd23fc 100644 --- a/neutron/tests/unit/nicira/test_nvplib.py +++ b/neutron/tests/unit/nicira/test_nvplib.py @@ -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}], diff --git a/neutron/tests/unit/test_db_plugin.py b/neutron/tests/unit/test_db_plugin.py index 651041c03..f52b89d67 100644 --- a/neutron/tests/unit/test_db_plugin.py +++ b/neutron/tests/unit/test_db_plugin.py @@ -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, diff --git a/neutron/tests/unit/test_debug_commands.py b/neutron/tests/unit/test_debug_commands.py index e820c4d2a..9410d1a89 100644 --- a/neutron/tests/unit/test_debug_commands.py +++ b/neutron/tests/unit/test_debug_commands.py @@ -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) diff --git a/neutron/tests/unit/test_dhcp_agent.py b/neutron/tests/unit/test_dhcp_agent.py index 4cc6b2537..c3c665a1c 100644 --- a/neutron/tests/unit/test_dhcp_agent.py +++ b/neutron/tests/unit/test_dhcp_agent.py @@ -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') diff --git a/neutron/tests/unit/test_extension_portsecurity.py b/neutron/tests/unit/test_extension_portsecurity.py index 8ba50ff80..0d1eca446 100644 --- a/neutron/tests/unit/test_extension_portsecurity.py +++ b/neutron/tests/unit/test_extension_portsecurity.py @@ -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() diff --git a/neutron/tests/unit/test_extension_security_group.py b/neutron/tests/unit/test_extension_security_group.py index d0f6ae0bf..67ca40194 100644 --- a/neutron/tests/unit/test_extension_security_group.py +++ b/neutron/tests/unit/test_extension_security_group.py @@ -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']) diff --git a/neutron/tests/unit/test_iptables_firewall.py b/neutron/tests/unit/test_iptables_firewall.py index 004c533af..e03119278 100644 --- a/neutron/tests/unit/test_iptables_firewall.py +++ b/neutron/tests/unit/test_iptables_firewall.py @@ -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) diff --git a/neutron/tests/unit/test_l3_agent.py b/neutron/tests/unit/test_l3_agent.py index 86e43d600..75e5b2644 100644 --- a/neutron/tests/unit/test_l3_agent.py +++ b/neutron/tests/unit/test_l3_agent.py @@ -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) diff --git a/neutron/tests/unit/test_linux_dhcp.py b/neutron/tests/unit/test_linux_dhcp.py index 7842acb6f..54fde1a5c 100644 --- a/neutron/tests/unit/test_linux_dhcp.py +++ b/neutron/tests/unit/test_linux_dhcp.py @@ -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: diff --git a/neutron/tests/unit/test_linux_ip_lib.py b/neutron/tests/unit/test_linux_ip_lib.py index 6c4eb5d0c..7bbbb3ddc 100644 --- a/neutron/tests/unit/test_linux_ip_lib.py +++ b/neutron/tests/unit/test_linux_ip_lib.py @@ -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): diff --git a/neutron/tests/unit/test_security_groups_rpc.py b/neutron/tests/unit/test_security_groups_rpc.py index ca98a55be..32fe1a518 100644 --- a/neutron/tests/unit/test_security_groups_rpc.py +++ b/neutron/tests/unit/test_security_groups_rpc.py @@ -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')])