Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame^] | 1 | package net.floodlightcontroller.flowcache.web; |
| 2 | |
| 3 | import net.floodlightcontroller.flowcache.IFlowService; |
| 4 | |
| 5 | import org.openflow.util.HexString; |
| 6 | import org.restlet.resource.Get; |
| 7 | import org.restlet.resource.ServerResource; |
| 8 | import org.slf4j.Logger; |
| 9 | import org.slf4j.LoggerFactory; |
| 10 | |
| 11 | public class DeleteFlowResource extends ServerResource { |
| 12 | protected static Logger log = LoggerFactory.getLogger(DeleteFlowResource.class); |
| 13 | |
| 14 | @Get("json") |
| 15 | public Boolean retrieve() { |
| 16 | Boolean result = false; |
| 17 | |
| 18 | IFlowService flowService = |
| 19 | (IFlowService)getContext().getAttributes(). |
| 20 | get(IFlowService.class.getCanonicalName()); |
| 21 | |
| 22 | if (flowService == null) { |
| 23 | log.debug("ONOS Flow Service not found"); |
| 24 | return result; |
| 25 | } |
| 26 | |
| 27 | // Extract the arguments |
| 28 | String flowIdStr = (String) getRequestAttributes().get("flow-id"); |
| 29 | long flowId = HexString.toLong(flowIdStr); |
| 30 | log.debug("Delete Flow Id: " + flowIdStr); |
| 31 | |
| 32 | // TODO: Implement it. |
| 33 | result = true; |
| 34 | |
| 35 | return result; |
| 36 | } |
| 37 | } |