blob: c81fe0097c248bf383405b4c8558a049ccca1ba8 [file] [log] [blame]
Brian O'Connor7f8e3012014-02-15 23:59:29 -08001package net.onrc.onos.intent;
2
3import net.floodlightcontroller.util.MACAddress;
4import net.onrc.onos.ofcontroller.networkgraph.Port;
5import net.onrc.onos.ofcontroller.networkgraph.Switch;
6
7/**
8 *
9 * @author Brian O'Connor <bocon@onlab.us>
10 *
11 */
12
13public 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}