blob: 6e30a88794094735d789fcb0c916c8f659ff43ad [file] [log] [blame]
Brian O'Connor8c166a72013-11-14 18:41:48 -08001package net.onrc.onos.ofcontroller.flowprogrammer;
Brian O'Connora8e49802013-10-30 20:49:59 -07002
3import java.io.IOException;
4import java.util.ArrayList;
Brian O'Connora8e49802013-10-30 20:49:59 -07005import java.util.HashMap;
6import java.util.HashSet;
7import java.util.List;
8import java.util.Map;
9import java.util.Set;
Naoki Shiota2bdda572013-12-09 15:05:21 -080010import java.util.concurrent.Callable;
Brian O'Connora8e49802013-10-30 20:49:59 -070011import java.util.concurrent.ExecutionException;
Brian O'Connora8e49802013-10-30 20:49:59 -070012import java.util.concurrent.Future;
Naoki Shiota2bdda572013-12-09 15:05:21 -080013import java.util.concurrent.FutureTask;
Brian O'Connora8e49802013-10-30 20:49:59 -070014
Brian O'Connor0d6ba512013-11-05 15:17:44 -080015import org.openflow.protocol.OFFlowMod;
Brian O'Connora8e49802013-10-30 20:49:59 -070016import org.openflow.protocol.OFMatch;
Brian O'Connor0d6ba512013-11-05 15:17:44 -080017import org.openflow.protocol.OFPort;
Brian O'Connora8e49802013-10-30 20:49:59 -070018import org.openflow.protocol.OFStatisticsRequest;
19import org.openflow.protocol.statistics.OFFlowStatisticsReply;
20import org.openflow.protocol.statistics.OFFlowStatisticsRequest;
21import org.openflow.protocol.statistics.OFStatistics;
22import org.openflow.protocol.statistics.OFStatisticsType;
23import org.slf4j.Logger;
24import org.slf4j.LoggerFactory;
25
Brian O'Connora8e49802013-10-30 20:49:59 -070026import net.floodlightcontroller.core.IOFSwitch;
yoshied0a6eb2013-12-05 16:54:27 -080027import net.onrc.onos.graph.DBOperation;
28import net.onrc.onos.graph.GraphDBManager;
Brian O'Connora8e49802013-10-30 20:49:59 -070029import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry;
30import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
Naoki Shiota8df97bc2014-03-13 18:42:23 -070031import net.onrc.onos.ofcontroller.flowprogrammer.IFlowPusherService.MsgPriority;
Brian O'Connora8e49802013-10-30 20:49:59 -070032import net.onrc.onos.ofcontroller.util.Dpid;
Pavlin Radoslavov6bfaea62013-12-03 14:55:57 -080033import net.onrc.onos.ofcontroller.util.FlowEntry;
Brian O'Connora8e49802013-10-30 20:49:59 -070034import net.onrc.onos.ofcontroller.util.FlowEntryId;
35
Naoki Shiotae3199732013-11-25 16:14:43 -080036/**
Naoki Shiotab485d412013-11-26 12:04:19 -080037 * FlowSynchronizer is an implementation of FlowSyncService.
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -080038 * In addition to IFlowSyncService, FlowSynchronizer periodically reads flow
39 * tables from switches and compare them with GraphDB to drop unnecessary
40 * flows and/or to install missing flows.
Naoki Shiotae3199732013-11-25 16:14:43 -080041 * @author Brian
42 *
43 */
Brian O'Connorea1efbe2013-11-25 22:57:43 -080044public class FlowSynchronizer implements IFlowSyncService {
Brian O'Connora8e49802013-10-30 20:49:59 -070045
Brian O'Connorea1efbe2013-11-25 22:57:43 -080046 private static Logger log = LoggerFactory.getLogger(FlowSynchronizer.class);
Brian O'Connore46492e2013-11-14 21:11:50 -080047
yoshied0a6eb2013-12-05 16:54:27 -080048 private DBOperation dbHandler;
Brian O'Connorea1efbe2013-11-25 22:57:43 -080049 protected IFlowPusherService pusher;
Naoki Shiota2bdda572013-12-09 15:05:21 -080050 private Map<IOFSwitch, FutureTask<SyncResult>> switchThreads;
Brian O'Connore46492e2013-11-14 21:11:50 -080051
52 public FlowSynchronizer() {
Yoshi Muroi5804ce92014-02-08 03:58:04 -080053 dbHandler = GraphDBManager.getDBOperation();
Naoki Shiota2bdda572013-12-09 15:05:21 -080054 switchThreads = new HashMap<IOFSwitch, FutureTask<SyncResult>>();
Brian O'Connore46492e2013-11-14 21:11:50 -080055 }
56
Brian O'Connorea1efbe2013-11-25 22:57:43 -080057 @Override
Naoki Shiota2bdda572013-12-09 15:05:21 -080058 public Future<SyncResult> synchronize(IOFSwitch sw) {
Pavlin Radoslavovf8c78552013-11-26 10:56:59 -080059 Synchronizer sync = new Synchronizer(sw);
Naoki Shiota2bdda572013-12-09 15:05:21 -080060 FutureTask<SyncResult> task = new FutureTask<SyncResult>(sync);
61 switchThreads.put(sw, task);
62 task.run();
63 return task;
Brian O'Connore46492e2013-11-14 21:11:50 -080064 }
Brian O'Connorea1efbe2013-11-25 22:57:43 -080065
Brian O'Connore46492e2013-11-14 21:11:50 -080066 @Override
Brian O'Connorea1efbe2013-11-25 22:57:43 -080067 public void interrupt(IOFSwitch sw) {
Naoki Shiota2bdda572013-12-09 15:05:21 -080068 FutureTask<SyncResult> t = switchThreads.remove(sw);
Brian O'Connore46492e2013-11-14 21:11:50 -080069 if(t != null) {
Naoki Shiota2bdda572013-12-09 15:05:21 -080070 t.cancel(true);
Brian O'Connorea1efbe2013-11-25 22:57:43 -080071 }
Brian O'Connore46492e2013-11-14 21:11:50 -080072 }
73
Naoki Shiotab485d412013-11-26 12:04:19 -080074 /**
75 * Initialize Synchronizer.
76 * @param pusherService FlowPusherService used for sending messages.
77 */
Brian O'Connorea1efbe2013-11-25 22:57:43 -080078 public void init(IFlowPusherService pusherService) {
79 pusher = pusherService;
Brian O'Connore46492e2013-11-14 21:11:50 -080080 }
81
Naoki Shiotae3199732013-11-25 16:14:43 -080082 /**
83 * Synchronizer represents main thread of synchronization.
84 * @author Brian
85 *
86 */
Naoki Shiota2bdda572013-12-09 15:05:21 -080087 protected class Synchronizer implements Callable<SyncResult> {
Brian O'Connora8e49802013-10-30 20:49:59 -070088 IOFSwitch sw;
89 ISwitchObject swObj;
Brian O'Connore46492e2013-11-14 21:11:50 -080090
Pavlin Radoslavovf8c78552013-11-26 10:56:59 -080091 public Synchronizer(IOFSwitch sw) {
Brian O'Connora8e49802013-10-30 20:49:59 -070092 this.sw = sw;
93 Dpid dpid = new Dpid(sw.getId());
94 this.swObj = dbHandler.searchSwitch(dpid.toString());
95 }
Brian O'Connore46492e2013-11-14 21:11:50 -080096
Brian O'Connor321a5d32013-12-09 18:11:35 -080097 double graphIDTime, switchTime, compareTime, graphEntryTime, extractTime, pushTime, totalTime;
Brian O'Connora8e49802013-10-30 20:49:59 -070098 @Override
Naoki Shiota2bdda572013-12-09 15:05:21 -080099 public SyncResult call() {
Naoki Shiota8df97bc2014-03-13 18:42:23 -0700100 pusher.suspend(sw);
Brian O'Connor321a5d32013-12-09 18:11:35 -0800101 long start = System.nanoTime();
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800102 Set<FlowEntryWrapper> graphEntries = getFlowEntriesFromGraph();
Brian O'Connor321a5d32013-12-09 18:11:35 -0800103 long step1 = System.nanoTime();
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800104 Set<FlowEntryWrapper> switchEntries = getFlowEntriesFromSwitch();
Naoki Shiotadf051d42014-01-20 16:12:41 -0800105 if (switchEntries == null) {
106 log.debug("getFlowEntriesFromSwitch() failed");
107 return null;
108 }
Brian O'Connor321a5d32013-12-09 18:11:35 -0800109 long step2 = System.nanoTime();
Naoki Shiota2bdda572013-12-09 15:05:21 -0800110 SyncResult result = compare(graphEntries, switchEntries);
Brian O'Connor321a5d32013-12-09 18:11:35 -0800111 long step3 = System.nanoTime();
112 graphIDTime = (step1 - start);
113 switchTime = (step2 - step1);
114 compareTime = (step3 - step2);
115 totalTime = (step3 - start);
116 outputTime();
Naoki Shiota8df97bc2014-03-13 18:42:23 -0700117 pusher.resume(sw);
Naoki Shiota2bdda572013-12-09 15:05:21 -0800118
119 return result;
Brian O'Connora8e49802013-10-30 20:49:59 -0700120 }
Brian O'Connor321a5d32013-12-09 18:11:35 -0800121
122 private void outputTime() {
123 double div = Math.pow(10, 6); //convert nanoseconds to ms
124 graphIDTime /= div;
125 switchTime /= div;
126 compareTime = (compareTime - graphEntryTime - extractTime - pushTime) / div;
127 graphEntryTime /= div;
128 extractTime /= div;
129 pushTime /= div;
Brian O'Connor8f7f8582013-12-11 15:48:07 -0800130 totalTime /= div;
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800131 log.debug("Sync time (ms):{},{},{},{},{},{},{}"
132 , graphIDTime
133 , switchTime
134 , compareTime
135 , graphEntryTime
136 , extractTime
137 , pushTime
138 , totalTime);
Brian O'Connora8e49802013-10-30 20:49:59 -0700139 }
Brian O'Connore46492e2013-11-14 21:11:50 -0800140
Naoki Shiotae3199732013-11-25 16:14:43 -0800141 /**
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800142 * Compare flows entries in GraphDB and switch to pick up necessary
143 * messages.
Naoki Shiotae3199732013-11-25 16:14:43 -0800144 * After picking up, picked messages are added to FlowPusher.
145 * @param graphEntries Flow entries in GraphDB.
146 * @param switchEntries Flow entries in switch.
147 */
Naoki Shiota2bdda572013-12-09 15:05:21 -0800148 private SyncResult compare(Set<FlowEntryWrapper> graphEntries, Set<FlowEntryWrapper> switchEntries) {
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800149 int added = 0, removed = 0, skipped = 0;
150 for(FlowEntryWrapper entry : switchEntries) {
Brian O'Connore46492e2013-11-14 21:11:50 -0800151 if(graphEntries.contains(entry)) {
152 graphEntries.remove(entry);
153 skipped++;
154 }
155 else {
156 // remove flow entry from the switch
157 entry.removeFromSwitch(sw);
158 removed++;
159 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700160 }
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800161 for(FlowEntryWrapper entry : graphEntries) {
Brian O'Connore46492e2013-11-14 21:11:50 -0800162 // add flow entry to switch
163 entry.addToSwitch(sw);
Brian O'Connor321a5d32013-12-09 18:11:35 -0800164 graphEntryTime += entry.dbTime;
165 extractTime += entry.extractTime;
166 pushTime += entry.pushTime;
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800167 added++;
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800168 }
169 log.debug("Flow entries added {}, " +
170 "Flow entries removed {}, " +
171 "Flow entries skipped {}"
172 , added
173 , removed
174 , skipped );
175
Naoki Shiota2bdda572013-12-09 15:05:21 -0800176 return new SyncResult(added, removed, skipped);
Brian O'Connora8e49802013-10-30 20:49:59 -0700177 }
Brian O'Connore46492e2013-11-14 21:11:50 -0800178
Naoki Shiotae3199732013-11-25 16:14:43 -0800179 /**
180 * Read GraphDB to get FlowEntries associated with a switch.
181 * @return set of FlowEntries
182 */
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800183 private Set<FlowEntryWrapper> getFlowEntriesFromGraph() {
184 Set<FlowEntryWrapper> entries = new HashSet<FlowEntryWrapper>();
Brian O'Connora8e49802013-10-30 20:49:59 -0700185 for(IFlowEntry entry : swObj.getFlowEntries()) {
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800186 FlowEntryWrapper fe = new FlowEntryWrapper(entry);
187 entries.add(fe);
Brian O'Connora8e49802013-10-30 20:49:59 -0700188 }
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800189 return entries;
Brian O'Connora8e49802013-10-30 20:49:59 -0700190 }
Brian O'Connore46492e2013-11-14 21:11:50 -0800191
Naoki Shiotae3199732013-11-25 16:14:43 -0800192 /**
193 * Read flow table from switch and derive FlowEntries from table.
194 * @return set of FlowEntries
195 */
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800196 private Set<FlowEntryWrapper> getFlowEntriesFromSwitch() {
Brian O'Connora8e49802013-10-30 20:49:59 -0700197
198 int lengthU = 0;
199 OFMatch match = new OFMatch();
200 match.setWildcards(OFMatch.OFPFW_ALL);
201
202 OFFlowStatisticsRequest stat = new OFFlowStatisticsRequest();
203 stat.setOutPort((short) 0xffff); //TODO: OFPort.OFPP_NONE
204 stat.setTableId((byte) 0xff); // TODO: fix this with enum (ALL TABLES)
205 stat.setMatch(match);
206 List<OFStatistics> stats = new ArrayList<OFStatistics>();
207 stats.add(stat);
208 lengthU += stat.getLength();
209
210 OFStatisticsRequest req = new OFStatisticsRequest();
211 req.setStatisticType(OFStatisticsType.FLOW);
212 req.setStatistics(stats);
213 lengthU += req.getLengthU();
214 req.setLengthU(lengthU);
215
216 List<OFStatistics> entries = null;
217 try {
218 Future<List<OFStatistics>> dfuture = sw.getStatistics(req);
219 entries = dfuture.get();
220 } catch (IOException e) {
221 // TODO Auto-generated catch block
222 e.printStackTrace();
Naoki Shiotadf051d42014-01-20 16:12:41 -0800223 return null;
Brian O'Connora8e49802013-10-30 20:49:59 -0700224 } catch (InterruptedException e) {
225 // TODO Auto-generated catch block
226 e.printStackTrace();
Naoki Shiotadf051d42014-01-20 16:12:41 -0800227 return null;
Brian O'Connora8e49802013-10-30 20:49:59 -0700228 } catch (ExecutionException e) {
229 // TODO Auto-generated catch block
230 e.printStackTrace();
Naoki Shiotadf051d42014-01-20 16:12:41 -0800231 return null;
Brian O'Connora8e49802013-10-30 20:49:59 -0700232 }
Brian O'Connore46492e2013-11-14 21:11:50 -0800233
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800234 Set<FlowEntryWrapper> results = new HashSet<FlowEntryWrapper>();
Brian O'Connora8e49802013-10-30 20:49:59 -0700235 for(OFStatistics result : entries){
Brian O'Connora8e49802013-10-30 20:49:59 -0700236 OFFlowStatisticsReply entry = (OFFlowStatisticsReply) result;
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800237 FlowEntryWrapper fe = new FlowEntryWrapper(entry);
238 results.add(fe);
Brian O'Connora8e49802013-10-30 20:49:59 -0700239 }
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800240 return results;
Brian O'Connora8e49802013-10-30 20:49:59 -0700241 }
Brian O'Connor8c166a72013-11-14 18:41:48 -0800242
Brian O'Connora8e49802013-10-30 20:49:59 -0700243 }
244
Naoki Shiotae3199732013-11-25 16:14:43 -0800245 /**
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800246 * FlowEntryWrapper represents abstract FlowEntry which is embodied
247 * by FlowEntryId (from GraphDB) or OFFlowStatisticsReply (from switch).
Naoki Shiotae3199732013-11-25 16:14:43 -0800248 * @author Brian
249 *
250 */
Brian O'Connore46492e2013-11-14 21:11:50 -0800251 class FlowEntryWrapper {
Naoki Shiotaf74d5f32014-01-09 21:29:38 -0800252 FlowEntryId flowEntryId;
253 IFlowEntry iFlowEntry;
254 OFFlowStatisticsReply statisticsReply;
255
Brian O'Connore46492e2013-11-14 21:11:50 -0800256
257 public FlowEntryWrapper(IFlowEntry entry) {
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800258 flowEntryId = new FlowEntryId(entry.getFlowEntryId());
Naoki Shiotaf74d5f32014-01-09 21:29:38 -0800259 iFlowEntry = entry;
260 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700261
Brian O'Connore46492e2013-11-14 21:11:50 -0800262 public FlowEntryWrapper(OFFlowStatisticsReply entry) {
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800263 flowEntryId = new FlowEntryId(entry.getCookie());
Brian O'Connore46492e2013-11-14 21:11:50 -0800264 statisticsReply = entry;
Brian O'Connore46492e2013-11-14 21:11:50 -0800265 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700266
Naoki Shiotae3199732013-11-25 16:14:43 -0800267 /**
268 * Install this FlowEntry to a switch via FlowPusher.
Naoki Shiotab485d412013-11-26 12:04:19 -0800269 * @param sw Switch to which flow will be installed.
Naoki Shiotae3199732013-11-25 16:14:43 -0800270 */
Brian O'Connor321a5d32013-12-09 18:11:35 -0800271 double dbTime, extractTime, pushTime;
Brian O'Connore46492e2013-11-14 21:11:50 -0800272 public void addToSwitch(IOFSwitch sw) {
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800273 if (statisticsReply != null) {
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800274 log.error("Error adding existing flow entry {} to sw {}",
Brian O'Connore46492e2013-11-14 21:11:50 -0800275 statisticsReply.getCookie(), sw.getId());
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800276 return;
Brian O'Connore46492e2013-11-14 21:11:50 -0800277 }
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800278
Brian O'Connor321a5d32013-12-09 18:11:35 -0800279 double startDB = System.nanoTime();
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800280 // Get the Flow Entry state from the Network Graph
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800281 if (iFlowEntry == null) {
Naoki Shiotaf74d5f32014-01-09 21:29:38 -0800282 try {
283 iFlowEntry = dbHandler.searchFlowEntry(flowEntryId);
284 } catch (Exception e) {
285 log.error("Error finding flow entry {} in Network Graph",
286 flowEntryId);
287 return;
288 }
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800289 }
Brian O'Connor321a5d32013-12-09 18:11:35 -0800290 dbTime = System.nanoTime() - startDB;
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800291
Pavlin Radoslavov39f0f2e2014-03-20 12:04:57 -0700292 //
293 // TODO: The old FlowDatabaseOperation class is gone, so the code
294 //
295 /*
Brian O'Connor321a5d32013-12-09 18:11:35 -0800296 double startExtract = System.nanoTime();
Pavlin Radoslavov6bfaea62013-12-03 14:55:57 -0800297 FlowEntry flowEntry =
298 FlowDatabaseOperation.extractFlowEntry(iFlowEntry);
299 if (flowEntry == null) {
300 log.error("Cannot add flow entry {} to sw {} : flow entry cannot be extracted",
301 flowEntryId, sw.getId());
302 return;
303 }
Brian O'Connor321a5d32013-12-09 18:11:35 -0800304 extractTime = System.nanoTime() - startExtract;
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800305
Brian O'Connor321a5d32013-12-09 18:11:35 -0800306 double startPush = System.nanoTime();
Naoki Shiota8df97bc2014-03-13 18:42:23 -0700307 pusher.pushFlowEntry(sw, flowEntry, MsgPriority.HIGH);
Brian O'Connor321a5d32013-12-09 18:11:35 -0800308 pushTime = System.nanoTime() - startPush;
Pavlin Radoslavov39f0f2e2014-03-20 12:04:57 -0700309 */
Brian O'Connore46492e2013-11-14 21:11:50 -0800310 }
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800311
Naoki Shiotae3199732013-11-25 16:14:43 -0800312 /**
313 * Remove this FlowEntry from a switch via FlowPusher.
Naoki Shiotab485d412013-11-26 12:04:19 -0800314 * @param sw Switch from which flow will be removed.
Naoki Shiotae3199732013-11-25 16:14:43 -0800315 */
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800316 public void removeFromSwitch(IOFSwitch sw) {
317 if (statisticsReply == null) {
Yuta HIGUCHI5302ddf2014-01-06 12:53:35 -0800318 log.error("Error removing non-existent flow entry {} from sw {}",
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800319 flowEntryId, sw.getId());
320 return;
321 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700322
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800323 // Convert Statistics Reply to Flow Mod, then write it
324 OFFlowMod fm = new OFFlowMod();
325 fm.setCookie(statisticsReply.getCookie());
326 fm.setCommand(OFFlowMod.OFPFC_DELETE_STRICT);
327 fm.setLengthU(OFFlowMod.MINIMUM_LENGTH);
328 fm.setMatch(statisticsReply.getMatch());
329 fm.setPriority(statisticsReply.getPriority());
330 fm.setOutPort(OFPort.OFPP_NONE);
331
Naoki Shiota8df97bc2014-03-13 18:42:23 -0700332 pusher.add(sw, fm, MsgPriority.HIGH);
Brian O'Connore46492e2013-11-14 21:11:50 -0800333 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700334
Brian O'Connore46492e2013-11-14 21:11:50 -0800335 /**
336 * Return the hash code of the Flow Entry ID
337 */
338 @Override
339 public int hashCode() {
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800340 return flowEntryId.hashCode();
Brian O'Connore46492e2013-11-14 21:11:50 -0800341 }
Brian O'Connora8e49802013-10-30 20:49:59 -0700342
Brian O'Connore46492e2013-11-14 21:11:50 -0800343 /**
344 * Returns true of the object is another Flow Entry ID with
345 * the same value; otherwise, returns false.
346 *
347 * @param Object to compare
Naoki Shiotab485d412013-11-26 12:04:19 -0800348 * @return true if the object has the same Flow Entry ID.
Brian O'Connore46492e2013-11-14 21:11:50 -0800349 */
350 @Override
351 public boolean equals(Object obj){
Naoki Shiotadf051d42014-01-20 16:12:41 -0800352 if(obj != null && obj.getClass() == this.getClass()) {
Brian O'Connore46492e2013-11-14 21:11:50 -0800353 FlowEntryWrapper entry = (FlowEntryWrapper) obj;
354 // TODO: we need to actually compare the match + actions
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800355 return this.flowEntryId.equals(entry.flowEntryId);
Brian O'Connore46492e2013-11-14 21:11:50 -0800356 }
357 return false;
358 }
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800359
Brian O'Connore46492e2013-11-14 21:11:50 -0800360 @Override
361 public String toString() {
Pavlin Radoslavov07fb9972013-12-02 16:20:24 -0800362 return flowEntryId.toString();
Brian O'Connore46492e2013-11-14 21:11:50 -0800363 }
364 }
Brian O'Connor0d6ba512013-11-05 15:17:44 -0800365}