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 | 27831be | 2013-10-28 23:40:29 -0700 | [diff] [blame] | 3 | import java.util.ArrayList; |
| 4 | |
Pavlin Radoslavov | 892dd18 | 2013-12-05 23:33:15 -0800 | [diff] [blame] | 5 | import org.codehaus.jackson.annotate.JsonIgnore; |
Pavlin Radoslavov | ad008e0 | 2013-02-21 18:42:42 -0800 | [diff] [blame] | 6 | import org.codehaus.jackson.annotate.JsonProperty; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 7 | |
| 8 | /** |
| 9 | * The class representing the Flow Path. |
| 10 | */ |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 11 | public class FlowPath implements Comparable<FlowPath> { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 12 | public static final int PRIORITY_DEFAULT = 32768; // Default Flow Priority |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 13 | |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 14 | private FlowId flowId; // The Flow ID |
| 15 | private CallerId installerId; // The Caller ID of the path installer |
| 16 | private FlowPathType flowPathType; // The Flow Path type |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 17 | private FlowPathUserState flowPathUserState; // The Flow Path User state |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 18 | private FlowPathFlags flowPathFlags; // The Flow Path flags |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 19 | private int idleTimeout; // The Flow idle timeout |
| 20 | private int hardTimeout; // The Flow hard timeout |
| 21 | private int priority; // The Flow priority |
| 22 | private DataPath dataPath; // The data path |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 23 | private FlowEntryMatch flowEntryMatch; // Common Flow Entry Match for all |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 24 | // Flow Entries |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 25 | private FlowEntryActions flowEntryActions; // The Flow Entry Actions for |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 26 | // the first Flow Entry |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Default constructor. |
| 30 | */ |
| 31 | public FlowPath() { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 32 | flowPathType = FlowPathType.FP_TYPE_UNKNOWN; |
| 33 | flowPathUserState = FlowPathUserState.FP_USER_UNKNOWN; |
| 34 | flowPathFlags = new FlowPathFlags(); |
| 35 | priority = FlowPath.PRIORITY_DEFAULT; |
| 36 | dataPath = new DataPath(); |
| 37 | flowEntryActions = new FlowEntryActions(); |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 38 | } |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 39 | |
Pankaj Berde | 6a97eb8 | 2013-03-28 12:12:43 -0700 | [diff] [blame] | 40 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 41 | * Get the flow path Flow ID. |
| 42 | * |
| 43 | * @return the flow path Flow ID. |
| 44 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 45 | @JsonProperty("flowId") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 46 | public FlowId flowId() { |
| 47 | return flowId; |
| 48 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 49 | |
| 50 | /** |
| 51 | * Set the flow path Flow ID. |
| 52 | * |
| 53 | * @param flowId the flow path Flow ID to set. |
| 54 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 55 | @JsonProperty("flowId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 56 | public void setFlowId(FlowId flowId) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 57 | this.flowId = flowId; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 58 | } |
| 59 | |
| 60 | /** |
Pavlin Radoslavov | 892dd18 | 2013-12-05 23:33:15 -0800 | [diff] [blame] | 61 | * Test whether the Flow ID is valid. |
| 62 | * |
| 63 | * @return true if the Flow ID is valid, otherwise false. |
| 64 | */ |
| 65 | @JsonIgnore |
| 66 | public boolean isValidFlowId() { |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 67 | if (this.flowId == null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 68 | return false; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 69 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 70 | return (this.flowId.isValid()); |
Pavlin Radoslavov | 892dd18 | 2013-12-05 23:33:15 -0800 | [diff] [blame] | 71 | } |
| 72 | |
| 73 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 74 | * Get the Caller ID of the flow path installer. |
| 75 | * |
| 76 | * @return the Caller ID of the flow path installer. |
| 77 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 78 | @JsonProperty("installerId") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 79 | public CallerId installerId() { |
| 80 | return installerId; |
| 81 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 82 | |
| 83 | /** |
| 84 | * Set the Caller ID of the flow path installer. |
| 85 | * |
| 86 | * @param installerId the Caller ID of the flow path installer. |
| 87 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 88 | @JsonProperty("installerId") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 89 | public void setInstallerId(CallerId installerId) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 90 | this.installerId = installerId; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 91 | } |
| 92 | |
| 93 | /** |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 94 | * Get the flow path type. |
| 95 | * |
| 96 | * @return the flow path type. |
| 97 | */ |
| 98 | @JsonProperty("flowPathType") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 99 | public FlowPathType flowPathType() { |
| 100 | return flowPathType; |
| 101 | } |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 102 | |
| 103 | /** |
| 104 | * Set the flow path type. |
| 105 | * |
| 106 | * @param flowPathType the flow path type to set. |
| 107 | */ |
| 108 | @JsonProperty("flowPathType") |
| 109 | public void setFlowPathType(FlowPathType flowPathType) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 110 | this.flowPathType = flowPathType; |
Pavlin Radoslavov | d28cf7c | 2013-10-26 11:27:43 -0700 | [diff] [blame] | 111 | } |
| 112 | |
| 113 | /** |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 114 | * Get the flow path user state. |
| 115 | * |
| 116 | * @return the flow path user state. |
| 117 | */ |
| 118 | @JsonProperty("flowPathUserState") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 119 | public FlowPathUserState flowPathUserState() { |
| 120 | return flowPathUserState; |
| 121 | } |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 122 | |
| 123 | /** |
| 124 | * Set the flow path user state. |
| 125 | * |
| 126 | * @param flowPathUserState the flow path user state to set. |
| 127 | */ |
| 128 | @JsonProperty("flowPathUserState") |
| 129 | public void setFlowPathUserState(FlowPathUserState flowPathUserState) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 130 | this.flowPathUserState = flowPathUserState; |
Pavlin Radoslavov | 7d4a40e | 2013-10-27 23:39:40 -0700 | [diff] [blame] | 131 | } |
| 132 | |
| 133 | /** |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 134 | * Get the flow path flags. |
| 135 | * |
| 136 | * @return the flow path flags. |
| 137 | */ |
| 138 | @JsonProperty("flowPathFlags") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 139 | public FlowPathFlags flowPathFlags() { |
| 140 | return flowPathFlags; |
| 141 | } |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 142 | |
| 143 | /** |
| 144 | * Set the flow path flags. |
| 145 | * |
| 146 | * @param flowPathFlags the flow path flags to set. |
| 147 | */ |
| 148 | @JsonProperty("flowPathFlags") |
| 149 | public void setFlowPathFlags(FlowPathFlags flowPathFlags) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 150 | this.flowPathFlags = flowPathFlags; |
Pavlin Radoslavov | 204b286 | 2013-07-12 14:15:36 -0700 | [diff] [blame] | 151 | } |
| 152 | |
| 153 | /** |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 154 | * Get the flow idle timeout in seconds. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 155 | * <p/> |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 156 | * It should be an unsigned integer in the interval [0, 65535]. |
| 157 | * If zero, the timeout is not set. |
| 158 | * |
| 159 | * @return the flow idle timeout. |
| 160 | */ |
| 161 | @JsonProperty("idleTimeout") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 162 | public int idleTimeout() { |
| 163 | return idleTimeout; |
| 164 | } |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 165 | |
| 166 | /** |
| 167 | * Set the flow idle timeout in seconds. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 168 | * <p/> |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 169 | * It should be an unsigned integer in the interval [0, 65535]. |
| 170 | * If zero, the timeout is not set. |
| 171 | * |
| 172 | * @param idleTimeout the flow idle timeout to set. |
| 173 | */ |
| 174 | @JsonProperty("idleTimeout") |
| 175 | public void setIdleTimeout(int idleTimeout) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 176 | this.idleTimeout = 0xffff & idleTimeout; |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 177 | } |
| 178 | |
| 179 | /** |
| 180 | * Get the flow hard timeout in seconds. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 181 | * <p/> |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 182 | * It should be an unsigned integer in the interval [0, 65535]. |
| 183 | * If zero, the timeout is not set. |
| 184 | * |
| 185 | * @return the flow hard timeout. |
| 186 | */ |
| 187 | @JsonProperty("hardTimeout") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 188 | public int hardTimeout() { |
| 189 | return hardTimeout; |
| 190 | } |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 191 | |
| 192 | /** |
| 193 | * Set the flow hard timeout. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 194 | * <p/> |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 195 | * It should be an unsigned integer in the interval [0, 65535]. |
| 196 | * If zero, the timeout is not set. |
| 197 | * |
| 198 | * @param hardTimeout the flow hard timeout to set. |
| 199 | */ |
| 200 | @JsonProperty("hardTimeout") |
| 201 | public void setHardTimeout(int hardTimeout) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 202 | this.hardTimeout = 0xffff & hardTimeout; |
Pavlin Radoslavov | 5139c0b | 2013-12-09 18:04:53 -0800 | [diff] [blame] | 203 | } |
| 204 | |
| 205 | /** |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 206 | * Get the flow priority. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 207 | * <p/> |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 208 | * It should be an unsigned integer in the interval [0, 65535]. |
| 209 | * |
| 210 | * @return the flow priority. |
| 211 | */ |
| 212 | @JsonProperty("priority") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 213 | public int priority() { |
| 214 | return priority; |
| 215 | } |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 216 | |
| 217 | /** |
| 218 | * Set the flow priority. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 219 | * <p/> |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 220 | * It should be an unsigned integer in the interval [0, 65535]. |
| 221 | * |
| 222 | * @param priority the flow priority to set. |
| 223 | */ |
| 224 | @JsonProperty("priority") |
| 225 | public void setPriority(int priority) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 226 | this.priority = 0xffff & priority; |
Pavlin Radoslavov | afbf103 | 2014-02-04 10:37:52 -0800 | [diff] [blame] | 227 | } |
| 228 | |
| 229 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 230 | * Get the flow path's data path. |
| 231 | * |
| 232 | * @return the flow path's data path. |
| 233 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 234 | @JsonProperty("dataPath") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 235 | public DataPath dataPath() { |
| 236 | return dataPath; |
| 237 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 238 | |
| 239 | /** |
| 240 | * Set the flow path's data path. |
| 241 | * |
| 242 | * @param dataPath the flow path's data path to set. |
| 243 | */ |
Pavlin Radoslavov | 2013cbb | 2013-02-26 10:15:18 -0800 | [diff] [blame] | 244 | @JsonProperty("dataPath") |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 245 | public void setDataPath(DataPath dataPath) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 246 | this.dataPath = dataPath; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 247 | } |
| 248 | |
| 249 | /** |
Pavlin Radoslavov | 27831be | 2013-10-28 23:40:29 -0700 | [diff] [blame] | 250 | * Get the data path flow entries. |
| 251 | * |
| 252 | * @return the data path flow entries. |
| 253 | */ |
| 254 | public ArrayList<FlowEntry> flowEntries() { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 255 | return this.dataPath.flowEntries(); |
Pavlin Radoslavov | 27831be | 2013-10-28 23:40:29 -0700 | [diff] [blame] | 256 | } |
| 257 | |
| 258 | /** |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 259 | * Get the flow path's match conditions common for all Flow Entries. |
| 260 | * |
| 261 | * @return the flow path's match conditions common for all Flow Entries. |
| 262 | */ |
| 263 | @JsonProperty("flowEntryMatch") |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 264 | public FlowEntryMatch flowEntryMatch() { |
| 265 | return flowEntryMatch; |
| 266 | } |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 267 | |
| 268 | /** |
| 269 | * Set the flow path's match conditions common for all Flow Entries. |
| 270 | * |
| 271 | * @param flowEntryMatch the flow path's match conditions common for all |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 272 | * Flow Entries. |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 273 | */ |
| 274 | @JsonProperty("flowEntryMatch") |
| 275 | public void setFlowEntryMatch(FlowEntryMatch flowEntryMatch) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 276 | this.flowEntryMatch = flowEntryMatch; |
Pavlin Radoslavov | 67b3ef3 | 2013-04-03 02:44:48 -0700 | [diff] [blame] | 277 | } |
| 278 | |
| 279 | /** |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 280 | * Get the flow path's flow entry actions for the first Flow Entry. |
| 281 | * |
| 282 | * @return the flow path's flow entry actions for the first Flow Entry. |
| 283 | */ |
| 284 | @JsonProperty("flowEntryActions") |
| 285 | public FlowEntryActions flowEntryActions() { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 286 | return flowEntryActions; |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 287 | } |
| 288 | |
| 289 | /** |
| 290 | * Set the flow path's flow entry actions for the first Flow Entry. |
| 291 | * |
| 292 | * @param flowEntryActions the flow path's flow entry actions for the first |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 293 | * Flow Entry. |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 294 | */ |
| 295 | @JsonProperty("flowEntryActions") |
| 296 | public void setFlowEntryActions(FlowEntryActions flowEntryActions) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 297 | this.flowEntryActions = flowEntryActions; |
Pavlin Radoslavov | 1bc2c47 | 2013-07-17 18:11:37 -0700 | [diff] [blame] | 298 | } |
| 299 | |
| 300 | /** |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 301 | * Convert the flow path to a string. |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 302 | * <p/> |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 303 | * The string has the following form: |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 304 | * [flowId=XXX installerId=XXX flowPathType = XXX flowPathUserState = XXX |
| 305 | * flowPathFlags=XXX idleTimeout=XXX hardTimeout=XXX priority=XXX |
| 306 | * dataPath=XXX flowEntryMatch=XXX flowEntryActions=XXX] |
Pavlin Radoslavov | a10a9a8 | 2013-02-22 11:47:54 -0800 | [diff] [blame] | 307 | * |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 308 | * @return the flow path as a string. |
| 309 | */ |
| 310 | @Override |
| 311 | public String toString() { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 312 | String ret = "[flowId=" + this.flowId.toString(); |
| 313 | ret += " installerId=" + this.installerId.toString(); |
| 314 | ret += " flowPathType=" + this.flowPathType; |
| 315 | ret += " flowPathUserState=" + this.flowPathUserState; |
| 316 | ret += " flowPathFlags=" + this.flowPathFlags.toString(); |
| 317 | ret += " idleTimeout=" + this.idleTimeout; |
| 318 | ret += " hardTimeout=" + this.hardTimeout; |
| 319 | ret += " priority=" + this.priority; |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 320 | if (dataPath != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 321 | ret += " dataPath=" + this.dataPath.toString(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 322 | } |
| 323 | if (flowEntryMatch != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 324 | ret += " flowEntryMatch=" + this.flowEntryMatch.toString(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 325 | } |
| 326 | if (flowEntryActions != null) { |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 327 | ret += " flowEntryActions=" + this.flowEntryActions.toString(); |
Ray Milkey | b29e626 | 2014-04-09 16:02:14 -0700 | [diff] [blame] | 328 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 329 | ret += "]"; |
| 330 | return ret; |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 331 | } |
Ray Milkey | 269ffb9 | 2014-04-03 14:43:30 -0700 | [diff] [blame] | 332 | |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 333 | /** |
Pavlin Radoslavov | 60c9b8f | 2014-04-09 16:25:01 -0700 | [diff] [blame] | 334 | * Compares this object with the specified object for order. |
| 335 | * NOTE: The test is based on the Flow ID. |
| 336 | * |
| 337 | * @param o the object to be compared. |
| 338 | * @return a negative integer, zero, or a positive integer as this object |
| 339 | * is less than, equal to, or greater than the specified object. |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 340 | */ |
| 341 | @Override |
| 342 | public int compareTo(FlowPath f) { |
Pavlin Radoslavov | 60c9b8f | 2014-04-09 16:25:01 -0700 | [diff] [blame] | 343 | return (this.flowId.compareTo(f.flowId())); |
| 344 | } |
| 345 | |
| 346 | /** |
| 347 | * Test whether some other object is "equal to" this one. |
| 348 | * NOTE: The test is based on the Flow ID. |
| 349 | * |
| 350 | * @param obj the reference object with which to compare. |
| 351 | * @return true if this object is the same as the obj argument; false |
| 352 | * otherwise. |
| 353 | */ |
| 354 | @Override |
| 355 | public boolean equals(Object obj) { |
| 356 | if (obj instanceof FlowPath) { |
| 357 | FlowPath other = (FlowPath) obj; |
| 358 | return (this.flowId.equals(other.flowId())); |
| 359 | } |
| 360 | return false; |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * Get the hash code for the object. |
| 365 | * NOTE: The computation is based on the Flow ID. |
| 366 | * |
| 367 | * @return a hash code value for this object. |
| 368 | */ |
| 369 | @Override |
| 370 | public int hashCode() { |
| 371 | return this.flowId.hashCode(); |
Umesh Krishnaswamy | 57a32a9 | 2013-03-21 14:21:15 -0700 | [diff] [blame] | 372 | } |
Pavlin Radoslavov | 5363c2a | 2013-02-18 09:55:42 -0800 | [diff] [blame] | 373 | } |