Search in sources :

Example 1 with OpenDaylightControllerResponse

use of org.apache.cloudstack.network.opendaylight.api.responses.OpenDaylightControllerResponse in project cloudstack by apache.

the class ListOpenDaylightControllersCmd method execute.

/////////////////////////////////////////////////////
/////////////// API Implementation///////////////////
/////////////////////////////////////////////////////
@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    List<OpenDaylightControllerVO> controllers = resourceManager.listControllers(this);
    List<OpenDaylightControllerResponse> controllerList = new ArrayList<OpenDaylightControllerResponse>();
    for (OpenDaylightControllerVO controller : controllers) {
        OpenDaylightControllerResponse responseObject = resourceManager.createResponseFromVO(controller);
        controllerList.add(responseObject);
    }
    ListResponse<OpenDaylightControllerResponse> responseList = new ListResponse<OpenDaylightControllerResponse>();
    responseList.setResponseName(getCommandName());
    responseList.setResponses(controllerList);
    setResponseObject(responseList);
}
Also used : ListResponse(org.apache.cloudstack.api.response.ListResponse) OpenDaylightControllerResponse(org.apache.cloudstack.network.opendaylight.api.responses.OpenDaylightControllerResponse) ArrayList(java.util.ArrayList) OpenDaylightControllerVO(org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO)

Example 2 with OpenDaylightControllerResponse

use of org.apache.cloudstack.network.opendaylight.api.responses.OpenDaylightControllerResponse in project cloudstack by apache.

the class OpenDaylightControllerResourceManagerImpl method createResponseFromVO.

@Override
public OpenDaylightControllerResponse createResponseFromVO(OpenDaylightControllerVO controller) {
    OpenDaylightControllerResponse response = new OpenDaylightControllerResponse();
    HostVO controllerHost = hostDao.findById(controller.getHostId());
    hostDao.loadDetails(controllerHost);
    PhysicalNetwork pnw = ApiDBUtils.findPhysicalNetworkById(controller.getPhysicalNetworkId());
    if (pnw != null) {
        response.setPhysicalNetworkId(pnw.getUuid());
    }
    response.setObjectName("opendaylightcontroller");
    response.setId(controller.getUuid());
    response.setUrl(controllerHost.getDetail("url"));
    response.setName(controllerHost.getDetail("name"));
    response.setUsername(controllerHost.getDetail("username"));
    return response;
}
Also used : PhysicalNetwork(com.cloud.network.PhysicalNetwork) OpenDaylightControllerResponse(org.apache.cloudstack.network.opendaylight.api.responses.OpenDaylightControllerResponse) HostVO(com.cloud.host.HostVO)

Aggregations

OpenDaylightControllerResponse (org.apache.cloudstack.network.opendaylight.api.responses.OpenDaylightControllerResponse)2 HostVO (com.cloud.host.HostVO)1 PhysicalNetwork (com.cloud.network.PhysicalNetwork)1 ArrayList (java.util.ArrayList)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1 OpenDaylightControllerVO (org.apache.cloudstack.network.opendaylight.dao.OpenDaylightControllerVO)1