Search in sources :

Example 6 with VirtualRouterProvider

use of com.cloud.network.VirtualRouterProvider in project cloudstack by apache.

the class InternalLbElementServiceTest method enableProvider.

@Test
public void enableProvider() {
    VirtualRouterProvider provider = null;
    try {
        provider = _lbElSvc.configureInternalLoadBalancerElement(validElId, true);
    } finally {
        assertNotNull("Test failed. Couldn't find the VR provider by the valid id ", provider);
        assertTrue("Test failed. The provider wasn't eanbled ", provider.isEnabled());
    }
}
Also used : VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) Test(org.junit.Test)

Example 7 with VirtualRouterProvider

use of com.cloud.network.VirtualRouterProvider in project cloudstack by apache.

the class InternalLbElementServiceTest method disableProvider.

@Test
public void disableProvider() {
    VirtualRouterProvider provider = null;
    try {
        provider = _lbElSvc.configureInternalLoadBalancerElement(validElId, false);
    } finally {
        assertNotNull("Test failed. Couldn't find the VR provider by the valid id ", provider);
        assertFalse("Test failed. The provider wasn't disabled ", provider.isEnabled());
    }
}
Also used : VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) Test(org.junit.Test)

Example 8 with VirtualRouterProvider

use of com.cloud.network.VirtualRouterProvider in project cloudstack by apache.

the class InternalLoadBalancerVMManagerImpl method getInternalLbProviderId.

protected long getInternalLbProviderId(final Network guestNetwork) {
    final Type type = Type.InternalLbVm;
    final long physicalNetworkId = _ntwkModel.getPhysicalNetworkId(guestNetwork);
    final PhysicalNetworkServiceProvider provider = _physicalProviderDao.findByServiceProvider(physicalNetworkId, type.toString());
    if (provider == null) {
        throw new CloudRuntimeException("Cannot find service provider " + type.toString() + " in physical network " + physicalNetworkId);
    }
    final VirtualRouterProvider internalLbProvider = _vrProviderDao.findByNspIdAndType(provider.getId(), type);
    if (internalLbProvider == null) {
        throw new CloudRuntimeException("Cannot find provider " + type.toString() + " as service provider " + provider.getId());
    }
    return internalLbProvider.getId();
}
Also used : Type(com.cloud.network.VirtualRouterProvider.Type) TrafficType(com.cloud.network.Networks.TrafficType) HypervisorType(com.cloud.hypervisor.Hypervisor.HypervisorType) CloudRuntimeException(com.cloud.utils.exception.CloudRuntimeException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider) PhysicalNetworkServiceProvider(com.cloud.network.PhysicalNetworkServiceProvider)

Example 9 with VirtualRouterProvider

use of com.cloud.network.VirtualRouterProvider in project cloudstack by apache.

the class CreateInternalLoadBalancerElementCmd method create.

@Override
public void create() throws ResourceAllocationException {
    VirtualRouterProvider result = _service.get(0).addInternalLoadBalancerElement(getNspId());
    if (result != null) {
        setEntityId(result.getId());
        setEntityUuid(result.getUuid());
    } else {
        throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add Internal Load Balancer entity to physical network");
    }
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider)

Example 10 with VirtualRouterProvider

use of com.cloud.network.VirtualRouterProvider in project CloudStack-archive by CloudStack-extras.

the class ConfigureVirtualRouterElementCmd method execute.

@Override
public void execute() throws ConcurrentOperationException, ResourceUnavailableException, InsufficientCapacityException {
    UserContext.current().setEventDetails("Virtual router element: " + id);
    VirtualRouterProvider result = _service.configure(this);
    if (result != null) {
        VirtualRouterProviderResponse routerResponse = _responseGenerator.createVirtualRouterProviderResponse(result);
        routerResponse.setResponseName(getCommandName());
        this.setResponseObject(routerResponse);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to configure the virtual router provider");
    }
}
Also used : VirtualRouterProviderResponse(com.cloud.api.response.VirtualRouterProviderResponse) ServerApiException(com.cloud.api.ServerApiException) VirtualRouterProvider(com.cloud.network.VirtualRouterProvider)

Aggregations

VirtualRouterProvider (com.cloud.network.VirtualRouterProvider)19 CloudRuntimeException (com.cloud.utils.exception.CloudRuntimeException)6 ServerApiException (org.apache.cloudstack.api.ServerApiException)6 DomainRouterVO (com.cloud.vm.DomainRouterVO)5 ArrayList (java.util.ArrayList)5 Provider (com.cloud.network.Network.Provider)4 NicProfile (com.cloud.vm.NicProfile)4 VirtualRouterProviderResponse (com.cloud.api.response.VirtualRouterProviderResponse)3 PhysicalNetworkServiceProvider (com.cloud.network.PhysicalNetworkServiceProvider)3 InternalLoadBalancerElementResponse (org.apache.cloudstack.api.response.InternalLoadBalancerElementResponse)3 VirtualRouterProviderResponse (org.apache.cloudstack.api.response.VirtualRouterProviderResponse)3 AggregationControlCommand (com.cloud.agent.api.routing.AggregationControlCommand)2 ServerApiException (com.cloud.api.ServerApiException)2 ConcurrentOperationException (com.cloud.exception.ConcurrentOperationException)2 Network (com.cloud.network.Network)2 NetworkOffering (com.cloud.offering.NetworkOffering)2 ListResponse (org.apache.cloudstack.api.response.ListResponse)2 Test (org.junit.Test)2 Command (com.cloud.agent.api.Command)1 NetworkUsageCommand (com.cloud.agent.api.NetworkUsageCommand)1