Package com.cloud.server.api.response

Examples of com.cloud.server.api.response.NetworkDeviceResponse


        }
    }

    @Override
    public NetworkDeviceResponse getApiResponse(Host device) {
        NetworkDeviceResponse response;
        HostVO host = (HostVO)device;
        _hostDao.loadDetails(host);
        if (host.getType() == Host.Type.ExternalDhcp) {
            NwDeviceDhcpResponse r = new NwDeviceDhcpResponse();
            r.setZoneId(host.getDataCenterId());
            r.setPodId(host.getPodId());
            r.setUrl(host.getPrivateIpAddress());
            r.setType(host.getDetail("type"));
            response = r;
        } else if (host.getType() == Host.Type.PxeServer) {
            String pxeType = host.getDetail("type");
            if (pxeType.equalsIgnoreCase(PxeServerType.PING.getName())) {
                PxePingResponse r = new PxePingResponse();
                r.setZoneId(host.getDataCenterId());
                r.setPodId(host.getPodId());
                r.setUrl(host.getPrivateIpAddress());
                r.setType(pxeType);
                r.setStorageServerIp(host.getDetail("storageServer"));
                r.setPingDir(host.getDetail("pingDir"));
                r.setTftpDir(host.getDetail("tftpDir"));
                response = r;
            } else {
                throw new CloudRuntimeException("Unsupported PXE server type:" + pxeType);
            }
        } else {
            throw new CloudRuntimeException("Unsupported network device type:" + host.getType());
        }
       
        response.setId(device.getId());
        return response;
    }
View Full Code Here


    try {
      ExternalNetworkDeviceManager nwDeviceMgr;
      ComponentLocator locator = ComponentLocator.getLocator(ManagementService.Name);
      nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
      Host device = nwDeviceMgr.addNetworkDevice(this);
      NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(device);
      response.setObjectName("networkdevice");
      response.setResponseName(getCommandName());
      this.setResponseObject(response);
    } catch (InvalidParameterValueException ipve) {
      throw new ServerApiException(BaseCmd.PARAM_ERROR, ipve.getMessage());
    } catch (CloudRuntimeException cre) {
      throw new ServerApiException(BaseCmd.INTERNAL_ERROR, cre.getMessage());
View Full Code Here

      nwDeviceMgr = locator.getManager(ExternalNetworkDeviceManager.class);
      List<Host> devices = nwDeviceMgr.listNetworkDevice(this);
      List<NetworkDeviceResponse> nwdeviceResponses = new ArrayList<NetworkDeviceResponse>();
      ListResponse<NetworkDeviceResponse> listResponse = new ListResponse<NetworkDeviceResponse>();
      for (Host d : devices) {
        NetworkDeviceResponse response = nwDeviceMgr.getApiResponse(d);
        response.setObjectName("networkdevice");
        response.setResponseName(getCommandName());
        nwdeviceResponses.add(response);
      }
     
          listResponse.setResponses(nwdeviceResponses);
          listResponse.setResponseName(getCommandName());
View Full Code Here

TOP

Related Classes of com.cloud.server.api.response.NetworkDeviceResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.