mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
Implementing the SetFirewallRulesCommand for the simulator
* Essential since we need firewall rules open before applying network rules. Without the fix one recieves an UnsupportedCommandAnswer and fails the application of the network rule * Also RebootCommand responds with a RebootAnswer - minor fix Signed-off-by: Prasanna Santhanam <Prasanna.Santhanam@citrix.com>
This commit is contained in:
parent
d4d0950d71
commit
59f7cd4126
@ -13,7 +13,6 @@
|
|||||||
package com.cloud.agent.manager;
|
package com.cloud.agent.manager;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
import com.cloud.agent.api.Answer;
|
import com.cloud.agent.api.Answer;
|
||||||
@ -39,6 +38,7 @@ import com.cloud.agent.api.routing.DhcpEntryCommand;
|
|||||||
import com.cloud.agent.api.routing.IpAssocCommand;
|
import com.cloud.agent.api.routing.IpAssocCommand;
|
||||||
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
||||||
import com.cloud.agent.api.routing.SavePasswordCommand;
|
import com.cloud.agent.api.routing.SavePasswordCommand;
|
||||||
|
import com.cloud.agent.api.routing.SetFirewallRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||||
import com.cloud.agent.api.routing.VmDataCommand;
|
import com.cloud.agent.api.routing.VmDataCommand;
|
||||||
@ -63,6 +63,8 @@ public interface MockVmManager extends Manager {
|
|||||||
Answer SetStaticNatRules(SetStaticNatRulesCommand cmd);
|
Answer SetStaticNatRules(SetStaticNatRulesCommand cmd);
|
||||||
|
|
||||||
Answer SetPortForwardingRules(SetPortForwardingRulesCommand cmd);
|
Answer SetPortForwardingRules(SetPortForwardingRulesCommand cmd);
|
||||||
|
|
||||||
|
Answer SetFirewallRules(SetFirewallRulesCommand cmd);
|
||||||
|
|
||||||
Answer getNetworkUsage(NetworkUsageCommand cmd);
|
Answer getNetworkUsage(NetworkUsageCommand cmd);
|
||||||
|
|
||||||
|
|||||||
@ -37,6 +37,7 @@ import com.cloud.agent.api.MigrateAnswer;
|
|||||||
import com.cloud.agent.api.MigrateCommand;
|
import com.cloud.agent.api.MigrateCommand;
|
||||||
import com.cloud.agent.api.NetworkUsageAnswer;
|
import com.cloud.agent.api.NetworkUsageAnswer;
|
||||||
import com.cloud.agent.api.NetworkUsageCommand;
|
import com.cloud.agent.api.NetworkUsageCommand;
|
||||||
|
import com.cloud.agent.api.RebootAnswer;
|
||||||
import com.cloud.agent.api.RebootCommand;
|
import com.cloud.agent.api.RebootCommand;
|
||||||
import com.cloud.agent.api.SecurityGroupRuleAnswer;
|
import com.cloud.agent.api.SecurityGroupRuleAnswer;
|
||||||
import com.cloud.agent.api.SecurityGroupRulesCmd;
|
import com.cloud.agent.api.SecurityGroupRulesCmd;
|
||||||
@ -53,6 +54,7 @@ import com.cloud.agent.api.routing.DhcpEntryCommand;
|
|||||||
import com.cloud.agent.api.routing.IpAssocCommand;
|
import com.cloud.agent.api.routing.IpAssocCommand;
|
||||||
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
||||||
import com.cloud.agent.api.routing.SavePasswordCommand;
|
import com.cloud.agent.api.routing.SavePasswordCommand;
|
||||||
|
import com.cloud.agent.api.routing.SetFirewallRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||||
import com.cloud.agent.api.routing.VmDataCommand;
|
import com.cloud.agent.api.routing.VmDataCommand;
|
||||||
@ -272,6 +274,12 @@ public class MockVmManagerImpl implements MockVmManager {
|
|||||||
return new Answer(cmd);
|
return new Answer(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Answer SetFirewallRules(SetFirewallRulesCommand cmd) {
|
||||||
|
return new Answer(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public NetworkUsageAnswer getNetworkUsage(NetworkUsageCommand cmd) {
|
public NetworkUsageAnswer getNetworkUsage(NetworkUsageCommand cmd) {
|
||||||
return new NetworkUsageAnswer(cmd, null, 100L, 100L);
|
return new NetworkUsageAnswer(cmd, null, 100L, 100L);
|
||||||
@ -345,7 +353,7 @@ public class MockVmManagerImpl implements MockVmManager {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Answer rebootVM(RebootCommand cmd) {
|
public Answer rebootVM(RebootCommand cmd) {
|
||||||
return new Answer(cmd);
|
return new RebootAnswer(cmd, "Rebooted "+cmd.getVmName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -457,5 +465,5 @@ public class MockVmManagerImpl implements MockVmManager {
|
|||||||
}
|
}
|
||||||
return maps;
|
return maps;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -64,6 +64,7 @@ import com.cloud.agent.api.routing.DhcpEntryCommand;
|
|||||||
import com.cloud.agent.api.routing.IpAssocCommand;
|
import com.cloud.agent.api.routing.IpAssocCommand;
|
||||||
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
import com.cloud.agent.api.routing.LoadBalancerConfigCommand;
|
||||||
import com.cloud.agent.api.routing.SavePasswordCommand;
|
import com.cloud.agent.api.routing.SavePasswordCommand;
|
||||||
|
import com.cloud.agent.api.routing.SetFirewallRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
import com.cloud.agent.api.routing.SetPortForwardingRulesCommand;
|
||||||
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
import com.cloud.agent.api.routing.SetStaticNatRulesCommand;
|
||||||
import com.cloud.agent.api.routing.VmDataCommand;
|
import com.cloud.agent.api.routing.VmDataCommand;
|
||||||
@ -200,6 +201,8 @@ public class SimulatorManagerImpl implements SimulatorManager {
|
|||||||
return _mockVmMgr.checkSshCommand((CheckSshCommand)cmd);
|
return _mockVmMgr.checkSshCommand((CheckSshCommand)cmd);
|
||||||
} else if (cmd instanceof SetStaticNatRulesCommand) {
|
} else if (cmd instanceof SetStaticNatRulesCommand) {
|
||||||
return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand)cmd);
|
return _mockVmMgr.SetStaticNatRules((SetStaticNatRulesCommand)cmd);
|
||||||
|
} else if (cmd instanceof SetFirewallRulesCommand) {
|
||||||
|
return _mockVmMgr.SetFirewallRules((SetFirewallRulesCommand)cmd);
|
||||||
} else if (cmd instanceof SetPortForwardingRulesCommand) {
|
} else if (cmd instanceof SetPortForwardingRulesCommand) {
|
||||||
return _mockVmMgr.SetPortForwardingRules((SetPortForwardingRulesCommand)cmd);
|
return _mockVmMgr.SetPortForwardingRules((SetPortForwardingRulesCommand)cmd);
|
||||||
} else if (cmd instanceof NetworkUsageCommand) {
|
} else if (cmd instanceof NetworkUsageCommand) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user