/** * Removes a particular switch * * @param switchUUID Identifier of the switch * @return none * <pre> * * Example: * * Request URL: * http://localhost:8080/controller/nb/v2/opendove/odmc/switches/uuid * * Response body in JSON: * none * </pre> */ @Path("{switchUUID}") @DELETE @Produces({MediaType.APPLICATION_JSON}) @TypeHint(OpenDoveSwitchRequest.class) @StatusCodes({ @ResponseCode(code = 200, condition = "Operation successful"), @ResponseCode(code = 204, condition = "No content"), @ResponseCode(code = 401, condition = "Unauthorized"), @ResponseCode(code = 404, condition = "Not Found"), @ResponseCode(code = 500, condition = "Internal Error") }) public Response deleteSwtich(@PathParam("switchUUID") String switchUUID) { IfOpenDoveSwitchCRUD sbInterface = OpenDoveCRUDInterfaces.getIfOpenDoveSwitchCRU(this); if (sbInterface == null) { throw new ServiceUnavailableException( "OpenDove SB Interface " + RestMessages.SERVICEUNAVAILABLE.toString()); } if (!sbInterface.switchExists(switchUUID)) { throw new ResourceNotFoundException("Switch doesn't exist"); } OpenDoveSwitch target = sbInterface.getSwitch(switchUUID); target.setTombstoneFlag(true); return Response.status(202).build(); }
public void updateSwitch(String switchUUID, OpenDoveSwitch delta) { OpenDoveSwitch target = (OpenDoveSwitch) switchMap.get(switchUUID); if (target.overwrite(delta)) { switchMap.update(switchUUID, target); } }