Search in sources :

Example 21 with VirtualRouter

use of com.cloud.network.router.VirtualRouter 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);
}
Also used : Commands(com.cloud.agent.manager.Commands) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 22 with VirtualRouter

use of com.cloud.network.router.VirtualRouter 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;
    }
}
Also used : Commands(com.cloud.agent.manager.Commands) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) PvlanSetupCommand(com.cloud.agent.api.PvlanSetupCommand) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 23 with VirtualRouter

use of com.cloud.network.router.VirtualRouter 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;
    }
}
Also used : PublicIpAddress(com.cloud.network.PublicIpAddress) Commands(com.cloud.agent.manager.Commands) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 24 with VirtualRouter

use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.

the class AdvancedNetworkVisitor method visit.

@Override
public boolean visit(final NicPlugInOutRules nicPlugInOutRules) throws ResourceUnavailableException {
    final VirtualRouter router = nicPlugInOutRules.getRouter();
    final Commands commands = nicPlugInOutRules.getNetUsageCommands();
    if (commands.size() > 0) {
        return _networkGeneralHelper.sendCommandsToRouter(router, commands);
    }
    return true;
}
Also used : Commands(com.cloud.agent.manager.Commands) VirtualRouter(com.cloud.network.router.VirtualRouter)

Example 25 with VirtualRouter

use of com.cloud.network.router.VirtualRouter in project cloudstack by apache.

the class AdvancedNetworkVisitor method visit.

@Override
public boolean visit(final DhcpEntryRules dhcp) throws ResourceUnavailableException {
    final VirtualRouter router = dhcp.getRouter();
    final Commands commands = new Commands(Command.OnError.Stop);
    final NicVO nicVo = dhcp.getNicVo();
    final UserVmVO userVM = dhcp.getUserVM();
    final boolean remove = dhcp.isRemove();
    _commandSetupHelper.createDhcpEntryCommand(router, userVM, nicVo, remove, commands);
    return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
Also used : UserVmVO(com.cloud.vm.UserVmVO) Commands(com.cloud.agent.manager.Commands) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.network.router.VirtualRouter)

Aggregations

VirtualRouter (com.cloud.network.router.VirtualRouter)72 Commands (com.cloud.agent.manager.Commands)34 DomainRouterResponse (com.cloud.api.response.DomainRouterResponse)11 NicVO (com.cloud.vm.NicVO)11 ServerApiException (com.cloud.api.ServerApiException)10 UserVmVO (com.cloud.vm.UserVmVO)10 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)10 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)9 ArrayList (java.util.ArrayList)9 ServerApiException (org.apache.cloudstack.api.ServerApiException)9 DataCenter (com.cloud.dc.DataCenter)8 Network (com.cloud.network.Network)8 DomainRouterResponse (org.apache.cloudstack.api.response.DomainRouterResponse)8 InvalidParameterValueException (com.cloud.exception.InvalidParameterValueException)6 UpdateVmOverviewCommand (com.cloud.agent.api.UpdateVmOverviewCommand)5 VMOverviewTO (com.cloud.agent.api.to.overviews.VMOverviewTO)5 UpdateNetworkOverviewCommand (com.cloud.agent.api.UpdateNetworkOverviewCommand)4 NetworkOverviewTO (com.cloud.agent.api.to.overviews.NetworkOverviewTO)4 DeployDestination (com.cloud.deploy.DeployDestination)4 PvlanSetupCommand (com.cloud.agent.api.PvlanSetupCommand)2