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 | 27831be | 2013-10-28 23:40:29 -0700 | [diff] [blame] | 3 | import java.util.ArrayList; |
| 4 | |
HIGUCHI Yuta | 356086e | 2013-06-12 15:21:19 -0700 | [diff] [blame] | 5 | import net.floodlightcontroller.util.MACAddress; |
HIGUCHI Yuta | 2051490 | 2013-06-12 11:24:16 -0700 | [diff] [blame] | 6 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowEntry; |
| 7 | import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.IFlowPath; |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 8 | |
| 9 | import org.codehaus.jackson.annotate.JsonProperty; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 10 | |
| 11 | /** |
| 12 | * The class representing the Flow Path. |
| 13 | */ |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 14 | public class FlowPath implements Comparable<FlowPath> { |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 15 | private FlowId flowId; // The Flow ID |
| 16 | private CallerId installerId; // The Caller ID of the path installer |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 17 | private FlowPathType flowPathType; // The Flow Path type |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 18 | private FlowPathUserState flowPathUserState; // The Flow Path User state |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 19 | private FlowPathFlags flowPathFlags; // The Flow Path flags |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 20 | private DataPath dataPath; // The data path |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 21 | private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all |
| 22 | // Flow Entries |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 23 | private FlowEntryActions flowEntryActions; // The Flow Entry Actions for |
| 24 | // the first Flow Entry |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 25 | |
| 26 | /** |
| 27 | * Default constructor. |
| 28 | */ |
| 29 | public FlowPath() { |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 30 | flowPathType = FlowPathType.FP_TYPE_UNKNOWN; |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 31 | flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN; |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 32 | flowPathFlags = new FlowPathFlags(); |
Pavlin Radoslavov | b6f5354 | 2013-03-01 16:02:14 -0800 | [diff] [blame] | 33 | dataPath = new DataPath(); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 34 | flowEntryActions = new FlowEntryActions(); |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 35 | } |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 36 | |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 37 | /** |
| 38 | * Constructor to instantiate from object in Network Map |
| 39 | */ |
| 40 | public FlowPath(IFlowPath flowObj) { |
| 41 | dataPath = new DataPath(); |
| 42 | this.setFlowId(new FlowId(flowObj.getFlowId())); |
| 43 | this.setInstallerId(new CallerId(flowObj.getInstallerId())); |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 44 | this.setFlowPathType(FlowPathType.valueOf(flowObj.getFlowPathType())); |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 45 | this.setFlowPathUserState(FlowPathUserState.valueOf(flowObj.getFlowPathUserState())); |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 46 | this.setFlowPathFlags(new FlowPathFlags(flowObj.getFlowPathFlags())); |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 47 | this.dataPath().srcPort().setDpid(new Dpid(flowObj.getSrcSwitch())); |
| 48 | this.dataPath().srcPort().setPort(new Port(flowObj.getSrcPort())); |
| 49 | this.dataPath().dstPort().setDpid(new Dpid(flowObj.getDstSwitch())); |
| 50 | this.dataPath().dstPort().setPort(new Port(flowObj.getDstPort())); |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 51 | // |
| 52 | // Extract the match conditions that are common for all Flow Entries |
| 53 | // |
| 54 | { |
| 55 | FlowEntryMatch match = new FlowEntryMatch(); |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 56 | String matchSrcMac = flowObj.getMatchSrcMac(); |
| 57 | if (matchSrcMac != null) |
| 58 | match.enableSrcMac(MACAddress.valueOf(matchSrcMac)); |
| 59 | String matchDstMac = flowObj.getMatchDstMac(); |
| 60 | if (matchDstMac != null) |
| 61 | match.enableDstMac(MACAddress.valueOf(matchDstMac)); |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 62 | Short matchEthernetFrameType = flowObj.getMatchEthernetFrameType(); |
| 63 | if (matchEthernetFrameType != null) |
| 64 | match.enableEthernetFrameType(matchEthernetFrameType); |
| 65 | Short matchVlanId = flowObj.getMatchVlanId(); |
| 66 | if (matchVlanId != null) |
| 67 | match.enableVlanId(matchVlanId); |
| 68 | Byte matchVlanPriority = flowObj.getMatchVlanPriority(); |
| 69 | if (matchVlanPriority != null) |
| 70 | match.enableVlanPriority(matchVlanPriority); |
| 71 | String matchSrcIPv4Net = flowObj.getMatchSrcIPv4Net(); |
| 72 | if (matchSrcIPv4Net != null) |
| 73 | match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net)); |
| 74 | String matchDstIPv4Net = flowObj.getMatchDstIPv4Net(); |
| 75 | if (matchDstIPv4Net != null) |
| 76 | match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net)); |
| 77 | Byte matchIpProto = flowObj.getMatchIpProto(); |
| 78 | if (matchIpProto != null) |
| 79 | match.enableIpProto(matchIpProto); |
| 80 | Byte matchIpToS = flowObj.getMatchIpToS(); |
| 81 | if (matchIpToS != null) |
| 82 | match.enableIpToS(matchIpToS); |
| 83 | Short matchSrcTcpUdpPort = flowObj.getMatchSrcTcpUdpPort(); |
| 84 | if (matchSrcTcpUdpPort != null) |
| 85 | match.enableSrcTcpUdpPort(matchSrcTcpUdpPort); |
| 86 | Short matchDstTcpUdpPort = flowObj.getMatchDstTcpUdpPort(); |
| 87 | if (matchDstTcpUdpPort != null) |
| 88 | match.enableDstTcpUdpPort(matchDstTcpUdpPort); |
| 89 | |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 90 | this.setFlowEntryMatch(match); |
| 91 | } |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 92 | |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 93 | // |
| 94 | // Extract the actions for the first Flow Entry |
| 95 | // |
| 96 | { |
| 97 | FlowEntryActions actions = new FlowEntryActions(); |
| 98 | |
| 99 | String actionsStr = flowObj.getActions(); |
| 100 | if (actions != null) |
| 101 | actions = new FlowEntryActions(actionsStr); |
| 102 | |
| 103 | this.setFlowEntryActions(actions); |
| 104 | } |
| 105 | |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 106 | // |
| 107 | // Extract all Flow Entries |
| 108 | // |
| 109 | Iterable<IFlowEntry> flowEntries = flowObj.getFlowEntries(); |
| 110 | for (IFlowEntry flowEntryObj : flowEntries) { |
| 111 | FlowEntry flowEntry = new FlowEntry(); |
| 112 | flowEntry.setFlowEntryId(new FlowEntryId(flowEntryObj.getFlowEntryId())); |
| 113 | flowEntry.setDpid(new Dpid(flowEntryObj.getSwitchDpid())); |
| 114 | |
| 115 | // |
| 116 | // Extract the match conditions |
| 117 | // |
| 118 | FlowEntryMatch match = new FlowEntryMatch(); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 119 | // |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 120 | Short matchInPort = flowEntryObj.getMatchInPort(); |
| 121 | if (matchInPort != null) |
| 122 | match.enableInPort(new Port(matchInPort)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 123 | // |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 124 | String matchSrcMac = flowEntryObj.getMatchSrcMac(); |
| 125 | if (matchSrcMac != null) |
| 126 | match.enableSrcMac(MACAddress.valueOf(matchSrcMac)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 127 | // |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 128 | String matchDstMac = flowEntryObj.getMatchDstMac(); |
| 129 | if (matchDstMac != null) |
| 130 | match.enableDstMac(MACAddress.valueOf(matchDstMac)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 131 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 132 | Short matchEthernetFrameType = flowEntryObj.getMatchEthernetFrameType(); |
| 133 | if (matchEthernetFrameType != null) |
| 134 | match.enableEthernetFrameType(matchEthernetFrameType); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 135 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 136 | Short matchVlanId = flowEntryObj.getMatchVlanId(); |
| 137 | if (matchVlanId != null) |
| 138 | match.enableVlanId(matchVlanId); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 139 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 140 | Byte matchVlanPriority = flowEntryObj.getMatchVlanPriority(); |
| 141 | if (matchVlanPriority != null) |
| 142 | match.enableVlanPriority(matchVlanPriority); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 143 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 144 | String matchSrcIPv4Net = flowEntryObj.getMatchSrcIPv4Net(); |
| 145 | if (matchSrcIPv4Net != null) |
| 146 | match.enableSrcIPv4Net(new IPv4Net(matchSrcIPv4Net)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 147 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 148 | String matchDstIPv4Net = flowEntryObj.getMatchDstIPv4Net(); |
| 149 | if (matchDstIPv4Net != null) |
| 150 | match.enableDstIPv4Net(new IPv4Net(matchDstIPv4Net)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 151 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 152 | Byte matchIpProto = flowEntryObj.getMatchIpProto(); |
| 153 | if (matchIpProto != null) |
| 154 | match.enableIpProto(matchIpProto); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 155 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 156 | Byte matchIpToS = flowEntryObj.getMatchIpToS(); |
| 157 | if (matchIpToS != null) |
| 158 | match.enableIpToS(matchIpToS); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 159 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 160 | Short matchSrcTcpUdpPort = flowEntryObj.getMatchSrcTcpUdpPort(); |
| 161 | if (matchSrcTcpUdpPort != null) |
| 162 | match.enableSrcTcpUdpPort(matchSrcTcpUdpPort); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 163 | // |
Pavlin Radoslavov | ad3a1e6 | 2013-07-09 13:30:16 -0700 | [diff] [blame] | 164 | Short matchDstTcpUdpPort = flowEntryObj.getMatchDstTcpUdpPort(); |
| 165 | if (matchDstTcpUdpPort != null) |
| 166 | match.enableDstTcpUdpPort(matchDstTcpUdpPort); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 167 | // |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 168 | flowEntry.setFlowEntryMatch(match); |
| 169 | |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 170 | // |
| 171 | // Extract the actions |
| 172 | // |
| 173 | { |
| 174 | FlowEntryActions actions = new FlowEntryActions(); |
| 175 | |
HIGUCHI Yuta | 6fa3951 | 2013-08-04 06:00:47 +0900 | [diff] [blame] | 176 | String actionsStr = flowEntryObj.getActions(); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 177 | if (actions != null) |
| 178 | actions = new FlowEntryActions(actionsStr); |
| 179 | |
| 180 | flowEntry.setFlowEntryActions(actions); |
| 181 | } |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 182 | |
| 183 | String userState = flowEntryObj.getUserState(); |
| 184 | flowEntry.setFlowEntryUserState(FlowEntryUserState.valueOf(userState)); |
| 185 | String switchState = flowEntryObj.getSwitchState(); |
| 186 | flowEntry.setFlowEntrySwitchState(FlowEntrySwitchState.valueOf(switchState)); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 187 | // |
| 188 | // TODO: Take care of the FlowEntryErrorState. |
| 189 | // |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 190 | this.dataPath().flowEntries().add(flowEntry); |
| 191 | } |
| 192 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 193 | |
| 194 | /** |
| 195 | * Get the flow path Flow ID. |
| 196 | * |
| 197 | * @return the flow path Flow ID. |
| 198 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 199 | @JsonProperty("flowId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 200 | public FlowId flowId() { return flowId; } |
| 201 | |
| 202 | /** |
| 203 | * Set the flow path Flow ID. |
| 204 | * |
| 205 | * @param flowId the flow path Flow ID to set. |
| 206 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 207 | @JsonProperty("flowId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 208 | public void setFlowId(FlowId flowId) { |
| 209 | this.flowId = flowId; |
| 210 | } |
| 211 | |
| 212 | /** |
| 213 | * Get the Caller ID of the flow path installer. |
| 214 | * |
| 215 | * @return the Caller ID of the flow path installer. |
| 216 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 217 | @JsonProperty("installerId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 218 | public CallerId installerId() { return installerId; } |
| 219 | |
| 220 | /** |
| 221 | * Set the Caller ID of the flow path installer. |
| 222 | * |
| 223 | * @param installerId the Caller ID of the flow path installer. |
| 224 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 225 | @JsonProperty("installerId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 226 | public void setInstallerId(CallerId installerId) { |
| 227 | this.installerId = installerId; |
| 228 | } |
| 229 | |
| 230 | /** |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 231 | * Get the flow path type. |
| 232 | * |
| 233 | * @return the flow path type. |
| 234 | */ |
| 235 | @JsonProperty("flowPathType") |
| 236 | public FlowPathType flowPathType() { return flowPathType; } |
| 237 | |
| 238 | /** |
| 239 | * Set the flow path type. |
| 240 | * |
| 241 | * @param flowPathType the flow path type to set. |
| 242 | */ |
| 243 | @JsonProperty("flowPathType") |
| 244 | public void setFlowPathType(FlowPathType flowPathType) { |
| 245 | this.flowPathType = flowPathType; |
| 246 | } |
| 247 | |
| 248 | /** |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 249 | * Get the flow path user state. |
| 250 | * |
| 251 | * @return the flow path user state. |
| 252 | */ |
| 253 | @JsonProperty("flowPathUserState") |
| 254 | public FlowPathUserState flowPathUserState() { return flowPathUserState; } |
| 255 | |
| 256 | /** |
| 257 | * Set the flow path user state. |
| 258 | * |
| 259 | * @param flowPathUserState the flow path user state to set. |
| 260 | */ |
| 261 | @JsonProperty("flowPathUserState") |
| 262 | public void setFlowPathUserState(FlowPathUserState flowPathUserState) { |
| 263 | this.flowPathUserState = flowPathUserState; |
| 264 | } |
| 265 | |
| 266 | /** |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 267 | * Get the flow path flags. |
| 268 | * |
| 269 | * @return the flow path flags. |
| 270 | */ |
| 271 | @JsonProperty("flowPathFlags") |
| 272 | public FlowPathFlags flowPathFlags() { return flowPathFlags; } |
| 273 | |
| 274 | /** |
| 275 | * Set the flow path flags. |
| 276 | * |
| 277 | * @param flowPathFlags the flow path flags to set. |
| 278 | */ |
| 279 | @JsonProperty("flowPathFlags") |
| 280 | public void setFlowPathFlags(FlowPathFlags flowPathFlags) { |
| 281 | this.flowPathFlags = flowPathFlags; |
| 282 | } |
| 283 | |
| 284 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 285 | * Get the flow path's data path. |
| 286 | * |
| 287 | * @return the flow path's data path. |
| 288 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 289 | @JsonProperty("dataPath") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 290 | public DataPath dataPath() { return dataPath; } |
| 291 | |
| 292 | /** |
| 293 | * Set the flow path's data path. |
| 294 | * |
| 295 | * @param dataPath the flow path's data path to set. |
| 296 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 297 | @JsonProperty("dataPath") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 298 | public void setDataPath(DataPath dataPath) { |
| 299 | this.dataPath = dataPath; |
| 300 | } |
| 301 | |
| 302 | /** |
Pavlin Radoslavov | 27831be | 2013-10-28 23:40:29 -0700 | [diff] [blame] | 303 | * Get the data path flow entries. |
| 304 | * |
| 305 | * @return the data path flow entries. |
| 306 | */ |
| 307 | public ArrayList<FlowEntry> flowEntries() { |
| 308 | return this.dataPath.flowEntries(); |
| 309 | } |
| 310 | |
| 311 | /** |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 312 | * Get the flow path's match conditions common for all Flow Entries. |
| 313 | * |
| 314 | * @return the flow path's match conditions common for all Flow Entries. |
| 315 | */ |
| 316 | @JsonProperty("flowEntryMatch") |
| 317 | public FlowEntryMatch flowEntryMatch() { return flowEntryMatch; } |
| 318 | |
| 319 | /** |
| 320 | * Set the flow path's match conditions common for all Flow Entries. |
| 321 | * |
| 322 | * @param flowEntryMatch the flow path's match conditions common for all |
| 323 | * Flow Entries. |
| 324 | */ |
| 325 | @JsonProperty("flowEntryMatch") |
| 326 | public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) { |
| 327 | this.flowEntryMatch = flowEntryMatch; |
| 328 | } |
| 329 | |
| 330 | /** |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 331 | * Get the flow path's flow entry actions for the first Flow Entry. |
| 332 | * |
| 333 | * @return the flow path's flow entry actions for the first Flow Entry. |
| 334 | */ |
| 335 | @JsonProperty("flowEntryActions") |
| 336 | public FlowEntryActions flowEntryActions() { |
| 337 | return flowEntryActions; |
| 338 | } |
| 339 | |
| 340 | /** |
| 341 | * Set the flow path's flow entry actions for the first Flow Entry. |
| 342 | * |
| 343 | * @param flowEntryActions the flow path's flow entry actions for the first |
| 344 | * Flow Entry. |
| 345 | */ |
| 346 | @JsonProperty("flowEntryActions") |
| 347 | public void setFlowEntryActions(FlowEntryActions flowEntryActions) { |
| 348 | this.flowEntryActions = flowEntryActions; |
| 349 | } |
| 350 | |
| 351 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 352 | * Convert the flow path to a string. |
| 353 | * |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 354 | * The string has the following form: |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 355 | * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX |
| 356 | * flowPathFlags=XXX dataPath=XXX flowEntryMatch=XXX |
| 357 | * flowEntryActions=XXX] |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 358 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 359 | * @return the flow path as a string. |
| 360 | */ |
| 361 | @Override |
| 362 | public String toString() { |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 363 | String ret = "[flowId=" + this.flowId.toString(); |
| 364 | ret += " installerId=" + this.installerId.toString(); |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 365 | ret += " flowPathType=" + this.flowPathType; |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 366 | ret += " flowPathUserState=" + this.flowPathUserState; |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 367 | ret += " flowPathFlags=" + this.flowPathFlags.toString(); |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 368 | if (dataPath != null) |
| 369 | ret += " dataPath=" + this.dataPath.toString(); |
| 370 | if (flowEntryMatch != null) |
| 371 | ret += " flowEntryMatch=" + this.flowEntryMatch.toString(); |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 372 | if (flowEntryActions != null) |
| 373 | ret += " flowEntryActions=" + this.flowEntryActions.toString(); |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 374 | ret += "]"; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 375 | return ret; |
| 376 | } |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 377 | |
| 378 | /** |
| 379 | * CompareTo method to order flowPath by Id |
| 380 | */ |
| 381 | @Override |
| 382 | public int compareTo(FlowPath f) { |
| 383 | return (int) (this.flowId.value() - f.flowId.value()); |
| 384 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 385 | } |