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