forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMockRulesManagerImpl.java
More file actions
314 lines (265 loc) · 8.38 KB
/
MockRulesManagerImpl.java
File metadata and controls
314 lines (265 loc) · 8.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you 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.
package com.cloud.network;
import java.util.List;
import java.util.Map;
import javax.ejb.Local;
import javax.naming.ConfigurationException;
import org.apache.cloudstack.api.command.user.firewall.ListPortForwardingRulesCmd;
import com.cloud.exception.InsufficientAddressCapacityException;
import com.cloud.exception.NetworkRuleConflictException;
import com.cloud.exception.ResourceUnavailableException;
import com.cloud.network.rules.FirewallRule;
import com.cloud.network.rules.PortForwardingRule;
import com.cloud.network.rules.PortForwardingRuleVO;
import com.cloud.network.rules.RulesManager;
import com.cloud.network.rules.RulesService;
import com.cloud.network.rules.StaticNatRule;
import com.cloud.network.rules.FirewallRule.Purpose;
import com.cloud.user.Account;
import com.cloud.uservm.UserVm;
import com.cloud.utils.Pair;
import com.cloud.utils.component.Manager;
import com.cloud.utils.component.ManagerBase;
import com.cloud.utils.net.Ip;
import com.cloud.vm.VirtualMachine;
@Local(value = {RulesManager.class, RulesService.class})
public class MockRulesManagerImpl extends ManagerBase implements RulesManager, RulesService {
@Override
public Pair<List<? extends FirewallRule>, Integer> searchStaticNatRules(
Long ipId, Long id, Long vmId, Long start, Long size,
String accountName, Long domainId, Long projectId,
boolean isRecursive, boolean listAll) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean revokePortForwardingRule(long ruleId, boolean apply) {
// TODO Auto-generated method stub
return false;
}
@Override
public Pair<List<? extends PortForwardingRule>, Integer> listPortForwardingRules(
ListPortForwardingRulesCmd cmd) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean applyPortForwardingRules(long ipAdddressId, Account caller)
throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean enableStaticNat(long ipAddressId, long vmId, long networkId,
boolean isSystemVm, String ipAddr) throws NetworkRuleConflictException,
ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public PortForwardingRule getPortForwardigRule(long ruleId) {
// TODO Auto-generated method stub
return null;
}
@Override
public FirewallRule getFirewallRule(long ruleId) {
// TODO Auto-generated method stub
return null;
}
@Override
public StaticNatRule createStaticNatRule(StaticNatRule rule,
boolean openFirewall) throws NetworkRuleConflictException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean revokeStaticNatRule(long ruleId, boolean apply) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyStaticNatRules(long ipAdddressId, Account caller)
throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public StaticNatRule buildStaticNatRule(FirewallRule rule, boolean forRevoke) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<String> getSourceCidrs(long ruleId) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean disableStaticNat(long ipId)
throws ResourceUnavailableException, NetworkRuleConflictException,
InsufficientAddressCapacityException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyPortForwardingRules(long ipAddressId,
boolean continueOnError, Account caller) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyStaticNatRulesForIp(long sourceIpId,
boolean continueOnError, Account caller, boolean forRevoke) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyPortForwardingRulesForNetwork(long networkId,
boolean continueOnError, Account caller) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyStaticNatRulesForNetwork(long networkId,
boolean continueOnError, Account caller) {
// TODO Auto-generated method stub
return false;
}
@Override
public void checkIpAndUserVm(IpAddress ipAddress, UserVm userVm,
Account caller) {
// TODO Auto-generated method stub
}
@Override
public void checkRuleAndUserVm(FirewallRule rule, UserVm userVm,
Account caller) {
// TODO Auto-generated method stub
}
@Override
public boolean revokeAllPFAndStaticNatRulesForIp(long ipId, long userId,
Account caller) throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean revokeAllPFStaticNatRulesForNetwork(long networkId,
long userId, Account caller) throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public List<? extends FirewallRule> listFirewallRulesByIp(long ipAddressId) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<? extends PortForwardingRule> listPortForwardingRulesForApplication(
long ipId) {
// TODO Auto-generated method stub
return null;
}
@Override
public List<? extends PortForwardingRule> gatherPortForwardingRulesForApplication(
List<? extends IpAddress> addrs) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean revokePortForwardingRulesForVm(long vmId) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean revokeStaticNatRulesForVm(long vmId) {
// TODO Auto-generated method stub
return false;
}
@Override
public FirewallRule[] reservePorts(IpAddress ip, String protocol,
Purpose purpose, boolean openFirewall, Account caller, int... ports)
throws NetworkRuleConflictException {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean releasePorts(long ipId, String protocol, Purpose purpose,
int... ports) {
// TODO Auto-generated method stub
return false;
}
@Override
public List<PortForwardingRuleVO> listByNetworkId(long networkId) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean applyStaticNatForIp(long sourceIpId,
boolean continueOnError, Account caller, boolean forRevoke) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyStaticNatsForNetwork(long networkId,
boolean continueOnError, Account caller) {
// TODO Auto-generated method stub
return false;
}
@Override
public void getSystemIpAndEnableStaticNatForVm(VirtualMachine vm,
boolean getNewIp) throws InsufficientAddressCapacityException {
// TODO Auto-generated method stub
}
@Override
public boolean disableStaticNat(long ipAddressId, Account caller,
long callerUserId, boolean releaseIpIfElastic)
throws ResourceUnavailableException {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean applyStaticNatForNetwork(long networkId,
boolean continueOnError, Account caller, boolean forRevoke) {
// TODO Auto-generated method stub
return false;
}
@Override
public boolean configure(String name, Map<String, Object> params)
throws ConfigurationException {
return true;
}
@Override
public boolean start() {
return true;
}
@Override
public boolean stop() {
// TODO Auto-generated method stub
return false;
}
@Override
public String getName() {
// TODO Auto-generated method stub
return "MockRulesManagerImpl";
}
@Override
public PortForwardingRule createPortForwardingRule(PortForwardingRule rule,
Long vmId, Ip vmIp, boolean openFirewall)
throws NetworkRuleConflictException {
// TODO Auto-generated method stub
return null;
}
}