use of com.cloud.agent.manager.Commands in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final StaticNatRules nat) throws ResourceUnavailableException {
final Network network = nat.getNetwork();
final VirtualRouter router = nat.getRouter();
final List<? extends StaticNat> rules = nat.getRules();
final Commands cmds = new Commands(Command.OnError.Continue);
_commandSetupHelper.createApplyStaticNatCommands(rules, router, cmds, network.getId());
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
use of com.cloud.agent.manager.Commands in project cloudstack by apache.
the class BasicNetworkVisitor method visit.
@Override
public boolean visit(final UserdataPwdRules userdata) throws ResourceUnavailableException {
final VirtualRouter router = userdata.getRouter();
final Commands commands = new Commands(Command.OnError.Stop);
final VirtualMachineProfile profile = userdata.getProfile();
final NicVO nicVo = userdata.getNicVo();
final UserVmVO userVM = userdata.getUserVM();
final DeployDestination destination = userdata.getDestination();
if (router.getPodIdToDeployIn().longValue() == destination.getPod().getId()) {
_commandSetupHelper.createPasswordCommand(router, profile, nicVo, commands);
_commandSetupHelper.createVmDataCommand(router, userVM, nicVo, userVM.getDetail("SSH.PublicKey"), commands);
return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
return true;
}
use of com.cloud.agent.manager.Commands in project cloudstack by apache.
the class AdvancedNetworkVisitor method visit.
@Override
public boolean visit(final VpcIpAssociationRules vpcip) throws ResourceUnavailableException {
final VirtualRouter router = vpcip.getRouter();
final Commands cmds = new Commands(Command.OnError.Continue);
final Map<String, String> vlanMacAddress = vpcip.getVlanMacAddress();
final List<PublicIpAddress> ipsToSend = vpcip.getIpsToSend();
if (!ipsToSend.isEmpty()) {
_commandSetupHelper.createVpcAssociatePublicIPCommands(router, ipsToSend, cmds, vlanMacAddress);
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
} else {
return true;
}
}
use of com.cloud.agent.manager.Commands in project cloudstack by apache.
the class AdvancedNetworkVisitor method visit.
@Override
public boolean visit(final DhcpPvlanRules dhcp) throws ResourceUnavailableException {
final VirtualRouter router = dhcp.getRouter();
final PvlanSetupCommand setupCommand = dhcp.getSetupCommand();
// In fact we send command to the host of router, we're not programming
// router but the host
final Commands cmds = new Commands(Command.OnError.Stop);
cmds.addCommand(setupCommand);
try {
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
} catch (final ResourceUnavailableException e) {
s_logger.warn("Timed Out", e);
return false;
}
}
use of com.cloud.agent.manager.Commands in project cloudstack by apache.
the class AdvancedNetworkVisitor method visit.
@Override
public boolean visit(final AdvancedVpnRules vpnRules) throws ResourceUnavailableException {
final VirtualRouter router = vpnRules.getRouter();
final List<? extends VpnUser> users = vpnRules.getUsers();
final Commands cmds = new Commands(Command.OnError.Continue);
_commandSetupHelper.createApplyVpnUsersCommand(users, router, cmds);
// results accordingly
return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
Aggregations