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());
}
}
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());
}
}
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();
}
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");
}
}
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");
}
}
Aggregations