Debian Codegraph @

neutron_lib/exceptions/l3.py

raw
1 # All rights reserved.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License"); you may
4 # not use this file except in compliance with the License. You may obtain
5 # a copy of the License at
6 #
7 # http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12 # License for the specific language governing permissions and limitations
13 # under the License.
14
15 from neutron_lib._i18n import _
16 from neutron_lib import exceptions
17
18
19 # L3 Exceptions
20 class RouterNotFound(exceptions.NotFound):
21 message = _("Router %(router_id)s could not be found")
22
23
24 class RouterInUse(exceptions.InUse):
25 message = _("Router %(router_id)s %(reason)s")
26
27 def __init__(self, **kwargs):
28 if 'reason' not in kwargs:
29 kwargs['reason'] = "still has ports"
30 super().__init__(**kwargs)
31
32
33 class RouterInterfaceNotFound(exceptions.NotFound):
34 message = _("Router %(router_id)s does not have "
35 "an interface with id %(port_id)s")
36
37
38 class RouterInterfaceNotFoundForSubnet(exceptions.NotFound):
39 message = _("Router %(router_id)s has no interface "
40 "on subnet %(subnet_id)s")
41
42
43 class RouterInterfaceInUseByFloatingIP(exceptions.InUse):
44 message = _("Router interface for subnet %(subnet_id)s on router "
45 "%(router_id)s cannot be deleted, as it is required "
46 "by one or more floating IPs.")
47
48
49 class FloatingIPNotFound(exceptions.NotFound):
50 message = _("Floating IP %(floatingip_id)s could not be found")
51
52
53 class ExternalGatewayForFloatingIPNotFound(exceptions.NotFound):
54 message = _("External network %(external_network_id)s is not reachable "
55 "from subnet %(subnet_id)s. Therefore, cannot associate "
56 "Port %(port_id)s with a Floating IP.")
57
58
59 class FloatingIPPortAlreadyAssociated(exceptions.InUse):
60 message = _("Cannot associate floating IP %(floating_ip_address)s "
61 "(%(fip_id)s) with port %(port_id)s "
62 "using fixed IP %(fixed_ip)s, as that fixed IP already "
63 "has a floating IP on external network %(net_id)s.")
64
65
66 class RouterExternalGatewayInUseByFloatingIp(exceptions.InUse):
67 message = _("Gateway cannot be updated for router %(router_id)s, since a "
68 "gateway to external network %(net_id)s is required by one or "
69 "more floating IPs.")
70
71
72 class RouterInterfaceAttachmentConflict(exceptions.Conflict):
73 message = _("Error %(reason)s while attempting the operation.")
74
75
76 class RouterNotCompatibleWithAgent(exceptions.NeutronException):
77 message = _("Router '%(router_id)s' is not compatible with this agent.")
78
79
80 class RouterNotFoundInRouterFactory(exceptions.NeutronException):
81 message = _("Router '%(router_id)s' with features '%(features)s' could "
82 "not be found in the router factory.")
83
84
85 class FloatingIpSetupException(exceptions.NeutronException):
86 def __init__(self, message=None):
87 self.message = message
88 super().__init__()
89
90
91 class AbortSyncRouters(exceptions.NeutronException):
92 message = _("Aborting periodic_sync_routers_task due to an error.")
93
94
95 class IpTablesApplyException(exceptions.NeutronException):
96 def __init__(self, message=None):
97 self.message = message
98 super().__init__()
99
100
101 class L3ExtensionException(exceptions.NeutronException):
102 message = _('The following L3 agent extensions do not inherit from '
103 '``neutron_lib.agent.l3_extension.L3AgentExtension``: '
104 '%(extensions)s.')
105
106
107 class FipAssociated(exceptions.InUse):
108 """An operational error indicates that port still has an associated FIP.
109
110 A specialization of the InUse exception indicating an operation failed on
111 a port because it still has an associated FIP.
112
113 :param port_id: The UUID of the port requested.
114 """
115 message = _("Unable to complete the operation on port %(port_id)s "
116 "because the port still has an associated floating IP.")