Browse Source

Fix all pep8 E129 errors

Fixed all pep8 E129 errors and changed tox.ini to no longer
ignore them.

Change-Id: I0b06d99ce1d473b79a4cfdd173baa4f02e653847
changes/55/565355/2
Brian Haley 3 years ago
committed by Akihiro Motoki
parent
commit
7cfdf4aa81
60 changed files with 130 additions and 129 deletions
  1. +3
    -3
      neutron/agent/dhcp/agent.py
  2. +1
    -1
      neutron/agent/l3/agent.py
  3. +2
    -2
      neutron/agent/l3/dvr_fip_ns.py
  4. +2
    -2
      neutron/agent/l3/dvr_local_router.py
  5. +4
    -3
      neutron/agent/linux/dhcp.py
  6. +1
    -1
      neutron/agent/linux/iptables_manager.py
  7. +1
    -1
      neutron/agent/linux/openvswitch_firewall/firewall.py
  8. +1
    -1
      neutron/agent/linux/openvswitch_firewall/rules.py
  9. +1
    -1
      neutron/agent/linux/xenapi_root_helper.py
  10. +1
    -1
      neutron/agent/securitygroups_rpc.py
  11. +1
    -1
      neutron/api/api_common.py
  12. +1
    -1
      neutron/api/rpc/callbacks/producer/registry.py
  13. +6
    -5
      neutron/api/v2/base.py
  14. +1
    -1
      neutron/cmd/sanity_check.py
  15. +3
    -2
      neutron/db/agentschedulers_db.py
  16. +5
    -4
      neutron/db/db_base_plugin_v2.py
  17. +1
    -1
      neutron/db/dns_db.py
  18. +1
    -1
      neutron/db/ipam_backend_mixin.py
  19. +1
    -1
      neutron/db/l3_agentschedulers_db.py
  20. +2
    -2
      neutron/db/l3_db.py
  21. +5
    -6
      neutron/db/l3_dvr_db.py
  22. +2
    -2
      neutron/db/l3_hascheduler_db.py
  23. +1
    -1
      neutron/db/migration/cli.py
  24. +3
    -4
      neutron/db/securitygroups_db.py
  25. +2
    -2
      neutron/db/securitygroups_rpc_base.py
  26. +1
    -1
      neutron/manager.py
  27. +1
    -1
      neutron/objects/qos/policy.py
  28. +7
    -7
      neutron/pecan_wsgi/hooks/policy_enforcement.py
  29. +1
    -1
      neutron/plugins/ml2/drivers/l2pop/mech_driver.py
  30. +1
    -1
      neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py
  31. +1
    -1
      neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py
  32. +4
    -4
      neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py
  33. +3
    -3
      neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py
  34. +1
    -1
      neutron/plugins/ml2/extensions/dns_integration.py
  35. +10
    -12
      neutron/plugins/ml2/plugin.py
  36. +1
    -1
      neutron/quota/resource.py
  37. +1
    -1
      neutron/quota/resource_registry.py
  38. +1
    -1
      neutron/scheduler/dhcp_agent_scheduler.py
  39. +1
    -1
      neutron/scheduler/l3_agent_scheduler.py
  40. +4
    -4
      neutron/services/externaldns/drivers/designate/driver.py
  41. +1
    -1
      neutron/services/segments/plugin.py
  42. +1
    -1
      neutron/services/timestamp/timestamp_db.py
  43. +4
    -2
      neutron/tests/common/l3_test_common.py
  44. +2
    -2
      neutron/tests/common/net_helpers.py
  45. +1
    -1
      neutron/tests/fullstack/resources/machine.py
  46. +1
    -1
      neutron/tests/fullstack/test_securitygroup.py
  47. +1
    -1
      neutron/tests/unit/agent/linux/test_dhcp.py
  48. +1
    -1
      neutron/tests/unit/agent/test_securitygroups_rpc.py
  49. +2
    -2
      neutron/tests/unit/db/test_agentschedulers_db.py
  50. +6
    -6
      neutron/tests/unit/db/test_db_base_plugin_v2.py
  51. +3
    -3
      neutron/tests/unit/extensions/test_dns.py
  52. +1
    -1
      neutron/tests/unit/extensions/test_l3.py
  53. +1
    -1
      neutron/tests/unit/extensions/test_portsecurity.py
  54. +3
    -3
      neutron/tests/unit/objects/qos/test_policy.py
  55. +4
    -4
      neutron/tests/unit/objects/test_base.py
  56. +2
    -2
      neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py
  57. +1
    -1
      neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py
  58. +2
    -2
      neutron/tests/unit/scheduler/test_l3_agent_scheduler.py
  59. +2
    -2
      neutron/tests/unit/services/qos/test_qos_plugin.py
  60. +1
    -2
      tox.ini

+ 3
- 3
neutron/agent/dhcp/agent.py View File

@ -162,8 +162,8 @@ class DhcpAgent(manager.Manager):
# will automatically be retried on the notification
self.schedule_resync(e, network.id)
if (isinstance(e, oslo_messaging.RemoteError) and
e.exc_type == 'NetworkNotFound' or
isinstance(e, exceptions.NetworkNotFound)):
e.exc_type == 'NetworkNotFound' or
isinstance(e, exceptions.NetworkNotFound)):
LOG.debug("Network %s has been deleted.", network.id)
else:
LOG.exception('Unable to %(action)s dhcp for %(net_id)s.',
@ -521,7 +521,7 @@ class DhcpAgent(manager.Manager):
def disable_isolated_metadata_proxy(self, network):
if (self.conf.enable_metadata_network and
network.id in self._metadata_routers):
network.id in self._metadata_routers):
uuid = self._metadata_routers[network.id]
is_router_id = True
else:


+ 1
- 1
neutron/agent/l3/agent.py View File

@ -456,7 +456,7 @@ class L3NATAgent(ha.AgentMixin,
def _process_router_if_compatible(self, router):
if (self.conf.external_network_bridge and
not ip_lib.device_exists(self.conf.external_network_bridge)):
not ip_lib.device_exists(self.conf.external_network_bridge)):
LOG.error("The external network bridge '%s' does not exist",
self.conf.external_network_bridge)
return


+ 2
- 2
neutron/agent/l3/dvr_fip_ns.py View File

