Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.flowcache.web; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | |
Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 5 | import net.floodlightcontroller.util.FlowPath; |
HIGUCHI Yuta | edf81d7 | 2013-06-12 12:06:57 -0700 | [diff] [blame^] | 6 | import net.onrc.onos.ofcontroller.flowcache.IFlowService; |
Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 7 | |
| 8 | import org.restlet.resource.Get; |
| 9 | import org.restlet.resource.ServerResource; |
| 10 | import org.slf4j.Logger; |
| 11 | import org.slf4j.LoggerFactory; |
| 12 | |
| 13 | public class GetAllFlowsResource extends ServerResource { |
| 14 | protected static Logger log = LoggerFactory.getLogger(GetAllFlowsResource.class); |
| 15 | |
| 16 | @Get("json") |
| 17 | public ArrayList<FlowPath> retrieve() { |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 18 | ArrayList<FlowPath> result = null; |
Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 19 | |
| 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 Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 32 | result = flowService.getAllFlows(); |
Pavlin Radoslavov | 5ab6851 | 2013-02-18 09:59:33 -0800 | [diff] [blame] | 33 | |
| 34 | return result; |
| 35 | } |
| 36 | } |