blob: 74a44d4bd83392aafa1edcca4f2e4d1216e7bd61 [file] [log] [blame]
Umesh Krishnaswamye7a682b2013-03-21 14:16:28 -07001package net.floodlightcontroller.flowcache.web;
2
3import java.util.ArrayList;
4
5import net.floodlightcontroller.flowcache.IFlowService;
6import net.floodlightcontroller.util.FlowPath;
7import net.floodlightcontroller.util.FlowId;
8
9import org.restlet.resource.Get;
10import org.restlet.resource.ServerResource;
11import org.slf4j.Logger;
12import org.slf4j.LoggerFactory;
13
14public 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}