@ -309,8 +309,8 @@ class FipNamespace(namespaces.Namespace):
def _update_gateway_port(self, agent_gateway_port, interface_name):
if (self.agent_gateway_port and
not self._check_for_gateway_ip_change(agent_gateway_port)):
return
not self._check_for_gateway_ip_change(agent_gateway_port)):
return
# Caller already holding lock
self._update_gateway_route(
agent_gateway_port, interface_name, tbl_index=None)


+ 2
- 2
neutron/agent/l3/dvr_local_router.py View File

@ -625,8 +625,8 @@ class DvrLocalRouter(dvr_router_base.DvrRouterBase):
if int_port_addr_value is None:
return False
if ((key != lib_constants.IP_VERSION_6) and
int_port_addr_scopes.get(str(key)) in
ext_port_addr_scopes.values()):
int_port_addr_scopes.get(str(key)) in
ext_port_addr_scopes.values()):
return True
return False


+ 4
- 3
neutron/agent/linux/dhcp.py View File

@ -813,7 +813,7 @@ class Dnsmasq(DhcpLocalProcess):
(iaid, ip, client_id) = parts[1], parts[2], parts[4]
ip = ip.strip('[]')
if (ip_version and
netaddr.IPAddress(ip).version != ip_version):
netaddr.IPAddress(ip).version != ip_version):
continue
leases[ip] = {'iaid': iaid,
'client_id': client_id,
@ -1122,7 +1122,8 @@ class Dnsmasq(DhcpLocalProcess):
continue
for alloc in port.fixed_ips:
if (alloc.subnet_id in subnets and
subnets[alloc.subnet_id].gateway_ip == alloc.ip_address):
subnets[alloc.subnet_id].gateway_ip ==
alloc.ip_address):
isolated_subnets[alloc.subnet_id] = False
return isolated_subnets
@ -1165,7 +1166,7 @@ class Dnsmasq(DhcpLocalProcess):
return False
if (conf.enable_metadata_network and
cls.has_metadata_subnet(all_subnets)):
cls.has_metadata_subnet(all_subnets)):
return True
isolated_subnets = cls.get_isolated_subnets(network)


+ 1
- 1
neutron/agent/linux/iptables_manager.py View File

@ -499,7 +499,7 @@ class IptablesManager(object):
err = self._do_run_restore(args, commands)
if (isinstance(err, linux_utils.ProcessExecutionError) and
err.returncode == XTABLES_RESOURCE_PROBLEM_CODE):
err.returncode == XTABLES_RESOURCE_PROBLEM_CODE):
# maybe we run on a platform that includes iptables commit
# 999eaa241212d3952ddff39a99d0d55a74e3639e (for example, latest
# RHEL) and failed because of xlock acquired by another


+ 1
- 1
neutron/agent/linux/openvswitch_firewall/firewall.py View File

@ -364,7 +364,7 @@ class ConjIPFlowManager(object):
for sg_conj_id_map in vlan_conj_id_map.values():
for remote_sg_id, unused in unused_dict.items():
if (remote_sg_id in sg_conj_id_map and
sg_conj_id_map[remote_sg_id] & unused):
sg_conj_id_map[remote_sg_id] & unused):
sg_conj_id_map[remote_sg_id] -= unused
if not sg_conj_id_map[remote_sg_id]:
del sg_conj_id_map[remote_sg_id]


+ 1
- 1
neutron/agent/linux/openvswitch_firewall/rules.py View File

@ -142,7 +142,7 @@ def merge_port_ranges(rule_conj_list):
cur_conj.remove(conj_id)
if (len(result) == 1 and result[0][0]['port_range_min'] == 1 and
result[0][0]['port_range_max'] == 65535):
result[0][0]['port_range_max'] == 65535):
del result[0][0]['port_range_min']
del result[0][0]['port_range_max']
return result


+ 1
- 1
neutron/agent/linux/xenapi_root_helper.py View File

@ -62,7 +62,7 @@ class XenAPIClient(object):
# [XENAPI_PLUGIN_FAILURE_ID, methodname, except_class_name, message]
# We can distinguish the error type by checking the message string.
if (len(failure_details) == 4 and
XENAPI_PLUGIN_FAILURE_ID == failure_details[0]):
XENAPI_PLUGIN_FAILURE_ID == failure_details[0]):
if (MSG_UNAUTHORIZED == failure_details[3]):
return oslo_rootwrap_cmd.RC_UNAUTHORIZED
elif (MSG_NOT_FOUND == failure_details[3]):


+ 1
- 1
neutron/agent/securitygroups_rpc.py View File

@ -113,7 +113,7 @@ class SecurityGroupAgentRpc(object):
@functools.wraps(func)
def decorated_function(self, *args, **kwargs):
if (isinstance(self.firewall, firewall.NoopFirewallDriver) or
not is_firewall_enabled()):
not is_firewall_enabled()):
LOG.info("Skipping method %s as firewall is disabled "
"or configured as NoopFirewallDriver.",
func.__name__)


+ 1
- 1
neutron/api/api_common.py View File

@ -147,7 +147,7 @@ def get_limit_and_marker(request):
def _get_pagination_max_limit():
max_limit = -1
if (cfg.CONF.pagination_max_limit.lower() !=
constants.PAGINATION_INFINITE):
constants.PAGINATION_INFINITE):
try:
max_limit = int(cfg.CONF.pagination_max_limit)
if max_limit == 0:


+ 1
- 1
neutron/api/rpc/callbacks/producer/registry.py View File

@ -51,7 +51,7 @@ def pull(resource_type, resource_id, **kwargs):
obj = callback(resource_type, resource_id, **kwargs)
if obj:
if (not isinstance(obj, base.NeutronObject) or
resource_type != obj.obj_name()):
resource_type != obj.obj_name()):
raise exceptions.CallbackWrongResourceType(
resource_type=resource_type)
return obj

+ 6
- 5
neutron/api/v2/base.py View File

@ -169,11 +169,12 @@ class Controller(object):
attr_data = self._attr_info.get(attr_name)
if attr_data and attr_data['is_visible']:
if policy.check(
context,
'%s:%s' % (self._plugin_handlers[self.SHOW], attr_name),
data,
might_not_exist=True,
pluralized=self._collection):
context,
'%s:%s' % (self._plugin_handlers[self.SHOW],
attr_name),
data,
might_not_exist=True,
pluralized=self._collection):
# this attribute is visible, check next one
continue
# if the code reaches this point then either the policy check


+ 1
- 1
neutron/cmd/sanity_check.py View File

