replace rest of q_exc to n_exc in code base
The following patch renames the rest of q_exc to n_exc which were left when quantum was renamed to neutron. used: find . -name "*.py" -print | xargs sed -i 's/q_exc/n_exc/g' Change-Id: I04041030694b28c400b6c9c552433f2eaa4a37ba Closes-bug: #1287462
This commit is contained in:
parent
78366adca8
commit
2a2d566be3
@ -19,7 +19,7 @@ import netaddr
|
||||
import re
|
||||
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.openstack.common import uuidutils
|
||||
|
||||
@ -108,7 +108,7 @@ def _validate_string(data, max_len=None):
|
||||
def _validate_boolean(data, valid_values=None):
|
||||
try:
|
||||
convert_to_boolean(data)
|
||||
except q_exc.InvalidInput:
|
||||
except n_exc.InvalidInput:
|
||||
msg = _("'%s' is not a valid boolean value") % data
|
||||
LOG.debug(msg)
|
||||
return msg
|
||||
@ -148,7 +148,7 @@ def _validate_no_whitespace(data):
|
||||
if len(data.split()) > 1:
|
||||
msg = _("'%s' contains whitespace") % data
|
||||
LOG.debug(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
return data
|
||||
|
||||
|
||||
@ -453,7 +453,7 @@ def convert_to_boolean(data):
|
||||
elif data == 1:
|
||||
return True
|
||||
msg = _("'%s' cannot be converted to boolean") % data
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
|
||||
def convert_to_int(data):
|
||||
@ -461,26 +461,26 @@ def convert_to_int(data):
|
||||
return int(data)
|
||||
except (ValueError, TypeError):
|
||||
msg = _("'%s' is not a integer") % data
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
|
||||
def convert_kvp_str_to_list(data):
|
||||
"""Convert a value of the form 'key=value' to ['key', 'value'].
|
||||
|
||||
:raises: q_exc.InvalidInput if any of the strings are malformed
|
||||
:raises: n_exc.InvalidInput if any of the strings are malformed
|
||||
(e.g. do not contain a key).
|
||||
"""
|
||||
kvp = [x.strip() for x in data.split('=', 1)]
|
||||
if len(kvp) == 2 and kvp[0]:
|
||||
return kvp
|
||||
msg = _("'%s' is not of the form <key>=[value]") % data
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
|
||||
def convert_kvp_list_to_dict(kvp_list):
|
||||
"""Convert a list of 'key=value' strings to a dict.
|
||||
|
||||
:raises: q_exc.InvalidInput if any of the strings are malformed
|
||||
:raises: n_exc.InvalidInput if any of the strings are malformed
|
||||
(e.g. do not contain a key) or if any
|
||||
of the keys appear more than once.
|
||||
"""
|
||||
|
@ -25,7 +25,7 @@ from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import sqlalchemyutils
|
||||
@ -134,7 +134,7 @@ class CommonDbMixin(object):
|
||||
elif ('tenant_id' in resource and
|
||||
resource['tenant_id'] != context.tenant_id):
|
||||
reason = _('Cannot create resource for another tenant')
|
||||
raise q_exc.AdminRequired(reason=reason)
|
||||
raise n_exc.AdminRequired(reason=reason)
|
||||
else:
|
||||
tenant_id = context.tenant_id
|
||||
return tenant_id
|
||||
@ -244,21 +244,21 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
try:
|
||||
network = self._get_by_id(context, models_v2.Network, id)
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.NetworkNotFound(net_id=id)
|
||||
raise n_exc.NetworkNotFound(net_id=id)
|
||||
return network
|
||||
|
||||
def _get_subnet(self, context, id):
|
||||
try:
|
||||
subnet = self._get_by_id(context, models_v2.Subnet, id)
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.SubnetNotFound(subnet_id=id)
|
||||
raise n_exc.SubnetNotFound(subnet_id=id)
|
||||
return subnet
|
||||
|
||||
def _get_port(self, context, id):
|
||||
try:
|
||||
port = self._get_by_id(context, models_v2.Port, id)
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=id)
|
||||
raise n_exc.PortNotFound(port_id=id)
|
||||
return port
|
||||
|
||||
def _get_dns_by_subnet(self, context, subnet_id):
|
||||
@ -303,7 +303,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
'max_retries': max_retries - (i + 1)})
|
||||
LOG.error(_("Unable to generate mac address after %s attempts"),
|
||||
max_retries)
|
||||
raise q_exc.MacAddressGenerationFailure(net_id=network_id)
|
||||
raise n_exc.MacAddressGenerationFailure(net_id=network_id)
|
||||
|
||||
@staticmethod
|
||||
def _check_unique_mac(context, network_id, mac_address):
|
||||
@ -352,7 +352,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
def _generate_ip(context, subnets):
|
||||
try:
|
||||
return NeutronDbPluginV2._try_generate_ip(context, subnets)
|
||||
except q_exc.IpAddressGenerationFailure:
|
||||
except n_exc.IpAddressGenerationFailure:
|
||||
NeutronDbPluginV2._rebuild_availability_ranges(context, subnets)
|
||||
|
||||
return NeutronDbPluginV2._try_generate_ip(context, subnets)
|
||||
@ -389,7 +389,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
# increment the first free
|
||||
range['first_ip'] = str(netaddr.IPAddress(ip_address) + 1)
|
||||
return {'ip_address': ip_address, 'subnet_id': subnet['id']}
|
||||
raise q_exc.IpAddressGenerationFailure(net_id=subnets[0]['network_id'])
|
||||
raise n_exc.IpAddressGenerationFailure(net_id=subnets[0]['network_id'])
|
||||
|
||||
@staticmethod
|
||||
def _rebuild_availability_ranges(context, subnets):
|
||||
@ -534,7 +534,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
if 'subnet_id' not in fixed:
|
||||
if 'ip_address' not in fixed:
|
||||
msg = _('IP allocation requires subnet_id or ip_address')
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
filter = {'network_id': [network_id]}
|
||||
subnets = self.get_subnets(context, filters=filter)
|
||||
@ -547,7 +547,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
if not found:
|
||||
msg = _('IP address %s is not a valid IP for the defined '
|
||||
'networks subnets') % fixed['ip_address']
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
subnet = self._get_subnet(context, fixed['subnet_id'])
|
||||
if subnet['network_id'] != network_id:
|
||||
@ -556,7 +556,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
"%(subnet_id)s") %
|
||||
{'network_id': network_id,
|
||||
'subnet_id': fixed['subnet_id']})
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
subnet_id = subnet['id']
|
||||
|
||||
if 'ip_address' in fixed:
|
||||
@ -564,7 +564,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
if not NeutronDbPluginV2._check_unique_ip(context, network_id,
|
||||
subnet_id,
|
||||
fixed['ip_address']):
|
||||
raise q_exc.IpAddressInUse(net_id=network_id,
|
||||
raise n_exc.IpAddressInUse(net_id=network_id,
|
||||
ip_address=fixed['ip_address'])
|
||||
|
||||
# Ensure that the IP is valid on the subnet
|
||||
@ -573,7 +573,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
subnet['cidr'], fixed['ip_address'])):
|
||||
msg = _('IP address %s is not a valid IP for the defined '
|
||||
'subnet') % fixed['ip_address']
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
fixed_ip_set.append({'subnet_id': subnet_id,
|
||||
'ip_address': fixed['ip_address']})
|
||||
@ -581,7 +581,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
fixed_ip_set.append({'subnet_id': subnet_id})
|
||||
if len(fixed_ip_set) > cfg.CONF.max_fixed_ips_per_port:
|
||||
msg = _('Exceeded maximim amount of fixed ips per port')
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
return fixed_ip_set
|
||||
|
||||
def _allocate_fixed_ips(self, context, network, fixed_ips):
|
||||
@ -614,7 +614,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
# the new_ips contain all of the fixed_ips that are to be updated
|
||||
if len(new_ips) > cfg.CONF.max_fixed_ips_per_port:
|
||||
msg = _('Exceeded maximim amount of fixed ips per port')
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
# Remove all of the intersecting elements
|
||||
for original_ip in original_ips[:]:
|
||||
@ -701,7 +701,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
{'new_cidr': new_subnet_cidr,
|
||||
'subnet_id': subnet.id,
|
||||
'cidr': subnet.cidr})
|
||||
raise q_exc.InvalidInput(error_message=err_msg)
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
|
||||
def _validate_allocation_pools(self, ip_pools, subnet_cidr):
|
||||
"""Validate IP allocation pools.
|
||||
@ -726,23 +726,23 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
"%(start)s - %(end)s:"),
|
||||
{'start': ip_pool['start'],
|
||||
'end': ip_pool['end']})
|
||||
raise q_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
raise n_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
if (start_ip.version != subnet.version or
|
||||
end_ip.version != subnet.version):
|
||||
LOG.info(_("Specified IP addresses do not match "
|
||||
"the subnet IP version"))
|
||||
raise q_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
raise n_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
if end_ip < start_ip:
|
||||
LOG.info(_("Start IP (%(start)s) is greater than end IP "
|
||||
"(%(end)s)"),
|
||||
{'start': ip_pool['start'], 'end': ip_pool['end']})
|
||||
raise q_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
raise n_exc.InvalidAllocationPool(pool=ip_pool)
|
||||
if start_ip < subnet_first_ip or end_ip > subnet_last_ip:
|
||||
LOG.info(_("Found pool larger than subnet "
|
||||
"CIDR:%(start)s - %(end)s"),
|
||||
{'start': ip_pool['start'],
|
||||
'end': ip_pool['end']})
|
||||
raise q_exc.OutOfBoundsAllocationPool(
|
||||
raise n_exc.OutOfBoundsAllocationPool(
|
||||
pool=ip_pool,
|
||||
subnet_cidr=subnet_cidr)
|
||||
# Valid allocation pool
|
||||
@ -765,7 +765,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
LOG.info(_("Found overlapping ranges: %(l_range)s and "
|
||||
"%(r_range)s"),
|
||||
{'l_range': l_range, 'r_range': r_range})
|
||||
raise q_exc.OverlappingAllocationPools(
|
||||
raise n_exc.OverlappingAllocationPools(
|
||||
pool_1=l_range,
|
||||
pool_2=r_range,
|
||||
subnet_cidr=subnet_cidr)
|
||||
@ -776,11 +776,11 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
netaddr.IPAddress(route['nexthop'])
|
||||
except netaddr.core.AddrFormatError:
|
||||
err_msg = _("Invalid route: %s") % route
|
||||
raise q_exc.InvalidInput(error_message=err_msg)
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
except ValueError:
|
||||
# netaddr.IPAddress would raise this
|
||||
err_msg = _("Invalid route: %s") % route
|
||||
raise q_exc.InvalidInput(error_message=err_msg)
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
self._validate_ip_version(ip_version, route['nexthop'], 'nexthop')
|
||||
self._validate_ip_version(ip_version, route['destination'],
|
||||
'destination')
|
||||
@ -828,7 +828,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
# is not the owner of the network
|
||||
if (len(tenant_ids) > 1 or len(tenant_ids) == 1 and
|
||||
tenant_ids.pop() != original.tenant_id):
|
||||
raise q_exc.InvalidSharedSetting(network=original.name)
|
||||
raise n_exc.InvalidSharedSetting(network=original.name)
|
||||
|
||||
def _make_network_dict(self, network, fields=None,
|
||||
process_extensions=True):
|
||||
@ -956,7 +956,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
for p in ports)
|
||||
|
||||
if not only_auto_del:
|
||||
raise q_exc.NetworkInUse(net_id=id)
|
||||
raise n_exc.NetworkInUse(net_id=id)
|
||||
|
||||
# clean up network owned ports
|
||||
for port in ports:
|
||||
@ -999,7 +999,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
'ip_version': ip_version}
|
||||
msg = _("%(name)s '%(addr)s' does not match "
|
||||
"the ip_version '%(ip_version)s'") % data
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _validate_subnet(self, context, s, cur_subnet=None):
|
||||
"""Validate a subnet spec."""
|
||||
@ -1022,7 +1022,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
not NeutronDbPluginV2._check_subnet_ip(s['cidr'],
|
||||
s['gateway_ip'])):
|
||||
error_message = _("Gateway is not valid on subnet")
|
||||
raise q_exc.InvalidInput(error_message=error_message)
|
||||
raise n_exc.InvalidInput(error_message=error_message)
|
||||
# Ensure the gateway IP is not assigned to any port
|
||||
# skip this check in case of create (s parameter won't have id)
|
||||
# NOTE(salv-orlando): There is slight chance of a race, when
|
||||
@ -1034,27 +1034,27 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
ip_address=cur_subnet['gateway_ip'],
|
||||
subnet_id=cur_subnet['id']).first()
|
||||
if allocated and allocated['port_id']:
|
||||
raise q_exc.GatewayIpInUse(
|
||||
raise n_exc.GatewayIpInUse(
|
||||
ip_address=cur_subnet['gateway_ip'],
|
||||
port_id=allocated['port_id'])
|
||||
|
||||
if attributes.is_attr_set(s.get('dns_nameservers')):
|
||||
if len(s['dns_nameservers']) > cfg.CONF.max_dns_nameservers:
|
||||
raise q_exc.DNSNameServersExhausted(
|
||||
raise n_exc.DNSNameServersExhausted(
|
||||
subnet_id=s.get('id', _('new subnet')),
|
||||
quota=cfg.CONF.max_dns_nameservers)
|
||||
for dns in s['dns_nameservers']:
|
||||
try:
|
||||
netaddr.IPAddress(dns)
|
||||
except Exception:
|
||||
raise q_exc.InvalidInput(
|
||||
raise n_exc.InvalidInput(
|
||||
error_message=(_("Error parsing dns address %s") %
|
||||
dns))
|
||||
self._validate_ip_version(ip_ver, dns, 'dns_nameserver')
|
||||
|
||||
if attributes.is_attr_set(s.get('host_routes')):
|
||||
if len(s['host_routes']) > cfg.CONF.max_subnet_host_routes:
|
||||
raise q_exc.HostRoutesExhausted(
|
||||
raise n_exc.HostRoutesExhausted(
|
||||
subnet_id=s.get('id', _('new subnet')),
|
||||
quota=cfg.CONF.max_subnet_host_routes)
|
||||
# check if the routes are all valid
|
||||
@ -1067,7 +1067,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
allocation_pool['start'],
|
||||
allocation_pool['end'])
|
||||
if netaddr.IPAddress(gateway_ip) in pool_range:
|
||||
raise q_exc.GatewayConflictWithAllocationPools(
|
||||
raise n_exc.GatewayConflictWithAllocationPools(
|
||||
pool=pool_range,
|
||||
ip_address=gateway_ip)
|
||||
|
||||
@ -1234,7 +1234,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
NeutronDbPluginV2._delete_ip_allocation(
|
||||
context, subnet.network_id, id, a.ip_address)
|
||||
else:
|
||||
raise q_exc.SubnetInUse(subnet_id=id)
|
||||
raise n_exc.SubnetInUse(subnet_id=id)
|
||||
|
||||
context.session.delete(subnet)
|
||||
|
||||
@ -1283,7 +1283,7 @@ class NeutronDbPluginV2(neutron_plugin_base_v2.NeutronPluginBaseV2,
|
||||
if not NeutronDbPluginV2._check_unique_mac(context,
|
||||
network_id,
|
||||
mac_address):
|
||||
raise q_exc.MacAddressInUse(net_id=network_id,
|
||||
raise n_exc.MacAddressInUse(net_id=network_id,
|
||||
mac=mac_address)
|
||||
|
||||
# Returns the IP's for the port
|
||||
|
@ -22,7 +22,7 @@ from sqlalchemy.sql import expression as expr
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
@ -152,6 +152,6 @@ class External_net_db_mixin(object):
|
||||
def get_external_network_id(self, context):
|
||||
nets = self.get_networks(context, {external_net.EXTERNAL: [True]})
|
||||
if len(nets) > 1:
|
||||
raise q_exc.TooManyExternalNetworks()
|
||||
raise n_exc.TooManyExternalNetworks()
|
||||
else:
|
||||
return nets[0]['id'] if nets else None
|
||||
|
@ -20,7 +20,7 @@ from sqlalchemy.orm import exc
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
from neutron.extensions import l3
|
||||
@ -167,7 +167,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
l3_port_check=False)
|
||||
msg = (_('No IPs available for external network %s') %
|
||||
network_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
with context.session.begin(subtransactions=True):
|
||||
router.gw_port = self._core_plugin._get_port(context.elevated(),
|
||||
@ -187,7 +187,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
if not network_db.external:
|
||||
msg = _("Network %s is not a valid external "
|
||||
"network") % network_id
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
# figure out if we need to delete existing port
|
||||
if gw_port and gw_port['network_id'] != network_id:
|
||||
@ -281,7 +281,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
if ip['subnet_id'] == subnet_id:
|
||||
msg = (_("Router already has a port on subnet %s")
|
||||
% subnet_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
sub_id = ip['subnet_id']
|
||||
cidr = self._core_plugin._get_subnet(context.elevated(),
|
||||
sub_id)['cidr']
|
||||
@ -296,32 +296,32 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
msg = (_("Cidr %(subnet_cidr)s of subnet "
|
||||
"%(subnet_id)s overlaps with cidr %(cidr)s "
|
||||
"of subnet %(sub_id)s") % data)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
except exc.NoResultFound:
|
||||
pass
|
||||
|
||||
def add_router_interface(self, context, router_id, interface_info):
|
||||
if not interface_info:
|
||||
msg = _("Either subnet_id or port_id must be specified")
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
if 'port_id' in interface_info:
|
||||
# make sure port update is committed
|
||||
with context.session.begin(subtransactions=True):
|
||||
if 'subnet_id' in interface_info:
|
||||
msg = _("Cannot specify both subnet-id and port-id")
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
port = self._core_plugin._get_port(context,
|
||||
interface_info['port_id'])
|
||||
if port['device_id']:
|
||||
raise q_exc.PortInUse(net_id=port['network_id'],
|
||||
raise n_exc.PortInUse(net_id=port['network_id'],
|
||||
port_id=port['id'],
|
||||
device_id=port['device_id'])
|
||||
fixed_ips = [ip for ip in port['fixed_ips']]
|
||||
if len(fixed_ips) != 1:
|
||||
msg = _('Router port must have exactly one fixed IP')
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
subnet_id = fixed_ips[0]['subnet_id']
|
||||
subnet = self._core_plugin._get_subnet(context, subnet_id)
|
||||
self._check_for_dup_router_subnet(context, router_id,
|
||||
@ -336,7 +336,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
# Ensure the subnet has a gateway
|
||||
if not subnet['gateway_ip']:
|
||||
msg = _('Subnet for router interface must have a gateway IP')
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
self._check_for_dup_router_subnet(context, router_id,
|
||||
subnet['network_id'],
|
||||
subnet_id,
|
||||
@ -380,7 +380,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
def remove_router_interface(self, context, router_id, interface_info):
|
||||
if not interface_info:
|
||||
msg = _("Either subnet_id or port_id must be specified")
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if 'port_id' in interface_info:
|
||||
port_id = interface_info['port_id']
|
||||
port_db = self._core_plugin._get_port(context, port_id)
|
||||
@ -391,7 +391,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
if 'subnet_id' in interface_info:
|
||||
port_subnet_id = port_db['fixed_ips'][0]['subnet_id']
|
||||
if port_subnet_id != interface_info['subnet_id']:
|
||||
raise q_exc.SubnetMismatchForPort(
|
||||
raise n_exc.SubnetMismatchForPort(
|
||||
port_id=port_id,
|
||||
subnet_id=interface_info['subnet_id'])
|
||||
subnet_id = port_db['fixed_ips'][0]['subnet_id']
|
||||
@ -467,7 +467,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
if not subnet_db['gateway_ip']:
|
||||
msg = (_('Cannot add floating IP to port on subnet %s '
|
||||
'which has no gateway_ip') % internal_subnet_id)
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
# find router interface ports on this network
|
||||
router_intf_qry = context.session.query(models_v2.Port)
|
||||
@ -511,7 +511,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
msg = (_('Cannot create floating IP and bind it to '
|
||||
'Port %s, since that port is owned by a '
|
||||
'different tenant.') % port_id)
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
internal_subnet_id = None
|
||||
if 'fixed_ip_address' in fip and fip['fixed_ip_address']:
|
||||
@ -523,18 +523,18 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
msg = (_('Port %(id)s does not have fixed ip %(address)s') %
|
||||
{'id': internal_port['id'],
|
||||
'address': internal_ip_address})
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
else:
|
||||
ips = [ip['ip_address'] for ip in internal_port['fixed_ips']]
|
||||
if not ips:
|
||||
msg = (_('Cannot add floating IP to port %s that has'
|
||||
'no fixed IP addresses') % internal_port['id'])
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
if len(ips) > 1:
|
||||
msg = (_('Port %s has multiple fixed IPs. Must provide'
|
||||
' a specific IP when assigning a floating IP') %
|
||||
internal_port['id'])
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
internal_ip_address = internal_port['fixed_ips'][0]['ip_address']
|
||||
internal_subnet_id = internal_port['fixed_ips'][0]['subnet_id']
|
||||
return internal_port, internal_subnet_id, internal_ip_address
|
||||
@ -575,7 +575,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
if (('fixed_ip_address' in fip and fip['fixed_ip_address']) and
|
||||
not ('port_id' in fip and fip['port_id'])):
|
||||
msg = _("fixed_ip_address cannot be specified without a port_id")
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
if 'port_id' in fip and fip['port_id']:
|
||||
port_id, internal_ip_address, router_id = self.get_assoc_data(
|
||||
context,
|
||||
@ -610,7 +610,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
f_net_id = fip['floating_network_id']
|
||||
if not self._core_plugin._network_is_external(context, f_net_id):
|
||||
msg = _("Network %s is not a valid external network") % f_net_id
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
with context.session.begin(subtransactions=True):
|
||||
# This external port is never exposed to the tenant.
|
||||
@ -628,7 +628,7 @@ class L3_NAT_db_mixin(l3.RouterPluginBase):
|
||||
'name': ''}})
|
||||
# Ensure IP addresses are allocated on external port
|
||||
if not external_port['fixed_ips']:
|
||||
raise q_exc.ExternalIpAddressExhausted(net_id=f_net_id)
|
||||
raise n_exc.ExternalIpAddressExhausted(net_id=f_net_id)
|
||||
|
||||
floating_fixed_ip = external_port['fixed_ips'][0]
|
||||
floating_ip_address = floating_fixed_ip['ip_address']
|
||||
|
@ -21,7 +21,7 @@ from sqlalchemy.orm import exc
|
||||
from sqlalchemy.orm import validates
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import db_base_plugin_v2 as base_db
|
||||
from neutron.db import model_base
|
||||
from neutron.db import models_v2
|
||||
@ -340,7 +340,7 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
||||
pool = self._get_resource(context, Pool, v['pool_id'])
|
||||
# validate that the pool has same tenant
|
||||
if pool['tenant_id'] != tenant_id:
|
||||
raise q_exc.NotAuthorized()
|
||||
raise n_exc.NotAuthorized()
|
||||
# validate that the pool has same protocol
|
||||
if pool['protocol'] != v['protocol']:
|
||||
raise loadbalancer.ProtocolMismatch(
|
||||
@ -420,7 +420,7 @@ class LoadBalancerPluginDb(LoadBalancerPluginBase,
|
||||
|
||||
# check that the pool matches the tenant_id
|
||||
if new_pool['tenant_id'] != vip_db['tenant_id']:
|
||||
raise q_exc.NotAuthorized()
|
||||
raise n_exc.NotAuthorized()
|
||||
# validate that the pool has same protocol
|
||||
if new_pool['protocol'] != vip_db['protocol']:
|
||||
raise loadbalancer.ProtocolMismatch(
|
||||
|
@ -18,7 +18,7 @@
|
||||
import sqlalchemy
|
||||
from sqlalchemy.orm.properties import RelationshipProperty
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.openstack.common import log as logging
|
||||
|
||||
|
||||
@ -72,13 +72,13 @@ def paginate_query(query, model, limit, sorts, marker_obj=None):
|
||||
# Extension attribute doesn't support for sorting. Because it
|
||||
# existed in attr_info, it will be catched at here
|
||||
msg = _("%s is invalid attribute for sort_key") % sort_key
|
||||
raise q_exc.BadRequest(resource=model.__tablename__, msg=msg)
|
||||
raise n_exc.BadRequest(resource=model.__tablename__, msg=msg)
|
||||
if isinstance(sort_key_attr.property, RelationshipProperty):
|
||||
msg = _("The attribute '%(attr)s' is reference to other "
|
||||
"resource, can't used by sort "
|
||||
"'%(resource)s'") % {'attr': sort_key,
|
||||
'resource': model.__tablename__}
|
||||
raise q_exc.BadRequest(resource=model.__tablename__, msg=msg)
|
||||
raise n_exc.BadRequest(resource=model.__tablename__, msg=msg)
|
||||
query = query.order_by(sort_dir_func(sort_key_attr))
|
||||
|
||||
# Add pagination
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
|
||||
|
||||
NETWORK_TYPE = 'provider:network_type'
|
||||
@ -54,7 +54,7 @@ def _raise_if_updates_provider_attributes(attrs):
|
||||
immutable = (NETWORK_TYPE, PHYSICAL_NETWORK, SEGMENTATION_ID)
|
||||
if any(attributes.is_attr_set(attrs.get(a)) for a in immutable):
|
||||
msg = _("Plugin does not support updating provider attributes")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
|
||||
class Providernet(extensions.ExtensionDescriptor):
|
||||
|
@ -24,7 +24,7 @@ from neutron.api import extensions
|
||||
from neutron.api.v2.attributes import convert_to_int
|
||||
from neutron.api.v2 import base
|
||||
from neutron.api.v2 import resource
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.manager import NeutronManager
|
||||
from neutron.openstack.common import importutils
|
||||
from neutron import quota
|
||||
@ -79,7 +79,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
"""Retrieve the tenant info in context."""
|
||||
context = request.context
|
||||
if not context.tenant_id:
|
||||
raise q_exc.QuotaMissingTenant()
|
||||
raise n_exc.QuotaMissingTenant()
|
||||
return {'tenant': {'tenant_id': context.tenant_id}}
|
||||
|
||||
def show(self, request, id):
|
||||
@ -92,7 +92,7 @@ class QuotaSetsController(wsgi.Controller):
|
||||
def _check_admin(self, context,
|
||||
reason=_("Only admin can view or configure quota")):
|
||||
if not context.is_admin:
|
||||
raise q_exc.AdminRequired(reason=reason)
|
||||
raise n_exc.AdminRequired(reason=reason)
|
||||
|
||||
def delete(self, request, id):
|
||||
self._check_admin(request.context)
|
||||
|
@ -24,7 +24,7 @@ import re
|
||||
from sqlalchemy.orm import exc
|
||||
from sqlalchemy.sql import and_
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.openstack.common import log as logging
|
||||
@ -532,7 +532,7 @@ def reserve_vxlan(db_session, network_profile):
|
||||
segment_id, get_multicast_ip(network_profile))
|
||||
else:
|
||||
return (physical_network, segment_type, segment_id, "0.0.0.0")
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
|
||||
def alloc_network(db_session, network_profile_id):
|
||||
@ -568,10 +568,10 @@ def reserve_specific_vlan(db_session, physical_network, vlan_id):
|
||||
one())
|
||||
if alloc.allocated:
|
||||
if vlan_id == c_const.FLAT_VLAN_ID:
|
||||
raise q_exc.FlatNetworkInUse(
|
||||
raise n_exc.FlatNetworkInUse(
|
||||
physical_network=physical_network)
|
||||
else:
|
||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
raise n_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan)s on physical "
|
||||
"network %(network)s from pool"),
|
||||
@ -739,7 +739,7 @@ def set_port_status(port_id, status):
|
||||
port = db_session.query(models_v2.Port).filter_by(id=port_id).one()
|
||||
port.status = status
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
||||
|
||||
def get_vm_network(db_session, policy_profile_id, network_id):
|
||||
@ -942,7 +942,7 @@ def get_policy_profile(db_session, id):
|
||||
def create_profile_binding(tenant_id, profile_id, profile_type):
|
||||
"""Create Network/Policy Profile association with a tenant."""
|
||||
if profile_type not in ["network", "policy"]:
|
||||
raise q_exc.NeutronException(_("Invalid profile type"))
|
||||
raise n_exc.NeutronException(_("Invalid profile type"))
|
||||
|
||||
if _profile_binding_exists(tenant_id, profile_id, profile_type):
|
||||
return get_profile_binding(tenant_id, profile_id)
|
||||
@ -1218,7 +1218,7 @@ class NetworkProfile_db_mixin(object):
|
||||
"""
|
||||
if not re.match(r"(\d+)\-(\d+)", network_profile["segment_range"]):
|
||||
msg = _("Invalid segment range. example range: 500-550")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _validate_network_profile(self, net_p):
|
||||
"""
|
||||
@ -1230,7 +1230,7 @@ class NetworkProfile_db_mixin(object):
|
||||
msg = _("Arguments segment_type missing"
|
||||
" for network profile")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
segment_type = net_p["segment_type"].lower()
|
||||
if segment_type not in [c_const.NETWORK_TYPE_VLAN,
|
||||
c_const.NETWORK_TYPE_OVERLAY,
|
||||
@ -1239,27 +1239,27 @@ class NetworkProfile_db_mixin(object):
|
||||
msg = _("segment_type should either be vlan, overlay, "
|
||||
"multi-segment or trunk")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segment_type == c_const.NETWORK_TYPE_VLAN:
|
||||
if "physical_network" not in net_p:
|
||||
msg = _("Argument physical_network missing "
|
||||
"for network profile")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segment_type in [c_const.NETWORK_TYPE_TRUNK,
|
||||
c_const.NETWORK_TYPE_OVERLAY]:
|
||||
if "sub_type" not in net_p:
|
||||
msg = _("Argument sub_type missing "
|
||||
"for network profile")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segment_type in [c_const.NETWORK_TYPE_VLAN,
|
||||
c_const.NETWORK_TYPE_OVERLAY]:
|
||||
if "segment_range" not in net_p:
|
||||
msg = _("Argument segment_range missing "
|
||||
"for network profile")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
self._validate_segment_range(net_p)
|
||||
if segment_type == c_const.NETWORK_TYPE_OVERLAY:
|
||||
if net_p['sub_type'] != c_const.NETWORK_SUBTYPE_NATIVE_VXLAN:
|
||||
@ -1288,7 +1288,7 @@ class NetworkProfile_db_mixin(object):
|
||||
msg = (_("NetworkProfile name %s already exists"),
|
||||
net_p["name"])
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if (c_const.NETWORK_TYPE_MULTI_SEGMENT in
|
||||
[profile.segment_type, net_p["segment_type"]] or
|
||||
c_const.NETWORK_TYPE_TRUNK in
|
||||
@ -1304,7 +1304,7 @@ class NetworkProfile_db_mixin(object):
|
||||
(seg_max >= profile_seg_max))):
|
||||
msg = _("Segment range overlaps with another profile")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _get_network_profile_by_name(self, db_session, name):
|
||||
"""
|
||||
|
@ -21,7 +21,7 @@ import base64
|
||||
import httplib2
|
||||
import netaddr
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.extensions import providernet
|
||||
from neutron.openstack.common import log as logging
|
||||
from neutron.plugins.cisco.common import cisco_constants as c_const
|
||||
@ -323,7 +323,7 @@ class Client(object):
|
||||
network_address = str(ip.network)
|
||||
except netaddr.AddrFormatError:
|
||||
msg = _("Invalid input for CIDR")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
netmask = network_address = ""
|
||||
|
||||
|
@ -24,7 +24,7 @@ import eventlet
|
||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
@ -269,44 +269,44 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
if not network_type_set:
|
||||
msg = _("provider:network_type required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == c_const.NETWORK_TYPE_VLAN:
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segmentation_id < 1 or segmentation_id > 4094:
|
||||
msg = _("provider:segmentation_id out of range "
|
||||
"(1 through 4094)")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == c_const.NETWORK_TYPE_OVERLAY:
|
||||
if physical_network_set:
|
||||
msg = _("provider:physical_network specified for Overlay "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
physical_network = None
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segmentation_id < 5000:
|
||||
msg = _("provider:segmentation_id out of range "
|
||||
"(5000+)")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
msg = _("provider:network_type %s not supported"), network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
if network_type == c_const.NETWORK_TYPE_VLAN:
|
||||
if physical_network_set:
|
||||
if physical_network not in self.network_vlan_ranges:
|
||||
msg = (_("Unknown provider:physical_network %s") %
|
||||
physical_network)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif 'default' in self.network_vlan_ranges:
|
||||
physical_network = 'default'
|
||||
else:
|
||||
msg = _("provider:physical_network required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
return (network_type, physical_network, segmentation_id)
|
||||
|
||||
@ -326,7 +326,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
# TBD : Need to handle provider network updates
|
||||
msg = _("Plugin does not support updating provider attributes")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _get_cluster(self, segment1, segment2, clusters):
|
||||
"""
|
||||
@ -523,13 +523,13 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
binding2.network_type not in valid_seg_types or
|
||||
binding1.network_type == binding2.network_type):
|
||||
msg = _("Invalid pairing supplied")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
pair_list.append((segment1, segment2))
|
||||
else:
|
||||
LOG.debug(_('Invalid UUID supplied in %s'), pair)
|
||||
msg = _("Invalid UUID supplied")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
return pair_list
|
||||
|
||||
def _parse_trunk_segments(self, context, attrs, param, physical_network,
|
||||
@ -559,36 +559,36 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if binding.network_type == c_const.NETWORK_TYPE_TRUNK:
|
||||
msg = _("Cannot add a trunk segment '%s' as a member of "
|
||||
"another trunk segment") % segment
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif binding.network_type == c_const.NETWORK_TYPE_VLAN:
|
||||
if sub_type == c_const.NETWORK_TYPE_OVERLAY:
|
||||
msg = _("Cannot add vlan segment '%s' as a member of "
|
||||
"a vxlan trunk segment") % segment
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if not physical_network:
|
||||
physical_network = binding.physical_network
|
||||
elif physical_network != binding.physical_network:
|
||||
msg = _("Network UUID '%s' belongs to a different "
|
||||
"physical network") % segment
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif binding.network_type == c_const.NETWORK_TYPE_OVERLAY:
|
||||
if sub_type == c_const.NETWORK_TYPE_VLAN:
|
||||
msg = _("Cannot add vxlan segment '%s' as a member of "
|
||||
"a vlan trunk segment") % segment
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
try:
|
||||
if not utils.is_valid_vlan_tag(int(dot1qtag)):
|
||||
msg = _("Vlan tag '%s' is out of range") % dot1qtag
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
except ValueError:
|
||||
msg = _("Vlan tag '%s' is not an integer "
|
||||
"value") % dot1qtag
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
pair_list.append((segment, dot1qtag))
|
||||
else:
|
||||
LOG.debug(_('%s is not a valid uuid'), segment)
|
||||
msg = _("'%s' is not a valid UUID") % segment
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
return pair_list
|
||||
|
||||
def _extend_network_dict_member_segments(self, context, network):
|
||||
@ -634,10 +634,10 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
profile_id_set = attributes.is_attr_set(profile_id)
|
||||
if not profile_id_set:
|
||||
msg = _("n1kv:profile_id does not exist")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if not self._policy_profile_exists(profile_id):
|
||||
msg = _("n1kv:profile_id does not exist")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
return profile_id
|
||||
|
||||
@ -990,7 +990,7 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
LOG.debug(_('Seg list %s '), segment_pairs)
|
||||
else:
|
||||
if not segmentation_id:
|
||||
raise q_exc.TenantNetworksDisabled()
|
||||
raise n_exc.TenantNetworksDisabled()
|
||||
else:
|
||||
# provider network
|
||||
if network_type == c_const.NETWORK_TYPE_VLAN:
|
||||
@ -1105,11 +1105,11 @@ class N1kvNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if n1kv_db_v2.is_trunk_member(session, id):
|
||||
msg = _("Cannot delete network '%s' "
|
||||
"that is member of a trunk segment") % network['name']
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if n1kv_db_v2.is_multi_segment_member(session, id):
|
||||
msg = _("Cannot delete network '%s' that is a member of a "
|
||||
"multi-segment network") % network['name']
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if self.agent_vsm:
|
||||
try:
|
||||
self._send_delete_network_request(context, network)
|
||||
|
@ -18,7 +18,7 @@
|
||||
Common utilities and helper functions for Openstack Networking Plugins.
|
||||
"""
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
from neutron.plugins.common import constants
|
||||
|
||||
@ -27,11 +27,11 @@ def verify_vlan_range(vlan_range):
|
||||
"""Raise an exception for invalid tags or malformed range."""
|
||||
for vlan_tag in vlan_range:
|
||||
if not utils.is_valid_vlan_tag(vlan_tag):
|
||||
raise q_exc.NetworkVlanRangeError(
|
||||
raise n_exc.NetworkVlanRangeError(
|
||||
vlan_range=vlan_range,
|
||||
error=_("%s is not a valid VLAN tag") % vlan_tag)
|
||||
if vlan_range[1] < vlan_range[0]:
|
||||
raise q_exc.NetworkVlanRangeError(
|
||||
raise n_exc.NetworkVlanRangeError(
|
||||
vlan_range=vlan_range,
|
||||
error=_("End of VLAN range is less than start of VLAN range"))
|
||||
|
||||
@ -44,7 +44,7 @@ def parse_network_vlan_range(network_vlan_range):
|
||||
network, vlan_min, vlan_max = entry.split(':')
|
||||
vlan_range = (int(vlan_min), int(vlan_max))
|
||||
except ValueError as ex:
|
||||
raise q_exc.NetworkVlanRangeError(vlan_range=entry, error=ex)
|
||||
raise n_exc.NetworkVlanRangeError(vlan_range=entry, error=ex)
|
||||
verify_vlan_range(vlan_range)
|
||||
return network, vlan_range
|
||||
else:
|
||||
|
@ -23,7 +23,7 @@ import time
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.openstack.common import log as logging
|
||||
|
||||
# Check needed for unit testing on Unix
|
||||
@ -34,7 +34,7 @@ CONF = cfg.CONF
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class HyperVException(q_exc.NeutronException):
|
||||
class HyperVException(n_exc.NeutronException):
|
||||
message = _('HyperVException: %(msg)s')
|
||||
|
||||
WMI_JOB_STATE_STARTED = 4096
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db_api
|
||||
from neutron.db import models_v2
|
||||
from neutron.openstack.common import log as logging
|
||||
@ -44,7 +44,7 @@ class HyperVPluginDB(object):
|
||||
'physical_network': alloc.physical_network})
|
||||
alloc.allocated = True
|
||||
return (alloc.physical_network, alloc.vlan_id)
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
def reserve_flat_net(self, session):
|
||||
with session.begin(subtransactions=True):
|
||||
@ -58,7 +58,7 @@ class HyperVPluginDB(object):
|
||||
{'physical_network': alloc.physical_network})
|
||||
alloc.allocated = True
|
||||
return alloc.physical_network
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
def reserve_specific_vlan(self, session, physical_network, vlan_id):
|
||||
with session.begin(subtransactions=True):
|
||||
@ -70,10 +70,10 @@ class HyperVPluginDB(object):
|
||||
alloc = alloc_q.one()
|
||||
if alloc.allocated:
|
||||
if vlan_id == constants.FLAT_VLAN_ID:
|
||||
raise q_exc.FlatNetworkInUse(
|
||||
raise n_exc.FlatNetworkInUse(
|
||||
physical_network=physical_network)
|
||||
else:
|
||||
raise q_exc.VlanIdInUse(
|
||||
raise n_exc.VlanIdInUse(
|
||||
vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
@ -82,7 +82,7 @@ class HyperVPluginDB(object):
|
||||
'physical_network': physical_network})
|
||||
alloc.allocated = True
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
def reserve_specific_flat_net(self, session, physical_network):
|
||||
return self.reserve_specific_vlan(session, physical_network,
|
||||
@ -122,7 +122,7 @@ class HyperVPluginDB(object):
|
||||
session.merge(port)
|
||||
session.flush()
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
||||
def release_vlan(self, session, physical_network, vlan_id):
|
||||
with session.begin(subtransactions=True):
|
||||
|
@ -19,7 +19,7 @@
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import topics
|
||||
from neutron.db import agents_db
|
||||
from neutron.db import db_base_plugin_v2
|
||||
@ -77,14 +77,14 @@ class LocalNetworkProvider(BaseNetworkProvider):
|
||||
if attributes.is_attr_set(segmentation_id):
|
||||
msg = _("segmentation_id specified "
|
||||
"for %s network") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
attrs[provider.SEGMENTATION_ID] = None
|
||||
|
||||
physical_network = attrs.get(provider.PHYSICAL_NETWORK)
|
||||
if attributes.is_attr_set(physical_network):
|
||||
msg = _("physical_network specified "
|
||||
"for %s network") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
attrs[provider.PHYSICAL_NETWORK] = None
|
||||
|
||||
def extend_network_dict(self, network, binding):
|
||||
@ -99,7 +99,7 @@ class FlatNetworkProvider(BaseNetworkProvider):
|
||||
if attributes.is_attr_set(segmentation_id):
|
||||
msg = _("segmentation_id specified "
|
||||
"for %s network") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
segmentation_id = constants.FLAT_VLAN_ID
|
||||
attrs[provider.SEGMENTATION_ID] = segmentation_id
|
||||
|
||||
@ -125,7 +125,7 @@ class VlanNetworkProvider(BaseNetworkProvider):
|
||||
physical_network = attrs.get(provider.PHYSICAL_NETWORK)
|
||||
if not attributes.is_attr_set(physical_network):
|
||||
msg = _("physical_network not provided")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
self._db.reserve_specific_vlan(session, physical_network,
|
||||
segmentation_id)
|
||||
else:
|
||||
@ -180,7 +180,7 @@ class HyperVNeutronPlugin(agents_db.AgentDbMixin,
|
||||
msg = _(
|
||||
"Invalid tenant_network_type: %s. "
|
||||
"Agent terminated!") % tenant_network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
self._tenant_network_type = tenant_network_type
|
||||
|
||||
def _setup_rpc(self):
|
||||
@ -220,13 +220,13 @@ class HyperVNeutronPlugin(agents_db.AgentDbMixin,
|
||||
network_type_set = attributes.is_attr_set(network_type)
|
||||
if not network_type_set:
|
||||
if self._tenant_network_type == svc_constants.TYPE_NONE:
|
||||
raise q_exc.TenantNetworksDisabled()
|
||||
raise n_exc.TenantNetworksDisabled()
|
||||
network_type = self._tenant_network_type
|
||||
attrs[provider.NETWORK_TYPE] = network_type
|
||||
|
||||
if network_type not in self._network_providers_map:
|
||||
msg = _("Network type %s not supported") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
p = self._network_providers_map[network_type]
|
||||
# Provider specific network creation
|
||||
p.create_network(session, attrs)
|
||||
|
@ -22,7 +22,7 @@ import functools
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.db import agents_db
|
||||
@ -465,7 +465,7 @@ class SdnvePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
processed_request = {}
|
||||
if not router['router'].get('admin_state_up', True):
|
||||
raise q_exc.NotImplementedError(_('admin_state_up=False '
|
||||
raise n_exc.NotImplementedError(_('admin_state_up=False '
|
||||
'routers are not '
|
||||
'supported.'))
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import securitygroups_db as sg_db
|
||||
@ -109,7 +109,7 @@ def reserve_network(session):
|
||||
with_lockmode('update').
|
||||
first())
|
||||
if not state:
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
LOG.debug(_("Reserving vlan %(vlan_id)s on physical network "
|
||||
"%(physical_network)s from pool"),
|
||||
{'vlan_id': state.vlan_id,
|
||||
@ -128,10 +128,10 @@ def reserve_specific_network(session, physical_network, vlan_id):
|
||||
one())
|
||||
if state.allocated:
|
||||
if vlan_id == constants.FLAT_VLAN_ID:
|
||||
raise q_exc.FlatNetworkInUse(
|
||||
raise n_exc.FlatNetworkInUse(
|
||||
physical_network=physical_network)
|
||||
else:
|
||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
raise n_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s from pool"),
|
||||
@ -235,4 +235,4 @@ def set_port_status(port_id, status):
|
||||
session.merge(port)
|
||||
session.flush()
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
@ -22,7 +22,7 @@ from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
@ -344,51 +344,51 @@ class LinuxBridgePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
if not network_type_set:
|
||||
msg = _("provider:network_type required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == svc_constants.TYPE_FLAT:
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for flat network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
segmentation_id = constants.FLAT_VLAN_ID
|
||||
elif network_type == svc_constants.TYPE_VLAN:
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if not utils.is_valid_vlan_tag(segmentation_id):
|
||||
msg = (_("provider:segmentation_id out of range "
|
||||
"(%(min_id)s through %(max_id)s)") %
|
||||
{'min_id': q_const.MIN_VLAN_TAG,
|
||||
'max_id': q_const.MAX_VLAN_TAG})
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == svc_constants.TYPE_LOCAL:
|
||||
if physical_network_set:
|
||||
msg = _("provider:physical_network specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
physical_network = None
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
segmentation_id = constants.LOCAL_VLAN_ID
|
||||
else:
|
||||
msg = _("provider:network_type %s not supported") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
if network_type in [svc_constants.TYPE_VLAN, svc_constants.TYPE_FLAT]:
|
||||
if physical_network_set:
|
||||
if physical_network not in self.network_vlan_ranges:
|
||||
msg = (_("Unknown provider:physical_network %s") %
|
||||
physical_network)
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif 'default' in self.network_vlan_ranges:
|
||||
physical_network = 'default'
|
||||
else:
|
||||
msg = _("provider:physical_network required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
return (network_type, physical_network, segmentation_id)
|
||||
|
||||
@ -408,7 +408,7 @@ class LinuxBridgePluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
# tenant network
|
||||
network_type = self.tenant_network_type
|
||||
if network_type == svc_constants.TYPE_NONE:
|
||||
raise q_exc.TenantNetworksDisabled()
|
||||
raise n_exc.TenantNetworksDisabled()
|
||||
elif network_type == svc_constants.TYPE_VLAN:
|
||||
physical_network, vlan_id = db.reserve_network(session)
|
||||
else: # TYPE_LOCAL
|
||||
|
@ -17,7 +17,7 @@
|
||||
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import securitygroups_db as sg_db
|
||||
@ -116,7 +116,7 @@ def reserve_network(session):
|
||||
with_lockmode('update').
|
||||
first())
|
||||
if not entry:
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
LOG.debug(_("Reserving vlan %(seg_id)s on physical network "
|
||||
"%(net)s from pool"),
|
||||
{'seg_id': entry.segmentation_id,
|
||||
@ -134,7 +134,7 @@ def reserve_specific_network(session, physical_network, segmentation_id):
|
||||
segmentation_id=segmentation_id).
|
||||
with_lockmode('update').one())
|
||||
if entry.allocated:
|
||||
raise q_exc.VlanIdInUse(vlan_id=segmentation_id,
|
||||
raise n_exc.VlanIdInUse(vlan_id=segmentation_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(seg_id)s "
|
||||
"on physical network %(phy_net)s from pool"),
|
||||
@ -253,4 +253,4 @@ def set_port_status(port_id, status):
|
||||
session.merge(port)
|
||||
session.flush()
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
@ -24,7 +24,7 @@ from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
from neutron.db import agentschedulers_db
|
||||
@ -216,7 +216,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
if not network_type_set:
|
||||
msg = _("provider:network_type required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == svc_constants.TYPE_FLAT:
|
||||
self._process_flat_net(segmentation_id_set)
|
||||
segmentation_id = constants.FLAT_VLAN_ID
|
||||
@ -232,7 +232,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
else:
|
||||
msg = _("provider:network_type %s not supported") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
physical_network = self._process_net_type(network_type,
|
||||
physical_network,
|
||||
physical_network_set)
|
||||
@ -241,28 +241,28 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
def _process_flat_net(self, segmentation_id_set):
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for flat network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _process_vlan_net(self, segmentation_id, segmentation_id_set):
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if not utils.is_valid_vlan_tag(segmentation_id):
|
||||
msg = (_("provider:segmentation_id out of range "
|
||||
"(%(min_id)s through %(max_id)s)") %
|
||||
{'min_id': q_const.MIN_VLAN_TAG,
|
||||
'max_id': q_const.MAX_VLAN_TAG})
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _process_local_net(self, physical_network_set, segmentation_id_set):
|
||||
if physical_network_set:
|
||||
msg = _("provider:physical_network specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def _process_net_type(self, network_type,
|
||||
physical_network,
|
||||
@ -273,12 +273,12 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if physical_network not in self.network_vlan_ranges:
|
||||
msg = _("Unknown provider:physical_network "
|
||||
"%s") % physical_network
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif 'default' in self.network_vlan_ranges:
|
||||
physical_network = 'default'
|
||||
else:
|
||||
msg = _("provider:physical_network required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
return physical_network
|
||||
|
||||
def _check_port_binding_for_net_type(self, vnic_type, net_type):
|
||||
@ -319,7 +319,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
msg = _("Invalid vnic_type on port_create")
|
||||
else:
|
||||
msg = _("vnic_type is not defined in port profile")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
def create_network(self, context, network):
|
||||
(network_type, physical_network,
|
||||
@ -336,7 +336,7 @@ class MellanoxEswitchPlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
# tenant network
|
||||
network_type = self.tenant_network_type
|
||||
if network_type == svc_constants.TYPE_NONE:
|
||||
raise q_exc.TenantNetworksDisabled()
|
||||
raise n_exc.TenantNetworksDisabled()
|
||||
elif network_type == svc_constants.TYPE_VLAN:
|
||||
physical_network, vlan_id = db.reserve_network(session)
|
||||
else: # TYPE_LOCAL
|
||||
|
@ -21,7 +21,7 @@ from neutron.api import extensions as neutron_extensions
|
||||
from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.v2 import attributes as attrs
|
||||
from neutron.common import constants as const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.db import agents_db
|
||||
@ -365,7 +365,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
db_base_plugin_v2.AUTO_DELETE_PORT_OWNERS
|
||||
for p in ports)
|
||||
if not only_auto_del:
|
||||
raise q_exc.NetworkInUse(net_id=id)
|
||||
raise n_exc.NetworkInUse(net_id=id)
|
||||
|
||||
# Make sure auto-delete ports on OFC are deleted.
|
||||
_error_ports = []
|
||||
@ -421,7 +421,7 @@ class NECPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
}
|
||||
msg = attrs._validate_dict_or_empty(profile, key_specs=key_specs)
|
||||
if msg:
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
datapath_id = profile.get('portinfo:datapath_id')
|
||||
port_no = profile.get('portinfo:port_no')
|
||||
@ -780,5 +780,5 @@ class NECPluginV2RPCCallbacks(object):
|
||||
def _get_port(self, context, port_id):
|
||||
try:
|
||||
return self.plugin.get_port(context, port_id)
|
||||
except q_exc.PortNotFound:
|
||||
except n_exc.PortNotFound:
|
||||
return None
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import extraroute_db
|
||||
from neutron.db import l3_agentschedulers_db
|
||||
@ -196,7 +196,7 @@ class RouterMixin(extraroute_db.ExtraRoute_db_mixin,
|
||||
if not subnet_db['gateway_ip']:
|
||||
msg = (_('Cannot add floating IP to port on subnet %s '
|
||||
'which has no gateway_ip') % internal_subnet_id)
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
|
||||
# find router interface ports on this network
|
||||
router_intf_qry = context.session.query(models_v2.Port)
|
||||
|
@ -24,7 +24,7 @@ from sqlalchemy.orm import exc
|
||||
from neutron.api import extensions as neutron_extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as os_constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db
|
||||
from neutron.db import db_base_plugin_v2
|
||||
from neutron.db import external_net_db
|
||||
@ -84,7 +84,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
msg = (_("%(resource)s with id %(resource_id)s does not "
|
||||
"exist") % {'resource': resource,
|
||||
'resource_id': user_req[resource]})
|
||||
raise q_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
raise n_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
else:
|
||||
filter = {'name': [user_req[resource]]}
|
||||
obj_lister = getattr(self, "get_%ss" % resource)
|
||||
@ -94,13 +94,13 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
"or you dont have credential to access it")
|
||||
% {'resource': resource,
|
||||
'req_resource': user_req[resource]})
|
||||
raise q_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
raise n_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
if len(found_resource) > 1:
|
||||
msg = (_("More than one entry found for %(resource)s "
|
||||
"%(req_resource)s. Use id instead")
|
||||
% {'resource': resource,
|
||||
'req_resource': user_req[resource]})
|
||||
raise q_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
raise n_exc.BadRequest(resource=for_resource, msg=msg)
|
||||
found_resource = found_resource[0]
|
||||
return found_resource
|
||||
|
||||
@ -207,13 +207,13 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
subnet_id)
|
||||
if not subnet_mapping:
|
||||
msg = (_("Subnet %s not found on VSD") % subnet_id)
|
||||
raise q_exc.BadRequest(resource='port', msg=msg)
|
||||
raise n_exc.BadRequest(resource='port', msg=msg)
|
||||
port_mapping = nuagedb.get_port_mapping_by_id(session,
|
||||
id)
|
||||
if not port_mapping:
|
||||
msg = (_("Port-Mapping for port %s not "
|
||||
" found on VSD") % id)
|
||||
raise q_exc.BadRequest(resource='port', msg=msg)
|
||||
raise n_exc.BadRequest(resource='port', msg=msg)
|
||||
if not port_mapping['nuage_vport_id']:
|
||||
self._create_update_port(context, port,
|
||||
port_mapping, subnet_mapping)
|
||||
@ -323,7 +323,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if not net_partition:
|
||||
msg = _('Either net_partition is not provided with subnet OR '
|
||||
'default net_partition is not created at the start')
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
return net_partition
|
||||
|
||||
def _validate_create_subnet(self, subnet):
|
||||
@ -392,7 +392,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
msg = (_('Unable to complete operation on subnet %s.'
|
||||
'One or more ports have an IP allocation '
|
||||
'from this subnet.') % id)
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
super(NuagePlugin, self).delete_subnet(context, id)
|
||||
if subnet_l2dom and not self._check_router_subnet_for_tenant(context):
|
||||
self.nuageclient.delete_user(subnet_l2dom['nuage_user_id'])
|
||||
@ -422,7 +422,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
msg = (_("Router %s does not hold default zone OR "
|
||||
"net_partition mapping. Router-IF add failed")
|
||||
% router_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
if not subnet_l2dom:
|
||||
super(NuagePlugin,
|
||||
@ -431,7 +431,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
interface_info)
|
||||
msg = (_("Subnet %s does not hold Nuage VSD reference. "
|
||||
"Router-IF add failed") % subnet_id)
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
|
||||
if (subnet_l2dom['net_partition_id'] !=
|
||||
ent_rtr_mapping['net_partition_id']):
|
||||
@ -443,7 +443,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
"different net_partition Router-IF add "
|
||||
"not permitted") % {'subnet': subnet_id,
|
||||
'router': router_id})
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
nuage_subnet_id = subnet_l2dom['nuage_subnet_id']
|
||||
nuage_l2dom_tmplt_id = subnet_l2dom['nuage_l2dom_tmplt_id']
|
||||
if self.nuageclient.vms_on_l2domain(nuage_subnet_id):
|
||||
@ -453,7 +453,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
interface_info)
|
||||
msg = (_("Subnet %s has one or more active VMs "
|
||||
"Router-IF add not permitted") % subnet_id)
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
self.nuageclient.delete_subnet(nuage_subnet_id,
|
||||
nuage_l2dom_tmplt_id)
|
||||
net = netaddr.IPNetwork(subn['cidr'])
|
||||
@ -499,18 +499,18 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
except exc.NoResultFound:
|
||||
msg = (_("No router interface found for Router %s. "
|
||||
"Router-IF delete failed") % router_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
if not found:
|
||||
msg = (_("No router interface found for Router %s. "
|
||||
"Router-IF delete failed") % router_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
elif 'port_id' in interface_info:
|
||||
port_db = self._get_port(context, interface_info['port_id'])
|
||||
if not port_db:
|
||||
msg = (_("No router interface found for Router %s. "
|
||||
"Router-IF delete failed") % router_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
subnet_id = port_db['fixed_ips'][0]['subnet_id']
|
||||
|
||||
session = context.session
|
||||
@ -521,7 +521,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if self.nuageclient.vms_on_l2domain(nuage_subn_id):
|
||||
msg = (_("Subnet %s has one or more active VMs "
|
||||
"Router-IF delete not permitted") % subnet_id)
|
||||
raise q_exc.BadRequest(resource='subnet', msg=msg)
|
||||
raise n_exc.BadRequest(resource='subnet', msg=msg)
|
||||
|
||||
neutron_subnet = self.get_subnet(context, subnet_id)
|
||||
ent_rtr_mapping = nuagedb.get_ent_rtr_mapping_by_rtrid(
|
||||
@ -531,7 +531,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
msg = (_("Router %s does not hold net_partition "
|
||||
"assoc on Nuage VSD. Router-IF delete failed")
|
||||
% router_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
net = netaddr.IPNetwork(neutron_subnet['cidr'])
|
||||
net_part_id = ent_rtr_mapping['net_partition_id']
|
||||
net_partition = self.get_net_partition(context,
|
||||
@ -569,7 +569,7 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if not net_partition:
|
||||
msg = _("Either net_partition is not provided with router OR "
|
||||
"default net_partition is not created at the start")
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
return net_partition
|
||||
|
||||
def create_router(self, context, router):
|
||||
@ -670,11 +670,11 @@ class NuagePlugin(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
if ent_rtr_mapping:
|
||||
msg = (_("One or more router still attached to "
|
||||
"net_partition %s.") % id)
|
||||
raise q_exc.BadRequest(resource='net_partition', msg=msg)
|
||||
raise n_exc.BadRequest(resource='net_partition', msg=msg)
|
||||
net_partition = nuagedb.get_net_partition_by_id(context.session, id)
|
||||
if not net_partition:
|
||||
msg = (_("NetPartition with %s does not exist") % id)
|
||||
raise q_exc.BadRequest(resource='net_partition', msg=msg)
|
||||
raise n_exc.BadRequest(resource='net_partition', msg=msg)
|
||||
l3dom_tmplt_id = net_partition['l3dom_tmplt_id']
|
||||
l2dom_tmplt_id = net_partition['l2dom_tmplt_id']
|
||||
self.nuageclient.delete_net_partition(net_partition['id'],
|
||||
|
@ -16,7 +16,7 @@
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import securitygroups_db as sg_db
|
||||
@ -133,7 +133,7 @@ def reserve_vlan(session):
|
||||
'physical_network': alloc.physical_network})
|
||||
alloc.allocated = True
|
||||
return (alloc.physical_network, alloc.vlan_id)
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
|
||||
def reserve_specific_vlan(session, physical_network, vlan_id):
|
||||
@ -146,10 +146,10 @@ def reserve_specific_vlan(session, physical_network, vlan_id):
|
||||
one())
|
||||
if alloc.allocated:
|
||||
if vlan_id == constants.FLAT_VLAN_ID:
|
||||
raise q_exc.FlatNetworkInUse(
|
||||
raise n_exc.FlatNetworkInUse(
|
||||
physical_network=physical_network)
|
||||
else:
|
||||
raise q_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
raise n_exc.VlanIdInUse(vlan_id=vlan_id,
|
||||
physical_network=physical_network)
|
||||
LOG.debug(_("Reserving specific vlan %(vlan_id)s on physical "
|
||||
"network %(physical_network)s from pool"),
|
||||
@ -257,7 +257,7 @@ def reserve_tunnel(session):
|
||||
LOG.debug(_("Reserving tunnel %s from pool"), alloc.tunnel_id)
|
||||
alloc.allocated = True
|
||||
return alloc.tunnel_id
|
||||
raise q_exc.NoNetworkAvailable()
|
||||
raise n_exc.NoNetworkAvailable()
|
||||
|
||||
|
||||
def reserve_specific_tunnel(session, tunnel_id):
|
||||
@ -268,7 +268,7 @@ def reserve_specific_tunnel(session, tunnel_id):
|
||||
with_lockmode('update').
|
||||
one())
|
||||
if alloc.allocated:
|
||||
raise q_exc.TunnelIdInUse(tunnel_id=tunnel_id)
|
||||
raise n_exc.TunnelIdInUse(tunnel_id=tunnel_id)
|
||||
LOG.debug(_("Reserving specific tunnel %s from pool"), tunnel_id)
|
||||
alloc.allocated = True
|
||||
except exc.NoResultFound:
|
||||
@ -345,7 +345,7 @@ def set_port_status(port_id, status):
|
||||
session.merge(port)
|
||||
session.flush()
|
||||
except exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
||||
|
||||
def get_tunnel_endpoints():
|
||||
@ -391,5 +391,5 @@ def add_tunnel_endpoint(ip, max_retries=10):
|
||||
'transaction had been committed (%s attempts left)'),
|
||||
max_retries - (i + 1))
|
||||
|
||||
raise q_exc.NeutronException(
|
||||
raise n_exc.NeutronException(
|
||||
message=_('Unable to generate a new tunnel id'))
|
||||
|
@ -22,7 +22,7 @@ from neutron.api.rpc.agentnotifiers import dhcp_rpc_agent_api
|
||||
from neutron.api.rpc.agentnotifiers import l3_rpc_agent_api
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.common import utils
|
||||
@ -404,64 +404,64 @@ class OVSNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
|
||||
if not network_type_set:
|
||||
msg = _("provider:network_type required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == svc_constants.TYPE_FLAT:
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for flat network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
segmentation_id = constants.FLAT_VLAN_ID
|
||||
elif network_type == svc_constants.TYPE_VLAN:
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if not utils.is_valid_vlan_tag(segmentation_id):
|
||||
msg = (_("provider:segmentation_id out of range "
|
||||
"(%(min_id)s through %(max_id)s)") %
|
||||
{'min_id': q_const.MIN_VLAN_TAG,
|
||||
'max_id': q_const.MAX_VLAN_TAG})
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type in constants.TUNNEL_NETWORK_TYPES:
|
||||
if not self.enable_tunneling:
|
||||
msg = _("%s networks are not enabled") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
if physical_network_set:
|
||||
msg = _("provider:physical_network specified for %s "
|
||||
"network") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
physical_network = None
|
||||
if not segmentation_id_set:
|
||||
msg = _("provider:segmentation_id required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif network_type == svc_constants.TYPE_LOCAL:
|
||||
if physical_network_set:
|
||||
msg = _("provider:physical_network specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
physical_network = None
|
||||
if segmentation_id_set:
|
||||
msg = _("provider:segmentation_id specified for local "
|
||||
"network")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
else:
|
||||
segmentation_id = None
|
||||
else:
|
||||
msg = _("provider:network_type %s not supported") % network_type
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
if network_type in [svc_constants.TYPE_VLAN, svc_constants.TYPE_FLAT]:
|
||||
if physical_network_set:
|
||||
if physical_network not in self.network_vlan_ranges:
|
||||
msg = _("Unknown provider:physical_network "
|
||||
"%s") % physical_network
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
elif 'default' in self.network_vlan_ranges:
|
||||
physical_network = 'default'
|
||||
else:
|
||||
msg = _("provider:physical_network required")
|
||||
raise q_exc.InvalidInput(error_message=msg)
|
||||
raise n_exc.InvalidInput(error_message=msg)
|
||||
|
||||
return (network_type, physical_network, segmentation_id)
|
||||
|
||||
@ -481,7 +481,7 @@ class OVSNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
# tenant network
|
||||
network_type = self.tenant_network_type
|
||||
if network_type == svc_constants.TYPE_NONE:
|
||||
raise q_exc.TenantNetworksDisabled()
|
||||
raise n_exc.TenantNetworksDisabled()
|
||||
elif network_type == svc_constants.TYPE_VLAN:
|
||||
(physical_network,
|
||||
segmentation_id) = ovs_db_v2.reserve_vlan(session)
|
||||
|
@ -35,7 +35,7 @@ from neutron.agent.linux.ovs_lib import VifPort
|
||||
from neutron.agent import rpc as agent_rpc
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import config as logging_config
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import topics
|
||||
from neutron import context as q_context
|
||||
from neutron.extensions import securitygroup as ext_sg
|
||||
@ -215,7 +215,7 @@ class OVSNeutronOFPRyuAgent(sg_rpc.SecurityGroupAgentRpcCallbackMixin):
|
||||
|
||||
rest_api_addr = self.plugin_rpc.get_ofp_rest_api_addr(self.context)
|
||||
if not rest_api_addr:
|
||||
raise q_exc.Invalid(_("Ryu rest API port isn't specified"))
|
||||
raise n_exc.Invalid(_("Ryu rest API port isn't specified"))
|
||||
LOG.debug(_("Going to ofp controller mode %s"), rest_api_addr)
|
||||
|
||||
ryu_rest_client = client.OFPClient(rest_api_addr)
|
||||
|
@ -18,7 +18,7 @@ from sqlalchemy import exc as sa_exc
|
||||
from sqlalchemy import func
|
||||
from sqlalchemy.orm import exc as orm_exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
import neutron.db.api as db
|
||||
from neutron.db import models_v2
|
||||
from neutron.db import securitygroups_db as sg_db
|
||||
@ -191,7 +191,7 @@ class TunnelKey(object):
|
||||
# if this happens too often, increase _TRANSACTION_RETRY_MAX
|
||||
LOG.warn(_("Transaction retry exhausted (%d). "
|
||||
"Abandoned tunnel key allocation."), count)
|
||||
raise q_exc.ResourceExhausted()
|
||||
raise n_exc.ResourceExhausted()
|
||||
|
||||
return new_key
|
||||
|
||||
@ -212,4 +212,4 @@ def set_port_status(session, port_id, status):
|
||||
session.merge(port)
|
||||
session.flush()
|
||||
except orm_exc.NoResultFound:
|
||||
raise q_exc.PortNotFound(port_id=port_id)
|
||||
raise n_exc.PortNotFound(port_id=port_id)
|
||||
|
@ -22,7 +22,7 @@ from ryu.app import rest_nw_id
|
||||
|
||||
from neutron.agent import securitygroups_rpc as sg_rpc
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.db import api as db
|
||||
@ -121,7 +121,7 @@ class RyuNeutronPluginV2(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
cfg.CONF.OVS.tunnel_key_min, cfg.CONF.OVS.tunnel_key_max)
|
||||
self.ofp_api_host = cfg.CONF.OVS.openflow_rest_api
|
||||
if not self.ofp_api_host:
|
||||
raise q_exc.Invalid(_('Invalid configuration. check ryu.ini'))
|
||||
raise n_exc.Invalid(_('Invalid configuration. check ryu.ini'))
|
||||
|
||||
self.client = client.OFPClient(self.ofp_api_host)
|
||||
self.tun_client = client.TunnelClient(self.ofp_api_host)
|
||||
|
@ -25,7 +25,7 @@ from neutron.api import extensions as neutron_extensions
|
||||
from neutron.api.v2 import attributes as attr
|
||||
from neutron.api.v2 import base
|
||||
from neutron.common import constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
from neutron import context as q_context
|
||||
from neutron.db import agentschedulers_db
|
||||
@ -467,7 +467,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
LOG.debug(_("_nsx_create_port completed for port %(name)s "
|
||||
"on network %(network_id)s. The new port id is "
|
||||
"%(id)s."), port_data)
|
||||
except (api_exc.NsxApiException, q_exc.NeutronException):
|
||||
except (api_exc.NsxApiException, n_exc.NeutronException):
|
||||
self._handle_create_port_exception(
|
||||
context, port_data['id'],
|
||||
selected_lswitch and selected_lswitch['uuid'],
|
||||
@ -486,7 +486,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
switchlib.delete_port(self.cluster,
|
||||
selected_lswitch['uuid'],
|
||||
lport['uuid'])
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
LOG.debug(_("NSX Port %s already gone"), lport['uuid'])
|
||||
|
||||
def _nsx_delete_port(self, context, port_data):
|
||||
@ -513,7 +513,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
"on network %(net_id)s"),
|
||||
{'port_id': port_data['id'],
|
||||
'net_id': port_data['network_id']})
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
LOG.warning(_("Port %s not found in NSX"), port_data['id'])
|
||||
|
||||
def _nsx_delete_router_port(self, context, port_data):
|
||||
@ -579,7 +579,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
"%(name)s on network %(network_id)s. The new "
|
||||
"port id is %(id)s."),
|
||||
port_data)
|
||||
except (api_exc.NsxApiException, q_exc.NeutronException):
|
||||
except (api_exc.NsxApiException, n_exc.NeutronException):
|
||||
self._handle_create_port_exception(
|
||||
context, port_data['id'],
|
||||
selected_lswitch and selected_lswitch['uuid'],
|
||||
@ -588,7 +588,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
def _find_router_gw_port(self, context, port_data):
|
||||
router_id = port_data['device_id']
|
||||
if not router_id:
|
||||
raise q_exc.BadRequest(_("device_id field must be populated in "
|
||||
raise n_exc.BadRequest(_("device_id field must be populated in "
|
||||
"order to create an external gateway "
|
||||
"port for network %s"),
|
||||
port_data['network_id'])
|
||||
@ -784,7 +784,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
bindings = nsx_db.get_network_bindings_by_vlanid(
|
||||
context.session, segmentation_id)
|
||||
if bindings:
|
||||
raise q_exc.VlanIdInUse(
|
||||
raise n_exc.VlanIdInUse(
|
||||
vlan_id=segmentation_id,
|
||||
physical_network=physical_network)
|
||||
elif network_type == NetworkTypes.L3_EXT:
|
||||
@ -801,7 +801,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
{'net_type_param': pnet.NETWORK_TYPE,
|
||||
'net_type_value': network_type})
|
||||
if err_msg:
|
||||
raise q_exc.InvalidInput(error_message=err_msg)
|
||||
raise n_exc.InvalidInput(error_message=err_msg)
|
||||
# TODO(salvatore-orlando): Validate tranport zone uuid
|
||||
# which should be specified in physical_network
|
||||
|
||||
@ -1071,7 +1071,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
switchlib.delete_networks(self.cluster, id, lswitch_ids)
|
||||
LOG.debug(_("delete_network completed for tenant: %s"),
|
||||
context.tenant_id)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
LOG.warning(_("Did not found lswitch %s in NSX"), id)
|
||||
self.handle_network_dhcp_access(context, id, action='delete_network')
|
||||
|
||||
@ -1183,7 +1183,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
port_data['device_owner'],
|
||||
self._port_drivers['create']['default'])
|
||||
port_create_func(context, port_data)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
LOG.warning(_("Logical switch for network %s was not "
|
||||
"found in NSX."), port_data['network_id'])
|
||||
# Put port in error on quantum DB
|
||||
@ -1402,7 +1402,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
"platform currently in execution. Please, try "
|
||||
"without specifying the 'distributed' attribute.")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
except api_exc.NsxApiException:
|
||||
err_msg = _("Unable to create logical router on NSX Platform")
|
||||
LOG.exception(err_msg)
|
||||
@ -1456,7 +1456,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
if not ext_net.external:
|
||||
msg = (_("Network '%s' is not a valid external "
|
||||
"network") % network_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if ext_net.subnets:
|
||||
ext_subnet = ext_net.subnets[0]
|
||||
nexthop = ext_subnet.gateway_ip
|
||||
@ -1498,7 +1498,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# Set external gateway and remove router in case of failure
|
||||
try:
|
||||
self._update_router_gw_info(context, router_db['id'], gw_info)
|
||||
except (q_exc.NeutronException, api_exc.NsxApiException):
|
||||
except (n_exc.NeutronException, api_exc.NsxApiException):
|
||||
with excutils.save_and_reraise_exception():
|
||||
# As setting gateway failed, the router must be deleted
|
||||
# in order to ensure atomicity
|
||||
@ -1541,7 +1541,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
if not ext_net.external:
|
||||
msg = (_("Network '%s' is not a valid external "
|
||||
"network") % network_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if ext_net.subnets:
|
||||
ext_subnet = ext_net.subnets[0]
|
||||
nexthop = ext_subnet.gateway_ip
|
||||
@ -1551,14 +1551,14 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
msg = _("'routes' cannot contain route '0.0.0.0/0', "
|
||||
"this must be updated through the default "
|
||||
"gateway attribute")
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
previous_routes = self._update_lrouter(
|
||||
context, router_id, r.get('name'),
|
||||
nexthop, routes=r.get('routes'))
|
||||
# NOTE(salv-orlando): The exception handling below is not correct, but
|
||||
# unfortunately nsxlib raises a neutron notfound exception when an
|
||||
# object is not found in the underlying backend
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
# Put the router in ERROR status
|
||||
with context.session.begin(subtransactions=True):
|
||||
router_db = self._get_router(context, router_id)
|
||||
@ -1574,7 +1574,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
"platform currently in execution. Please, try "
|
||||
"without specifying the static routes.")
|
||||
LOG.exception(msg)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
try:
|
||||
return super(NsxPluginV2, self).update_router(context,
|
||||
router_id, router)
|
||||
@ -1625,7 +1625,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
# from the backend
|
||||
try:
|
||||
self._delete_lrouter(context, router_id, nsx_router_id)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
# This is not a fatal error, but needs to be logged
|
||||
LOG.warning(_("Logical router '%s' not found "
|
||||
"on NSX Platform"), router_id)
|
||||
@ -1838,7 +1838,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
if (('fixed_ip_address' in fip and fip['fixed_ip_address']) and
|
||||
not ('port_id' in fip and fip['port_id'])):
|
||||
msg = _("fixed_ip_address cannot be specified without a port_id")
|
||||
raise q_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
raise n_exc.BadRequest(resource='floatingip', msg=msg)
|
||||
port_id = internal_ip = router_id = None
|
||||
if 'port_id' in fip and fip['port_id']:
|
||||
fip_qry = context.session.query(l3_db.FloatingIP)
|
||||
@ -1988,7 +1988,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
except sa_exc.NoResultFound:
|
||||
LOG.debug(_("The port '%s' is not associated with floating IPs"),
|
||||
port_id)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
LOG.warning(_("Nat rules not found in nsx for port: %s"), id)
|
||||
|
||||
super(NsxPluginV2, self).disassociate_floatingips(context, port_id)
|
||||
@ -2140,7 +2140,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
try:
|
||||
secgrouplib.delete_security_profile(
|
||||
self.cluster, nsx_sec_profile_id)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
# The security profile was not found on the backend
|
||||
# do not fail in this case.
|
||||
LOG.warning(_("The NSX security profile %(sec_profile_id)s, "
|
||||
@ -2173,7 +2173,7 @@ class NsxPluginV2(addr_pair_db.AllowedAddressPairsMixin,
|
||||
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',
|
||||
raise n_exc.BadRequest(resource='security_group_rule',
|
||||
msg=msg)
|
||||
return super(NsxPluginV2, self)._validate_security_group_rules(context,
|
||||
rules)
|
||||
|
@ -19,7 +19,7 @@
|
||||
import netaddr
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db.firewall import firewall_db
|
||||
from neutron.db import l3_db
|
||||
from neutron.db.loadbalancer import loadbalancer_db
|
||||
@ -199,7 +199,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
if not ext_net.external:
|
||||
msg = (_("Network '%s' is not a valid external "
|
||||
"network") % network_id)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if ext_net.subnets:
|
||||
ext_subnet = ext_net.subnets[0]
|
||||
netmask = str(netaddr.IPNetwork(ext_subnet.cidr).netmask)
|
||||
@ -423,7 +423,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
msg = (_("An exception occurred while creating a port "
|
||||
"on lswitch %s") % lswitch['uuid'])
|
||||
LOG.exception(msg)
|
||||
raise q_exc.NeutronException(message=msg)
|
||||
raise n_exc.NeutronException(message=msg)
|
||||
|
||||
# create logic router port
|
||||
try:
|
||||
@ -439,7 +439,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
LOG.exception(msg)
|
||||
switchlib.delete_port(
|
||||
self.cluster, lswitch['uuid'], ls_port['uuid'])
|
||||
raise q_exc.NeutronException(message=msg)
|
||||
raise n_exc.NeutronException(message=msg)
|
||||
|
||||
# attach logic router port to switch port
|
||||
try:
|
||||
@ -472,7 +472,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
"for router %s") % name
|
||||
LOG.exception(msg)
|
||||
routerlib.delete_lrouter(self.cluster, lrouter['uuid'])
|
||||
raise q_exc.NeutronException(message=msg)
|
||||
raise n_exc.NeutronException(message=msg)
|
||||
|
||||
try:
|
||||
self._add_router_integration_interface(tenant_id, name,
|
||||
@ -482,7 +482,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
"for router %s") % name
|
||||
LOG.exception(msg)
|
||||
routerlib.delete_lrouter(self.cluster, lrouter['uuid'])
|
||||
raise q_exc.NeutronException(message=msg)
|
||||
raise n_exc.NeutronException(message=msg)
|
||||
|
||||
try:
|
||||
self._create_advanced_service_router(
|
||||
@ -492,7 +492,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
LOG.exception(msg)
|
||||
self.vcns_driver.delete_lswitch(lswitch('uuid'))
|
||||
routerlib.delete_lrouter(self.cluster, lrouter['uuid'])
|
||||
raise q_exc.NeutronException(message=msg)
|
||||
raise n_exc.NeutronException(message=msg)
|
||||
|
||||
lrouter['status'] = service_constants.PENDING_CREATE
|
||||
return lrouter
|
||||
@ -576,7 +576,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
nsx_status = RouterStatus.ROUTER_STATUS_ACTIVE
|
||||
else:
|
||||
nsx_status = RouterStatus.ROUTER_STATUS_DOWN
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
nsx_status = RouterStatus.ROUTER_STATUS_ERROR
|
||||
|
||||
return nsx_status
|
||||
@ -875,11 +875,11 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
if not router_id:
|
||||
msg = _("router_id is not provided!")
|
||||
LOG.error(msg)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if not self._is_advanced_service_router(context, router_id):
|
||||
msg = _("router_id:%s is not an advanced router!") % router_id
|
||||
LOG.error(msg)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
if self._get_resource_router_id_binding(
|
||||
context, firewall_db.Firewall, router_id=router_id):
|
||||
msg = _("A firewall is already associated with the router")
|
||||
@ -1191,7 +1191,7 @@ class NsxAdvancedPlugin(sr_db.ServiceRouter_mixin,
|
||||
if not router_id:
|
||||
msg = _("router_id is not provided!")
|
||||
LOG.error(msg)
|
||||
raise q_exc.BadRequest(resource='router', msg=msg)
|
||||
raise n_exc.BadRequest(resource='router', msg=msg)
|
||||
|
||||
if not self._is_advanced_service_router(context, router_id):
|
||||
msg = _("router_id: %s is not an advanced router!") % router_id
|
||||
|
@ -21,7 +21,7 @@ import uuid
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.common import constants as q_const
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import rpc as q_rpc
|
||||
from neutron.common import topics
|
||||
from neutron.db import agents_db
|
||||
@ -48,7 +48,7 @@ AGENT_SCHEDULER_OPTS = [
|
||||
cfg.CONF.register_opts(AGENT_SCHEDULER_OPTS)
|
||||
|
||||
|
||||
class DriverNotSpecified(q_exc.NeutronException):
|
||||
class DriverNotSpecified(n_exc.NeutronException):
|
||||
message = _("Device driver for agent should be specified "
|
||||
"in plugin driver.")
|
||||
|
||||
@ -96,7 +96,7 @@ class LoadBalancerCallbacks(object):
|
||||
pool = qry.one()
|
||||
|
||||
if pool.status != constants.ACTIVE:
|
||||
raise q_exc.Invalid(_('Expected active pool'))
|
||||
raise n_exc.Invalid(_('Expected active pool'))
|
||||
|
||||
retval = {}
|
||||
retval['pool'] = self.plugin._make_pool_dict(pool)
|
||||
@ -158,7 +158,7 @@ class LoadBalancerCallbacks(object):
|
||||
'health_monitor': loadbalancer_db.PoolMonitorAssociation
|
||||
}
|
||||
if obj_type not in model_mapping:
|
||||
raise q_exc.Invalid(_('Unknown object type: %s') % obj_type)
|
||||
raise n_exc.Invalid(_('Unknown object type: %s') % obj_type)
|
||||
try:
|
||||
if obj_type == 'health_monitor':
|
||||
self.plugin.update_pool_health_monitor(
|
||||
@ -166,7 +166,7 @@ class LoadBalancerCallbacks(object):
|
||||
else:
|
||||
self.plugin.update_status(
|
||||
context, model_mapping[obj_type], obj_id, status)
|
||||
except q_exc.NotFound:
|
||||
except n_exc.NotFound:
|
||||
# update_status may come from agent on an object which was
|
||||
# already deleted from db with other request
|
||||
LOG.warning(_('Cannot update status: %(obj_type)s %(obj_id)s '
|
||||
@ -191,7 +191,7 @@ class LoadBalancerCallbacks(object):
|
||||
context,
|
||||
port_id
|
||||
)
|
||||
except q_exc.PortNotFound:
|
||||
except n_exc.PortNotFound:
|
||||
msg = _('Unable to find port %s to plug.')
|
||||
LOG.debug(msg, port_id)
|
||||
return
|
||||
@ -215,7 +215,7 @@ class LoadBalancerCallbacks(object):
|
||||
context,
|
||||
port_id
|
||||
)
|
||||
except q_exc.PortNotFound:
|
||||
except n_exc.PortNotFound:
|
||||
msg = _('Unable to find port %s to unplug. This can occur when '
|
||||
'the Vip has been deleted first.')
|
||||
LOG.debug(msg, port_id)
|
||||
@ -232,7 +232,7 @@ class LoadBalancerCallbacks(object):
|
||||
{'port': port}
|
||||
)
|
||||
|
||||
except q_exc.PortNotFound:
|
||||
except n_exc.PortNotFound:
|
||||
msg = _('Unable to find port %s to unplug. This can occur when '
|
||||
'the Vip has been deleted first.')
|
||||
LOG.debug(msg, port_id)
|
||||
|
@ -21,7 +21,7 @@
|
||||
from sqlalchemy.orm import exc as s_exc
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.db import api as db
|
||||
from neutron.db import db_base_plugin_v2
|
||||
@ -215,7 +215,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
|
||||
vlan_ids.add(vlan_id)
|
||||
|
||||
self.assertRaises(q_exc.NoNetworkAvailable,
|
||||
self.assertRaises(n_exc.NoNetworkAvailable,
|
||||
n1kv_db_v2.reserve_vlan,
|
||||
self.session,
|
||||
p)
|
||||
@ -243,7 +243,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
self.assertRaises(q_exc.VlanIdInUse,
|
||||
self.assertRaises(n_exc.VlanIdInUse,
|
||||
n1kv_db_v2.reserve_specific_vlan,
|
||||
self.session,
|
||||
PHYS_NET,
|
||||
@ -265,7 +265,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
self.assertTrue(n1kv_db_v2.get_vlan_allocation(self.session, PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
self.assertRaises(q_exc.VlanIdInUse,
|
||||
self.assertRaises(n_exc.VlanIdInUse,
|
||||
n1kv_db_v2.reserve_specific_vlan,
|
||||
self.session,
|
||||
PHYS_NET,
|
||||
@ -338,7 +338,7 @@ class VxlanAllocationsTest(base.BaseTestCase,
|
||||
self.assertThat(vxlan_id, matchers.LessThan(VXLAN_MAX + 1))
|
||||
vxlan_ids.add(vxlan_id)
|
||||
|
||||
self.assertRaises(q_exc.NoNetworkAvailable,
|
||||
self.assertRaises(n_exc.NoNetworkAvailable,
|
||||
n1kv_db_v2.reserve_vxlan,
|
||||
self.session,
|
||||
profile)
|
||||
@ -731,7 +731,7 @@ class NetworkProfileTests(base.BaseTestCase,
|
||||
TEST_NETWORK_PROFILE_2['name'] = 'net-profile-min-overlap'
|
||||
TEST_NETWORK_PROFILE_2['segment_range'] = SEGMENT_RANGE_MIN_OVERLAP
|
||||
test_net_profile = {'network_profile': TEST_NETWORK_PROFILE_2}
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
self.create_network_profile,
|
||||
ctx,
|
||||
test_net_profile)
|
||||
@ -739,7 +739,7 @@ class NetworkProfileTests(base.BaseTestCase,
|
||||
TEST_NETWORK_PROFILE_2['name'] = 'net-profile-max-overlap'
|
||||
TEST_NETWORK_PROFILE_2['segment_range'] = SEGMENT_RANGE_MAX_OVERLAP
|
||||
test_net_profile = {'network_profile': TEST_NETWORK_PROFILE_2}
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
self.create_network_profile,
|
||||
ctx,
|
||||
test_net_profile)
|
||||
@ -747,7 +747,7 @@ class NetworkProfileTests(base.BaseTestCase,
|
||||
TEST_NETWORK_PROFILE_2['name'] = 'net-profile-overlap'
|
||||
TEST_NETWORK_PROFILE_2['segment_range'] = SEGMENT_RANGE_OVERLAP
|
||||
test_net_profile = {'network_profile': TEST_NETWORK_PROFILE_2}
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
self.create_network_profile,
|
||||
ctx,
|
||||
test_net_profile)
|
||||
|
@ -23,7 +23,7 @@ import webob.exc as wexc
|
||||
from neutron.api import extensions
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.api.v2 import base
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.db import db_base_plugin_v2 as base_plugin
|
||||
from neutron.db import l3_db
|
||||
@ -623,7 +623,7 @@ class TestCiscoPortsV2(CiscoNetworkPluginV2TestCase,
|
||||
|
||||
# Inject an exception in the OVS plugin delete_port
|
||||
# processing, and attempt a port deletion.
|
||||
inserted_exc = q_exc.Conflict
|
||||
inserted_exc = n_exc.Conflict
|
||||
expected_http = base.FAULT_MAP[inserted_exc].code
|
||||
with mock.patch.object(l3_db.L3_NAT_db_mixin,
|
||||
'disassociate_floatingips',
|
||||
|
@ -17,7 +17,7 @@ from oslo.config import cfg
|
||||
import testtools
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db
|
||||
from neutron.plugins.linuxbridge.db import l2network_db_v2 as lb_db
|
||||
from neutron.tests import base
|
||||
@ -114,7 +114,7 @@ class NetworkStatesTest(base.BaseTestCase):
|
||||
self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
|
||||
vlan_ids.add(vlan_id)
|
||||
|
||||
with testtools.ExpectedException(q_exc.NoNetworkAvailable):
|
||||
with testtools.ExpectedException(n_exc.NoNetworkAvailable):
|
||||
physical_network, vlan_id = lb_db.reserve_network(self.session)
|
||||
|
||||
for vlan_id in vlan_ids:
|
||||
@ -128,7 +128,7 @@ class NetworkStatesTest(base.BaseTestCase):
|
||||
self.assertTrue(lb_db.get_network_state(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.VlanIdInUse):
|
||||
with testtools.ExpectedException(n_exc.VlanIdInUse):
|
||||
lb_db.reserve_specific_network(self.session, PHYS_NET, vlan_id)
|
||||
|
||||
lb_db.release_network(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
|
||||
@ -142,7 +142,7 @@ class NetworkStatesTest(base.BaseTestCase):
|
||||
self.assertTrue(lb_db.get_network_state(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.VlanIdInUse):
|
||||
with testtools.ExpectedException(n_exc.VlanIdInUse):
|
||||
lb_db.reserve_specific_network(self.session, PHYS_NET, vlan_id)
|
||||
|
||||
lb_db.release_network(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
|
||||
|
@ -15,7 +15,7 @@
|
||||
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db
|
||||
from neutron.plugins.mlnx.db import mlnx_db_v2 as mlnx_db
|
||||
from neutron.tests import base
|
||||
@ -113,7 +113,7 @@ class SegmentationIdAllocationTest(base.BaseTestCase):
|
||||
self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
|
||||
vlan_ids.add(vlan_id)
|
||||
|
||||
self.assertRaises(q_exc.NoNetworkAvailable,
|
||||
self.assertRaises(n_exc.NoNetworkAvailable,
|
||||
mlnx_db.reserve_network,
|
||||
self.session)
|
||||
for vlan_id in vlan_ids:
|
||||
@ -128,7 +128,7 @@ class SegmentationIdAllocationTest(base.BaseTestCase):
|
||||
self.assertTrue(mlnx_db.get_network_state(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
self.assertRaises(q_exc.VlanIdInUse,
|
||||
self.assertRaises(n_exc.VlanIdInUse,
|
||||
mlnx_db.reserve_specific_network,
|
||||
self.session,
|
||||
PHYS_NET,
|
||||
@ -145,7 +145,7 @@ class SegmentationIdAllocationTest(base.BaseTestCase):
|
||||
self.assertTrue(mlnx_db.get_network_state(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
self.assertRaises(q_exc.VlanIdInUse,
|
||||
self.assertRaises(n_exc.VlanIdInUse,
|
||||
mlnx_db.reserve_specific_network,
|
||||
self.session,
|
||||
PHYS_NET,
|
||||
|
@ -20,7 +20,7 @@
|
||||
from testtools import matchers
|
||||
from webob import exc
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.extensions import portbindings
|
||||
from neutron.tests.unit import _test_extension_portbindings as test_bindings
|
||||
@ -303,7 +303,7 @@ class TestNecPortBindingValidatePortInfo(test_nec_plugin.NecPluginV2TestCase):
|
||||
self.assertEqual(portinfo['port_no'], 123)
|
||||
|
||||
def _test_validate_exception(self, profile, expected_msg):
|
||||
e = self.assertRaises(q_exc.InvalidInput,
|
||||
e = self.assertRaises(n_exc.InvalidInput,
|
||||
self.plugin._validate_portinfo, profile)
|
||||
self.assertThat(str(e), matchers.StartsWith(expected_msg))
|
||||
|
||||
|
@ -20,7 +20,7 @@ from oslo.config import cfg
|
||||
import testtools
|
||||
from testtools import matchers
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.db import api as db
|
||||
from neutron.openstack.common.db import exception as db_exc
|
||||
from neutron.openstack.common.db.sqlalchemy import session
|
||||
@ -132,7 +132,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
self.assertThat(vlan_id, matchers.LessThan(VLAN_MAX + 1))
|
||||
vlan_ids.add(vlan_id)
|
||||
|
||||
with testtools.ExpectedException(q_exc.NoNetworkAvailable):
|
||||
with testtools.ExpectedException(n_exc.NoNetworkAvailable):
|
||||
physical_network, vlan_id = ovs_db_v2.reserve_vlan(self.session)
|
||||
|
||||
ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_ids.pop(),
|
||||
@ -155,7 +155,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
self.assertTrue(ovs_db_v2.get_vlan_allocation(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.VlanIdInUse):
|
||||
with testtools.ExpectedException(n_exc.VlanIdInUse):
|
||||
ovs_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)
|
||||
|
||||
ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
|
||||
@ -169,7 +169,7 @@ class VlanAllocationsTest(base.BaseTestCase):
|
||||
self.assertTrue(ovs_db_v2.get_vlan_allocation(PHYS_NET,
|
||||
vlan_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.VlanIdInUse):
|
||||
with testtools.ExpectedException(n_exc.VlanIdInUse):
|
||||
ovs_db_v2.reserve_specific_vlan(self.session, PHYS_NET, vlan_id)
|
||||
|
||||
ovs_db_v2.release_vlan(self.session, PHYS_NET, vlan_id, VLAN_RANGES)
|
||||
@ -228,7 +228,7 @@ class TunnelAllocationsTest(base.BaseTestCase):
|
||||
self.assertThat(tunnel_id, matchers.LessThan(TUN_MAX + 1))
|
||||
tunnel_ids.add(tunnel_id)
|
||||
|
||||
with testtools.ExpectedException(q_exc.NoNetworkAvailable):
|
||||
with testtools.ExpectedException(n_exc.NoNetworkAvailable):
|
||||
tunnel_id = ovs_db_v2.reserve_tunnel(self.session)
|
||||
|
||||
ovs_db_v2.release_tunnel(self.session, tunnel_ids.pop(), TUNNEL_RANGES)
|
||||
@ -254,7 +254,7 @@ class TunnelAllocationsTest(base.BaseTestCase):
|
||||
ovs_db_v2.reserve_specific_tunnel(self.session, tunnel_id)
|
||||
self.assertTrue(ovs_db_v2.get_tunnel_allocation(tunnel_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.TunnelIdInUse):
|
||||
with testtools.ExpectedException(n_exc.TunnelIdInUse):
|
||||
ovs_db_v2.reserve_specific_tunnel(self.session, tunnel_id)
|
||||
|
||||
ovs_db_v2.release_tunnel(self.session, tunnel_id, TUNNEL_RANGES)
|
||||
@ -266,7 +266,7 @@ class TunnelAllocationsTest(base.BaseTestCase):
|
||||
ovs_db_v2.reserve_specific_tunnel(self.session, tunnel_id)
|
||||
self.assertTrue(ovs_db_v2.get_tunnel_allocation(tunnel_id).allocated)
|
||||
|
||||
with testtools.ExpectedException(q_exc.TunnelIdInUse):
|
||||
with testtools.ExpectedException(n_exc.TunnelIdInUse):
|
||||
ovs_db_v2.reserve_specific_tunnel(self.session, tunnel_id)
|
||||
|
||||
ovs_db_v2.release_tunnel(self.session, tunnel_id, TUNNEL_RANGES)
|
||||
@ -292,7 +292,7 @@ class TunnelAllocationsTest(base.BaseTestCase):
|
||||
error = db_exc.DBDuplicateEntry(['id'])
|
||||
query_mock.side_effect = error
|
||||
|
||||
with testtools.ExpectedException(q_exc.NeutronException):
|
||||
with testtools.ExpectedException(n_exc.NeutronException):
|
||||
ovs_db_v2.add_tunnel_endpoint('10.0.0.1', 5)
|
||||
self.assertEqual(query_mock.call_count, 5)
|
||||
|
||||
|
@ -119,7 +119,7 @@ class TestOVSNeutronOFPRyuAgent(RyuAgentTestCase):
|
||||
])
|
||||
|
||||
def test_invalid_rest_addr(self):
|
||||
self.assertRaises(self.mod_agent.q_exc.Invalid,
|
||||
self.assertRaises(self.mod_agent.n_exc.Invalid,
|
||||
self.mock_rest_addr, (''))
|
||||
|
||||
def mock_port_update(self, **kwargs):
|
||||
|
@ -30,7 +30,7 @@ from neutron.api.v2 import attributes
|
||||
from neutron.api.v2 import base as v2_base
|
||||
from neutron.api.v2 import router
|
||||
from neutron.common import config
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.manager import NeutronManager
|
||||
from neutron.openstack.common.notifier import api as notifer_api
|
||||
@ -503,7 +503,7 @@ class APIv2TestCase(APIv2TestBase):
|
||||
def test_native_pagination_without_native_sorting(self):
|
||||
instance = self.plugin.return_value
|
||||
instance._NeutronPluginBaseV2__native_sorting_support = False
|
||||
self.assertRaises(q_exc.Invalid, router.APIRouter)
|
||||
self.assertRaises(n_exc.Invalid, router.APIRouter)
|
||||
|
||||
def test_native_pagination_without_allow_sorting(self):
|
||||
cfg.CONF.set_override('allow_sorting', False)
|
||||
|
@ -23,7 +23,7 @@ from webob import exc
|
||||
import webtest
|
||||
|
||||
from neutron.api.v2 import resource as wsgi_resource
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.openstack.common import gettextutils
|
||||
from neutron.tests import base
|
||||
@ -127,7 +127,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
def test_unmapped_neutron_error_with_json(self):
|
||||
msg = u'\u7f51\u7edc'
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
expected_res = {'body': {
|
||||
'NeutronError': {
|
||||
@ -149,7 +149,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
def test_unmapped_neutron_error_with_xml(self):
|
||||
msg = u'\u7f51\u7edc'
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
expected_res = {'body': {
|
||||
'NeutronError': {
|
||||
@ -175,7 +175,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
mock_translation.return_value = msg_translation
|
||||
msg = _('Unmapped error')
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
|
||||
controller = mock.MagicMock()
|
||||
@ -193,7 +193,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
def test_mapped_neutron_error_with_json(self):
|
||||
msg = u'\u7f51\u7edc'
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
expected_res = {'body': {
|
||||
'NeutronError': {
|
||||
@ -217,7 +217,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
def test_mapped_neutron_error_with_xml(self):
|
||||
msg = u'\u7f51\u7edc'
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
expected_res = {'body': {
|
||||
'NeutronError': {
|
||||
@ -245,7 +245,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
mock_translation.return_value = msg_translation
|
||||
msg = _('Unmapped error')
|
||||
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = msg
|
||||
|
||||
controller = mock.MagicMock()
|
||||
@ -326,7 +326,7 @@ class ResourceTestCase(base.BaseTestCase):
|
||||
|
||||
def _test_error_log_level(self, map_webob_exc, expect_log_info=False,
|
||||
use_fault_map=True):
|
||||
class TestException(q_exc.NeutronException):
|
||||
class TestException(n_exc.NeutronException):
|
||||
message = 'Test Exception'
|
||||
|
||||
controller = mock.MagicMock()
|
||||
|
@ -18,7 +18,7 @@
|
||||
import testtools
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.tests import base
|
||||
|
||||
|
||||
@ -115,11 +115,11 @@ class TestAttributes(base.BaseTestCase):
|
||||
result = attributes._validate_no_whitespace(data)
|
||||
self.assertEqual(result, data)
|
||||
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes._validate_no_whitespace,
|
||||
'i have whitespace')
|
||||
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes._validate_no_whitespace,
|
||||
'i\thave\twhitespace')
|
||||
|
||||
@ -670,7 +670,7 @@ class TestConvertToBoolean(base.BaseTestCase):
|
||||
def test_convert_to_boolean_int(self):
|
||||
self.assertIs(attributes.convert_to_boolean(0), False)
|
||||
self.assertIs(attributes.convert_to_boolean(1), True)
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes.convert_to_boolean,
|
||||
7)
|
||||
|
||||
@ -681,7 +681,7 @@ class TestConvertToBoolean(base.BaseTestCase):
|
||||
self.assertIs(attributes.convert_to_boolean('false'), False)
|
||||
self.assertIs(attributes.convert_to_boolean('0'), False)
|
||||
self.assertIs(attributes.convert_to_boolean('1'), True)
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes.convert_to_boolean,
|
||||
'7')
|
||||
|
||||
@ -696,12 +696,12 @@ class TestConvertToInt(base.BaseTestCase):
|
||||
def test_convert_to_int_str(self):
|
||||
self.assertEqual(attributes.convert_to_int('4'), 4)
|
||||
self.assertEqual(attributes.convert_to_int('6'), 6)
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes.convert_to_int,
|
||||
'garbage')
|
||||
|
||||
def test_convert_to_int_none(self):
|
||||
self.assertRaises(q_exc.InvalidInput,
|
||||
self.assertRaises(n_exc.InvalidInput,
|
||||
attributes.convert_to_int,
|
||||
None)
|
||||
|
||||
@ -736,11 +736,11 @@ class TestConvertKvp(base.BaseTestCase):
|
||||
self.assertEqual({'a': ['b'], 'c': ['d']}, result)
|
||||
|
||||
def test_convert_kvp_str_to_list_fails_for_missing_key(self):
|
||||
with testtools.ExpectedException(q_exc.InvalidInput):
|
||||
with testtools.ExpectedException(n_exc.InvalidInput):
|
||||
attributes.convert_kvp_str_to_list('=a')
|
||||
|
||||
def test_convert_kvp_str_to_list_fails_for_missing_equals(self):
|
||||
with testtools.ExpectedException(q_exc.InvalidInput):
|
||||
with testtools.ExpectedException(n_exc.InvalidInput):
|
||||
attributes.convert_kvp_str_to_list('a')
|
||||
|
||||
def test_convert_kvp_str_to_list_succeeds_for_one_equals(self):
|
||||
|
@ -14,7 +14,7 @@
|
||||
|
||||
import testtools
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common import utils
|
||||
from neutron.plugins.common import utils as plugin_utils
|
||||
from neutron.tests import base
|
||||
@ -109,7 +109,7 @@ class TestVlanRangeVerifyValid(UtilTestParseVlanRanges):
|
||||
|
||||
def check_one_vlan_invalid(self, bad_range, which):
|
||||
expected_msg = self._vrange_invalid_vlan(bad_range, which)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.verify_range, bad_range)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
@ -152,7 +152,7 @@ class TestVlanRangeVerifyValid(UtilTestParseVlanRanges):
|
||||
def test_range_reversed(self):
|
||||
bad_range = (95, 10)
|
||||
expected_msg = self._vrange_invalid(bad_range)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.verify_range, bad_range)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
@ -174,28 +174,28 @@ class TestParseOneVlanRange(UtilTestParseVlanRanges):
|
||||
def test_parse_one_net_incomplete_range(self):
|
||||
config_str = "net1:100"
|
||||
expected_msg = self._range_too_few_err(config_str)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
def test_parse_one_net_range_too_many(self):
|
||||
config_str = "net1:100:150:200"
|
||||
expected_msg = self._range_too_many_err(config_str)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
def test_parse_one_net_vlan1_not_int(self):
|
||||
config_str = "net1:foo:199"
|
||||
expected_msg = self._vlan_not_int_err(config_str, 'foo')
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
def test_parse_one_net_vlan2_not_int(self):
|
||||
config_str = "net1:100:bar"
|
||||
expected_msg = self._vlan_not_int_err(config_str, 'bar')
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
@ -207,14 +207,14 @@ class TestParseOneVlanRange(UtilTestParseVlanRanges):
|
||||
def test_parse_one_net_range_bad_vlan1(self):
|
||||
config_str = "net1:9000:150"
|
||||
expected_msg = self._nrange_invalid_vlan(config_str, 1)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
def test_parse_one_net_range_bad_vlan2(self):
|
||||
config_str = "net1:4000:4999"
|
||||
expected_msg = self._nrange_invalid_vlan(config_str, 2)
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_one, config_str)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
@ -258,7 +258,7 @@ class TestParseVlanRangeList(UtilTestParseVlanRanges):
|
||||
config_list = ["net1:100",
|
||||
"net2:200:299"]
|
||||
expected_msg = self._range_too_few_err(config_list[0])
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_list, config_list)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
@ -266,7 +266,7 @@ class TestParseVlanRangeList(UtilTestParseVlanRanges):
|
||||
config_list = ["net1:100:199",
|
||||
"net2:200:0x200"]
|
||||
expected_msg = self._vlan_not_int_err(config_list[1], '0x200')
|
||||
err = self.assertRaises(q_exc.NetworkVlanRangeError,
|
||||
err = self.assertRaises(n_exc.NetworkVlanRangeError,
|
||||
self.parse_list, config_list)
|
||||
self.assertEqual(str(err), expected_msg)
|
||||
|
||||
|
@ -31,7 +31,7 @@ from neutron.api.v2 import attributes
|
||||
from neutron.api.v2.attributes import ATTR_NOT_SPECIFIED
|
||||
from neutron.api.v2.router import APIRouter
|
||||
from neutron.common import config
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron.common.test_lib import test_config
|
||||
from neutron import context
|
||||
from neutron.db import api as db
|
||||
@ -480,7 +480,7 @@ class NeutronDbPluginV2TestCase(testlib_api.WebTestCase):
|
||||
def _do_side_effect(self, patched_plugin, orig, *args, **kwargs):
|
||||
"""Invoked by test cases for injecting failures in plugin."""
|
||||
def second_call(*args, **kwargs):
|
||||
raise q_exc.NeutronException()
|
||||
raise n_exc.NeutronException()
|
||||
patched_plugin.side_effect = second_call
|
||||
return orig(*args, **kwargs)
|
||||
|
||||
@ -1155,7 +1155,7 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
|
||||
id = subnet['subnet']['network_id']
|
||||
res = self._create_port(self.fmt, id)
|
||||
data = self.deserialize(self.fmt, res)
|
||||
msg = str(q_exc.IpAddressGenerationFailure(net_id=id))
|
||||
msg = str(n_exc.IpAddressGenerationFailure(net_id=id))
|
||||
self.assertEqual(data['NeutronError']['message'], msg)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPConflict.code)
|
||||
|
||||
@ -1281,7 +1281,7 @@ fixed_ips=ip_address%%3D%s&fixed_ips=ip_address%%3D%s&fixed_ips=subnet_id%%3D%s
|
||||
# we just raise the exception that would result.
|
||||
@staticmethod
|
||||
def fake_gen_mac(context, net_id):
|
||||
raise q_exc.MacAddressGenerationFailure(net_id=net_id)
|
||||
raise n_exc.MacAddressGenerationFailure(net_id=net_id)
|
||||
|
||||
with mock.patch.object(neutron.db.db_base_plugin_v2.NeutronDbPluginV2,
|
||||
'_generate_mac', new=fake_gen_mac):
|
||||
@ -2425,7 +2425,7 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
|
||||
res = req.get_response(self.api)
|
||||
data = self.deserialize(self.fmt, res)
|
||||
self.assertEqual(res.status_int, webob.exc.HTTPConflict.code)
|
||||
msg = str(q_exc.SubnetInUse(subnet_id=id))
|
||||
msg = str(n_exc.SubnetInUse(subnet_id=id))
|
||||
self.assertEqual(data['NeutronError']['message'], msg)
|
||||
|
||||
def test_delete_network(self):
|
||||
@ -3497,12 +3497,12 @@ class TestSubnetsV2(NeutronDbPluginV2TestCase):
|
||||
def test_validate_subnet_dns_nameservers_exhausted(self):
|
||||
self._helper_test_validate_subnet(
|
||||
'max_dns_nameservers',
|
||||
q_exc.DNSNameServersExhausted)
|
||||
n_exc.DNSNameServersExhausted)
|
||||
|
||||
def test_validate_subnet_host_routes_exhausted(self):
|
||||
self._helper_test_validate_subnet(
|
||||
'max_subnet_host_routes',
|
||||
q_exc.HostRoutesExhausted)
|
||||
n_exc.HostRoutesExhausted)
|
||||
|
||||
|
||||
class DbModelTestCase(base.BaseTestCase):
|
||||
@ -3541,7 +3541,7 @@ class TestNeutronDbPluginV2(base.BaseTestCase):
|
||||
with mock.patch.object(db_base_plugin_v2.NeutronDbPluginV2,
|
||||
'_rebuild_availability_ranges') as rebuild:
|
||||
|
||||
exception = q_exc.IpAddressGenerationFailure(net_id='n')
|
||||
exception = n_exc.IpAddressGenerationFailure(net_id='n')
|
||||
generate.side_effect = exception
|
||||
|
||||
# I want the side_effect to throw an exception once but I
|
||||
@ -3550,7 +3550,7 @@ class TestNeutronDbPluginV2(base.BaseTestCase):
|
||||
# _try_generate_ip was called twice.
|
||||
try:
|
||||
db_base_plugin_v2.NeutronDbPluginV2._generate_ip('c', 's')
|
||||
except q_exc.IpAddressGenerationFailure:
|
||||
except n_exc.IpAddressGenerationFailure:
|
||||
pass
|
||||
|
||||
self.assertEqual(2, generate.call_count)
|
||||
|
@ -24,7 +24,7 @@ from webob import exc
|
||||
|
||||
from neutron.api.v2 import attributes
|
||||
from neutron.common import constants as l3_constants
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.db import api as qdbapi
|
||||
from neutron.db import db_base_plugin_v2
|
||||
@ -1137,7 +1137,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
|
||||
None)
|
||||
method = plugin_class + '._update_fip_assoc'
|
||||
with mock.patch(method) as pl:
|
||||
pl.side_effect = q_exc.BadRequest(
|
||||
pl.side_effect = n_exc.BadRequest(
|
||||
resource='floatingip',
|
||||
msg='fake_error')
|
||||
res = self._create_floatingip(
|
||||
@ -1175,7 +1175,7 @@ class L3NatTestCaseBase(L3NatTestCaseMixin):
|
||||
None)
|
||||
method = plugin_class + '._update_fip_assoc'
|
||||
with mock.patch(method) as pl:
|
||||
pl.side_effect = q_exc.IpAddressGenerationFailure(
|
||||
pl.side_effect = n_exc.IpAddressGenerationFailure(
|
||||
net_id='netid')
|
||||
res = self._create_floatingip(
|
||||
self.fmt,
|
||||
|
@ -16,7 +16,7 @@
|
||||
|
||||
from oslo.config import cfg
|
||||
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
|
||||
from neutron.plugins.common import constants
|
||||
from neutron.services import provider_configuration as provconf
|
||||
@ -84,7 +84,7 @@ class ParseServiceProviderConfigurationTestCase(base.BaseTestCase):
|
||||
':lbaas:driver_path',
|
||||
'svc_type:name1:path1'],
|
||||
'service_providers')
|
||||
self.assertRaises(q_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
self.assertRaises(n_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
|
||||
def test_parse_service_provider_invalid_format(self):
|
||||
cfg.CONF.set_override('service_provider',
|
||||
@ -92,13 +92,13 @@ class ParseServiceProviderConfigurationTestCase(base.BaseTestCase):
|
||||
':lbaas:driver_path',
|
||||
'svc_type:name1:path1:def'],
|
||||
'service_providers')
|
||||
self.assertRaises(q_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
self.assertRaises(n_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
cfg.CONF.set_override('service_provider',
|
||||
[constants.LOADBALANCER +
|
||||
':',
|
||||
'svc_type:name1:path1:def'],
|
||||
'service_providers')
|
||||
self.assertRaises(q_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
self.assertRaises(n_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
|
||||
def test_parse_service_provider_name_too_long(self):
|
||||
name = 'a' * 256
|
||||
@ -107,7 +107,7 @@ class ParseServiceProviderConfigurationTestCase(base.BaseTestCase):
|
||||
':' + name + ':driver_path',
|
||||
'svc_type:name1:path1:def'],
|
||||
'service_providers')
|
||||
self.assertRaises(q_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
self.assertRaises(n_exc.Invalid, provconf.parse_service_provider_opt)
|
||||
|
||||
|
||||
class ProviderConfigurationTestCase(base.BaseTestCase):
|
||||
@ -118,7 +118,7 @@ class ProviderConfigurationTestCase(base.BaseTestCase):
|
||||
pconf = provconf.ProviderConfiguration([])
|
||||
pconf.providers[('svctype', 'name')] = {'driver': 'driver',
|
||||
'default': True}
|
||||
self.assertRaises(q_exc.Invalid,
|
||||
self.assertRaises(n_exc.Invalid,
|
||||
pconf._ensure_driver_unique, 'driver')
|
||||
self.assertIsNone(pconf._ensure_driver_unique('another_driver1'))
|
||||
|
||||
@ -126,7 +126,7 @@ class ProviderConfigurationTestCase(base.BaseTestCase):
|
||||
pconf = provconf.ProviderConfiguration([])
|
||||
pconf.providers[('svctype', 'name')] = {'driver': 'driver',
|
||||
'default': True}
|
||||
self.assertRaises(q_exc.Invalid,
|
||||
self.assertRaises(n_exc.Invalid,
|
||||
pconf._ensure_default_unique,
|
||||
'svctype', True)
|
||||
self.assertIsNone(pconf._ensure_default_unique('svctype', False))
|
||||
@ -153,7 +153,7 @@ class ProviderConfigurationTestCase(base.BaseTestCase):
|
||||
'driver': 'path',
|
||||
'default': False}
|
||||
pconf.add_provider(prov)
|
||||
self.assertRaises(q_exc.Invalid, pconf.add_provider, prov)
|
||||
self.assertRaises(n_exc.Invalid, pconf.add_provider, prov)
|
||||
self.assertEqual(len(pconf.providers), 1)
|
||||
|
||||
def test_get_service_providers(self):
|
||||
|
@ -25,7 +25,7 @@ import webob.exc as webexc
|
||||
import webtest
|
||||
|
||||
from neutron.api import extensions
|
||||
from neutron.common import exceptions as q_exc
|
||||
from neutron.common import exceptions as n_exc
|
||||
from neutron import context
|
||||
from neutron.db import api as db_api
|
||||
from neutron.db import servicetype_db as st_db
|
||||
@ -66,7 +66,7 @@ class ServiceTypeManagerTestCase(base.BaseTestCase):
|
||||
'default': False}
|
||||
self.manager._load_conf()
|
||||
self.assertRaises(
|
||||
q_exc.Invalid, self.manager.conf.add_provider, prov)
|
||||
n_exc.Invalid, self.manager.conf.add_provider, prov)
|
||||
|
||||
def test_get_service_providers(self):
|
||||
cfg.CONF.set_override('service_provider',
|
||||
@ -99,7 +99,7 @@ class ServiceTypeManagerTestCase(base.BaseTestCase):
|
||||
constants.LOADBALANCER +
|
||||
':lbaas2:driver_path:default'],
|
||||
'service_providers')
|
||||
self.assertRaises(q_exc.Invalid, self.manager._load_conf)
|
||||
self.assertRaises(n_exc.Invalid, self.manager._load_conf)
|
||||
|
||||
def test_get_default_provider(self):
|
||||
cfg.CONF.set_override('service_provider',
|
||||
|
Loading…
Reference in New Issue
Block a user