blob: d9f19ba92216dafe4065f9863023ff6dbfaaba94 [file] [log] [blame]
Pavlin Radoslavov9e5344c2013-02-18 09:58:30 -08001package net.floodlightcontroller.flowcache;
2
3import java.util.ArrayList;
4import java.util.Collection;
5import java.util.HashMap;
6import java.util.Map;
7
8import net.floodlightcontroller.core.module.FloodlightModuleContext;
9import net.floodlightcontroller.core.module.FloodlightModuleException;
10import net.floodlightcontroller.core.module.IFloodlightModule;
11import net.floodlightcontroller.core.module.IFloodlightService;
12import net.floodlightcontroller.flowcache.IFlowService;
13import net.floodlightcontroller.flowcache.web.FlowWebRoutable;
14import net.floodlightcontroller.restserver.IRestApiService;
15import net.floodlightcontroller.util.CallerId;
16import net.floodlightcontroller.util.DataPathEndpoints;
17import net.floodlightcontroller.util.FlowId;
18import net.floodlightcontroller.util.FlowPath;
19
20import org.slf4j.Logger;
21import org.slf4j.LoggerFactory;
22
23public class FlowManager implements IFloodlightModule, IFlowService {
24
25 protected IRestApiService restApi;
26
27 /** The logger. */
28 private static Logger logger =
29 LoggerFactory.getLogger(FlowReconcileManager.class);
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}