Jonathan Hart | 23701d1 | 2014-04-03 10:45:48 -0700 | [diff] [blame] | 1 | package net.onrc.onos.core.util; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 2 | |
3 | import net.floodlightcontroller.util.MACAddress; | ||||
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 4 | |
5 | import org.codehaus.jackson.annotate.JsonProperty; | ||||
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 6 | |
7 | /** | ||||
8 | * The class representing the Flow Entry Matching filter. | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 9 | * <p/> |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 10 | * The Flow Entry matching filter that is used to specify |
11 | * the network data that would be forwarded on the data path from | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 12 | * the source to the destination. Examples: source or destination MAC address, |
13 | * IP prefix that includes the destination's IP address, etc. | ||||
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 14 | */ |
15 | public class FlowEntryMatch { | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 16 | /** |
17 | * A class for storing a value to match. | ||||
18 | */ | ||||
Pavlin Radoslavov | a2d35f1 | 2013-10-17 16:46:39 -0700 | [diff] [blame] | 19 | public static class Field<T> { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 20 | /** |
21 | * Default constructor. | ||||
22 | */ | ||||
23 | public Field() { | ||||
24 | this.enabled = false; | ||||
25 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 26 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 27 | /** |
28 | * Constructor for a given value to match. | ||||
29 | * | ||||
30 | * @param value the value to match. | ||||
31 | */ | ||||
32 | public Field(T value) { | ||||
33 | this.value = value; | ||||
34 | this.enabled = true; | ||||
35 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 36 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 37 | /** |
38 | * Get the value. | ||||
39 | * | ||||
40 | * @return the value. | ||||
41 | */ | ||||
42 | public T value() { | ||||
43 | return this.value; | ||||
44 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 45 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 46 | /** |
47 | * Enable the matching for a given value. | ||||
48 | * | ||||
49 | * @param value the value to set. | ||||
50 | */ | ||||
51 | public void enableMatch(T value) { | ||||
52 | this.value = value; | ||||
53 | this.enabled = true; | ||||
54 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 55 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 56 | /** |
57 | * Disable the matching. | ||||
58 | */ | ||||
59 | public void disableMatch() { | ||||
60 | this.enabled = false; | ||||
61 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 62 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 63 | /** |
64 | * Test whether matching is enabled. | ||||
65 | * | ||||
66 | * @return true if matching is enabled, otherwise false. | ||||
67 | */ | ||||
68 | public boolean enabled() { | ||||
69 | return this.enabled; | ||||
70 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 71 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 72 | private T value; // The value to match |
73 | private boolean enabled; // Set to true, if matching is enabled | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 74 | } |
75 | |||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 76 | private Field<Port> inPort; // Matching input switch port |
77 | private Field<MACAddress> srcMac; // Matching source MAC address | ||||
78 | private Field<MACAddress> dstMac; // Matching destination MAC address | ||||
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 79 | private Field<Short> ethernetFrameType; // Matching Ethernet frame type |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 80 | private Field<Short> vlanId; // Matching VLAN ID |
81 | private Field<Byte> vlanPriority; // Matching VLAN priority | ||||
82 | private Field<IPv4Net> srcIPv4Net; // Matching source IPv4 prefix | ||||
83 | private Field<IPv4Net> dstIPv4Net; // Matching destination IPv4 prefix | ||||
84 | private Field<Byte> ipProto; // Matching IP protocol | ||||
85 | private Field<Byte> ipToS; // Matching IP ToS (DSCP field, 6 bits) | ||||
86 | private Field<Short> srcTcpUdpPort; // Matching source TCP/UDP port | ||||
87 | private Field<Short> dstTcpUdpPort; // Matching destination TCP/UDP port | ||||
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 88 | |
89 | /** | ||||
90 | * Default constructor. | ||||
91 | */ | ||||
92 | public FlowEntryMatch() { | ||||
93 | } | ||||
94 | |||||
95 | /** | ||||
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 96 | * Copy constructor. |
97 | * | ||||
98 | * @param other the object to copy from. | ||||
99 | */ | ||||
100 | public FlowEntryMatch(FlowEntryMatch other) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 101 | if ((other.inPort != null) && other.inPort.enabled()) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 102 | this.enableInPort(other.inPort.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 103 | } |
104 | if ((other.srcMac != null) && other.srcMac.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 105 | this.enableSrcMac(other.srcMac.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 106 | } |
107 | if ((other.dstMac != null) && other.dstMac.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 108 | this.enableDstMac(other.dstMac.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 109 | } |
110 | if ((other.ethernetFrameType != null) && other.ethernetFrameType.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 111 | this.enableEthernetFrameType(other.ethernetFrameType.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 112 | } |
113 | if ((other.vlanId != null) && other.vlanId.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 114 | this.enableVlanId(other.vlanId.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 115 | } |
116 | if ((other.vlanPriority != null) && other.vlanPriority.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 117 | this.enableVlanPriority(other.vlanPriority.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 118 | } |
119 | if ((other.srcIPv4Net != null) && other.srcIPv4Net.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 120 | this.enableSrcIPv4Net(other.srcIPv4Net.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 121 | } |
122 | if ((other.dstIPv4Net != null) && other.dstIPv4Net.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 123 | this.enableDstIPv4Net(other.dstIPv4Net.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 124 | } |
125 | if ((other.ipProto != null) && other.ipProto.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 126 | this.enableIpProto(other.ipProto.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 127 | } |
128 | if ((other.ipToS != null) && other.ipToS.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 129 | this.enableIpToS(other.ipToS.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 130 | } |
131 | if ((other.srcTcpUdpPort != null) && other.srcTcpUdpPort.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 132 | this.enableSrcTcpUdpPort(other.srcTcpUdpPort.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 133 | } |
134 | if ((other.dstTcpUdpPort != null) && other.dstTcpUdpPort.enabled()) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 135 | this.enableDstTcpUdpPort(other.dstTcpUdpPort.value()); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 136 | } |
Pavlin Radoslavov | b9fe6b4 | 2013-03-27 16:25:05 -0700 | [diff] [blame] | 137 | } |
138 | |||||
139 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 140 | * Get the matching input switch port. |
141 | * | ||||
142 | * @return the matching input switch port. | ||||
143 | */ | ||||
144 | @JsonProperty("inPort") | ||||
145 | public Port inPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 146 | if (inPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 147 | return inPort.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 148 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 149 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 150 | } |
151 | |||||
152 | /** | ||||
153 | * Enable the matching on input switch port. | ||||
154 | * | ||||
155 | * @param inPort the input switch port value to enable for matching. | ||||
156 | */ | ||||
157 | @JsonProperty("inPort") | ||||
158 | public void enableInPort(Port inPort) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 159 | this.inPort = new Field<Port>(inPort); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 160 | } |
161 | |||||
162 | /** | ||||
163 | * Disable the matching on input switch port. | ||||
164 | */ | ||||
165 | public void disableInPort() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 166 | this.inPort = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 167 | } |
168 | |||||
169 | /** | ||||
170 | * Test if matching on input switch port is enabled. | ||||
171 | * | ||||
172 | * @return true if matching on input switch port is enabled. | ||||
173 | */ | ||||
174 | @JsonProperty("matchInPort") | ||||
175 | public boolean matchInPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 176 | if (inPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 177 | return inPort.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 178 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 179 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 180 | } |
181 | |||||
182 | /** | ||||
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 183 | * Get the matching source MAC address. |
184 | * | ||||
185 | * @return the matching source MAC address. | ||||
186 | */ | ||||
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 187 | @JsonProperty("srcMac") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 188 | public MACAddress srcMac() { |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 189 | if (srcMac != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 190 | return srcMac.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 191 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 192 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 193 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 194 | |
195 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 196 | * Enable the matching on source MAC address. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 197 | * |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 198 | * @param srcMac the source MAC address value to enable for matching. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 199 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 200 | @JsonProperty("srcMac") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 201 | public void enableSrcMac(MACAddress srcMac) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 202 | this.srcMac = new Field<MACAddress>(srcMac); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 203 | } |
204 | |||||
205 | /** | ||||
206 | * Disable the matching on source MAC address. | ||||
207 | */ | ||||
208 | public void disableSrcMac() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 209 | this.srcMac = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 210 | } |
211 | |||||
212 | /** | ||||
213 | * Test if matching on source MAC address is enabled. | ||||
214 | * | ||||
215 | * @return true if matching on source MAC address is enabled. | ||||
216 | */ | ||||
217 | @JsonProperty("matchSrcMac") | ||||
218 | public boolean matchSrcMac() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 219 | if (srcMac != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 220 | return srcMac.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 221 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 222 | return false; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 223 | } |
224 | |||||
225 | /** | ||||
226 | * Get the matching destination MAC address. | ||||
227 | * | ||||
228 | * @return the matching destination MAC address. | ||||
229 | */ | ||||
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 230 | @JsonProperty("dstMac") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 231 | public MACAddress dstMac() { |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 232 | if (dstMac != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 233 | return dstMac.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 234 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 235 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 236 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 237 | |
238 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 239 | * Enable the matching on destination MAC address. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 240 | * |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 241 | * @param dstMac the destination MAC address value to enable for matching. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 242 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 243 | @JsonProperty("dstMac") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 244 | public void enableDstMac(MACAddress dstMac) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 245 | this.dstMac = new Field<MACAddress>(dstMac); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 246 | } |
247 | |||||
248 | /** | ||||
249 | * Disable the matching on destination MAC address. | ||||
250 | */ | ||||
251 | public void disableDstMac() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 252 | this.dstMac = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 253 | } |
254 | |||||
255 | /** | ||||
256 | * Test if matching on destination MAC address is enabled. | ||||
257 | * | ||||
258 | * @return true if matching on destination MAC address is enabled. | ||||
259 | */ | ||||
260 | @JsonProperty("matchDstMac") | ||||
261 | public boolean matchDstMac() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 262 | if (dstMac != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 263 | return dstMac.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 264 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 265 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 266 | } |
267 | |||||
268 | /** | ||||
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 269 | * Get the matching Ethernet frame type. |
270 | * | ||||
271 | * @return the matching Ethernet frame type. | ||||
272 | */ | ||||
273 | @JsonProperty("ethernetFrameType") | ||||
274 | public Short ethernetFrameType() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 275 | if (ethernetFrameType != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 276 | return ethernetFrameType.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 277 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 278 | return null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 279 | } |
280 | |||||
281 | /** | ||||
282 | * Enable the matching on Ethernet frame type. | ||||
283 | * | ||||
284 | * @param ethernetFrameType the Ethernet frame type value to enable for | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 285 | * matching. |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 286 | */ |
287 | @JsonProperty("ethernetFrameType") | ||||
288 | public void enableEthernetFrameType(Short ethernetFrameType) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 289 | this.ethernetFrameType = new Field<Short>(ethernetFrameType); |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 290 | } |
291 | |||||
292 | /** | ||||
293 | * Disable the matching on Ethernet frame type. | ||||
294 | */ | ||||
295 | public void disableEthernetFrameType() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 296 | this.ethernetFrameType = null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 297 | } |
298 | |||||
299 | /** | ||||
300 | * Test if matching on Ethernet frame type is enabled. | ||||
301 | * | ||||
302 | * @return true if matching on Ethernet frame type is enabled. | ||||
303 | */ | ||||
304 | @JsonProperty("matchEthernetFrameType") | ||||
305 | public boolean matchEthernetFrameType() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 306 | if (ethernetFrameType != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 307 | return ethernetFrameType.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 308 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 309 | return false; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 310 | } |
311 | |||||
312 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 313 | * Get the matching VLAN ID. |
314 | * | ||||
315 | * @return the matching VLAN ID. | ||||
316 | */ | ||||
317 | @JsonProperty("vlanId") | ||||
318 | public Short vlanId() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 319 | if (vlanId != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 320 | return vlanId.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 321 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 322 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 323 | } |
324 | |||||
325 | /** | ||||
326 | * Enable the matching on VLAN ID. | ||||
327 | * | ||||
328 | * @param vlanId the VLAN ID value to enable for matching. | ||||
329 | */ | ||||
330 | @JsonProperty("vlanId") | ||||
331 | public void enableVlanId(Short vlanId) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 332 | this.vlanId = new Field<Short>(vlanId); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 333 | } |
334 | |||||
335 | /** | ||||
336 | * Disable the matching on VLAN ID. | ||||
337 | */ | ||||
338 | public void disableVlanId() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 339 | this.vlanId = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 340 | } |
341 | |||||
342 | /** | ||||
343 | * Test if matching on VLAN ID is enabled. | ||||
344 | * | ||||
345 | * @return true if matching on VLAN ID is enabled. | ||||
346 | */ | ||||
347 | @JsonProperty("matchVlanId") | ||||
348 | public boolean matchVlanId() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 349 | if (vlanId != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 350 | return vlanId.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 351 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 352 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 353 | } |
354 | |||||
355 | /** | ||||
356 | * Get the matching VLAN priority. | ||||
357 | * | ||||
358 | * @return the matching VLAN priority. | ||||
359 | */ | ||||
360 | @JsonProperty("vlanPriority") | ||||
361 | public Byte vlanPriority() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 362 | if (vlanPriority != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 363 | return vlanPriority.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 364 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 365 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 366 | } |
367 | |||||
368 | /** | ||||
369 | * Enable the matching on VLAN priority. | ||||
370 | * | ||||
371 | * @param vlanPriority the VLAN priority value to enable for matching. | ||||
372 | */ | ||||
373 | @JsonProperty("vlanPriority") | ||||
374 | public void enableVlanPriority(Byte vlanPriority) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 375 | this.vlanPriority = new Field<Byte>(vlanPriority); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 376 | } |
377 | |||||
378 | /** | ||||
379 | * Disable the matching on VLAN priority. | ||||
380 | */ | ||||
381 | public void disableVlanPriority() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 382 | this.vlanPriority = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 383 | } |
384 | |||||
385 | /** | ||||
386 | * Test if matching on VLAN priority is enabled. | ||||
387 | * | ||||
388 | * @return true if matching on VLAN priority is enabled. | ||||
389 | */ | ||||
390 | @JsonProperty("matchVlanPriority") | ||||
391 | public boolean matchVlanPriority() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 392 | if (vlanPriority != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 393 | return vlanPriority.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 394 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 395 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 396 | } |
397 | |||||
398 | /** | ||||
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 399 | * Get the matching source IPv4 prefix. |
400 | * | ||||
401 | * @return the matching source IPv4 prefix. | ||||
402 | */ | ||||
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 403 | @JsonProperty("srcIPv4Net") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 404 | public IPv4Net srcIPv4Net() { |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 405 | if (srcIPv4Net != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 406 | return srcIPv4Net.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 407 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 408 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 409 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 410 | |
411 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 412 | * Enable the matching on source IPv4 prefix. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 413 | * |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 414 | * @param srcIPv4Net the source IPv4 prefix value to enable for matching. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 415 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 416 | @JsonProperty("srcIPv4Net") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 417 | public void enableSrcIPv4Net(IPv4Net srcIPv4Net) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 418 | this.srcIPv4Net = new Field<IPv4Net>(srcIPv4Net); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 419 | } |
420 | |||||
421 | /** | ||||
422 | * Disable the matching on source IPv4 prefix. | ||||
423 | */ | ||||
424 | public void disableSrcIPv4Net() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 425 | this.srcIPv4Net = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 426 | } |
427 | |||||
428 | /** | ||||
429 | * Test if matching on source IPv4 prefix is enabled. | ||||
430 | * | ||||
431 | * @return true if matching on source IPv4 prefix is enabled. | ||||
432 | */ | ||||
433 | @JsonProperty("matchSrcIPv4Net") | ||||
434 | public boolean matchSrcIPv4Net() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 435 | if (srcIPv4Net != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 436 | return srcIPv4Net.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 437 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 438 | return false; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 439 | } |
440 | |||||
441 | /** | ||||
442 | * Get the matching destination IPv4 prefix. | ||||
443 | * | ||||
444 | * @return the matching destination IPv4 prefix. | ||||
445 | */ | ||||
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 446 | @JsonProperty("dstIPv4Net") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 447 | public IPv4Net dstIPv4Net() { |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 448 | if (dstIPv4Net != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 449 | return dstIPv4Net.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 450 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 451 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 452 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 453 | |
454 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 455 | * Enable the matching on destination IPv4 prefix. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 456 | * |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 457 | * @param dstIPv4Net the destination IPv4 prefix value to enable for |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 458 | * matching. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 459 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 460 | @JsonProperty("dstIPv4Net") |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 461 | public void enableDstIPv4Net(IPv4Net dstIPv4Net) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 462 | this.dstIPv4Net = new Field<IPv4Net>(dstIPv4Net); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 463 | } |
464 | |||||
465 | /** | ||||
466 | * Disable the matching on destination IPv4 prefix. | ||||
467 | */ | ||||
468 | public void disableDstIPv4Net() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 469 | this.dstIPv4Net = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 470 | } |
471 | |||||
472 | /** | ||||
473 | * Test if matching on destination IPv4 prefix is enabled. | ||||
474 | * | ||||
475 | * @return true if matching on destination IPv4 prefix is enabled. | ||||
476 | */ | ||||
477 | @JsonProperty("matchDstIPv4Net") | ||||
478 | public boolean matchDstIPv4Net() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 479 | if (dstIPv4Net != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 480 | return dstIPv4Net.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 481 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 482 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 483 | } |
484 | |||||
485 | /** | ||||
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 486 | * Get the matching IP protocol. |
487 | * | ||||
488 | * @return the matching IP protocol. | ||||
489 | */ | ||||
490 | @JsonProperty("ipProto") | ||||
491 | public Byte ipProto() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 492 | if (ipProto != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 493 | return ipProto.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 494 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 495 | return null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 496 | } |
497 | |||||
498 | /** | ||||
499 | * Enable the matching on IP protocol. | ||||
500 | * | ||||
501 | * @param ipProto the IP protocol value to enable for matching. | ||||
502 | */ | ||||
503 | @JsonProperty("ipProto") | ||||
504 | public void enableIpProto(Byte ipProto) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 505 | this.ipProto = new Field<Byte>(ipProto); |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 506 | } |
507 | |||||
508 | /** | ||||
509 | * Disable the matching on IP protocol. | ||||
510 | */ | ||||
511 | public void disableIpProto() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 512 | this.ipProto = null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 513 | } |
514 | |||||
515 | /** | ||||
516 | * Test if matching on IP protocol is enabled. | ||||
517 | * | ||||
518 | * @return true if matching on IP protocol is enabled. | ||||
519 | */ | ||||
520 | @JsonProperty("matchIpProto") | ||||
521 | public boolean matchIpProto() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 522 | if (ipProto != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 523 | return ipProto.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 524 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 525 | return false; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 526 | } |
527 | |||||
528 | /** | ||||
Ray Milkey | b41100a | 2014-04-10 10:42:15 -0700 | [diff] [blame] | 529 | * Get the matching IP ToS (DSCP field, 6 bits). |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 530 | * |
531 | * @return the matching IP ToS. | ||||
532 | */ | ||||
533 | @JsonProperty("ipToS") | ||||
534 | public Byte ipToS() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 535 | if (ipToS != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 536 | return ipToS.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 537 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 538 | return null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 539 | } |
540 | |||||
541 | /** | ||||
542 | * Enable the matching on IP ToS (DSCP field, 6 bits). | ||||
543 | * | ||||
544 | * @param ipToS the IP ToS value to enable for matching. | ||||
545 | */ | ||||
546 | @JsonProperty("ipToS") | ||||
547 | public void enableIpToS(Byte ipToS) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 548 | this.ipToS = new Field<Byte>(ipToS); |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 549 | } |
550 | |||||
551 | /** | ||||
552 | * Disable the matching on IP ToS (DSCP field, 6 bits). | ||||
553 | */ | ||||
554 | public void disableIpToS() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 555 | this.ipToS = null; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 556 | } |
557 | |||||
558 | /** | ||||
559 | * Test if matching on IP ToS (DSCP field, 6 bits) is enabled. | ||||
560 | * | ||||
561 | * @return true if matching on IP ToS is enabled. | ||||
562 | */ | ||||
563 | @JsonProperty("matchIpToS") | ||||
564 | public boolean matchIpToS() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 565 | if (ipToS != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 566 | return ipToS.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 567 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 568 | return false; |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 569 | } |
570 | |||||
571 | /** | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 572 | * Get the matching source TCP/UDP port. |
573 | * | ||||
574 | * @return the matching source TCP/UDP port. | ||||
575 | */ | ||||
576 | @JsonProperty("srcTcpUdpPort") | ||||
577 | public Short srcTcpUdpPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 578 | if (srcTcpUdpPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 579 | return srcTcpUdpPort.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 580 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 581 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 582 | } |
583 | |||||
584 | /** | ||||
585 | * Enable the matching on source TCP/UDP port. | ||||
586 | * | ||||
587 | * @param srcTcpUdpPort the source TCP/UDP port to enable for matching. | ||||
588 | */ | ||||
589 | @JsonProperty("srcTcpUdpPort") | ||||
590 | public void enableSrcTcpUdpPort(Short srcTcpUdpPort) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 591 | this.srcTcpUdpPort = new Field<Short>(srcTcpUdpPort); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 592 | } |
593 | |||||
594 | /** | ||||
595 | * Disable the matching on source TCP/UDP port. | ||||
596 | */ | ||||
597 | public void disableSrcTcpUdpPort() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 598 | this.srcTcpUdpPort = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 599 | } |
600 | |||||
601 | /** | ||||
602 | * Test if matching on source TCP/UDP port is enabled. | ||||
603 | * | ||||
604 | * @return true if matching on source TCP/UDP port is enabled. | ||||
605 | */ | ||||
606 | @JsonProperty("matchSrcTcpUdpPort") | ||||
607 | public boolean matchSrcTcpUdpPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 608 | if (srcTcpUdpPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 609 | return srcTcpUdpPort.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 610 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 611 | return false; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 612 | } |
613 | |||||
614 | /** | ||||
615 | * Get the matching destination TCP/UDP port. | ||||
616 | * | ||||
617 | * @return the matching destination TCP/UDP port. | ||||
618 | */ | ||||
619 | @JsonProperty("dstTcpUdpPort") | ||||
620 | public Short dstTcpUdpPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 621 | if (dstTcpUdpPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 622 | return dstTcpUdpPort.value(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 623 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 624 | return null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 625 | } |
626 | |||||
627 | /** | ||||
628 | * Enable the matching on destination TCP/UDP port. | ||||
629 | * | ||||
630 | * @param dstTcpUdpPort the destination TCP/UDP port to enable for | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 631 | * matching. |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 632 | */ |
633 | @JsonProperty("dstTcpUdpPort") | ||||
634 | public void enableDstTcpUdpPort(Short dstTcpUdpPort) { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 635 | this.dstTcpUdpPort = new Field<Short>(dstTcpUdpPort); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 636 | } |
637 | |||||
638 | /** | ||||
639 | * Disable the matching on destination TCP/UDP port. | ||||
640 | */ | ||||
641 | public void disableDstTcpUdpPort() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 642 | this.dstTcpUdpPort = null; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 643 | } |
644 | |||||
645 | /** | ||||
646 | * Test if matching on destination TCP/UDP port is enabled. | ||||
647 | * | ||||
648 | * @return true if matching on destination TCP/UDP port is enabled. | ||||
649 | */ | ||||
650 | @JsonProperty("matchDstTcpUdpPort") | ||||
651 | public boolean matchDstTcpUdpPort() { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 652 | if (dstTcpUdpPort != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 653 | return dstTcpUdpPort.enabled(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 654 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 655 | return false; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 656 | } |
657 | |||||
658 | /** | ||||
659 | * Convert the matching filter to a string. | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 660 | * <p/> |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 661 | * The string has the following form: |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 662 | * [srcMac=XXX dstMac=XXX srcIPv4Net=XXX dstIPv4Net=XXX] |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 663 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 664 | * @return the matching filter as a string. |
665 | */ | ||||
666 | @Override | ||||
667 | public String toString() { | ||||
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 668 | String ret = "["; |
669 | boolean addSpace = false; | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 670 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 671 | // |
672 | // Conditionally add only those matching fields that are enabled | ||||
673 | // | ||||
674 | if (matchInPort()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 675 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 676 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 677 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 678 | addSpace = true; |
679 | ret += "inPort=" + this.inPort().toString(); | ||||
680 | } | ||||
681 | if (matchSrcMac()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 682 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 683 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 684 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 685 | addSpace = true; |
686 | ret += "srcMac=" + this.srcMac().toString(); | ||||
687 | } | ||||
688 | if (matchDstMac()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 689 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 690 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 691 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 692 | addSpace = true; |
693 | ret += "dstMac=" + this.dstMac().toString(); | ||||
694 | } | ||||
695 | if (matchEthernetFrameType()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 696 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 697 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 698 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 699 | addSpace = true; |
700 | ret += "ethernetFrameType=" + this.ethernetFrameType().toString(); | ||||
701 | } | ||||
702 | if (matchVlanId()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 703 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 704 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 705 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 706 | addSpace = true; |
707 | ret += "vlanId=" + this.vlanId().toString(); | ||||
708 | } | ||||
709 | if (matchVlanPriority()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 710 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 711 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 712 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 713 | addSpace = true; |
714 | ret += "vlanPriority=" + this.vlanPriority().toString(); | ||||
715 | } | ||||
716 | if (matchSrcIPv4Net()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 717 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 718 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 719 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 720 | addSpace = true; |
721 | ret += "srcIPv4Net=" + this.srcIPv4Net().toString(); | ||||
722 | } | ||||
723 | if (matchDstIPv4Net()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 724 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 725 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 726 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 727 | addSpace = true; |
728 | ret += "dstIPv4Net=" + this.dstIPv4Net().toString(); | ||||
729 | } | ||||
730 | if (matchIpProto()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 731 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 732 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 733 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 734 | addSpace = true; |
735 | ret += "ipProto=" + this.ipProto().toString(); | ||||
736 | } | ||||
737 | if (matchIpToS()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 738 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 739 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 740 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 741 | addSpace = true; |
742 | ret += "ipToS=" + this.ipToS().toString(); | ||||
743 | } | ||||
744 | if (matchSrcTcpUdpPort()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 745 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 746 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 747 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 748 | addSpace = true; |
749 | ret += "srcTcpUdpPort=" + this.srcTcpUdpPort().toString(); | ||||
750 | } | ||||
751 | if (matchDstTcpUdpPort()) { | ||||
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 752 | if (addSpace) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 753 | ret += " "; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 754 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 755 | addSpace = true; |
756 | ret += "dstTcpUdpPort=" + this.dstTcpUdpPort().toString(); | ||||
757 | } | ||||
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 758 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 759 | ret += "]"; |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 760 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 761 | return ret; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 762 | } |
763 | } |