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