API's and implementations to support L2 Gateways in Neutron.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
5.5 KiB

# Copyright 2015 OpenStack Foundation
# Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from neutron_lib.api import faults
from neutron_lib import exceptions
from webob import exc as web_exc
from networking_l2gw._i18n import _
class L2GatewayInUse(exceptions.InUse):
message = _("L2 Gateway '%(gateway_id)s' still has active mappings "
"with one or more neutron networks.")
class L2GatewayNotFound(exceptions.NotFound):
message = _("L2 Gateway %(gateway_id)s could not be found")
class L2GatewayDeviceInUse(exceptions.InUse):
message = _("L2 Gateway Device '%(device_id)s' is still used by "
"one or more network gateways.")
class L2AgentNotFoundByHost(exceptions.NotFound):
message = _("L2 Agent for host '%(host)s' could not be found.")
class L2GatewayDeviceNotFound(exceptions.NotFound):
message = _("L2 Gateway Device %(device_id)s could not be found.")
class L2GatewayDeviceNameNotFound(exceptions.NotFound):
message = _("L2 Gateway Device %(device_name)s could not be found.")
class L2GatewayPortInUse(exceptions.InUse):
message = _("Port '%(port_id)s' is owned by '%(device_owner)s' and "
"therefore cannot be deleted directly via the port API.")
class L2GatewayConnectionExists(exceptions.InUse):
message = _("The specified mapping '%(mapping)s' exists on "
"network gateway '%(gateway_id)s'.")
class L2MultipleGatewayConnections(exceptions.NeutronException):
message = _("Multiple network connections found on '%(gateway_id)s' "
"with provided criteria.")
class L2GatewayInterfaceNotFound(exceptions.NeutronException):
message = _("L2 Gateway interface '%(interface_id)s' not found.")
class L2GatewayPhysicalPortNotFound(exceptions.NeutronException):
message = _("Physical Port '%(int_name)s' in Physical switch "
"'%(device_name)s' could not be found")
class L2GatewayPhysicalPortFaultStatus(exceptions.NeutronException):
message = _("Physical Port '%(int_name)s' in Physical switch "
"'%(device_name)s' port_fault_status is '%(fault_status)s'")
class L2GatewayPhysicalSwitchFaultStatus(exceptions.NeutronException):
message = _("Physical Switch '%(device_name)s' switch_fault_status is "
class L2GatewayConnectionNotFound(exceptions.NotFound):
message = _("The connection %(id)s not found on the l2 gateway")
class L2gatewaySegmentationIDNotFound(exceptions.NotFound):
message = _("The segmentation id not found on gateway "
class MultipleVxlanSegmentsFound(exceptions.NeutronException):
message = _("Multiple Vxlan segments found for the network "
class VxlanSegmentationIDNotFound(exceptions.NotFound):
message = _("vxlan segmentation id not found for the "
"network '%(network_id)s'")
class L2GatewayInterfaceRequired(exceptions.NeutronException):
message = _("L2 Gateway Interface required")
class L2GatewaySegmentationIDExists(exceptions.NeutronException):
message = _("The segmentation id is already specified in "
"existing gateway interfaces.")
class L2GatewaySegmentationIDNotExists(exceptions.NeutronException):
message = _("The segmentation id is not specified in "
"existing gateway interfaces.")
class L2GatewaySegmentationRequired(exceptions.NeutronException):
message = _("L2 gateway segmentation id must be consistent for all "
"the interfaces")
class L2GatewayDuplicateSegmentationID(exceptions.Conflict):
message = _("%(message)s")
class OVSDBError(exceptions.NeutronException):
message = _("%(message)s")
class L2GatewayServiceDriverError(exceptions.NeutronException):
"""Service driver call failed."""
message = _("%(method)s failed.")
class InvalidMethod(exceptions.NeutronException):
message = _("invalid method '%(op_method)s'")
faults.FAULT_MAP.update({L2GatewayInUse: web_exc.HTTPConflict,
L2GatewayPortInUse: web_exc.HTTPConflict,
L2GatewayConnectionExists: web_exc.HTTPConflict,
L2GatewayConnectionNotFound: web_exc.HTTPNotFound,
MultipleVxlanSegmentsFound: web_exc.HTTPConflict,
VxlanSegmentationIDNotFound: web_exc.HTTPNotFound,
L2GatewaySegmentationRequired: web_exc.HTTPConflict,
L2MultipleGatewayConnections: web_exc.HTTPConflict,
L2AgentNotFoundByHost: web_exc.HTTPNotFound,
OVSDBError: web_exc.HTTPConflict})
class L3DvrAgentNotFound(exceptions.NotFound):
message = _("L3 agent could not be found")
class DvrAgentHostnameNotFound(exceptions.NeutronException):
message = _("Hostname '%(host)' has address")