@ -375,7 +375,7 @@ def enable_tests_from_config():
if cfg.CONF.SECURITYGROUP.enable_security_group:
cfg.CONF.set_default('ip6tables_installed', True)
if ('sriovnicswitch' in cfg.CONF.ml2.mechanism_drivers and
'qos' in cfg.CONF.ml2.extension_drivers):
'qos' in cfg.CONF.ml2.extension_drivers):
cfg.CONF.set_default('vf_extended_management', True)
if cfg.CONF.SECURITYGROUP.firewall_driver in (
'iptables',


+ 3
- 2
neutron/db/agentschedulers_db.py View File

@ -73,8 +73,9 @@ class AgentSchedulerDbMixin(agents_db.AgentDbMixin):
agent_data = agent['agent']
agent_notifier = self.agent_notifiers.get(original_agent['agent_type'])
if (agent_notifier and
'admin_state_up' in agent_data and
original_agent['admin_state_up'] != agent_data['admin_state_up']):
'admin_state_up' in agent_data and
original_agent['admin_state_up'] !=
agent_data['admin_state_up']):
agent_notifier.agent_updated(context,
agent_data['admin_state_up'],
original_agent['host'])


+ 5
- 4
neutron/db/db_base_plugin_v2.py View File

@ -278,7 +278,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
# raise if multiple tenants found or if the only tenant found
# is not the owner of the network
if (len(tenant_ids) > 1 or len(tenant_ids) == 1 and
original.tenant_id not in tenant_ids):
original.tenant_id not in tenant_ids):
self._validate_projects_have_access_to_network(
original, tenant_ids)
@ -570,7 +570,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
error_message = _("Subnet has a prefix length that is "
"incompatible with DHCP service enabled")
if ((ip_ver == 4 and subnet_prefixlen > 30) or
(ip_ver == 6 and subnet_prefixlen > 126)):
(ip_ver == 6 and subnet_prefixlen > 126)):
raise exc.InvalidInput(error_message=error_message)
net = netaddr.IPNetwork(s['cidr'])
@ -937,7 +937,7 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
for ip in port['fixed_ips']:
if ip['subnet_id'] == result['id']:
if (port['device_owner'] in
constants.ROUTER_INTERFACE_OWNERS):
constants.ROUTER_INTERFACE_OWNERS):
routers.append(port['device_id'])
ip['ip_address'] = result['gateway_ip']
else:
@ -1244,7 +1244,8 @@ class NeutronDbPluginV2(db_base_plugin_common.DbBasePluginCommon,
def _check_mac_addr_update(self, context, port, new_mac, device_owner):
if (device_owner and
device_owner.startswith(constants.DEVICE_OWNER_NETWORK_PREFIX)):
device_owner.startswith(
constants.DEVICE_OWNER_NETWORK_PREFIX)):
raise n_exc.UnsupportedPortDeviceOwner(
op=_("mac address update"), port_id=id,
device_owner=device_owner)


+ 1
- 1
neutron/db/dns_db.py View File

@ -134,7 +134,7 @@ class DNSDbMixin(object):
context, floatingip_data))
if dns_data_db:
if (dns_data_db['published_dns_name'] != current_dns_name or
dns_data_db['published_dns_domain'] != current_dns_domain):
dns_data_db['published_dns_domain'] != current_dns_domain):
dns_actions_data = DNSActionsData(
previous_dns_name=dns_data_db['published_dns_name'],
previous_dns_domain=dns_data_db['published_dns_domain'])


+ 1
- 1
neutron/db/ipam_backend_mixin.py View File

@ -238,7 +238,7 @@ class IpamBackendMixin(db_base_plugin_common.DbBasePluginCommon):
subnet_list = self._get_subnets(context)
for subnet in subnet_list:
if ((netaddr.IPSet([subnet.cidr]) & new_subnet_ipset) and
str(subnet.cidr) != const.PROVISIONAL_IPV6_PD_PREFIX):
str(subnet.cidr) != const.PROVISIONAL_IPV6_PD_PREFIX):
# don't give out details of the overlapping subnet
err_msg = ("Requested subnet with cidr: %(cidr)s for "
"network: %(network_id)s overlaps with another "


+ 1
- 1
neutron/db/l3_agentschedulers_db.py View File

@ -99,7 +99,7 @@ class L3AgentSchedulerDbMixin(l3agentscheduler.L3AgentSchedulerPluginBase,
raise l3agentscheduler.DVRL3CannotAssignToDvrAgent()
if (agent_mode == constants.L3_AGENT_MODE_LEGACY and
router.get('distributed')):
router.get('distributed')):
raise l3agentscheduler.RouterL3AgentMismatch(
router_id=router['id'], agent_id=agent['id'])


+ 2
- 2
neutron/db/l3_db.py View File

@ -333,7 +333,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
if (not extensions.is_extension_supported(
l3_plugin,
constants.L3_AGENT_SCHEDULER_EXT_ALIAS) or
l3_plugin.router_scheduler is None):
l3_plugin.router_scheduler is None):
# that might mean that we are dealing with non-agent-based
# implementation of l3 services
return
@ -801,7 +801,7 @@ class L3_NAT_dbonly_mixin(l3.RouterPluginBase,
'subnet_id': subnet['id']}
if (subnet['ip_version'] == 6 and not
ipv6_utils.is_ipv6_pd_enabled(subnet)):
ipv6_utils.is_ipv6_pd_enabled(subnet)):
# Add new prefix to an existing ipv6 port with the same network id
# if one exists
port = self._find_ipv6_router_port_by_network(context, router,


+ 5
- 6
neutron/db/l3_dvr_db.py View File

@ -361,7 +361,7 @@ class DVRResourceOperationHandler(object):
# dvr service ports except for the compute port and
# dhcp port.
if (port['device_owner'] == "" or
port['device_owner'] in allowed_device_owners):
port['device_owner'] in allowed_device_owners):
addr_pair_active_service_port_list = (
self._get_ports_for_allowed_address_pair_ip(
admin_ctx, port['network_id'],
@ -458,8 +458,8 @@ class DVRResourceOperationHandler(object):
for port in router.attached_ports:
p = port['port']
if (p['network_id'] == net_id and
p['device_owner'] == device_owner and
self.l3plugin._port_has_ipv6_address(p)):
p['device_owner'] == device_owner and
self.l3plugin._port_has_ipv6_address(p)):
return self.l3plugin._core_plugin._make_port_dict(p)
def _check_for_multiprefix_csnat_port_and_update(
@ -678,7 +678,7 @@ class _DVRAgentInterfaceMixin(object):
# Skip if it is bound, but not to the given host
fip_dest_host = floating_ip.get('dest_host')
if (fip_host != l3_const.FLOATING_IP_HOST_NEEDS_BINDING and
fip_host != host and fip_dest_host is None):
fip_host != host and fip_dest_host is None):
return True
# not being skipped, log host
@ -721,8 +721,7 @@ class _DVRAgentInterfaceMixin(object):
# All unbound ports with floatingip irrespective of
# the device owner should be included as valid ports
# and updated.
if (port_in_migration or
self._is_unbound_port(port)):
if port_in_migration or self._is_unbound_port(port):
port_dict.update({port['id']: port})
continue
port_host = port[portbindings.HOST_ID]


+ 2
- 2
neutron/db/l3_hascheduler_db.py View File

@ -63,8 +63,8 @@ def _notify_l3_agent_ha_port_update(resource, event, trigger, **kwargs):
if new_port and original_port and host:
new_device_owner = new_port.get('device_owner', '')
if (new_device_owner == constants.DEVICE_OWNER_ROUTER_HA_INTF and
new_port['status'] == constants.PORT_STATUS_ACTIVE and
original_port['status'] != new_port['status']):
new_port['status'] == constants.PORT_STATUS_ACTIVE and
original_port['status'] != new_port['status']):
l3plugin = directory.get_plugin(plugin_constants.L3)
l3plugin.l3_rpc_notifier.routers_updated_on_host(
context, [new_port['device_id']], host)


