HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 1 | package net.onrc.onos.ofcontroller.util; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 2 | |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 3 | |
Pankaj Berde | d0ae0ff | 2013-03-26 15:37:12 -0700 | [diff] [blame] | 4 | import org.codehaus.jackson.annotate.JsonIgnore; |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 5 | import org.codehaus.jackson.annotate.JsonProperty; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 6 | |
| 7 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 8 | * The class representing the Flow Entry. |
| 9 | * |
| 10 | * NOTE: The specification is incomplete. E.g., the entry needs to |
| 11 | * support multiple in-ports and multiple out-ports. |
| 12 | */ |
| 13 | public class FlowEntry { |
Pavlin Radoslavov | d5b21db | 2013-07-29 17:09:53 -0700 | [diff] [blame] | 14 | private FlowId flowId; // FlowID of the Flow Entry |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 15 | private FlowEntryId flowEntryId; // The Flow Entry ID |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 16 | private int idleTimeout; // The Flow idle timeout |
| 17 | private int hardTimeout; // The Flow hard timeout |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 18 | private FlowEntryMatch flowEntryMatch; // The Flow Entry Match |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 19 | private FlowEntryActions flowEntryActions; // The Flow Entry Actions |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 20 | private Dpid dpid; // The Switch DPID |
Pavlin Radoslavov | fbcb97c | 2013-03-21 11:29:58 -0700 | [diff] [blame] | 21 | private Port inPort; // The Switch incoming port. Used only |
| 22 | // when the entry is used to return |
| 23 | // Shortest Path computation. |
| 24 | private Port outPort; // The Switch outgoing port. Used only |
| 25 | // when the entry is used to return |
| 26 | // Shortest Path computation. |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 27 | private FlowEntryUserState flowEntryUserState; // The Flow Entry User state |
| 28 | private FlowEntrySwitchState flowEntrySwitchState; // The Flow Entry Switch state |
| 29 | // The Flow Entry Error state (if FlowEntrySwitchState is FE_SWITCH_FAILED) |
| 30 | private FlowEntryErrorState flowEntryErrorState; |
| 31 | |
| 32 | /** |
| 33 | * Default constructor. |
| 34 | */ |
| 35 | public FlowEntry() { |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 36 | // TODO: Test code |
| 37 | /* |
| 38 | MACAddress mac = MACAddress.valueOf("01:02:03:04:05:06"); |
| 39 | IPv4 ipv4 = new IPv4("1.2.3.4"); |
| 40 | IPv4Net ipv4net = new IPv4Net("5.6.7.0/24"); |
| 41 | |
| 42 | flowEntryMatch = new FlowEntryMatch(); |
| 43 | flowEntryMatch.enableInPort(new Port((short)10)); |
| 44 | flowEntryMatch.enableSrcMac(mac); |
| 45 | flowEntryMatch.enableDstMac(mac); |
| 46 | flowEntryMatch.enableVlanId((short)20); |
| 47 | flowEntryMatch.enableVlanPriority((byte)30); |
| 48 | flowEntryMatch.enableEthernetFrameType((short)40); |
| 49 | flowEntryMatch.enableIpToS((byte)50); |
| 50 | flowEntryMatch.enableIpProto((byte)60); |
| 51 | flowEntryMatch.enableSrcIPv4Net(ipv4net); |
| 52 | flowEntryMatch.enableDstIPv4Net(ipv4net); |
| 53 | flowEntryMatch.enableSrcTcpUdpPort((short)70); |
| 54 | flowEntryMatch.enableDstTcpUdpPort((short)80); |
| 55 | |
| 56 | FlowEntryAction action = null; |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 57 | FlowEntryActions actions = new FlowEntryActions(); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 58 | |
| 59 | action = new FlowEntryAction(); |
| 60 | action.setActionOutput(new Port((short)12)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 61 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 62 | |
| 63 | action = new FlowEntryAction(); |
| 64 | action.setActionOutputToController((short)13); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 65 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 66 | |
| 67 | action = new FlowEntryAction(); |
| 68 | action.setActionSetVlanId((short)14); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 69 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 70 | |
| 71 | action = new FlowEntryAction(); |
| 72 | action.setActionSetVlanPriority((byte)15); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 73 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 74 | |
| 75 | action = new FlowEntryAction(); |
| 76 | action.setActionStripVlan(true); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 77 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 78 | |
| 79 | action = new FlowEntryAction(); |
| 80 | action.setActionSetEthernetSrcAddr(mac); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 81 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 82 | |
| 83 | action = new FlowEntryAction(); |
| 84 | action.setActionSetEthernetDstAddr(mac); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 85 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 86 | |
| 87 | action = new FlowEntryAction(); |
| 88 | action.setActionSetIPv4SrcAddr(ipv4); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 89 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 90 | |
| 91 | action = new FlowEntryAction(); |
| 92 | action.setActionSetIPv4DstAddr(ipv4); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 93 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 94 | |
| 95 | action = new FlowEntryAction(); |
| 96 | action.setActionSetIpToS((byte)16); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 97 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 98 | |
| 99 | action = new FlowEntryAction(); |
| 100 | action.setActionSetTcpUdpSrcPort((short)17); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 101 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 102 | |
| 103 | action = new FlowEntryAction(); |
| 104 | action.setActionSetTcpUdpDstPort((short)18); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 105 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 106 | |
| 107 | action = new FlowEntryAction(); |
| 108 | action.setActionEnqueue(new Port((short)19), 20); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 109 | actions.addAction(action); |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 110 | |
| 111 | setFlowEntryActions(actions); |
| 112 | */ |
| 113 | |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 114 | flowEntryActions = new FlowEntryActions(); |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 115 | flowEntryUserState = FlowEntryUserState.FE_USER_UNKNOWN; |
| 116 | flowEntrySwitchState = FlowEntrySwitchState.FE_SWITCH_UNKNOWN; |
| 117 | } |
| 118 | |
| 119 | /** |
Pavlin Radoslavov | 5f85c7b | 2013-03-28 05:33:57 -0700 | [diff] [blame] | 120 | * Get the Flow ID. |
Pavlin Radoslavov | 062c72d | 2013-10-30 12:42:15 -0700 | [diff] [blame] | 121 | * |
Pavlin Radoslavov | 5f85c7b | 2013-03-28 05:33:57 -0700 | [diff] [blame] | 122 | * @return the Flow ID. |
| 123 | */ |
| 124 | @JsonIgnore |
Pavlin Radoslavov | b1309e8 | 2013-10-30 12:18:28 -0700 | [diff] [blame] | 125 | public FlowId flowId() { return flowId; } |
Pavlin Radoslavov | 5f85c7b | 2013-03-28 05:33:57 -0700 | [diff] [blame] | 126 | |
| 127 | /** |
| 128 | * Set the Flow ID. |
| 129 | * |
| 130 | * @param flowId the Flow ID to set. |
| 131 | */ |
| 132 | public void setFlowId(FlowId flowId) { |
| 133 | this.flowId = flowId; |
| 134 | } |
| 135 | |
| 136 | /** |
Pavlin Radoslavov | 062c72d | 2013-10-30 12:42:15 -0700 | [diff] [blame] | 137 | * Test whether the Flow ID is valid. |
| 138 | * |
| 139 | * @return true if the Flow ID is valid, otherwise false. |
| 140 | */ |
Pavlin Radoslavov | da26a9a | 2013-11-22 19:31:36 -0800 | [diff] [blame] | 141 | @JsonIgnore |
Pavlin Radoslavov | 062c72d | 2013-10-30 12:42:15 -0700 | [diff] [blame] | 142 | public boolean isValidFlowId() { |
| 143 | if (this.flowId == null) |
| 144 | return false; |
Pavlin Radoslavov | f74271f | 2013-11-25 18:22:47 -0800 | [diff] [blame] | 145 | return (this.flowId.isValid()); |
Pavlin Radoslavov | 062c72d | 2013-10-30 12:42:15 -0700 | [diff] [blame] | 146 | } |
| 147 | |
| 148 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 149 | * Get the Flow Entry ID. |
| 150 | * |
| 151 | * @return the Flow Entry ID. |
| 152 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 153 | @JsonProperty("flowEntryId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 154 | public FlowEntryId flowEntryId() { return flowEntryId; } |
| 155 | |
| 156 | /** |
| 157 | * Set the Flow Entry ID. |
| 158 | * |
| 159 | * @param flowEntryId the Flow Entry ID to set. |
| 160 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 161 | @JsonProperty("flowEntryId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 162 | public void setFlowEntryId(FlowEntryId flowEntryId) { |
| 163 | this.flowEntryId = flowEntryId; |
| 164 | } |
| 165 | |
| 166 | /** |
Pavlin Radoslavov | b1309e8 | 2013-10-30 12:18:28 -0700 | [diff] [blame] | 167 | * Test whether the Flow Entry ID is valid. |
| 168 | * |
| 169 | * @return true if the Flow Entry ID is valid, otherwise false. |
| 170 | */ |
Pavlin Radoslavov | da26a9a | 2013-11-22 19:31:36 -0800 | [diff] [blame] | 171 | @JsonIgnore |
Pavlin Radoslavov | b1309e8 | 2013-10-30 12:18:28 -0700 | [diff] [blame] | 172 | public boolean isValidFlowEntryId() { |
| 173 | if (this.flowEntryId == null) |
| 174 | return false; |
Pavlin Radoslavov | f74271f | 2013-11-25 18:22:47 -0800 | [diff] [blame] | 175 | return (this.flowEntryId.isValid()); |
Pavlin Radoslavov | b1309e8 | 2013-10-30 12:18:28 -0700 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | /** |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 179 | * Get the flow idle timeout in seconds. |
| 180 | * |
| 181 | * It should be an unsigned integer in the interval [0, 65535]. |
| 182 | * If zero, the timeout is not set. |
| 183 | * |
| 184 | * @return the flow idle timeout. |
| 185 | */ |
| 186 | @JsonProperty("idleTimeout") |
| 187 | public int idleTimeout() { return idleTimeout; } |
| 188 | |
| 189 | /** |
| 190 | * Set the flow idle timeout in seconds. |
| 191 | * |
| 192 | * It should be an unsigned integer in the interval [0, 65535]. |
| 193 | * If zero, the timeout is not set. |
| 194 | * |
| 195 | * @param idleTimeout the flow idle timeout to set. |
| 196 | */ |
| 197 | @JsonProperty("idleTimeout") |
| 198 | public void setIdleTimeout(int idleTimeout) { |
| 199 | this.idleTimeout = 0xffff & idleTimeout; |
| 200 | } |
| 201 | |
| 202 | /** |
| 203 | * Get the flow hard timeout in seconds. |
| 204 | * |
| 205 | * It should be an unsigned integer in the interval [0, 65535]. |
| 206 | * If zero, the timeout is not set. |
| 207 | * |
| 208 | * @return the flow hard timeout. |
| 209 | */ |
| 210 | @JsonProperty("hardTimeout") |
| 211 | public int hardTimeout() { return hardTimeout; } |
| 212 | |
| 213 | /** |
| 214 | * Set the flow hard timeout in seconds. |
| 215 | * |
| 216 | * It should be an unsigned integer in the interval [0, 65535]. |
| 217 | * If zero, the timeout is not set. |
| 218 | * |
| 219 | * @param hardTimeout the flow hard timeout to set. |
| 220 | */ |
| 221 | @JsonProperty("hardTimeout") |
| 222 | public void setHardTimeout(int hardTimeout) { |
| 223 | this.hardTimeout = 0xffff & hardTimeout; |
| 224 | } |
| 225 | |
| 226 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 227 | * Get the Flow Entry Match. |
| 228 | * |
| 229 | * @return the Flow Entry Match. |
| 230 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 231 | @JsonProperty("flowEntryMatch") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 232 | public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; } |
| 233 | |
| 234 | /** |
| 235 | * Set the Flow Entry Match. |
| 236 | * |
| 237 | * @param flowEntryMatch the Flow Entry Match to set. |
| 238 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 239 | @JsonProperty("flowEntryMatch") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 240 | public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) { |
| 241 | this.flowEntryMatch = flowEntryMatch; |
| 242 | } |
| 243 | |
| 244 | /** |
| 245 | * Get the Flow Entry Actions. |
| 246 | * |
| 247 | * @return the Flow Entry Actions. |
| 248 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 249 | @JsonProperty("flowEntryActions") |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 250 | public FlowEntryActions flowEntryActions() { |
Pavlin Radoslavov | ede9758 | 2013-03-08 18:57:28 -0800 | [diff] [blame] | 251 | return flowEntryActions; |
| 252 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 253 | |
| 254 | /** |
| 255 | * Set the Flow Entry Actions. |
| 256 | * |
| 257 | * @param flowEntryActions the Flow Entry Actions to set. |
| 258 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 259 | @JsonProperty("flowEntryActions") |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 260 | public void setFlowEntryActions(FlowEntryActions flowEntryActions) { |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 261 | this.flowEntryActions = flowEntryActions; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Get the Switch DPID. |
| 266 | * |
| 267 | * @return the Switch DPID. |
| 268 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 269 | @JsonProperty("dpid") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 270 | public Dpid dpid() { return dpid; } |
| 271 | |
| 272 | /** |
| 273 | * Set the Switch DPID. |
| 274 | * |
| 275 | * @param dpid the Switch DPID to set. |
| 276 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 277 | @JsonProperty("dpid") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 278 | public void setDpid(Dpid dpid) { |
| 279 | this.dpid = dpid; |
| 280 | } |
| 281 | |
| 282 | /** |
| 283 | * Get the Switch incoming port. |
| 284 | * |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 285 | * Used only when the entry is used to return Shortest Path computation. |
| 286 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 287 | * @return the Switch incoming port. |
| 288 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 289 | @JsonProperty("inPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 290 | public Port inPort() { return inPort; } |
| 291 | |
| 292 | /** |
| 293 | * Set the Switch incoming port. |
| 294 | * |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 295 | * Used only when the entry is used to return Shortest Path computation. |
| 296 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 297 | * @param inPort the Switch incoming port to set. |
| 298 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 299 | @JsonProperty("inPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 300 | public void setInPort(Port inPort) { |
| 301 | this.inPort = inPort; |
| 302 | } |
| 303 | |
| 304 | /** |
| 305 | * Get the Switch outgoing port. |
| 306 | * |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 307 | * Used only when the entry is used to return Shortest Path computation. |
| 308 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 309 | * @return the Switch outgoing port. |
| 310 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 311 | @JsonProperty("outPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 312 | public Port outPort() { return outPort; } |
| 313 | |
| 314 | /** |
| 315 | * Set the Switch outgoing port. |
| 316 | * |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 317 | * Used only when the entry is used to return Shortest Path computation. |
| 318 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 319 | * @param outPort the Switch outgoing port to set. |
| 320 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 321 | @JsonProperty("outPort") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 322 | public void setOutPort(Port outPort) { |
| 323 | this.outPort = outPort; |
| 324 | } |
| 325 | |
| 326 | /** |
| 327 | * Get the Flow Entry User state. |
| 328 | * |
| 329 | * @return the Flow Entry User state. |
| 330 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 331 | @JsonProperty("flowEntryUserState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 332 | public FlowEntryUserState flowEntryUserState() { |
| 333 | return flowEntryUserState; |
| 334 | } |
| 335 | |
| 336 | /** |
| 337 | * Set the Flow Entry User state. |
| 338 | * |
| 339 | * @param flowEntryUserState the Flow Entry User state to set. |
| 340 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 341 | @JsonProperty("flowEntryUserState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 342 | public void setFlowEntryUserState(FlowEntryUserState flowEntryUserState) { |
| 343 | this.flowEntryUserState = flowEntryUserState; |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * Get the Flow Entry Switch state. |
| 348 | * |
| 349 | * The Flow Entry Error state is used if FlowEntrySwitchState is |
| 350 | * FE_SWITCH_FAILED. |
| 351 | * |
| 352 | * @return the Flow Entry Switch state. |
| 353 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 354 | @JsonProperty("flowEntrySwitchState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 355 | public FlowEntrySwitchState flowEntrySwitchState() { |
| 356 | return flowEntrySwitchState; |
| 357 | } |
| 358 | |
| 359 | /** |
| 360 | * Set the Flow Entry Switch state. |
| 361 | * |
| 362 | * The Flow Entry Error state is used if FlowEntrySwitchState is |
| 363 | * FE_SWITCH_FAILED. |
| 364 | * |
| 365 | * @param flowEntrySwitchState the Flow Entry Switch state to set. |
| 366 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 367 | @JsonProperty("flowEntrySwitchState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 368 | public void setFlowEntrySwitchState(FlowEntrySwitchState flowEntrySwitchState) { |
| 369 | this.flowEntrySwitchState = flowEntrySwitchState; |
| 370 | } |
| 371 | |
| 372 | /** |
| 373 | * Get the Flow Entry Error state. |
| 374 | * |
| 375 | * @return the Flow Entry Error state. |
| 376 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 377 | @JsonProperty("flowEntryErrorState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 378 | public FlowEntryErrorState flowEntryErrorState() { |
| 379 | return flowEntryErrorState; |
| 380 | } |
| 381 | |
| 382 | /** |
| 383 | * Set the Flow Entry Error state. |
| 384 | * |
| 385 | * @param flowEntryErrorState the Flow Entry Error state to set. |
| 386 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 387 | @JsonProperty("flowEntryErrorState") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 388 | public void setFlowEntryErrorState(FlowEntryErrorState flowEntryErrorState) { |
| 389 | this.flowEntryErrorState = flowEntryErrorState; |
| 390 | } |
| 391 | |
| 392 | /** |
| 393 | * Convert the flow entry to a string. |
| 394 | * |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 395 | * The string has the following form: |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 396 | * [flowEntryId=XXX idleTimeout=XXX hardTimeout=XXX |
| 397 | * flowEntryMatch=XXX flowEntryActions=XXX dpid=XXX |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 398 | * inPort=XXX outPort=XXX flowEntryUserState=XXX flowEntrySwitchState=XXX |
| 399 | * flowEntryErrorState=XXX] |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 400 | * @return the flow entry as a string. |
| 401 | */ |
| 402 | @Override |
| 403 | public String toString() { |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 404 | StringBuilder ret = new StringBuilder(); |
| 405 | if ( flowEntryId != null ) { |
| 406 | ret.append("[flowEntryId=" + this.flowEntryId.toString()); |
| 407 | } else { |
HIGUCHI Yuta | 64163c0 | 2013-08-06 07:51:19 +0900 | [diff] [blame] | 408 | ret.append("["); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 409 | } |
Pavlin Radoslavov | 919d0a2 | 2013-10-30 12:50:37 -0700 | [diff] [blame] | 410 | if ( flowId != null ) { |
| 411 | ret.append(" flowId=" + this.flowId.toString()); |
| 412 | } |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 413 | ret.append(" idleTimeout=" + this.idleTimeout); |
| 414 | ret.append(" hardTimeout=" + this.hardTimeout); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 415 | if ( flowEntryMatch != null ) { |
| 416 | ret.append(" flowEntryMatch=" + this.flowEntryMatch.toString()); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 417 | } |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 418 | ret.append(" flowEntryActions=" + this.flowEntryActions.toString() ); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 419 | if ( dpid != null ) { |
| 420 | ret.append(" dpid=" + this.dpid.toString()); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 421 | } |
| 422 | if ( inPort != null ) { |
| 423 | ret.append(" inPort=" + this.inPort.toString()); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 424 | } |
| 425 | if ( outPort != null ) { |
| 426 | ret.append(" outPort=" + this.outPort.toString()); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 427 | } |
| 428 | ret.append(" flowEntryUserState=" + this.flowEntryUserState); |
| 429 | ret.append(" flowEntrySwitchState=" + this.flowEntrySwitchState); |
| 430 | if ( flowEntryErrorState != null ) { |
| 431 | ret.append(" flowEntryErrorState=" + this.flowEntryErrorState.toString()); |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 432 | } |
| 433 | ret.append("]"); |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 434 | |
HIGUCHI Yuta | 01f4d7d | 2013-08-04 06:02:24 +0900 | [diff] [blame] | 435 | return ret.toString(); |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 436 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 437 | } |