@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { resourceManager.addController(this); }
@Override public Answer executeRequest(Command cmd) { if (cmd instanceof ConfigureNetworkCommand) { return executeRequest((ConfigureNetworkCommand)cmd); } else if (cmd instanceof DestroyNetworkCommand) { return executeRequest((DestroyNetworkCommand)cmd); } else if (cmd instanceof ConfigurePortCommand) { return executeRequest((ConfigurePortCommand)cmd); } else if (cmd instanceof DestroyPortCommand) { return executeRequest((DestroyPortCommand)cmd); } else if (cmd instanceof AddHypervisorCommand) { return executeRequest((AddHypervisorCommand)cmd); } else if (cmd instanceof ReadyCommand) { return executeRequest((ReadyCommand)cmd); } else if (cmd instanceof MaintainCommand) { return executeRequest((MaintainCommand)cmd); } else { return Answer.createUnsupportedCommandAnswer(cmd); } }
@Override public StartupCommand[] initialize() { StartupOpenDaylightControllerCommand sc = new StartupOpenDaylightControllerCommand(); sc.setGuid((String)configuration.get("guid")); sc.setName(getName()); sc.setDataCenter((String)configuration.get("zoneId")); sc.setPod(""); sc.setPrivateIpAddress(""); sc.setStorageIpAddress(""); sc.setVersion(OpenDaylightControllerResource.class.getPackage().getImplementationVersion()); return new StartupCommand[] {sc}; }
@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); }
@Override public void setConfigParams(Map<String, Object> params) { for (Entry<String, Object> entry : params.entrySet()) { configuration.put(entry.getKey(), entry.getValue()); } updateConfiguration(); }
@Override public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException { try { resourceManager.deleteController(this); SuccessResponse response = new SuccessResponse(getCommandName()); response.setResponseName(getCommandName()); setResponseObject(response); //FIXME } catch (InvalidParameterValueException e) { throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to delete OpenDaylight controller."); } }
@Override public OpenDaylightControllerVO addController(AddOpenDaylightControllerCmd cmd) { ServerResource odlController = new OpenDaylightControllerResource();
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { for (Entry<String, Object> entry : params.entrySet()) { configuration.put(entry.getKey(), entry.getValue()); } updateConfiguration(); return true; }