Renamed the intent package
net.onrc.onos.intent.* => net.onrc.onos.core.intent.*
Change-Id: Id61f79ed52acf3b91af4ebad2515ac5b7d6dc5e1
diff --git a/src/main/java/net/onrc/onos/core/intent/Match.java b/src/main/java/net/onrc/onos/core/intent/Match.java
new file mode 100644
index 0000000..0d5d38a
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/intent/Match.java
@@ -0,0 +1,66 @@
+package net.onrc.onos.core.intent;
+
+import java.util.Arrays;
+
+import net.floodlightcontroller.util.MACAddress;
+//import net.onrc.onos.ofcontroller.networkgraph.Port;
+//import net.onrc.onos.ofcontroller.networkgraph.Switch;
+import net.onrc.onos.ofcontroller.util.FlowEntryMatch;
+
+/**
+ *
+ * @author Brian O'Connor <bocon@onlab.us>
+ *
+ */
+
+public class Match {
+ protected long sw;
+ protected MACAddress srcMac;
+ protected MACAddress dstMac;
+ protected long srcPort;
+
+ public Match(long sw, long 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.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);
+ match.enableDstMac(dstMac);
+ match.enableInPort(new net.onrc.onos.ofcontroller.util.Port((short) srcPort));
+ return match;
+ }
+
+ @Override
+ public String toString() {
+ return "Sw:" + sw + " (" + srcPort + "," + srcMac + "," + dstMac + ")";
+ }
+
+ @Override
+ public int hashCode() {
+ long[] nums = new long[4];
+ nums[0] = sw;
+ nums[1] = srcPort;
+ nums[2] = srcMac.toLong();
+ nums[3] = dstMac.toLong();
+ return Arrays.hashCode(nums);
+ }
+}