blob: 4d1eb4568e8b91aa9ebec538e1b353d88804dd56 [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
Yuta HIGUCHIfb564502014-06-16 21:29:00 -070022 private PortNumber inPort; // The Switch incoming port. Used only
Ray Milkey269ffb92014-04-03 14:43:30 -070023 // when the entry is used to return
24 // Shortest Path computation.
Yuta HIGUCHIfb564502014-06-16 21:29:00 -070025 private PortNumber outPort; // The Switch outgoing port. Used only
Ray Milkey269ffb92014-04-03 14:43:30 -070026 // 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 Milkeyb29e6262014-04-09 16:02:14 -0700147 if (this.flowId == null) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700148 return false;
Ray Milkeyb29e6262014-04-09 16:02:14 -0700149 }
Ray Milkey269ffb92014-04-03 14:43:30 -0700150 return (this.flowId.isValid());
Pavlin Radoslavov062c72d2013-10-30 12:42:15 -0700151 }
152
153 /**
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800154 * Get the Flow Entry ID.
155 *
156 * @return the Flow Entry ID.
157 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800158 @JsonProperty("flowEntryId")
Ray Milkey269ffb92014-04-03 14:43:30 -0700159 public FlowEntryId flowEntryId() {
160 return flowEntryId;
161 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800162
163 /**
164 * Set the Flow Entry ID.
165 *
166 * @param flowEntryId the Flow Entry ID to set.
167 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800168 @JsonProperty("flowEntryId")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800169 public void setFlowEntryId(FlowEntryId flowEntryId) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700170 this.flowEntryId = flowEntryId;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800171 }
172
173 /**
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700174 * Test whether the Flow Entry ID is valid.
175 *
176 * @return true if the Flow Entry ID is valid, otherwise false.
177 */
Pavlin Radoslavovda26a9a2013-11-22 19:31:36 -0800178 @JsonIgnore
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700179 public boolean isValidFlowEntryId() {
Ray Milkeyb29e6262014-04-09 16:02:14 -0700180 if (this.flowEntryId == null) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700181 return false;
Ray Milkeyb29e6262014-04-09 16:02:14 -0700182 }
Ray Milkey269ffb92014-04-03 14:43:30 -0700183 return (this.flowEntryId.isValid());
Pavlin Radoslavovb1309e82013-10-30 12:18:28 -0700184 }
185
186 /**
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800187 * Get the flow idle timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700188 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800189 * It should be an unsigned integer in the interval [0, 65535].
190 * If zero, the timeout is not set.
191 *
192 * @return the flow idle timeout.
193 */
194 @JsonProperty("idleTimeout")
Ray Milkey269ffb92014-04-03 14:43:30 -0700195 public int idleTimeout() {
196 return idleTimeout;
197 }
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800198
199 /**
200 * Set the flow idle timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700201 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800202 * It should be an unsigned integer in the interval [0, 65535].
203 * If zero, the timeout is not set.
204 *
205 * @param idleTimeout the flow idle timeout to set.
206 */
207 @JsonProperty("idleTimeout")
208 public void setIdleTimeout(int idleTimeout) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700209 this.idleTimeout = 0xffff & idleTimeout;
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800210 }
211
212 /**
213 * Get the flow hard timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700214 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800215 * It should be an unsigned integer in the interval [0, 65535].
216 * If zero, the timeout is not set.
217 *
218 * @return the flow hard timeout.
219 */
220 @JsonProperty("hardTimeout")
Ray Milkey269ffb92014-04-03 14:43:30 -0700221 public int hardTimeout() {
222 return hardTimeout;
223 }
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800224
225 /**
226 * Set the flow hard timeout in seconds.
Ray Milkey269ffb92014-04-03 14:43:30 -0700227 * <p/>
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800228 * It should be an unsigned integer in the interval [0, 65535].
229 * If zero, the timeout is not set.
230 *
231 * @param hardTimeout the flow hard timeout to set.
232 */
233 @JsonProperty("hardTimeout")
234 public void setHardTimeout(int hardTimeout) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700235 this.hardTimeout = 0xffff & hardTimeout;
Pavlin Radoslavov5139c0b2013-12-09 18:04:53 -0800236 }
237
238 /**
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800239 * Get the flow priority.
Ray Milkey269ffb92014-04-03 14:43:30 -0700240 * <p/>
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800241 * It should be an unsigned integer in the interval [0, 65535].
242 *
243 * @return the flow priority.
244 */
245 @JsonProperty("priority")
Ray Milkey269ffb92014-04-03 14:43:30 -0700246 public int priority() {
247 return priority;
248 }
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800249
250 /**
251 * Set the flow priority.
Ray Milkey269ffb92014-04-03 14:43:30 -0700252 * <p/>
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800253 * It should be an unsigned integer in the interval [0, 65535].
254 *
255 * @param priority the flow priority to set.
256 */
257 @JsonProperty("priority")
258 public void setPriority(int priority) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700259 this.priority = 0xffff & priority;
Pavlin Radoslavovafbf1032014-02-04 10:37:52 -0800260 }
261
262 /**
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800263 * Get the Flow Entry Match.
264 *
265 * @return the Flow Entry Match.
266 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800267 @JsonProperty("flowEntryMatch")
Ray Milkey269ffb92014-04-03 14:43:30 -0700268 public FlowEntryMatch flowEntryMatch() {
269 return flowEntryMatch;
270 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800271
272 /**
273 * Set the Flow Entry Match.
274 *
275 * @param flowEntryMatch the Flow Entry Match to set.
276 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800277 @JsonProperty("flowEntryMatch")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800278 public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700279 this.flowEntryMatch = flowEntryMatch;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800280 }
281
282 /**
283 * Get the Flow Entry Actions.
284 *
285 * @return the Flow Entry Actions.
286 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800287 @JsonProperty("flowEntryActions")
Pavlin Radoslavov1bc2c472013-07-17 18:11:37 -0700288 public FlowEntryActions flowEntryActions() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700289 return flowEntryActions;
Pavlin Radoslavovede97582013-03-08 18:57:28 -0800290 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800291
292 /**
293 * Set the Flow Entry Actions.
294 *
295 * @param flowEntryActions the Flow Entry Actions to set.
296 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800297 @JsonProperty("flowEntryActions")
Pavlin Radoslavov1bc2c472013-07-17 18:11:37 -0700298 public void setFlowEntryActions(FlowEntryActions flowEntryActions) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700299 this.flowEntryActions = flowEntryActions;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800300 }
301
302 /**
303 * Get the Switch DPID.
304 *
305 * @return the Switch DPID.
306 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800307 @JsonProperty("dpid")
Ray Milkey269ffb92014-04-03 14:43:30 -0700308 public Dpid dpid() {
309 return dpid;
310 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800311
312 /**
313 * Set the Switch DPID.
314 *
315 * @param dpid the Switch DPID to set.
316 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800317 @JsonProperty("dpid")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800318 public void setDpid(Dpid dpid) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700319 this.dpid = dpid;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800320 }
321
322 /**
323 * Get the Switch incoming port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700324 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700325 * Used only when the entry is used to return Shortest Path computation.
326 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800327 * @return the Switch incoming port.
328 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800329 @JsonProperty("inPort")
Yuta HIGUCHIfb564502014-06-16 21:29:00 -0700330 public PortNumber inPort() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700331 return inPort;
332 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800333
334 /**
335 * Set the Switch incoming port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700336 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700337 * Used only when the entry is used to return Shortest Path computation.
338 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800339 * @param inPort the Switch incoming port to set.
340 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800341 @JsonProperty("inPort")
Yuta HIGUCHIfb564502014-06-16 21:29:00 -0700342 public void setInPort(PortNumber inPort) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700343 this.inPort = inPort;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800344 }
345
346 /**
347 * Get the Switch outgoing port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700348 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700349 * Used only when the entry is used to return Shortest Path computation.
350 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800351 * @return the Switch outgoing port.
352 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800353 @JsonProperty("outPort")
Yuta HIGUCHIfb564502014-06-16 21:29:00 -0700354 public PortNumber outPort() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700355 return outPort;
356 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800357
358 /**
359 * Set the Switch outgoing port.
Ray Milkey269ffb92014-04-03 14:43:30 -0700360 * <p/>
Pavlin Radoslavov67b3ef32013-04-03 02:44:48 -0700361 * Used only when the entry is used to return Shortest Path computation.
362 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800363 * @param outPort the Switch outgoing port to set.
364 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800365 @JsonProperty("outPort")
Yuta HIGUCHIfb564502014-06-16 21:29:00 -0700366 public void setOutPort(PortNumber outPort) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700367 this.outPort = outPort;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800368 }
369
370 /**
371 * Get the Flow Entry User state.
372 *
373 * @return the Flow Entry User state.
374 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800375 @JsonProperty("flowEntryUserState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800376 public FlowEntryUserState flowEntryUserState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700377 return flowEntryUserState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800378 }
379
380 /**
381 * Set the Flow Entry User state.
382 *
383 * @param flowEntryUserState the Flow Entry User state to set.
384 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800385 @JsonProperty("flowEntryUserState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800386 public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700387 this.flowEntryUserState = flowEntryUserState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800388 }
389
390 /**
391 * Get the Flow Entry Switch state.
Ray Milkey269ffb92014-04-03 14:43:30 -0700392 * <p/>
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800393 * The Flow Entry Error state is used if FlowEntrySwitchState is
394 * FE_SWITCH_FAILED.
395 *
396 * @return the Flow Entry Switch state.
397 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800398 @JsonProperty("flowEntrySwitchState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800399 public FlowEntrySwitchState flowEntrySwitchState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700400 return flowEntrySwitchState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800401 }
402
403 /**
404 * Set the Flow Entry Switch state.
Ray Milkey269ffb92014-04-03 14:43:30 -0700405 * <p/>
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800406 * The Flow Entry Error state is used if FlowEntrySwitchState is
407 * FE_SWITCH_FAILED.
408 *
409 * @param flowEntrySwitchState the Flow Entry Switch state to set.
410 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800411 @JsonProperty("flowEntrySwitchState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800412 public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700413 this.flowEntrySwitchState = flowEntrySwitchState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800414 }
415
416 /**
417 * Get the Flow Entry Error state.
418 *
419 * @return the Flow Entry Error state.
420 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800421 @JsonProperty("flowEntryErrorState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800422 public FlowEntryErrorState flowEntryErrorState() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700423 return flowEntryErrorState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800424 }
425
426 /**
427 * Set the Flow Entry Error state.
428 *
429 * @param flowEntryErrorState the Flow Entry Error state to set.
430 */
Pavlin Radoslavov2013cbb2013-02-26 10:15:18 -0800431 @JsonProperty("flowEntryErrorState")
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800432 public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) {
Ray Milkey269ffb92014-04-03 14:43:30 -0700433 this.flowEntryErrorState = flowEntryErrorState;
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800434 }
435
436 /**
437 * Convert the flow entry to a string.
Ray Milkey269ffb92014-04-03 14:43:30 -0700438 * <p/>
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800439 * The string has the following form:
Ray Milkey269ffb92014-04-03 14:43:30 -0700440 * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX
441 * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX
442 * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX
443 * flowEntryErrorState=XXX]
444 *
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800445 * @return the flow entry as a string.
446 */
447 @Override
448 public String toString() {
Ray Milkey269ffb92014-04-03 14:43:30 -0700449 StringBuilder ret = new StringBuilder();
450 if (flowEntryId != null) {
451 ret.append("[flowEntryId=" + this.flowEntryId.toString());
452 } else {
453 ret.append("[");
454 }
455 if (flowId != null) {
456 ret.append(" flowId=" + this.flowId.toString());
457 }
458 ret.append(" idleTimeout=" + this.idleTimeout);
459 ret.append(" hardTimeout=" + this.hardTimeout);
460 ret.append(" priority=" + this.priority);
461 if (flowEntryMatch != null) {
462 ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString());
463 }
464 ret.append(" flowEntryActions=" + this.flowEntryActions.toString());
465 if (dpid != null) {
466 ret.append(" dpid=" + this.dpid.toString());
467 }
468 if (inPort != null) {
469 ret.append(" inPort=" + this.inPort.toString());
470 }
471 if (outPort != null) {
472 ret.append(" outPort=" + this.outPort.toString());
473 }
474 ret.append(" flowEntryUserState=" + this.flowEntryUserState);
475 ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState);
476 if (flowEntryErrorState != null) {
477 ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString());
478 }
479 ret.append("]");
Pavlin Radoslavovad008e02013-02-21 18:42:42 -0800480
Ray Milkey269ffb92014-04-03 14:43:30 -0700481 return ret.toString();
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800482 }
Pavlin Radoslavov5363c2a2013-02-18 09:55:42 -0800483}