Debian Codegraph @

neutron_lib/exceptions/vpn.py

raw
1 # Licensed under the Apache License, Version 2.0 (the "License"); you may
2 # not use this file except in compliance with the License. You may obtain
3 # a copy of the License at
4 #
5 # http://www.apache.org/licenses/LICENSE-2.0
6 #
7 # Unless required by applicable law or agreed to in writing, software
8 # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
9 # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
10 # License for the specific language governing permissions and limitations
11 # under the License.
12
13 from neutron_lib._i18n import _
14 from neutron_lib import exceptions
15
16
17 # VPNaaS Exceptions
18 class VPNServiceNotFound(exceptions.NotFound):
19 message = _("VPNService %(vpnservice_id)s could not be found")
20
21
22 class IPsecSiteConnectionNotFound(exceptions.NotFound):
23 message = _("ipsec_site_connection %(ipsec_site_conn_id)s not found")
24
25
26 class IPsecSiteConnectionDpdIntervalValueError(exceptions.InvalidInput):
27 message = _("ipsec_site_connection %(attr)s is "
28 "equal to or less than dpd_interval")
29
30
31 class IPsecSiteConnectionMtuError(exceptions.InvalidInput):
32 message = _("ipsec_site_connection MTU %(mtu)d is too small "
33 "for ipv%(version)s")
34
35
36 class IPsecSiteConnectionPeerCidrError(exceptions.InvalidInput):
37 message = _("ipsec_site_connection peer cidr %(peer_cidr)s is "
38 "invalid CIDR")
39
40
41 class IKEPolicyNotFound(exceptions.NotFound):
42 message = _("IKEPolicy %(ikepolicy_id)s could not be found")
43
44
45 class IPsecPolicyNotFound(exceptions.NotFound):
46 message = _("IPsecPolicy %(ipsecpolicy_id)s could not be found")
47
48
49 class IKEPolicyInUse(exceptions.InUse):
50 message = _("IKEPolicy %(ikepolicy_id)s is in use by existing "
51 "IPsecSiteConnection and can't be updated or deleted")
52
53
54 class VPNServiceInUse(exceptions.InUse):
55 message = _("VPNService %(vpnservice_id)s is still in use")
56
57
58 class SubnetInUseByVPNService(exceptions.InUse):
59 message = _("Subnet %(subnet_id)s is used by VPNService %(vpnservice_id)s")
60
61
62 class SubnetInUseByEndpointGroup(exceptions.InUse):
63 message = _("Subnet %(subnet_id)s is used by endpoint group %(group_id)s")
64
65
66 class SubnetInUseByIPsecSiteConnection(exceptions.InUse):
67 message = _("Subnet %(subnet_id)s is used by ipsec site connection "
68 "%(ipsec_site_connection_id)s")
69
70
71 class VPNStateInvalidToUpdate(exceptions.BadRequest):
72 message = _("Invalid state %(state)s of vpnaas resource %(id)s "
73 "for updating")
74
75
76 class IPsecPolicyInUse(exceptions.InUse):
77 message = _("IPsecPolicy %(ipsecpolicy_id)s is in use by existing "
78 "IPsecSiteConnection and can't be updated or deleted")
79
80
81 class DeviceDriverImportError(exceptions.NeutronException):
82 message = _("Can not load driver :%(device_driver)s")
83
84
85 class SubnetIsNotConnectedToRouter(exceptions.BadRequest):
86 message = _("Subnet %(subnet_id)s is not "
87 "connected to Router %(router_id)s")
88
89
90 class RouterIsNotExternal(exceptions.BadRequest):
91 message = _("Router %(router_id)s has no external network gateway set")
92
93
94 class VPNPeerAddressNotResolved(exceptions.InvalidInput):
95 message = _("Peer address %(peer_address)s cannot be resolved")
96
97
98 class ExternalNetworkHasNoSubnet(exceptions.BadRequest):
99 message = _("Router's %(router_id)s external network has "
100 "no %(ip_version)s subnet")
101
102
103 # VPN Endpoint Group Exceptions
104 class VPNEndpointGroupNotFound(exceptions.NotFound):
105 message = _("Endpoint group %(endpoint_group_id)s could not be found")
106
107
108 class InvalidEndpointInEndpointGroup(exceptions.InvalidInput):
109 message = _("Endpoint '%(endpoint)s' is invalid for group "
110 "type '%(group_type)s': %(why)s")
111
112
113 class MissingEndpointForEndpointGroup(exceptions.BadRequest):
114 message = _("No endpoints specified for endpoint group '%(group)s'")
115
116
117 class NonExistingSubnetInEndpointGroup(exceptions.InvalidInput):
118 message = _("Subnet %(subnet)s in endpoint group does not exist")
119
120
121 class MixedIPVersionsForIPSecEndpoints(exceptions.BadRequest):
122 message = _("Endpoints in group %(group)s do not have the same IP "
123 "version, as required for IPSec site-to-site connection")
124
125
126 class MixedIPVersionsForPeerCidrs(exceptions.BadRequest):
127 message = _("Peer CIDRs do not have the same IP version, as required "
128 "for IPSec site-to-site connection")
129
130
131 class MixedIPVersionsForIPSecConnection(exceptions.BadRequest):
132 message = _("IP versions are not compatible between peer and local "
133 "endpoints")
134
135
136 class InvalidEndpointGroup(exceptions.BadRequest):
137 message = _("Endpoint group%(suffix)s %(which)s cannot be specified, "
138 "when VPN Service has subnet specified")
139
140
141 class WrongEndpointGroupType(exceptions.BadRequest):
142 message = _("Endpoint group %(which)s type is '%(group_type)s' and "
143 "should be '%(expected)s'")
144
145
146 class PeerCidrsInvalid(exceptions.BadRequest):
147 message = _("Peer CIDRs cannot be specified, when using endpoint "
148 "groups")
149
150
151 class MissingPeerCidrs(exceptions.BadRequest):
152 message = _("Missing peer CIDRs for IPsec site-to-site connection")
153
154
155 class MissingRequiredEndpointGroup(exceptions.BadRequest):
156 message = _("Missing endpoint group%(suffix)s %(which)s for IPSec "
157 "site-to-site connection")
158
159
160 class EndpointGroupInUse(exceptions.BadRequest):
161 message = _("Endpoint group %(group_id)s is in use and cannot be deleted")
162
163
164 # VPN Flavors Exceptions
165 class FlavorsPluginNotLoaded(exceptions.NotFound):
166 message = _("Flavors plugin not found")
167
168
169 class NoProviderFoundForFlavor(exceptions.NotFound):
170 message = _("No service provider found for flavor %(flavor_id)s")
171
172
173 # IPsec Service Driver Validator Exceptions
174 class IpsecValidationFailure(exceptions.BadRequest):
175 message = _("IPSec does not support %(resource)s attribute %(key)s "
176 "with value '%(value)s'")
177
178
179 class IkeValidationFailure(exceptions.BadRequest):
180 message = _("IKE does not support %(resource)s attribute %(key)s "
181 "with value '%(value)s'")
182
183
184 # Cisco Csr Driver Exceptions
185 class CsrInternalError(exceptions.NeutronException):
186 message = _("Fatal - %(reason)s")
187
188
189 # Cisco CSR Driver Validator Exceptions
190 class CsrValidationFailure(exceptions.BadRequest):
191 message = _("Cisco CSR does not support %(resource)s attribute %(key)s "
192 "with value '%(value)s'")