Umesh Krishnaswamy | e7a682b | 2013-03-21 14:16:28 -0700 | [diff] [blame^] | 1 | package net.floodlightcontroller.flowcache.web; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | |
| 5 | import net.floodlightcontroller.flowcache.IFlowService; |
| 6 | import net.floodlightcontroller.util.FlowPath; |
| 7 | import net.floodlightcontroller.util.FlowId; |
| 8 | |
| 9 | import org.restlet.resource.Get; |
| 10 | import org.restlet.resource.ServerResource; |
| 11 | import org.slf4j.Logger; |
| 12 | import org.slf4j.LoggerFactory; |
| 13 | |
| 14 | public class GetSummaryFlowsResource extends ServerResource { |
| 15 | protected static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class); |
| 16 | |
| 17 | @Get("json") |
| 18 | public ArrayList<FlowPath> retrieve() { |
| 19 | ArrayList<FlowPath> result = null; |
| 20 | |
| 21 | IFlowService flowService = (IFlowService)getContext().getAttributes().get(IFlowService.class.getCanonicalName()); |
| 22 | |
| 23 | if (flowService == null) { |
| 24 | log.debug("ONOS Flow Service not found"); |
| 25 | return result; |
| 26 | } |
| 27 | |
| 28 | // Extract the arguments |
| 29 | log.debug("Get All Flows Endpoints"); |
| 30 | |
| 31 | FlowId flowId = new FlowId(0); |
| 32 | |
| 33 | result = flowService.getAllFlowsSummary(flowId, 0); |
| 34 | |
| 35 | return result; |
| 36 | } |
| 37 | } |