blob: 02045905d2abef3756dda5bd436547808c1770e2 [file] [log] [blame]
Jonathan Hart23701d12014-04-03 10:45:48 -07001package net.onrc.onos.core.util;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08002
Pavlin Radoslavovede97582013-03-08 18:57:28 -08003
Pankaj Berded0ae0ff2013-03-26 15:37:12 -07004import org.codehaus.jackson.annotate.JsonIgnore;
Pavlin Radoslavovad008e02013-02-21 18:42:42 -08005import org.codehaus.jackson.annotate.JsonProperty;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08006
7/**
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -08008 * The class representing the Flow Entry.
Ray Milkey269ffb92014-04-03 14:43:30 -07009 * <p/>
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080010 * NOTE: The specification is incomplete. E.g., the entry needs to
11 * support multiple in-ports and multiple out-ports.
12 */
13public class FlowEntry {
Ray Milkey269ffb92014-04-03 14:43:30 -070014 private FlowId flowId; // FlowID of the Flow Entry
15 private FlowEntryId flowEntryId; // The Flow Entry ID
16 private int idleTimeout; // The Flow idle timeout
17 private int hardTimeout; // The Flow hard timeout
18 private int priority; // The Flow priority
19 private FlowEntryMatch flowEntryMatch; // The Flow Entry Match
20 private FlowEntryActions flowEntryActions; // The Flow Entry Actions
21 private Dpid dpid; // The Switch DPID
22 private Port inPort; // The Switch incoming port. Used only
23 // when the entry is used to return
24 // Shortest Path computation.
25 private Port outPort; // The Switch outgoing port. Used only
26 // when the entry is used to return
27 // Shortest Path computation.
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -080028 private FlowEntryUserState flowEntryUserState; // The Flow Entry User state
29 private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state
30 // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED)
31 private FlowEntryErrorState flowEntryErrorState;
32
33 /**
34 * Default constructor.
35 */
36 public FlowEntry() {
Ray Milkey269ffb92014-04-03 14:43:30 -070037 // TODO: Test code
38 /*
39 MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06");
40 IPv4 ipv4 = new IPv4("1.2.3.4");
41 IPv4Net ipv4net = new IPv4Net("5.6.7.0/24");
Pavlin Radoslavovede97582013-03-08 18:57:28 -080042
Ray Milkey269ffb92014-04-03 14:43:30 -070043 flowEntryMatch = new FlowEntryMatch();
44 flowEntryMatch.enableInPort(new Port((short)10));
45 flowEntryMatch.enableSrcMac(mac);
46 flowEntryMatch.enableDstMac(mac);
47 flowEntryMatch.enableVlanId((short)20);
48 flowEntryMatch.enableVlanPriority((byte)30);
49 flowEntryMatch.enableEthernetFrameType((short)40);
50 flowEntryMatch.enableIpToS((byte)50);
51 flowEntryMatch.enableIpProto((byte)60);
52 flowEntryMatch.enableSrcIPv4Net(ipv4net);
53 flowEntryMatch.enableDstIPv4Net(ipv4net);
54 flowEntryMatch.enableSrcTcpUdpPort((short)70);
55 flowEntryMatch.enableDstTcpUdpPort((short)80);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080056
Ray Milkey269ffb92014-04-03 14:43:30 -070057 FlowEntryAction action = null;
58 FlowEntryActions actions = new FlowEntryActions();
Pavlin Radoslavovede97582013-03-08 18:57:28 -080059
Ray Milkey269ffb92014-04-03 14:43:30 -070060 action = new FlowEntryAction();
61 action.setActionOutput(new Port((short)12));
62 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080063
Ray Milkey269ffb92014-04-03 14:43:30 -070064 action = new FlowEntryAction();
65 action.setActionOutputToController((short)13);
66 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080067
Ray Milkey269ffb92014-04-03 14:43:30 -070068 action = new FlowEntryAction();
69 action.setActionSetVlanId((short)14);
70 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080071
Ray Milkey269ffb92014-04-03 14:43:30 -070072 action = new FlowEntryAction();
73 action.setActionSetVlanPriority((byte)15);
74 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080075
Ray Milkey269ffb92014-04-03 14:43:30 -070076 action = new FlowEntryAction();
77 action.setActionStripVlan(true);
78 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080079
Ray Milkey269ffb92014-04-03 14:43:30 -070080 action = new FlowEntryAction();
81 action.setActionSetEthernetSrcAddr(mac);
82 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080083
Ray Milkey269ffb92014-04-03 14:43:30 -070084 action = new FlowEntryAction();
85 action.setActionSetEthernetDstAddr(mac);
86 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080087
Ray Milkey269ffb92014-04-03 14:43:30 -070088 action = new FlowEntryAction();
89 action.setActionSetIPv4SrcAddr(ipv4);
90 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080091
Ray Milkey269ffb92014-04-03 14:43:30 -070092 action = new FlowEntryAction();
93 action.setActionSetIPv4DstAddr(ipv4);
94 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080095
Ray Milkey269ffb92014-04-03 14:43:30 -070096 action = new FlowEntryAction();
97 action.setActionSetIpToS((byte)16);
98 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -080099
Ray Milkey269ffb92014-04-03 14:43:30 -0700100 action = new FlowEntryAction();
101 action.setActionSetTcpUdpSrcPort((short)17);
102 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800103
Ray Milkey269ffb92014-04-03 14:43:30 -0700104 action = new FlowEntryAction();
105 action.setActionSetTcpUdpDstPort((short)18);
106 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800107
Ray Milkey269ffb92014-04-03 14:43:30 -0700108 action = new FlowEntryAction();
109 action.setActionEnqueue(new Port((short)19), 20);
110 actions.addAction(action);
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800111
Ray Milkey269ffb92014-04-03 14:43:30 -0700112 setFlowEntryActions(actions);
113 */
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800114
Ray Milkey269ffb92014-04-03 14:43:30 -0700115 priority = FlowPath.PRIORITY_DEFAULT;
116 flowEntryActions = new FlowEntryActions();
117 flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN;
118 flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800119 }
120
121 /**
Pavlin Radoslavov5f85c7b2013-03-28 05:33:57 -0700122 * Get the Flow ID.
Pavlin Radoslavov062c72d2013-10-30 12:42:15 -0700123 *
Pavlin Radoslavov5f85c7b2013-03-28 05:33:57 -0700124 * @return the Flow ID.
125 */
126 @JsonIgnore
Ray Milkey269ffb92014-04-03 14:43:30 -0700127 public FlowId flowId() {
128 return flowId;
129 }
Pavlin Radoslavov5f85c7b2013-03-28 05:33:57 -0700130
131 /**
132 * Set the Flow ID.
133 *
134 * @param flowId the Flow ID to set.
135 */
136 public void setFlowId(FlowId flowId) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700137 this.flowId = flowId;
Pavlin Radoslavov5f85c7b2013-03-28 05:33:57 -0700138 }
139
140 /**
Pavlin Radoslavov062c72d2013-10-30 12:42:15 -0700141 * Test whether the Flow ID is valid.
142 *
143 * @return true if the Flow ID is valid, otherwise false.
144 */
Pavlin Radoslavovda26a9a2013-11-22 19:31:36 -0800145 @JsonIgnore
Pavlin Radoslavov062c72d2013-10-30 12:42:15 -0700146 public boolean isValidFlowId() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700147 if (this.flowId == null)
148 return false;
149 return (this.flowId.isValid());
Pavlin Radoslavov062c72d2013-10-30 12:42:15 -0700150 }
151
152 /**
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800153 * Get the Flow Entry ID.
154 *
155 * @return the Flow Entry ID.
156 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800157 @JsonProperty("flowEntryId")
Ray Milkey269ffb92014-04-03 14:43:30 -0700158 public FlowEntryId flowEntryId() {
159 return flowEntryId;
160 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800161
162 /**
163 * Set the Flow Entry ID.
164 *
165 * @param flowEntryId the Flow Entry ID to set.
166 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800167 @JsonProperty("flowEntryId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800168 public void setFlowEntryId(FlowEntryId flowEntryId) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700169 this.flowEntryId = flowEntryId;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800170 }
171
172 /**
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700173 * Test whether the Flow Entry ID is valid.
174 *
175 * @return true if the Flow Entry ID is valid, otherwise false.
176 */
Pavlin Radoslavovda26a9a2013-11-22 19:31:36 -0800177 @JsonIgnore
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700178 public boolean isValidFlowEntryId() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700179 if (this.flowEntryId == null)
180 return false;
181 return (this.flowEntryId.isValid());
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700182 }
183
184 /**
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800185 * Get the flow idle timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700186 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800187 * It should be an unsigned integer in the interval [0, 65535].
188 * If zero, the timeout is not set.
189 *
190 * @return the flow idle timeout.
191 */
192 @JsonProperty("idleTimeout")
Ray Milkey269ffb92014-04-03 14:43:30 -0700193 public int idleTimeout() {
194 return idleTimeout;
195 }
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800196
197 /**
198 * Set the flow idle timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700199 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800200 * It should be an unsigned integer in the interval [0, 65535].
201 * If zero, the timeout is not set.
202 *
203 * @param idleTimeout the flow idle timeout to set.
204 */
205 @JsonProperty("idleTimeout")
206 public void setIdleTimeout(int idleTimeout) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700207 this.idleTimeout = 0xffff & idleTimeout;
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800208 }
209
210 /**
211 * Get the flow hard timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700212 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800213 * It should be an unsigned integer in the interval [0, 65535].
214 * If zero, the timeout is not set.
215 *
216 * @return the flow hard timeout.
217 */
218 @JsonProperty("hardTimeout")
Ray Milkey269ffb92014-04-03 14:43:30 -0700219 public int hardTimeout() {
220 return hardTimeout;
221 }
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800222
223 /**
224 * Set the flow hard timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700225 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800226 * It should be an unsigned integer in the interval [0, 65535].
227 * If zero, the timeout is not set.
228 *
229 * @param hardTimeout the flow hard timeout to set.
230 */
231 @JsonProperty("hardTimeout")
232 public void setHardTimeout(int hardTimeout) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700233 this.hardTimeout = 0xffff & hardTimeout;
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800234 }
235
236 /**
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800237 * Get the flow priority.
Ray Milkey269ffb92014-04-03 14:43:30 -0700238 * <p/>
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800239 * It should be an unsigned integer in the interval [0, 65535].
240 *
241 * @return the flow priority.
242 */
243 @JsonProperty("priority")
Ray Milkey269ffb92014-04-03 14:43:30 -0700244 public int priority() {
245 return priority;
246 }
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800247
248 /**
249 * Set the flow priority.
Ray Milkey269ffb92014-04-03 14:43:30 -0700250 * <p/>
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800251 * It should be an unsigned integer in the interval [0, 65535].
252 *
253 * @param priority the flow priority to set.
254 */
255 @JsonProperty("priority")
256 public void setPriority(int priority) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700257 this.priority = 0xffff & priority;
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800258 }
259
260 /**
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800261 * Get the Flow Entry Match.
262 *
263 * @return the Flow Entry Match.
264 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800265 @JsonProperty("flowEntryMatch")
Ray Milkey269ffb92014-04-03 14:43:30 -0700266 public FlowEntryMatch flowEntryMatch() {
267 return flowEntryMatch;
268 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800269
270 /**
271 * Set the Flow Entry Match.
272 *
273 * @param flowEntryMatch the Flow Entry Match to set.
274 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800275 @JsonProperty("flowEntryMatch")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800276 public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700277 this.flowEntryMatch = flowEntryMatch;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800278 }
279
280 /**
281 * Get the Flow Entry Actions.
282 *
283 * @return the Flow Entry Actions.
284 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800285 @JsonProperty("flowEntryActions")
Pavlin Radoslavov1bc2c472013-07-17 18:11:37 -0700286 public FlowEntryActions flowEntryActions() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700287 return flowEntryActions;
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800288 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800289
290 /**
291 * Set the Flow Entry Actions.
292 *
293 * @param flowEntryActions the Flow Entry Actions to set.
294 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800295 @JsonProperty("flowEntryActions")
Pavlin Radoslavov1bc2c472013-07-17 18:11:37 -0700296 public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700297 this.flowEntryActions = flowEntryActions;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800298 }
299
300 /**
301 * Get the Switch DPID.
302 *
303 * @return the Switch DPID.
304 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800305 @JsonProperty("dpid")
Ray Milkey269ffb92014-04-03 14:43:30 -0700306 public Dpid dpid() {
307 return dpid;
308 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800309
310 /**
311 * Set the Switch DPID.
312 *
313 * @param dpid the Switch DPID to set.
314 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800315 @JsonProperty("dpid")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800316 public void setDpid(Dpid dpid) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700317 this.dpid = dpid;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800318 }
319
320 /**
321 * Get the Switch incoming port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700322 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700323 * Used only when the entry is used to return Shortest Path computation.
324 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800325 * @return the Switch incoming port.
326 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800327 @JsonProperty("inPort")
Ray Milkey269ffb92014-04-03 14:43:30 -0700328 public Port inPort() {
329 return inPort;
330 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800331
332 /**
333 * Set the Switch incoming port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700334 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700335 * Used only when the entry is used to return Shortest Path computation.
336 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800337 * @param inPort the Switch incoming port to set.
338 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800339 @JsonProperty("inPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800340 public void setInPort(Port inPort) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700341 this.inPort = inPort;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800342 }
343
344 /**
345 * Get the Switch outgoing port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700346 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700347 * Used only when the entry is used to return Shortest Path computation.
348 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800349 * @return the Switch outgoing port.
350 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800351 @JsonProperty("outPort")
Ray Milkey269ffb92014-04-03 14:43:30 -0700352 public Port outPort() {
353 return outPort;
354 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800355
356 /**
357 * Set the Switch outgoing port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700358 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700359 * Used only when the entry is used to return Shortest Path computation.
360 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800361 * @param outPort the Switch outgoing port to set.
362 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800363 @JsonProperty("outPort")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800364 public void setOutPort(Port outPort) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700365 this.outPort = outPort;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800366 }
367
368 /**
369 * Get the Flow Entry User state.
370 *
371 * @return the Flow Entry User state.
372 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800373 @JsonProperty("flowEntryUserState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800374 public FlowEntryUserState flowEntryUserState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700375 return flowEntryUserState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800376 }
377
378 /**
379 * Set the Flow Entry User state.
380 *
381 * @param flowEntryUserState the Flow Entry User state to set.
382 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800383 @JsonProperty("flowEntryUserState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800384 public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700385 this.flowEntryUserState = flowEntryUserState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800386 }
387
388 /**
389 * Get the Flow Entry Switch state.
Ray Milkey269ffb92014-04-03 14:43:30 -0700390 * <p/>
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800391 * The Flow Entry Error state is used if FlowEntrySwitchState is
392 * FE_SWITCH_FAILED.
393 *
394 * @return the Flow Entry Switch state.
395 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800396 @JsonProperty("flowEntrySwitchState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800397 public FlowEntrySwitchState flowEntrySwitchState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700398 return flowEntrySwitchState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800399 }
400
401 /**
402 * Set the Flow Entry Switch state.
Ray Milkey269ffb92014-04-03 14:43:30 -0700403 * <p/>
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800404 * The Flow Entry Error state is used if FlowEntrySwitchState is
405 * FE_SWITCH_FAILED.
406 *
407 * @param flowEntrySwitchState the Flow Entry Switch state to set.
408 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800409 @JsonProperty("flowEntrySwitchState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800410 public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700411 this.flowEntrySwitchState = flowEntrySwitchState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800412 }
413
414 /**
415 * Get the Flow Entry Error state.
416 *
417 * @return the Flow Entry Error state.
418 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800419 @JsonProperty("flowEntryErrorState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800420 public FlowEntryErrorState flowEntryErrorState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700421 return flowEntryErrorState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800422 }
423
424 /**
425 * Set the Flow Entry Error state.
426 *
427 * @param flowEntryErrorState the Flow Entry Error state to set.
428 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800429 @JsonProperty("flowEntryErrorState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800430 public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700431 this.flowEntryErrorState = flowEntryErrorState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800432 }
433
434 /**
435 * Convert the flow entry to a string.
Ray Milkey269ffb92014-04-03 14:43:30 -0700436 * <p/>
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800437 * The string has the following form:
Ray Milkey269ffb92014-04-03 14:43:30 -0700438 * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
439 * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
440 * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
441 * flowEntryErrorState=XXX]
442 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800443 * @return the flow entry as a string.
444 */
445 @Override
446 public String toString() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700447 StringBuilder ret = new StringBuilder();
448 if (flowEntryId != null) {
449 ret.append("[flowEntryId=" + this.flowEntryId.toString());
450 } else {
451 ret.append("[");
452 }
453 if (flowId != null) {
454 ret.append(" flowId=" + this.flowId.toString());
455 }
456 ret.append(" idleTimeout=" + this.idleTimeout);
457 ret.append(" hardTimeout=" + this.hardTimeout);
458 ret.append(" priority=" + this.priority);
459 if (flowEntryMatch != null) {
460 ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
461 }
462 ret.append(" flowEntryActions=" + this.flowEntryActions.toString());
463 if (dpid != null) {
464 ret.append(" dpid=" + this.dpid.toString());
465 }
466 if (inPort != null) {
467 ret.append(" inPort=" + this.inPort.toString());
468 }
469 if (outPort != null) {
470 ret.append(" outPort=" + this.outPort.toString());
471 }
472 ret.append(" flowEntryUserState=" + this.flowEntryUserState);
473 ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
474 if (flowEntryErrorState != null) {
475 ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
476 }
477 ret.append("]");
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800478
Ray Milkey269ffb92014-04-03 14:43:30 -0700479 return ret.toString();
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800480 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800481}