+ 1
- 1
neutron/db/migration/cli.py View File

@ -122,7 +122,7 @@ def do_upgrade(config, cmd):
branch = None
if ((CONF.command.revision or CONF.command.delta) and
(CONF.command.expand or CONF.command.contract)):
(CONF.command.expand or CONF.command.contract)):
raise SystemExit(_(
'Phase upgrade options do not accept revision specification'))


+ 3
- 4
neutron/db/securitygroups_db.py View File

@ -440,8 +440,7 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
def _validate_port_range(self, rule):
"""Check that port_range is valid."""
if (rule['port_range_min'] is None and
rule['port_range_max'] is None):
if rule['port_range_min'] is None and rule['port_range_max'] is None:
return
if not rule['protocol']:
raise ext_sg.SecurityGroupProtocolRequiredWithPorts()
@ -474,8 +473,8 @@ class SecurityGroupDbMixin(ext_sg.SecurityGroupPluginBase):
# Only the protocols above support port ranges, raise otherwise.
# When min/max are the same it is just a single port.
if (rule['port_range_min'] is not None and
rule['port_range_max'] is not None and
rule['port_range_min'] != rule['port_range_max']):
rule['port_range_max'] is not None and
rule['port_range_min'] != rule['port_range_max']):
raise ext_sg.SecurityGroupInvalidProtocolForPortRange(
protocol=ip_proto)


+ 2
- 2
neutron/db/securitygroups_rpc_base.py View File

@ -117,7 +117,7 @@ class SecurityGroupServerNotifierRpcMixin(sg_db.SecurityGroupDbMixin):
# since it includes the legacy router interface device owners
# and DVR router interface device owners.
if (port['device_owner'] not in
[const.DEVICE_OWNER_DHCP, const.ROUTER_INTERFACE_OWNERS]):
[const.DEVICE_OWNER_DHCP, const.ROUTER_INTERFACE_OWNERS]):
sec_groups |= set(port.get(ext_sg.SECURITYGROUPS))
if sec_groups:
@ -172,7 +172,7 @@ class SecurityGroupInfoAPIMixin(object):
security_group_id = rule_in_db.get('security_group_id')
ethertype = rule_in_db['ethertype']
if ('security_group_source_groups'
not in sg_info['devices'][port_id]):
not in sg_info['devices'][port_id]):
sg_info['devices'][port_id][
'security_group_source_groups'] = []


+ 1
- 1
neutron/manager.py View File

