blob: 5ffbefa3587dc5912560d00e87f0bfa1dc9a6531 [file] [log] [blame]
HIGUCHI Yutaefa54882013-06-12 13:13:02 -07001package net.onrc.onos.ofcontroller.flowcache.web;
Pavlin Radoslavov5ab68512013-02-18 09:59:33 -08002
3import java.util.ArrayList;
4
HIGUCHI Yutaedf81d72013-06-12 12:06:57 -07005import net.onrc.onos.ofcontroller.flowcache.IFlowService;
HIGUCHI Yuta356086e2013-06-12 15:21:19 -07006import net.onrc.onos.ofcontroller.util.FlowPath;
Pavlin Radoslavov5ab68512013-02-18 09:59:33 -08007
8import org.restlet.resource.Get;
9import org.restlet.resource.ServerResource;
10import org.slf4j.Logger;
11import org.slf4j.LoggerFactory;
12
13public class GetAllFlowsResource extends ServerResource {
14 protected static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class);
15
16 @Get("json")
17 public ArrayList<FlowPath> retrieve() {
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080018 ArrayList<FlowPath> result = null;
Pavlin Radoslavov5ab68512013-02-18 09:59:33 -080019
20 IFlowService flowService =
21 (IFlowService)getContext().getAttributes().
22 get(IFlowService.class.getCanonicalName());
23
24 if (flowService == null) {
25 log.debug("ONOS Flow Service not found");
26 return result;
27 }
28
29 // Extract the arguments
30 log.debug("Get All Flows Endpoints");
31
Pavlin Radoslavovb6f53542013-03-01 16:02:14 -080032 result = flowService.getAllFlows();
Pavlin Radoslavov5ab68512013-02-18 09:59:33 -080033
34 return result;
35 }
36}