group-based-policy/gbpservice/neutron/plugins/ml2plus/drivers/apic_aim/exceptions.py
Amit Bose 2adc2e2fb9 [AIM] Support sharing of L3Outs
Changes to allow different Neutron external
networks to use the same L3Out in APIC. In the
past we did not prevent such configurations, but
we also did not support it properly. Changes include:
* Delete L3Out only if there are no Neutron external
networks using the L3Out
* Disallow overlapping external subnets in external
networks that share the same L3Out
* Contracts consumed and provided by APIC
external network should use routers
uplinked to all the Neutron external networks that
share an L3Out
* Likewise, external CIDRs on APIC external network
should consider external-cidrs of all Neutron
external networks that share an L3Out

Had to make minor changes to some UTs to avoid situations
that now raise exceptions.

Change-Id: I2f9dd295ec35972dd9b015f117aaf0a6fa33f6a1
Signed-off-by: Amit Bose <amitbose@gmail.com>
2018-02-21 15:36:24 -08:00

70 lines
2.6 KiB
Python

# Copyright (c) 2017 Cisco Systems Inc.
# All Rights Reserved.
#
# 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 import exceptions
class InternalError(exceptions.NeutronException):
message = _("Internal mechanism driver error - %(details)s.")
def __init__(self, **kwargs):
kwargs.setdefault('details', _("See error log for details"))
super(InternalError, self).__init__(**kwargs)
class UnsupportedRoutingTopology(exceptions.BadRequest):
message = _("All router interfaces for a network must share either the "
"same router or the same subnet.")
class UnscopedSharedNetworkProjectConflict(exceptions.BadRequest):
message = _("Shared network %(net1)s from project %(proj1)s and shared "
"network %(net2)s from project %(proj2)s cannot be combined "
"in the same topology.")
class NonIsomorphicNetworkRoutingUnsupported(exceptions.BadRequest):
message = _("All router interfaces for a network must utilize the same "
"VRF.")
class ScopeUpdateNotSupported(exceptions.BadRequest):
message = _("Updating the address_scope of a subnetpool that is "
"associated with routers is not currently supported.")
class SnatPortsInUse(exceptions.SubnetInUse):
def __init__(self, **kwargs):
kwargs['reason'] = _('Subnet has SNAT IP addresses allocated')
super(SnatPortsInUse, self).__init__(**kwargs)
class SnatPoolCannotBeUsedForFloatingIp(exceptions.InvalidInput):
message = _("Floating IP cannot be allocated in SNAT host pool subnet.")
class PreExistingSVICannotBeConnectedToRouter(exceptions.BadRequest):
message = _("A SVI network with pre-existing l3out is not allowed to "
"be connected to a router.")
class OnlyOneSubnetInSVINetwork(exceptions.BadRequest):
message = _("Only one subnet is allowed in SVI network.")
class ExternalSubnetOverlapInL3Out(exceptions.BadRequest):
message = _("External subnet CIDR %(cidr)s overlaps with existing "
"subnets in APIC L3Outside %(l3out)s.")