blob: 9bd3bea9ef7530a32d354616e25a1649dd282057 [file] [log] [blame]
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08001package net.floodlightcontroller.util;
2
3import net.floodlightcontroller.util.MACAddress;
4import net.floodlightcontroller.util.IPv4Net;
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08005
6import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08007
8/**
9 * The class representing the Flow Entry Matching filter.
10 *
11 * The Flow Entry matching filter that is used to specify
12 * the network data that would be forwarded on the data path from
13 * the source to the destination. Examples: MAC address (of the
14 * sender), IP prefix that includes the destination's IP address, etc.
15 *
16 * NOTE: The FlowEntryMatch specification below is incomplete: we need
17 * more matching fields, we need to indicate which fields need to be
18 * matched, etc.
19 */
20public class FlowEntryMatch {
21 private MACAddress srcMac; // Matching source MAC address
22 private MACAddress dstMac; // Matching destination MAC address
23 private IPv4Net srcIPv4Net; // Matching source IPv4 prefix
24 private IPv4Net dstIPv4Net; // Matching destination IPv4 prefix
25
26 /**
27 * Default constructor.
28 */
29 public FlowEntryMatch() {
30 }
31
32 /**
33 * Get the matching source MAC address.
34 *
35 * @return the matching source MAC address.
36 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080037 @JsonProperty("srcMac")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080038 public MACAddress srcMac() { return srcMac; }
39
40 /**
41 * Set the matching source MAC address.
42 *
43 * @param srcMac the matching source MAC address to set.
44 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080045 @JsonProperty("srcMac")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080046 public void setSrcMac(MACAddress srcMac) {
47 this.srcMac = srcMac;
48 }
49
50 /**
51 * Get the matching destination MAC address.
52 *
53 * @return the matching destination MAC address.
54 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080055 @JsonProperty("dstMac")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080056 public MACAddress dstMac() { return dstMac; }
57
58 /**
59 * Set the matching destination MAC address.
60 *
61 * @param dstMac the matching destination MAC address to set.
62 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080063 @JsonProperty("dstMac")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080064 public void setDstMac(MACAddress dstMac) {
65 this.dstMac = dstMac;
66 }
67
68 /**
69 * Get the matching source IPv4 prefix.
70 *
71 * @return the matching source IPv4 prefix.
72 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080073 @JsonProperty("srcIPv4Net")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080074 public IPv4Net srcIPv4Net() { return srcIPv4Net; }
75
76 /**
77 * Set the matching source IPv4 prefix.
78 *
79 * @param srcIPv4Net the matching source IPv4 prefix to set.
80 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080081 @JsonProperty("srcIPv4Net")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080082 public void setSrcIPv4Net(IPv4Net srcIPv4Net) {
83 this.srcIPv4Net = srcIPv4Net;
84 }
85
86 /**
87 * Get the matching destination IPv4 prefix.
88 *
89 * @return the matching destination IPv4 prefix.
90 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080091 @JsonProperty("dstIPv4Net")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080092 public IPv4Net dstIPv4Net() { return dstIPv4Net; }
93
94 /**
95 * Set the matching destination IPv4 prefix.
96 *
97 * @param srcIPv4Net the matching destination IPv4 prefix to set.
98 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -080099 @JsonProperty("dstIPv4Net")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800100 public void setDstIPv4Net(IPv4Net dstIPv4Net) {
101 this.dstIPv4Net = dstIPv4Net;
102 }
103
104 /**
105 * Convert the matching filter to a string.
106 *
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800107 * The string has the following form:
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -0800108 * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX]
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800109 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800110 * @return the matching filter as a string.
111 */
112 @Override
113 public String toString() {
Pavlin Radoslavova10a9a82013-02-22 11:47:54 -0800114 String ret = "[srcMac=" + this.srcMac.toString();
115 ret += " dstMac=" + this.dstMac.toString();
116 ret += " srcIPv4Net=" + this.srcIPv4Net.toString();
117 ret += " dstIPv4Net=" + this.dstIPv4Net.toString();
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800118 ret += "]";
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800119 return ret;
120 }
121}