use of com.cloud.network.PhysicalNetworkServiceProvider in project cloudstack by apache.
the class AddNetworkServiceProviderCmd method create.
@Override
public void create() throws ResourceAllocationException {
PhysicalNetworkServiceProvider result = _networkService.addProviderToPhysicalNetwork(getPhysicalNetworkId(), getProviderName(), getDestinationPhysicalNetworkId(), getEnabledServices());
if (result != null) {
setEntityId(result.getId());
setEntityUuid(result.getUuid());
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add service provider entity to physical network");
}
}
use of com.cloud.network.PhysicalNetworkServiceProvider in project cloudstack by apache.
the class UpdateNetworkServiceProviderCmd method execute.
@Override
public void execute() {
PhysicalNetworkServiceProvider result = _networkService.updateNetworkServiceProvider(getId(), getState(), getEnabledServices());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to update service provider");
}
}
use of com.cloud.network.PhysicalNetworkServiceProvider in project cloudstack by apache.
the class ListNetworkServiceProvidersCmd method execute.
@Override
public void execute() {
Pair<List<? extends PhysicalNetworkServiceProvider>, Integer> serviceProviders = _networkService.listNetworkServiceProviders(getPhysicalNetworkId(), getName(), getState(), this.getStartIndex(), this.getPageSizeVal());
ListResponse<ProviderResponse> response = new ListResponse<ProviderResponse>();
List<ProviderResponse> serviceProvidersResponses = new ArrayList<ProviderResponse>();
for (PhysicalNetworkServiceProvider serviceProvider : serviceProviders.first()) {
ProviderResponse serviceProviderResponse = _responseGenerator.createNetworkServiceProviderResponse(serviceProvider);
serviceProvidersResponses.add(serviceProviderResponse);
}
response.setResponses(serviceProvidersResponses, serviceProviders.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
use of com.cloud.network.PhysicalNetworkServiceProvider in project cloudstack by apache.
the class RouterDeploymentDefinition method findVirtualProvider.
protected void findVirtualProvider() {
// Check if providers are supported in the physical networks
final Type type = Type.VirtualRouter;
final Long physicalNetworkId = networkModel.getPhysicalNetworkId(guestNetwork);
final PhysicalNetworkServiceProvider provider = physicalProviderDao.findByServiceProvider(physicalNetworkId, type.toString());
if (provider == null) {
throw new CloudRuntimeException(String.format("Cannot find service provider %s in physical network %s", type.toString(), physicalNetworkId));
}
vrProvider = vrProviderDao.findByNspIdAndType(provider.getId(), type);
if (vrProvider == null) {
throw new CloudRuntimeException(String.format("Cannot find virtual router provider %s as service provider %s", type.toString(), provider.getId()));
}
}
use of com.cloud.network.PhysicalNetworkServiceProvider in project CloudStack-archive by CloudStack-extras.
the class AddNetworkServiceProviderCmd method execute.
@Override
public void execute() {
UserContext.current().setEventDetails("Network ServiceProvider Id: " + getEntityId());
PhysicalNetworkServiceProvider result = _networkService.getCreatedPhysicalNetworkServiceProvider(getEntityId());
if (result != null) {
ProviderResponse response = _responseGenerator.createNetworkServiceProviderResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to add service provider to physical network");
}
}
Aggregations