Search in sources :

Example 26 with VirtualRouter

use of com.cloud.legacymodel.network.VirtualRouter in project cosmic by MissionCriticalCloud.

the class AdvancedNetworkVisitor method visit.

@Override
public boolean visit(final AdvancedVpnRules vpnRules) throws ResourceUnavailableException {
    final VirtualRouter router = vpnRules.getRouter();
    final Commands cmds = new Commands(Command.OnError.Continue);
    final NetworkOverviewTO networkOverview = _commandSetupHelper.createNetworkOverviewFromRouter(router, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), null, null, null);
    final UpdateNetworkOverviewCommand updateNetworkOverviewCommand = _commandSetupHelper.createUpdateNetworkOverviewCommand(router, networkOverview);
    cmds.addCommand(updateNetworkOverviewCommand);
    // results accordingly
    return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
Also used : Commands(com.cloud.agent.manager.Commands) NetworkOverviewTO(com.cloud.legacymodel.to.NetworkOverviewTO) UpdateNetworkOverviewCommand(com.cloud.legacymodel.communication.command.UpdateNetworkOverviewCommand) VirtualRouter(com.cloud.legacymodel.network.VirtualRouter)

Example 27 with VirtualRouter

use of com.cloud.legacymodel.network.VirtualRouter in project cosmic by MissionCriticalCloud.

the class AdvancedNetworkVisitor 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();
    _commandSetupHelper.createPasswordCommand(router, profile, nicVO, commands);
    final VMOverviewTO vmOverview = _commandSetupHelper.createVmOverviewFromRouter(router);
    final UpdateVmOverviewCommand updateVmOverviewCommand = _commandSetupHelper.createUpdateVmOverviewCommand(router, vmOverview);
    commands.addCommand(updateVmOverviewCommand);
    return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
Also used : VMOverviewTO(com.cloud.legacymodel.to.VMOverviewTO) Commands(com.cloud.agent.manager.Commands) VirtualMachineProfile(com.cloud.vm.VirtualMachineProfile) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.legacymodel.network.VirtualRouter) UpdateVmOverviewCommand(com.cloud.legacymodel.communication.command.UpdateVmOverviewCommand)

Example 28 with VirtualRouter

use of com.cloud.legacymodel.network.VirtualRouter in project cosmic by MissionCriticalCloud.

the class BasicNetworkVisitor method visit.

@Override
public boolean visit(final SshKeyToRouterRules sshkey) throws ResourceUnavailableException {
    final VirtualRouter router = sshkey.getRouter();
    final VirtualMachineProfile profile = sshkey.getProfile();
    final Commands commands = new Commands(Command.OnError.Stop);
    final NicVO nicVO = sshkey.getNicVo();
    final VMTemplateVO template = sshkey.getTemplate();
    if (template != null && template.getEnablePassword()) {
        _commandSetupHelper.createPasswordCommand(router, profile, nicVO, commands);
    }
    final VMOverviewTO vmOverview = _commandSetupHelper.createVmOverviewFromRouter(router);
    final UpdateVmOverviewCommand updateVmOverviewCommand = _commandSetupHelper.createUpdateVmOverviewCommand(router, vmOverview);
    commands.addCommand(updateVmOverviewCommand);
    return _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
Also used : VMOverviewTO(com.cloud.legacymodel.to.VMOverviewTO) Commands(com.cloud.agent.manager.Commands) VMTemplateVO(com.cloud.storage.VMTemplateVO) VirtualMachineProfile(com.cloud.vm.VirtualMachineProfile) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.legacymodel.network.VirtualRouter) UpdateVmOverviewCommand(com.cloud.legacymodel.communication.command.UpdateVmOverviewCommand)

Example 29 with VirtualRouter

use of com.cloud.legacymodel.network.VirtualRouter in project cosmic by MissionCriticalCloud.

the class BasicNetworkVisitor method visit.

@Override
public boolean visit(final PasswordToRouterRules passwd) throws ResourceUnavailableException {
    final VirtualRouter router = passwd.getRouter();
    final NicVO nicVo = passwd.getNicVo();
    final VirtualMachineProfile profile = passwd.getProfile();
    final Commands cmds = new Commands(Command.OnError.Stop);
    _commandSetupHelper.createPasswordCommand(router, profile, nicVo, cmds);
    return _networkGeneralHelper.sendCommandsToRouter(router, cmds);
}
Also used : Commands(com.cloud.agent.manager.Commands) VirtualMachineProfile(com.cloud.vm.VirtualMachineProfile) NicVO(com.cloud.vm.NicVO) VirtualRouter(com.cloud.legacymodel.network.VirtualRouter)

Example 30 with VirtualRouter

use of com.cloud.legacymodel.network.VirtualRouter in project cosmic by MissionCriticalCloud.

the class BasicNetworkVisitor 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 DeployDestination destination = dhcp.getDestination();
    return router.getPodIdToDeployIn() != destination.getPod().getId() || _networkGeneralHelper.sendCommandsToRouter(router, commands);
}
Also used : DeployDestination(com.cloud.deploy.DeployDestination) Commands(com.cloud.agent.manager.Commands) VirtualRouter(com.cloud.legacymodel.network.VirtualRouter)

Aggregations

VirtualRouter (com.cloud.legacymodel.network.VirtualRouter)36 Commands (com.cloud.agent.manager.Commands)21 UpdateVmOverviewCommand (com.cloud.legacymodel.communication.command.UpdateVmOverviewCommand)8 VMOverviewTO (com.cloud.legacymodel.to.VMOverviewTO)8 NicVO (com.cloud.vm.NicVO)8 VirtualMachineProfile (com.cloud.vm.VirtualMachineProfile)8 UpdateNetworkOverviewCommand (com.cloud.legacymodel.communication.command.UpdateNetworkOverviewCommand)7 NetworkOverviewTO (com.cloud.legacymodel.to.NetworkOverviewTO)7 DomainRouterVO (com.cloud.vm.DomainRouterVO)7 ServerApiException (com.cloud.api.ServerApiException)5 DomainRouterResponse (com.cloud.api.response.DomainRouterResponse)5 Zone (com.cloud.db.model.Zone)5 ResourceUnavailableException (com.cloud.legacymodel.exceptions.ResourceUnavailableException)5 Ip (com.cloud.legacymodel.network.Ip)5 UserVmVO (com.cloud.vm.UserVmVO)5 ArrayList (java.util.ArrayList)5 InvalidParameterValueException (com.cloud.legacymodel.exceptions.InvalidParameterValueException)4 Network (com.cloud.legacymodel.network.Network)4 Config (com.cloud.configuration.Config)3 ZoneRepository (com.cloud.db.repository.ZoneRepository)3