MACAddress is being compared with ==
- Same problem exist for Switch,Port
but leaving them alone for now, as it's type will probably be changed to long later.
Change-Id: Iab3591fb70d688aa37ab6889ec3e30b07afc11a2
diff --git a/src/main/java/net/onrc/onos/intent/Match.java b/src/main/java/net/onrc/onos/intent/Match.java
index 3f95ce4..308cfcf 100644
--- a/src/main/java/net/onrc/onos/intent/Match.java
+++ b/src/main/java/net/onrc/onos/intent/Match.java
@@ -6,7 +6,7 @@
import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
/**
- *
+ *
* @author Brian O'Connor <bocon@onlab.us>
*
*/
@@ -16,29 +16,29 @@
protected MACAddress srcMac;
protected MACAddress dstMac;
protected Port srcPort;
-
- public Match(Switch sw, Port srcPort,
+
+ public Match(Switch sw, Port srcPort,
MACAddress srcMac, MACAddress dstMac) {
this.sw = sw;
this.srcPort = srcPort;
this.srcMac = srcMac;
this.dstMac = dstMac;
}
-
+
@Override
public boolean equals(Object obj) {
if(obj instanceof Match) {
Match other = (Match) obj;
return this.sw == other.sw &&
- this.srcMac == other.srcMac &&
- this.dstMac == other.dstMac &&
+ this.srcMac.equals(other.srcMac) &&
+ this.dstMac.equals(other.dstMac) &&
this.srcPort == other.srcPort;
}
else {
return false;
}
}
-
+
public FlowEntryMatch getFlowEntryMatch(){
FlowEntryMatch match = new FlowEntryMatch();
match.enableSrcMac(srcMac);
@@ -46,7 +46,8 @@
match.enableInPort(new net.onrc.onos.ofcontroller.util.Port(srcPort.getNumber().shortValue()));
return match;
}
-
+
+ @Override
public String toString() {
return "(" + srcPort + "," + srcMac + "," + dstMac + ")";
}