@ -79,7 +79,7 @@ def validate_post_plugin_load():
message. If all is OK then it will return None.
"""
if ('dhcp_agents_per_network' in cfg.CONF and
cfg.CONF.dhcp_agents_per_network <= 0):
cfg.CONF.dhcp_agents_per_network <= 0):
msg = _("dhcp_agents_per_network must be >= 1. '%s' "
"is invalid.") % cfg.CONF.dhcp_agents_per_network
return msg


+ 1
- 1
neutron/objects/qos/policy.py View File

@ -134,7 +134,7 @@ class QosPolicy(rbac_db.NeutronRbacObject):
policy_obj = super(QosPolicy, cls).get_object(admin_context,
**kwargs)
if (not policy_obj or
not cls.is_accessible(context, policy_obj)):
not cls.is_accessible(context, policy_obj)):
return
policy_obj.obj_load_attr('rules')


+ 7
- 7
neutron/pecan_wsgi/hooks/policy_enforcement.py View File

@ -234,13 +234,13 @@ class PolicyHook(hooks.PecanHook):
attr_data = controller.resource_info.get(attr_name)
if attr_data and attr_data['is_visible']:
if policy.check(
context,
# NOTE(kevinbenton): this used to reference a
# _plugin_handlers dict, why?
'get_%s:%s' % (resource, attr_name),
data,
might_not_exist=True,
pluralized=collection):
context,
# NOTE(kevinbenton): this used to reference a
# _plugin_handlers dict, why?
'get_%s:%s' % (resource, attr_name),
data,
might_not_exist=True,
pluralized=collection):
# this attribute is visible, check next one
continue
# if the code reaches this point then either the policy check


+ 1
- 1
neutron/plugins/ml2/drivers/l2pop/mech_driver.py View File

@ -141,7 +141,7 @@ class L2populationMechanismDriver(api.MechanismDriver):
orig = context.original
if (orig['mac_address'] != port['mac_address'] and
context.status == const.PORT_STATUS_ACTIVE):
context.status == const.PORT_STATUS_ACTIVE):
msg = _("unable to modify mac_address of ACTIVE port "
"%s") % port['id']
raise exceptions.InvalidInput(error_message=msg)


+ 1
- 1
neutron/plugins/ml2/drivers/linuxbridge/agent/linuxbridge_neutron_agent.py View File

@ -196,7 +196,7 @@ class LinuxBridgeManager(amb.CommonAgentManagerBase):
# prefix = mix_interface.1 (backward compatible)
# prefix = mix_iHASHED.1111
if (len(physical_interface) + len(vlan_postfix) >
constants.DEVICE_NAME_MAX_LEN):
constants.DEVICE_NAME_MAX_LEN):
physical_interface = plugin_utils.get_interface_name(
physical_interface, max_len=(constants.DEVICE_NAME_MAX_LEN -
MAX_VLAN_POSTFIX_LEN))


+ 1
- 1
neutron/plugins/ml2/drivers/mech_sriov/mech_driver/mech_driver.py View File

@ -82,7 +82,7 @@ class SriovNicSwitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
if profile:
capabilities = profile.get('capabilities', [])
if (vnic_type == portbindings.VNIC_DIRECT and
'switchdev' in capabilities):
'switchdev' in capabilities):
LOG.debug("Refusing to bind due to unsupported vnic_type: %s "
"with switchdev capability", portbindings.VNIC_DIRECT)
return


+ 4
- 4
neutron/plugins/ml2/drivers/openvswitch/agent/ovs_neutron_agent.py View File

@ -1425,7 +1425,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
def _setup_tunnel_port(self, br, port_name, remote_ip, tunnel_type):
try:
if (netaddr.IPAddress(self.local_ip).version !=
netaddr.IPAddress(remote_ip).version):
netaddr.IPAddress(remote_ip).version):
LOG.error("IP version mismatch, cannot create tunnel: "
"local_ip=%(lip)s remote_ip=%(rip)s",
{'lip': self.local_ip, 'rip': remote_ip})
@ -2065,8 +2065,8 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
# Secure and wire/unwire VIFs and update their status
# on Neutron server
if (self._port_info_has_changes(port_info) or
self.sg_agent.firewall_refresh_needed() or
ovs_restarted):
self.sg_agent.firewall_refresh_needed() or
ovs_restarted):
LOG.debug("Starting to process devices in:%s",
port_info)
failed_devices = self.process_network_ports(
@ -2153,7 +2153,7 @@ class OVSNeutronAgent(l2population_rpc.L2populationRpcCallBackTunnelMixin,
def _check_agent_configurations(self):
if (self.enable_distributed_routing and self.enable_tunneling and
not self.l2_pop):
not self.l2_pop):
raise ValueError(_("DVR deployments for VXLAN/GRE/Geneve "
"underlays require L2-pop to be enabled, "


+ 3
- 3
neutron/plugins/ml2/drivers/openvswitch/mech_driver/mech_openvswitch.py View File

@ -85,7 +85,7 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
if profile:
capabilities = profile.get('capabilities', [])
if (vnic_type == portbindings.VNIC_DIRECT and
'switchdev' not in capabilities):
'switchdev' not in capabilities):
LOG.debug("Refusing to bind due to unsupported vnic_type: %s with "
"no switchdev capability", portbindings.VNIC_DIRECT)
return
@ -96,8 +96,8 @@ class OpenvswitchMechanismDriver(mech_agent.SimpleAgentMechanismDriverBase):
if (any(x in caps.get('iface_types', []) for x
in [a_const.OVS_DPDK_VHOST_USER,
a_const.OVS_DPDK_VHOST_USER_CLIENT]) and
agent['configurations'].get('datapath_type') ==
a_const.OVS_DATAPATH_NETDEV):
agent['configurations'].get('datapath_type') ==
a_const.OVS_DATAPATH_NETDEV):
return portbindings.VIF_TYPE_VHOST_USER
return self.vif_type


+ 1
- 1
neutron/plugins/ml2/extensions/dns_integration.py View File

@ -143,7 +143,7 @@ class DNSExtensionDriver(api.ExtensionDriver):
is_dns_domain_changed = (dns_domain is not None and
dns_data_db[dns_apidef.DNSDOMAIN] != dns_domain)
if (is_dns_name_changed or is_dns_domain_changed or
(has_fixed_ips and dns_data_db['current_dns_name'])):
(has_fixed_ips and dns_data_db['current_dns_name'])):
dns_data_db = self._populate_previous_external_dns_data(
dns_data_db)
dns_data_db = self._populate_current_external_dns_data(


+ 10
- 12
neutron/plugins/ml2/plugin.py View File

@ -329,14 +329,13 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
host = attrs.get(portbindings.HOST_ID) or ''
original_host = binding.host
if (validators.is_attr_set(host) and
original_host != host):
if validators.is_attr_set(host) and original_host != host:
binding.host = host
changes = True
vnic_type = attrs and attrs.get(portbindings.VNIC_TYPE)
if (validators.is_attr_set(vnic_type) and
binding.vnic_type != vnic_type):
binding.vnic_type != vnic_type):
binding.vnic_type = vnic_type
changes = True
@ -564,7 +563,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# Update the port status if requested by the bound driver.
if (bind_context._binding_levels and
bind_context._new_port_status):
bind_context._new_port_status):
port_db.status = bind_context._new_port_status
port['status'] = bind_context._new_port_status
@ -886,13 +885,12 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
# relationship can be updated.
context.session.expire(db_network)
if (
mtuw_apidef.MTU in net_data or
if (mtuw_apidef.MTU in net_data or
# NOTE(ihrachys) mtu may be null for existing networks,
# calculate and update it as needed; the conditional can be
# removed in Queens when we populate all mtu attributes and
# enforce it's not nullable on database level
db_network.mtu is None):
db_network.mtu is None):
db_network.mtu = self._get_network_mtu(db_network,
validate=False)
# agents should now update all ports to reflect new MTU
@ -1747,7 +1745,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
port_id = port.id
if ((port.status != status and
port['device_owner'] != const.DEVICE_OWNER_DVR_INTERFACE) or
port['device_owner'] == const.DEVICE_OWNER_DVR_INTERFACE):
port['device_owner'] == const.DEVICE_OWNER_DVR_INTERFACE):
attr = {
'id': port.id,
portbindings.HOST_ID: host,
@ -1759,7 +1757,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
with db_api.context_manager.writer.using(context):
context.session.add(port) # bring port into writer session
if (port.status != status and
port['device_owner'] != const.DEVICE_OWNER_DVR_INTERFACE):
port['device_owner'] != const.DEVICE_OWNER_DVR_INTERFACE):
original_port = self._make_port_dict(port)
port.status = status
# explicit flush before _make_port_dict to ensure extensions
@ -1783,7 +1781,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
updated = True
if (updated and
port['device_owner'] == const.DEVICE_OWNER_DVR_INTERFACE):
port['device_owner'] == const.DEVICE_OWNER_DVR_INTERFACE):
with db_api.context_manager.writer.using(context):
port = db.get_port(context, port_id)
if not port:
@ -1915,7 +1913,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
events.AFTER_DELETE))
def _handle_segment_change(self, rtype, event, trigger, context, segment):
if (event == events.PRECOMMIT_CREATE and
not isinstance(trigger, segments_plugin.Plugin)):
not isinstance(trigger, segments_plugin.Plugin)):
# TODO(xiaohhui): Now, when create network, ml2 will reserve
# segment and trigger this event handler. This event handler
# will reserve segment again, which will lead to error as the
@ -1957,7 +1955,7 @@ class Ml2Plugin(db_base_plugin_v2.NeutronDbPluginV2,
self, context, network_with_segments,
original_network=network_with_segments)
if (event == events.PRECOMMIT_CREATE or
event == events.PRECOMMIT_DELETE):
event == events.PRECOMMIT_DELETE):
self.mechanism_manager.update_network_precommit(mech_context)
elif event == events.AFTER_CREATE or event == events.AFTER_DELETE:
self.mechanism_manager.update_network_postcommit(mech_context)

+ 1
- 1
neutron/quota/resource.py View File

@ -264,7 +264,7 @@ class TrackedResource(BaseResource):
# or if data migrations do not take care of usage counters, the
# assumption will not hold anymore
if (tenant_id in self._dirty_tenants or
not usage_info or usage_info.dirty):
not usage_info or usage_info.dirty):
LOG.debug(("Usage tracker for resource:%(resource)s and tenant:"
"%(tenant_id)s is out of sync, need to count used "
"quota"), {'resource': self.name,


+ 1
- 1
neutron/quota/resource_registry.py View File

@ -171,7 +171,7 @@ class ResourceRegistry(object):
"""
if (not cfg.CONF.QUOTAS.track_quota_usage or
resource_name not in self._tracked_resource_mappings):
resource_name not in self._tracked_resource_mappings):
LOG.info("Creating instance of CountableResource for "
"resource:%s", resource_name)
return resource.CountableResource(


+ 1
- 1
neutron/scheduler/dhcp_agent_scheduler.py View File

@ -85,7 +85,7 @@ class AutoScheduler(object):
az_hints = (net.get(az_def.AZ_HINTS) or
cfg.CONF.default_availability_zones)
if (az_hints and
dhcp_agent['availability_zone'] not in az_hints):
dhcp_agent['availability_zone'] not in az_hints):
continue
bindings_to_add.append((dhcp_agent, net_id))
# do it outside transaction so particular scheduling results don't


