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