Fixing FlowMod comparison bug
Also, implemented barriers before sending installed notification to high-level runtime
Change-Id: I17de82d4d0d2d5656e003c784084da172339aaf1
diff --git a/src/main/java/net/onrc/onos/intent/FlowEntry.java b/src/main/java/net/onrc/onos/intent/FlowEntry.java
index 374e5d6..7aa3d76 100644
--- a/src/main/java/net/onrc/onos/intent/FlowEntry.java
+++ b/src/main/java/net/onrc/onos/intent/FlowEntry.java
@@ -51,7 +51,7 @@
public net.onrc.onos.ofcontroller.util.FlowEntry getFlowEntry() {
net.onrc.onos.ofcontroller.util.FlowEntry entry = new net.onrc.onos.ofcontroller.util.FlowEntry();
entry.setDpid(new Dpid(sw));
- entry.setFlowEntryId(new FlowEntryId(0)); // all zero for now
+ entry.setFlowEntryId(new FlowEntryId(hashCode())); // naive, but useful for now
entry.setFlowEntryMatch(match.getFlowEntryMatch());
FlowEntryActions flowEntryActions = new FlowEntryActions();
for(Action action : actions) {
@@ -71,6 +71,19 @@
return entry;
}
- //TODO: implement hash for cookie
- //TODO: implement equals (don't include operator!)
-}
\ No newline at end of file
+
+ public int hashCode() {
+ return match.hashCode();
+ }
+
+ public boolean equals(Object o) {
+ if(!(o instanceof FlowEntry)) {
+ return false;
+ }
+ FlowEntry other = (FlowEntry) o;
+ // Note: we should not consider the operator for this comparison
+ return this.match.equals(other.match)
+ && this.actions.containsAll(other.actions)
+ && other.actions.containsAll(this.actions);
+ }
+}