+ 1
- 1
neutron/scheduler/l3_agent_scheduler.py View File

@ -106,7 +106,7 @@ class L3Scheduler(object):
for router, count in plugin.get_routers_l3_agents_count(context):
if (count < 1 or
router.get('ha', False) and count < max_agents_for_ha):
router.get('ha', False) and count < max_agents_for_ha):
# Either the router was un-scheduled (scheduled to 0 agents),
# or it's an HA router and it was under-scheduled (scheduled to
# less than max_agents_for_ha). Either way, it should be added


+ 4
- 4
neutron/services/externaldns/drivers/designate/driver.py View File

@ -69,16 +69,16 @@ class Designate(driver.ExternalDNSService):
ipv6_ptr_zone_size = CONF.designate.ipv6_ptr_zone_prefix_size
if (ipv4_ptr_zone_size < IPV4_PTR_ZONE_PREFIX_MIN_SIZE or
ipv4_ptr_zone_size > IPV4_PTR_ZONE_PREFIX_MAX_SIZE or
(ipv4_ptr_zone_size % 8) != 0):
ipv4_ptr_zone_size > IPV4_PTR_ZONE_PREFIX_MAX_SIZE or
(ipv4_ptr_zone_size % 8) != 0):
raise dns_exc.InvalidPTRZoneConfiguration(
parameter='ipv4_ptr_zone_size', number='8',
maximum=str(IPV4_PTR_ZONE_PREFIX_MAX_SIZE),
minimum=str(IPV4_PTR_ZONE_PREFIX_MIN_SIZE))
if (ipv6_ptr_zone_size < IPV6_PTR_ZONE_PREFIX_MIN_SIZE or
ipv6_ptr_zone_size > IPV6_PTR_ZONE_PREFIX_MAX_SIZE or
(ipv6_ptr_zone_size % 4) != 0):
ipv6_ptr_zone_size > IPV6_PTR_ZONE_PREFIX_MAX_SIZE or
(ipv6_ptr_zone_size % 4) != 0):
raise dns_exc.InvalidPTRZoneConfiguration(
parameter='ipv6_ptr_zone_size', number='4',
maximum=str(IPV6_PTR_ZONE_PREFIX_MAX_SIZE),


+ 1
- 1
neutron/services/segments/plugin.py View File

@ -412,7 +412,7 @@ class NovaSegmentNotifier(object):
def _does_port_require_nova_inventory_update(self, port):
device_owner = port.get('device_owner')
if (device_owner.startswith(constants.DEVICE_OWNER_COMPUTE_PREFIX) or
device_owner == constants.DEVICE_OWNER_DHCP):
device_owner == constants.DEVICE_OWNER_DHCP):
return False
return True


+ 1
- 1
neutron/services/timestamp/timestamp_db.py View File

@ -58,7 +58,7 @@ def _update_timestamp(session, context, instances):
while objs_list:
obj = objs_list.pop()
if (isinstance(obj, standard_attr.HasStandardAttributes) and
obj.standard_attr_id):
obj.standard_attr_id):
obj.updated_at = timeutils.utcnow()


+ 4
- 2
neutron/tests/common/l3_test_common.py View File

@ -302,7 +302,8 @@ def get_unassigned_pd_interfaces(router):
for intf in router[lib_constants.INTERFACE_KEY]:
for subnet in intf['subnets']:
if (ipv6_utils.is_ipv6_pd_enabled(subnet) and
subnet['cidr'] == lib_constants.PROVISIONAL_IPV6_PD_PREFIX):
subnet['cidr'] ==
lib_constants.PROVISIONAL_IPV6_PD_PREFIX):
pd_intfs.append(intf)
return pd_intfs
@ -312,7 +313,8 @@ def assign_prefix_for_pd_interfaces(router):
for ifno, intf in enumerate(router[lib_constants.INTERFACE_KEY]):
for subnet in intf['subnets']:
if (ipv6_utils.is_ipv6_pd_enabled(subnet) and
subnet['cidr'] == lib_constants.PROVISIONAL_IPV6_PD_PREFIX):
subnet['cidr'] ==
lib_constants.PROVISIONAL_IPV6_PD_PREFIX):
subnet['cidr'] = "2001:db8:%d::/64" % ifno
pd_intfs.append(intf)
return pd_intfs


