use of com.cloud.network.PhysicalNetwork in project cloudstack by apache.
the class BigSwitchBcfElement method createBigSwitchBcfDeviceResponse.
@Override
public BigSwitchBcfDeviceResponse createBigSwitchBcfDeviceResponse(BigSwitchBcfDeviceVO bigswitchBcfDeviceVO) {
HostVO bigswitchBcfHost = _hostDao.findById(bigswitchBcfDeviceVO.getHostId());
_hostDao.loadDetails(bigswitchBcfHost);
BigSwitchBcfDeviceResponse response = new BigSwitchBcfDeviceResponse();
response.setDeviceName(bigswitchBcfDeviceVO.getDeviceName());
PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(bigswitchBcfDeviceVO.getPhysicalNetworkId());
if (pnw != null) {
response.setPhysicalNetworkId(pnw.getUuid());
}
response.setId(bigswitchBcfDeviceVO.getUuid());
response.setProviderName(bigswitchBcfDeviceVO.getProviderName());
response.setHostName(bigswitchBcfHost.getDetail("hostname"));
response.setObjectName("bigswitchbcfdevice");
return response;
}
use of com.cloud.network.PhysicalNetwork in project cloudstack by apache.
the class NiciraNvpElement method createNiciraNvpDeviceResponse.
@Override
public NiciraNvpDeviceResponse createNiciraNvpDeviceResponse(NiciraNvpDeviceVO niciraNvpDeviceVO) {
HostVO niciraNvpHost = hostDao.findById(niciraNvpDeviceVO.getHostId());
hostDao.loadDetails(niciraNvpHost);
NiciraNvpDeviceResponse response = new NiciraNvpDeviceResponse();
response.setDeviceName(niciraNvpDeviceVO.getDeviceName());
PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(niciraNvpDeviceVO.getPhysicalNetworkId());
if (pnw != null) {
response.setPhysicalNetworkId(pnw.getUuid());
}
response.setId(niciraNvpDeviceVO.getUuid());
response.setProviderName(niciraNvpDeviceVO.getProviderName());
response.setHostName(niciraNvpHost.getDetail("ip"));
response.setTransportZoneUuid(niciraNvpHost.getDetail("transportzoneuuid"));
response.setL3GatewayServiceUuid(niciraNvpHost.getDetail("l3gatewayserviceuuid"));
response.setL2GatewayServiceUuid(niciraNvpHost.getDetail("l2gatewayserviceuuid"));
response.setObjectName("niciranvpdevice");
return response;
}
use of com.cloud.network.PhysicalNetwork in project CloudStack-archive by CloudStack-extras.
the class CreatePhysicalNetworkCmd method execute.
/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() {
UserContext.current().setEventDetails("Physical Network Id: " + getEntityId());
PhysicalNetwork result = _networkService.getCreatedPhysicalNetwork(getEntityId());
if (result != null) {
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to create physical network");
}
}
use of com.cloud.network.PhysicalNetwork in project cloudstack by apache.
the class ListPhysicalNetworksCmd method execute.
@Override
public void execute() {
Pair<List<? extends PhysicalNetwork>, Integer> result = _networkService.searchPhysicalNetworks(getId(), getZoneId(), this.getKeyword(), this.getStartIndex(), this.getPageSizeVal(), getNetworkName());
if (result != null) {
ListResponse<PhysicalNetworkResponse> response = new ListResponse<PhysicalNetworkResponse>();
List<PhysicalNetworkResponse> networkResponses = new ArrayList<PhysicalNetworkResponse>();
for (PhysicalNetwork network : result.first()) {
PhysicalNetworkResponse networkResponse = _responseGenerator.createPhysicalNetworkResponse(network);
networkResponses.add(networkResponse);
}
response.setResponses(networkResponses, result.second());
response.setResponseName(getCommandName());
this.setResponseObject(response);
} else {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to search for physical networks");
}
}
use of com.cloud.network.PhysicalNetwork in project cloudstack by apache.
the class UpdatePhysicalNetworkCmd method execute.
@Override
public void execute() {
PhysicalNetwork result = _networkService.updatePhysicalNetwork(getId(), getNetworkSpeed(), getTags(), getVlan(), getState());
if (result != null) {
PhysicalNetworkResponse response = _responseGenerator.createPhysicalNetworkResponse(result);
response.setResponseName(getCommandName());
this.setResponseObject(response);
}
}
Aggregations