Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 1 | package net.floodlightcontroller.flowcache; |
| 2 | |
| 3 | import java.util.ArrayList; |
| 4 | import java.util.Collection; |
| 5 | import java.util.HashMap; |
| 6 | import java.util.Map; |
| 7 | |
| 8 | import net.floodlightcontroller.core.module.FloodlightModuleContext; |
| 9 | import net.floodlightcontroller.core.module.FloodlightModuleException; |
| 10 | import net.floodlightcontroller.core.module.IFloodlightModule; |
| 11 | import net.floodlightcontroller.core.module.IFloodlightService; |
| 12 | import net.floodlightcontroller.flowcache.IFlowService; |
| 13 | import net.floodlightcontroller.flowcache.web.FlowWebRoutable; |
| 14 | import net.floodlightcontroller.restserver.IRestApiService; |
| 15 | import net.floodlightcontroller.util.CallerId; |
| 16 | import net.floodlightcontroller.util.DataPathEndpoints; |
| 17 | import net.floodlightcontroller.util.FlowId; |
| 18 | import net.floodlightcontroller.util.FlowPath; |
| 19 | |
| 20 | import org.slf4j.Logger; |
| 21 | import org.slf4j.LoggerFactory; |
| 22 | |
| 23 | public class FlowManager implements IFloodlightModule, IFlowService { |
| 24 | |
| 25 | protected IRestApiService restApi; |
| 26 | |
| 27 | /** The logger. */ |
| 28 | private static Logger logger = |
Pavlin Radoslavov | d7d8b79 | 2013-02-22 10:24:38 -0800 | [diff] [blame] | 29 | LoggerFactory.getLogger(FlowManager.class); |
Pavlin Radoslavov | 9e5344c | 2013-02-18 09:58:30 -0800 | [diff] [blame] | 30 | |
| 31 | @Override |
| 32 | public Collection<Class<? extends IFloodlightService>> getModuleServices() { |
| 33 | Collection<Class<? extends IFloodlightService>> l = |
| 34 | new ArrayList<Class<? extends IFloodlightService>>(); |
| 35 | l.add(IFlowService.class); |
| 36 | return l; |
| 37 | } |
| 38 | |
| 39 | @Override |
| 40 | public Map<Class<? extends IFloodlightService>, IFloodlightService> |
| 41 | getServiceImpls() { |
| 42 | Map<Class<? extends IFloodlightService>, |
| 43 | IFloodlightService> m = |
| 44 | new HashMap<Class<? extends IFloodlightService>, |
| 45 | IFloodlightService>(); |
| 46 | m.put(IFlowService.class, this); |
| 47 | return m; |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public Collection<Class<? extends IFloodlightService>> |
| 52 | getModuleDependencies() { |
| 53 | Collection<Class<? extends IFloodlightService>> l = |
| 54 | new ArrayList<Class<? extends IFloodlightService>>(); |
| 55 | l.add(IRestApiService.class); |
| 56 | return l; |
| 57 | } |
| 58 | |
| 59 | @Override |
| 60 | public void init(FloodlightModuleContext context) |
| 61 | throws FloodlightModuleException { |
| 62 | restApi = context.getServiceImpl(IRestApiService.class); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void startUp(FloodlightModuleContext context) { |
| 67 | restApi.addRestletRoutable(new FlowWebRoutable()); |
| 68 | } |
| 69 | |
| 70 | /** |
| 71 | * Add a flow. |
| 72 | * |
| 73 | * Internally, ONOS will automatically register the installer for |
| 74 | * receiving Flow Path Notifications for that path. |
| 75 | * |
| 76 | * @param flowPath the Flow Path to install. |
| 77 | * @param flowId the return-by-reference Flow ID as assigned internally. |
| 78 | * @return true on success, otherwise false. |
| 79 | */ |
| 80 | @Override |
| 81 | public boolean addFlow(FlowPath flowPath, FlowId flowId) { |
| 82 | // TODO |
| 83 | return true; |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * Delete a previously added flow. |
| 88 | * |
| 89 | * @param flowId the Flow ID of the flow to delete. |
| 90 | * @return true on success, otherwise false. |
| 91 | */ |
| 92 | @Override |
| 93 | public boolean deleteFlow(FlowId flowId) { |
| 94 | // TODO |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | /** |
| 99 | * Get a previously added flow. |
| 100 | * |
| 101 | * @param flowId the Flow ID of the flow to get. |
| 102 | * @param flowPath the return-by-reference flow path. |
| 103 | * @return true on success, otherwise false. |
| 104 | */ |
| 105 | @Override |
| 106 | public boolean getFlow(FlowId flowId, FlowPath flowPath) { |
| 107 | // TODO |
| 108 | return true; |
| 109 | } |
| 110 | |
| 111 | /** |
| 112 | * Get a previously added flow by a specific installer for given |
| 113 | * data path endpoints. |
| 114 | * |
| 115 | * @param installerId the Caller ID of the installer of the flow to get. |
| 116 | * @param dataPathEndpoints the data path endpoints of the flow to get. |
| 117 | * @param flowPath the return-by-reference flow path. |
| 118 | * @return true on success, otherwise false. |
| 119 | */ |
| 120 | @Override |
| 121 | public boolean getFlow(CallerId installerId, |
| 122 | DataPathEndpoints dataPathEndpoints, |
| 123 | FlowPath flowPath) { |
| 124 | // TODO |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | /** |
| 129 | * Get all installed flows by all installers for given data path endpoints. |
| 130 | * |
| 131 | * @param dataPathEndpoints the data path endpoints of the flows to get. |
| 132 | * @param flowPaths the return-by-reference list of flows. |
| 133 | */ |
| 134 | @Override |
| 135 | public void getAllFlows(DataPathEndpoints dataPathEndpoints, |
| 136 | ArrayList<FlowPath> flowPaths) { |
| 137 | // TODO |
| 138 | } |
| 139 | |
| 140 | /** |
| 141 | * Get all installed flows by all installers. |
| 142 | * |
| 143 | * @param flowPaths the return-by-reference list of flows. |
| 144 | */ |
| 145 | @Override |
| 146 | public void getAllFlows(ArrayList<FlowPath> flowPaths) { |
| 147 | // TODO |
| 148 | } |
| 149 | } |