+ 2
- 2
neutron/tests/common/net_helpers.py View File

@ -595,7 +595,7 @@ class VethFixture(fixtures.Fixture):
for port in self.ports:
ip_wrapper = ip_lib.IPWrapper(port.namespace)
if (ip_wrapper.netns.exists(port.namespace) or
port.namespace is None):
port.namespace is None):
try:
ip_wrapper.del_veth(port.name)
break
@ -666,7 +666,7 @@ class MacvtapFixture(fixtures.Fixture):
def destroy(self):
if (ip_lib.network_namespace_exists(self.ip_dev.namespace) or
self.ip_dev.namespace is None):
self.ip_dev.namespace is None):
try:
self.ip_dev.link.delete()
except RuntimeError:


+ 1
- 1
neutron/tests/fullstack/resources/machine.py View File

@ -109,7 +109,7 @@ class FakeFullstackMachine(machine_fixtures.FakeMachineBase):
subnet_id = fixed_ip['subnet_id']
subnet = self.safe_client.client.show_subnet(subnet_id)
if (netaddr.IPAddress(fixed_ip['ip_address']).version ==
constants.IP_VERSION_6):
constants.IP_VERSION_6):
# v6Address/default_route is auto-configured.
self._ipv6 = fixed_ip['ip_address']
self.gateway_ipv6 = subnet['subnet']['gateway_ip']


+ 1
- 1
neutron/tests/fullstack/test_securitygroup.py View File

@ -55,7 +55,7 @@ class BaseSecurityGroupsSameNetworkTest(base.BaseFullStackTestCase):
super(BaseSecurityGroupsSameNetworkTest, self).setUp(env)
if (self.firewall_driver == 'openvswitch' and
not OVSVersionChecker.supports_ovsfirewall()):
not OVSVersionChecker.supports_ovsfirewall()):
self.skipTest("Open vSwitch firewall_driver doesn't work "
"with this version of ovs.")


+ 1
- 1
neutron/tests/unit/agent/linux/test_dhcp.py View File

@ -1220,7 +1220,7 @@ class TestDnsmasq(TestBase):
possible_leases = 0
for i, s in enumerate(network.subnets):
if (s.ip_version != 6 or
s.ipv6_address_mode == constants.DHCPV6_STATEFUL):
s.ipv6_address_mode == constants.DHCPV6_STATEFUL):
if s.ip_version == 4:
expected.extend([prefix % (
i, s.cidr.split('/')[0],


+ 1
- 1
neutron/tests/unit/agent/test_securitygroups_rpc.py View File

@ -275,7 +275,7 @@ class SGServerRpcCallBackTestCase(test_sg.SecurityGroupDBTestCase):
def _port_with_addr_pairs_and_security_group(self):
plugin_obj = directory.get_plugin()
if ('allowed-address-pairs'
not in plugin_obj.supported_extension_aliases):
not in plugin_obj.supported_extension_aliases):
self.skipTest("Test depends on allowed-address-pairs extension")
fake_prefix = FAKE_PREFIX['IPv4']
with self.network() as n,\


+ 2
- 2
neutron/tests/unit/db/test_agentschedulers_db.py View File

@ -215,7 +215,7 @@ class AgentSchedulerTestMixIn(object):
agents = self._list_agents()
for agent_data in agents['agents']:
if (agent_data['agent_type'] == agent_type and
agent_data['host'] == host):
agent_data['host'] == host):
return agent_data['id']
@ -1139,7 +1139,7 @@ class OvsAgentSchedulerTestCase(OvsAgentSchedulerTestCaseBase):
default = l3agents['agents'][0]['id']
for com in agents['agents']:
if (com['id'] != default and
com['agent_type'] == constants.AGENT_TYPE_L3):
com['agent_type'] == constants.AGENT_TYPE_L3):
another_l3_agent_id = com['id']
another_l3_agent_host = com['host']
break


+ 6
- 6
neutron/tests/unit/db/test_db_base_plugin_v2.py View File

@ -341,7 +341,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
data['subnet'][arg] = kwargs[arg]
if ('gateway_ip' in kwargs and
kwargs['gateway_ip'] is not constants.ATTR_NOT_SPECIFIED):
kwargs['gateway_ip'] is not constants.ATTR_NOT_SPECIFIED):
data['subnet']['gateway_ip'] = kwargs['gateway_ip']
subnet_req = self.new_create_request('subnets', data, fmt)
@ -401,9 +401,9 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
data['port'][arg] = kwargs[arg]
# create a dhcp port device id if one hasn't been supplied
if ('device_owner' in kwargs and
kwargs['device_owner'] == constants.DEVICE_OWNER_DHCP and
'host' in kwargs and
'device_id' not in kwargs):
kwargs['device_owner'] == constants.DEVICE_OWNER_DHCP and
'host' in kwargs and
'device_id' not in kwargs):
device_id = utils.get_dhcp_agent_device_id(net_id, kwargs['host'])
data['port']['device_id'] = device_id
port_req = self.new_create_request('ports', data, fmt)
@ -4351,8 +4351,8 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
ipv6_ra_mode=addr_mode,
ipv6_address_mode=addr_mode)
if (insert_db_reference_error or insert_address_allocated or
device_owner == constants.DEVICE_OWNER_ROUTER_SNAT or
device_owner in constants.ROUTER_INTERFACE_OWNERS):
device_owner == constants.DEVICE_OWNER_ROUTER_SNAT or
device_owner in constants.ROUTER_INTERFACE_OWNERS):
# DVR SNAT, router interfaces and DHCP ports should not have
# been updated with addresses from the new auto-address subnet
self.assertEqual(1, len(port['port']['fixed_ips']))


+ 3
- 3
neutron/tests/unit/extensions/test_dns.py View File

@ -91,9 +91,9 @@ class DnsExtensionTestCase(test_plugin.Ml2PluginV2TestCase):
data['port'][arg] = kwargs[arg]
# create a dhcp port device id if one hasn't been supplied
if ('device_owner' in kwargs and
kwargs['device_owner'] == constants.DEVICE_OWNER_DHCP and
'host' in kwargs and
'device_id' not in kwargs):
kwargs['device_owner'] == constants.DEVICE_OWNER_DHCP and
'host' in kwargs and
'device_id' not in kwargs):
device_id = utils.get_dhcp_agent_device_id(net_id, kwargs['host'])
data['port']['device_id'] = device_id
port_req = self.new_create_request('ports', data, fmt)


