Brian O'Connor | 7f8e301 | 2014-02-15 23:59:29 -0800 | [diff] [blame^] | 1 | package net.onrc.onos.intent; |
| 2 | |
| 3 | import net.floodlightcontroller.util.MACAddress; |
| 4 | import net.onrc.onos.ofcontroller.networkgraph.Port; |
| 5 | import net.onrc.onos.ofcontroller.networkgraph.Switch; |
| 6 | |
| 7 | /** |
| 8 | * |
| 9 | * @author Brian O'Connor <bocon@onlab.us> |
| 10 | * |
| 11 | */ |
| 12 | |
| 13 | public class Match { |
| 14 | protected Switch sw; |
| 15 | protected MACAddress srcMac; |
| 16 | protected MACAddress dstMac; |
| 17 | protected Port srcPort; |
| 18 | |
| 19 | public Match(Switch sw, Port srcPort, |
| 20 | MACAddress srcMac, MACAddress dstMac) { |
| 21 | this.sw = sw; |
| 22 | this.srcPort = srcPort; |
| 23 | this.srcMac = srcMac; |
| 24 | this.dstMac = dstMac; |
| 25 | } |
| 26 | |
| 27 | @Override |
| 28 | public boolean equals(Object obj) { |
| 29 | if(obj instanceof Match) { |
| 30 | Match other = (Match) obj; |
| 31 | return this.sw == other.sw && |
| 32 | this.srcMac == other.srcMac && |
| 33 | this.dstMac == other.dstMac && |
| 34 | this.srcPort == other.srcPort; |
| 35 | } |
| 36 | else { |
| 37 | return false; |
| 38 | } |
| 39 | } |
| 40 | |
| 41 | public String toString() { |
| 42 | return "(" + srcPort + "," + srcMac + "," + dstMac + ")"; |
| 43 | } |
| 44 | } |