Debian Codegraph @

networking_l2gw/services/l2gateway/exceptions.py

raw
1 # Copyright 2015 OpenStack Foundation
2 # Copyright (c) 2015 Hewlett-Packard Development Company, L.P.
3 #
4 # Licensed under the Apache License, Version 2.0 (the "License"); you may
5 # not use this file except in compliance with the License. You may obtain
6 # a copy of the License at
7 #
8 # http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 # License for the specific language governing permissions and limitations
14 # under the License.
15
16 from neutron_lib.api import faults
17 from neutron_lib import exceptions
18 from webob import exc as web_exc
19
20 from networking_l2gw._i18n import _
21
22
23 class L2GatewayInUse(exceptions.InUse):
24 message = _("L2 Gateway '%(gateway_id)s' still has active mappings "
25 "with one or more neutron networks.")
26
27
28 class L2GatewayNotFound(exceptions.NotFound):
29 message = _("L2 Gateway %(gateway_id)s could not be found")
30
31
32 class L2GatewayDeviceInUse(exceptions.InUse):
33 message = _("L2 Gateway Device '%(device_id)s' is still used by "
34 "one or more network gateways.")
35
36
37 class L2AgentNotFoundByHost(exceptions.NotFound):
38 message = _("L2 Agent for host '%(host)s' could not be found.")
39
40
41 class L2GatewayDeviceNotFound(exceptions.NotFound):
42 message = _("L2 Gateway Device %(device_id)s could not be found.")
43
44
45 class L2GatewayDeviceNameNotFound(exceptions.NotFound):
46 message = _("L2 Gateway Device %(device_name)s could not be found.")
47
48
49 class L2GatewayPortInUse(exceptions.InUse):
50 message = _("Port '%(port_id)s' is owned by '%(device_owner)s' and "
51 "therefore cannot be deleted directly via the port API.")
52
53
54 class L2GatewayConnectionExists(exceptions.InUse):
55 message = _("The specified mapping '%(mapping)s' exists on "
56 "network gateway '%(gateway_id)s'.")
57
58
59 class L2MultipleGatewayConnections(exceptions.NeutronException):
60 message = _("Multiple network connections found on '%(gateway_id)s' "
61 "with provided criteria.")
62
63
64 class L2GatewayInterfaceNotFound(exceptions.NeutronException):
65 message = _("L2 Gateway interface '%(interface_id)s' not found.")
66
67
68 class L2GatewayPhysicalPortNotFound(exceptions.NeutronException):
69 message = _("Physical Port '%(int_name)s' in Physical switch "
70 "'%(device_name)s' could not be found")
71
72
73 class L2GatewayPhysicalPortFaultStatus(exceptions.NeutronException):
74 message = _("Physical Port '%(int_name)s' in Physical switch "
75 "'%(device_name)s' port_fault_status is '%(fault_status)s'")
76
77
78 class L2GatewayPhysicalSwitchFaultStatus(exceptions.NeutronException):
79 message = _("Physical Switch '%(device_name)s' switch_fault_status is "
80 "'%(fault_status)s'")
81
82
83 class L2GatewayConnectionNotFound(exceptions.NotFound):
84 message = _("The connection %(id)s not found on the l2 gateway")
85
86
87 class L2gatewaySegmentationIDNotFound(exceptions.NotFound):
88 message = _("The segmentation id not found on gateway "
89 "'%(gateway_id)s'")
90
91
92 class MultipleVxlanSegmentsFound(exceptions.NeutronException):
93 message = _("Multiple Vxlan segments found for the network "
94 "'%(network_id)s'")
95
96
97 class VxlanSegmentationIDNotFound(exceptions.NotFound):
98 message = _("vxlan segmentation id not found for the "
99 "network '%(network_id)s'")
100
101
102 class L2GatewayInterfaceRequired(exceptions.NeutronException):
103 message = _("L2 Gateway Interface required")
104
105
106 class L2GatewaySegmentationIDExists(exceptions.NeutronException):
107 message = _("The segmentation id is already specified in "
108 "existing gateway interfaces.")
109
110
111 class L2GatewaySegmentationIDNotExists(exceptions.NeutronException):
112 message = _("The segmentation id is not specified in "
113 "existing gateway interfaces.")
114
115
116 class L2GatewaySegmentationRequired(exceptions.NeutronException):
117 message = _("L2 gateway segmentation id must be consistent for all "
118 "the interfaces")
119
120
121 class L2GatewayDuplicateSegmentationID(exceptions.Conflict):
122 message = _("%(message)s")
123
124
125 class OVSDBError(exceptions.NeutronException):
126 message = _("%(message)s")
127
128
129 class L2GatewayServiceDriverError(exceptions.NeutronException):
130 """Service driver call failed."""
131 message = _("%(method)s failed.")
132
133
134 class InvalidMethod(exceptions.NeutronException):
135 message = _("invalid method '%(op_method)s'")
136
137
138 faults.FAULT_MAP.update({L2GatewayInUse: web_exc.HTTPConflict,
139 L2GatewayPortInUse: web_exc.HTTPConflict,
140 L2GatewayConnectionExists: web_exc.HTTPConflict,
141 L2GatewayConnectionNotFound: web_exc.HTTPNotFound,
142 MultipleVxlanSegmentsFound: web_exc.HTTPConflict,
143 VxlanSegmentationIDNotFound: web_exc.HTTPNotFound,
144 L2GatewaySegmentationRequired: web_exc.HTTPConflict,
145 L2MultipleGatewayConnections: web_exc.HTTPConflict,
146 L2GatewayDuplicateSegmentationID:
147 web_exc.HTTPConflict,
148 L2AgentNotFoundByHost: web_exc.HTTPNotFound,
149 OVSDBError: web_exc.HTTPConflict})
150
151
152 class L3DvrAgentNotFound(exceptions.NotFound):
153 message = _("L3 agent could not be found")
154
155
156 class DvrAgentHostnameNotFound(exceptions.NeutronException):
157 message = _("Hostname '%(host)' has 127.0.0.1 address")