+ 1
- 1
neutron/tests/unit/extensions/test_l3.py View File

@ -2114,7 +2114,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
self.assertEqual(400, res.status_int)
for p in self._list('ports')['ports']:
if (p['device_owner'] ==
lib_constants.DEVICE_OWNER_FLOATINGIP):
lib_constants.DEVICE_OWNER_FLOATINGIP):
self.fail('garbage port is not deleted')
def test_floatingip_with_assoc_fails(self):


+ 1
- 1
neutron/tests/unit/extensions/test_portsecurity.py View File

@ -105,7 +105,7 @@ class PortSecurityTestPlugin(db_base_plugin_v2.NeutronDbPluginV2,
self._process_port_port_security_create(context, p, neutron_db)
if (validators.is_attr_set(p.get(ext_sg.SECURITYGROUPS)) and
not (port_security and has_ip)):
not (port_security and has_ip)):
raise psec_exc.PortSecurityAndIPRequiredForSecurityGroups()
# Port requires ip and port_security enabled for security group


+ 3
- 3
neutron/tests/unit/objects/qos/test_policy.py View File

@ -90,9 +90,9 @@ class QosPolicyObjectTestCase(test_base.BaseObjectIfaceTestCase):
return_value=[self.db_objs[0]]) as get_objects_mock:
with mock.patch.object(
self.context,
'elevated',
return_value=admin_context) as context_mock:
self.context,
'elevated',
return_value=admin_context) as context_mock:
objs = self._test_class.get_objects(
self.context,


+ 4
- 4
neutron/tests/unit/objects/test_base.py View File

@ -1152,10 +1152,10 @@ class BaseObjectIfaceTestCase(_BaseObjectTestCase, test_base.BaseTestCase):
return_value={'a': 'a', 'b': 'b', 'c': 'c'})
def test_update_changes_forbidden(self, *mocks):
with mock.patch.object(
self._test_class,
'fields_no_update',
new_callable=mock.PropertyMock(return_value=['a', 'c']),
create=True):
self._test_class,
'fields_no_update',
new_callable=mock.PropertyMock(return_value=['a', 'c']),
create=True):
obj = self._test_class(self.context, **self.obj_fields[0])
self.assertRaises(o_exc.NeutronObjectUpdateForbidden, obj.update)


+ 2
- 2
neutron/tests/unit/plugins/ml2/drivers/mechanism_test.py View File

@ -92,7 +92,7 @@ class TestMechanismDriver(api.MechanismDriver):
if context.vif_type in (portbindings.VIF_TYPE_UNBOUND,
portbindings.VIF_TYPE_BINDING_FAILED):
if (context.segments_to_bind and
context.segments_to_bind[0][api.NETWORK_TYPE] == 'vlan'):
context.segments_to_bind[0][api.NETWORK_TYPE] == 'vlan'):
# Partially bound.
self._check_bound(context.binding_levels,
context.top_bound_segment,
@ -188,7 +188,7 @@ class TestMechanismDriver(api.MechanismDriver):
def update_port_precommit(self, context):
if ((context.original_top_bound_segment and
not context.top_bound_segment) or
(context.host == "host-fail")):
(context.host == "host-fail")):
self.bound_ports.remove((context.original['id'],
context.original_host))
self._check_port_context(context, True)


+ 1
- 1
neutron/tests/unit/scheduler/test_dhcp_agent_scheduler.py View File

@ -282,7 +282,7 @@ class TestAutoScheduleNetworks(TestDhcpSchedulerBaseTestCase):
expected_hosted_agents = (1 if expected_result and
self.valid_host else 0)
if (self.az_hints and
agents[0]['availability_zone'] not in self.az_hints):
agents[0]['availability_zone'] not in self.az_hints):
expected_hosted_agents = 0
host = "host-a" if self.valid_host else "host-b"
observed_ret_value = scheduler.auto_schedule_networks(


+ 2
- 2
neutron/tests/unit/scheduler/test_l3_agent_scheduler.py View File

@ -1243,8 +1243,8 @@ class L3DvrSchedulerTestCase(testlib_api.SqlTestCase):
}
with mock.patch(
'neutron.db.db_base_plugin_v2.NeutronDbPluginV2' '.get_ports',
return_value=[dvr_port]):
'neutron.db.db_base_plugin_v2.NeutronDbPluginV2' '.get_ports',
return_value=[dvr_port]):
sub_ids = self.dut.get_subnet_ids_on_router(self.adminContext,
r1['id'])
self.assertEqual(sub_ids.pop(),


+ 2
- 2
neutron/tests/unit/services/qos/test_qos_plugin.py View File

@ -524,8 +524,8 @@ class TestQosPlugin(base.BaseQosTestCase):
setattr(_policy, "rules", [self.rule])
with mock.patch('neutron.objects.qos.rule.get_rules',
return_value=[self.rule]), mock.patch(
'neutron.objects.qos.policy.QosPolicy.get_object',
return_value=_policy):
'neutron.objects.qos.policy.QosPolicy.get_object',
return_value=_policy):
self.rule_data['bandwidth_limit_rule']['max_kbps'] = 1
self.qos_plugin.update_policy_bandwidth_limit_rule(
self.ctxt, self.rule.id, self.policy.id, self.rule_data)


+ 1
- 2
tox.ini View File

@ -137,7 +137,6 @@ commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck
# E125 continuation line does not distinguish itself from next logical line
# E126 continuation line over-indented for hanging indent
# E128 continuation line under-indented for visual indent
# E129 visually indented line with same indent as next logical line
# H404 multi line docstring should start with a summary
# H405 multi line docstring summary not separated with an empty line
# N530 direct neutron imports not allowed
@ -145,7 +144,7 @@ commands = sphinx-build -W -b linkcheck doc/source doc/build/linkcheck
# N534 Untranslated exception message
# TODO(amotoki) check the following new rules should be fixed or ignored
# E731 do not assign a lambda expression, use a def
ignore = E125,E126,E128,E129,E731,H404,H405,N530,N534
ignore = E125,E126,E128,E731,H404,H405,N530,N534
# H106: Don't put vim configuration in source files
# H203: Use assertIs(Not)None to check for None
# H204: Use assert(Not)Equal to check for equality


Loading…
Cancel
Save