Debian Codegraph @

neutron_lib/exceptions/firewall_v2.py

raw
1 # Copyright (c) 2016 Mirantis, Inc.
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 class FirewallGroupNotFound(exceptions.NotFound):
20 message = _("Firewall group %(firewall_id)s could not be found.")
21
22
23 class FirewallGroupInUse(exceptions.InUse):
24 message = _("Firewall group %(firewall_id)s is still active.")
25
26
27 class FirewallGroupInPendingState(exceptions.Conflict):
28 message = _("Operation cannot be performed since associated firewall "
29 "group %(firewall_id)s is in %(pending_state)s.")
30
31
32 class FirewallGroupPortInvalid(exceptions.Conflict):
33 message = _("Port %(port_id)s of firewall group is invalid.")
34
35
36 class FirewallGroupPortInvalidProject(exceptions.Conflict):
37 message = _("Operation cannot be performed as port %(port_id)s "
38 "is in an invalid project %(project_id)s.")
39
40
41 class FirewallGroupPortInUse(exceptions.InUse):
42 message = _("Port(s) %(port_ids)s provided already associated with "
43 "other firewall group(s).")
44
45
46 class FirewallPolicyNotFound(exceptions.NotFound):
47 message = _("Firewall policy %(firewall_policy_id)s could not be found.")
48
49
50 class FirewallPolicyInUse(exceptions.InUse):
51 message = _("Firewall policy %(firewall_policy_id)s is being used.")
52
53
54 class FirewallPolicyConflict(exceptions.NotFound):
55 """FWaaS exception raised for firewall policy conflict
56
57 Raised when user tries to use another project's unshared policy.
58 """
59 message = _("Operation cannot be performed since firewall policy "
60 "%(firewall_policy_id)s for your project could not be found. "
61 "Please confirm if the firewall policy exists and is shared.")
62
63
64 class FirewallRuleSharingConflict(exceptions.NotFound):
65 """FWaaS exception for sharing policies
66
67 Raised when shared policy uses unshared rules.
68 """
69 message = _("Operation cannot be performed since firewall policy "
70 "%(firewall_policy_id)s could not find the firewall rule "
71 "%(firewall_rule_id)s. Please confirm if the firewall rule "
72 "exists and is shared.")
73
74
75 class FirewallPolicySharingConflict(exceptions.Conflict):
76 """FWaaS exception raised for sharing policies
77
78 Raised if policy is 'shared' but its associated rules are not.
79 """
80 message = _("Operation cannot be performed. Before sharing firewall "
81 "policy %(firewall_policy_id)s, share associated firewall "
82 "rule %(firewall_rule_id)s.")
83
84
85 class FirewallRuleNotFound(exceptions.NotFound):
86 message = _("Firewall rule %(firewall_rule_id)s could not be found.")
87
88
89 class FirewallRuleInUse(exceptions.InUse):
90 message = _("Firewall rule %(firewall_rule_id)s is being used.")
91
92
93 class FirewallRuleNotAssociatedWithPolicy(exceptions.InvalidInput):
94 message = _("Firewall rule %(firewall_rule_id)s is not associated "
95 "with firewall policy %(firewall_policy_id)s.")
96
97
98 class FirewallRuleInvalidProtocol(exceptions.InvalidInput):
99 message = _("Protocol %(protocol)s is not supported. "
100 "Only protocol values %(values)s and their integer "
101 "representation (0 to 255) are supported.")
102
103
104 class FirewallRuleInvalidAction(exceptions.InvalidInput):
105 message = _("Action %(action)s is not supported. "
106 "Only action values %(values)s are supported.")
107
108
109 class FirewallRuleInvalidICMPParameter(exceptions.InvalidInput):
110 message = _("%(param)s are not allowed when protocol "
111 "is set to ICMP.")
112
113
114 class FirewallRuleWithPortWithoutProtocolInvalid(exceptions.InvalidInput):
115 message = _("Source/destination port requires a protocol.")
116
117
118 class FirewallRuleInvalidPortValue(exceptions.InvalidInput):
119 message = _("Invalid value for port %(port)s.")
120
121
122 class FirewallRuleInfoMissing(exceptions.InvalidInput):
123 message = _("Missing rule info argument for insert/remove "
124 "rule operation.")
125
126
127 class FirewallIpAddressConflict(exceptions.InvalidInput):
128 message = _("Invalid input - IP addresses do not agree with IP Version.")
129
130
131 class FirewallInternalDriverError(exceptions.NeutronException):
132 """FWaaS exception for all driver errors
133
134 On any failure or exception in the driver, driver should log it and
135 raise this exception to the agent
136 """
137
138 message = _("%(driver)s: Internal driver error.")
139
140
141 class FirewallRuleConflict(exceptions.Conflict):
142 """FWaaS rule conflict exception
143
144 Occurs when admin policy tries to use another project's rule that is
145 not shared.
146 """
147 message = _("Operation cannot be performed since firewall rule "
148 "%(firewall_rule_id)s is not shared and belongs to "
149 "another project %(project_id)s.")
150
151
152 class FirewallRuleAlreadyAssociated(exceptions.Conflict):
153 """FWaaS exception for an already associated rule
154
155 Occurs when there is an attempt to assign a rule to a policy that
156 the rule is already associated with.
157 """
158 message = _("Operation cannot be performed since firewall rule "
159 "%(firewall_rule_id)s is already associated with firewall "
160 "policy %(firewall_policy_id)s.")
161
162
163 class FirewallGroupCannotRemoveDefault(exceptions.InUse):
164 message = _("Deleting default firewall group not allowed.")
165
166
167 class FirewallGroupCannotUpdateDefault(exceptions.InUse):
168 message = _("Updating default firewall group not allowed.")
169
170
171 class FirewallGroupDefaultAlreadyExists(exceptions.InUse):
172 """Default firewall group conflict exception
173
174 Occurs when a user creates firewall group named 'default'.
175 """
176 message = _("Default firewall group already exists. 'default' is the "
177 "reserved name for firewall group.")
178
179
180 class FirewallGroupPortNotSupported(exceptions.Conflict):
181 message = _("Port %(port_id)s is not supported by firewall driver "
182 "'%(driver_name)s'.")