1 package org.olsr.v1.info.api.dto; 2 3 import org.olsr.v1.info.api.commands.InfoCommand; 4 import org.osgi.annotation.versioning.ProviderType; 5 6 import com.fasterxml.jackson.annotation.JsonProperty; 7 8 /** 9 * Smart-gateway configuration in the {@link InfoCommand#CONFIG} jsoninfo OLSRd plugin response 10 */ 11 @ProviderType 12 public class JsonInfoConfigSgw { 13 private boolean enabled = false; 14 private boolean alwaysRemoveServerTunnel = false; 15 private boolean allowNAT = false; 16 private boolean uplinkNAT = false; 17 private int useCount = 0; 18 private int takeDownPercentage = 0; 19 private String instanceId = ""; 20 private String policyRoutingScript = ""; 21 private JsonInfoConfigSgwEgress egress = new JsonInfoConfigSgwEgress(); 22 private String statusFile = ""; 23 private long tablesOffset = 0; 24 private long rulesOffset = 0; 25 private long period = 0; 26 private int stableCount = 0; 27 private int threshold = 0; 28 private JsonInfoConfigSgwCostsCalculation costsCalculation = new JsonInfoConfigSgwCostsCalculation(); 29 private long maxCostMaxEtx = 0; 30 private String uplink = ""; 31 private JsonInfoConfigSgwBandwidth bandwidth = new JsonInfoConfigSgwBandwidth(); 32 private JsonInfoConfigSgwPrefix prefix = new JsonInfoConfigSgwPrefix(); 33 34 /** 35 * @return the enabled status 36 */ getEnabled()37 public boolean getEnabled() { 38 return this.enabled; 39 } 40 41 /** 42 * @param enabled the enabled status to set 43 */ 44 @JsonProperty("enabled") setEnabled(final boolean enabled)45 public void setEnabled(final boolean enabled) { 46 this.enabled = enabled; 47 } 48 49 /** 50 * @return the always remove server tunnel status 51 */ getAlwaysRemoveServerTunnel()52 public boolean getAlwaysRemoveServerTunnel() { 53 return this.alwaysRemoveServerTunnel; 54 } 55 56 /** 57 * @param alwaysRemoveServerTunnel the always remove server tunnel status to set 58 */ 59 @JsonProperty("alwaysRemoveServerTunnel") setAlwaysRemoveServerTunnel(final boolean alwaysRemoveServerTunnel)60 public void setAlwaysRemoveServerTunnel(final boolean alwaysRemoveServerTunnel) { 61 this.alwaysRemoveServerTunnel = alwaysRemoveServerTunnel; 62 } 63 64 /** 65 * @return the allow NAT status 66 */ getAllowNAT()67 public boolean getAllowNAT() { 68 return this.allowNAT; 69 } 70 71 /** 72 * @param allowNAT the allow NAT status to set 73 */ 74 @JsonProperty("allowNAT") setAllowNAT(final boolean allowNAT)75 public void setAllowNAT(final boolean allowNAT) { 76 this.allowNAT = allowNAT; 77 } 78 79 /** 80 * @return the uplink NAT status 81 */ getUplinkNAT()82 public boolean getUplinkNAT() { 83 return this.uplinkNAT; 84 } 85 86 /** 87 * @param uplinkNAT the uplink NAT status to set 88 */ 89 @JsonProperty("uplinkNAT") setUplinkNAT(final boolean uplinkNAT)90 public void setUplinkNAT(final boolean uplinkNAT) { 91 this.uplinkNAT = uplinkNAT; 92 } 93 94 /** 95 * @return the use count 96 */ getUseCount()97 public int getUseCount() { 98 return this.useCount; 99 } 100 101 /** 102 * @param useCount the use count to set 103 */ 104 @JsonProperty("useCount") setUseCount(final int useCount)105 public void setUseCount(final int useCount) { 106 this.useCount = useCount; 107 } 108 109 /** 110 * @return the take-down percentage 111 */ getTakeDownPercentage()112 public int getTakeDownPercentage() { 113 return this.takeDownPercentage; 114 } 115 116 /** 117 * @param takeDownPercentage the take-down percentage to set 118 */ 119 @JsonProperty("takeDownPercentage") setTakeDownPercentage(final int takeDownPercentage)120 public void setTakeDownPercentage(final int takeDownPercentage) { 121 this.takeDownPercentage = takeDownPercentage; 122 } 123 124 /** 125 * @return the instance Id 126 */ getInstanceId()127 public String getInstanceId() { 128 return this.instanceId; 129 } 130 131 /** 132 * @param instanceId the instance Id to set 133 */ 134 @JsonProperty("instanceId") setInstanceId(final String instanceId)135 public void setInstanceId(final String instanceId) { 136 if (instanceId == null) { 137 this.instanceId = ""; 138 } else { 139 this.instanceId = instanceId; 140 } 141 } 142 143 /** 144 * @return the policy routing script 145 */ getPolicyRoutingScript()146 public String getPolicyRoutingScript() { 147 return this.policyRoutingScript; 148 } 149 150 /** 151 * @param policyRoutingScript the policy routing script to set 152 */ 153 @JsonProperty("policyRoutingScript") setPolicyRoutingScript(final String policyRoutingScript)154 public void setPolicyRoutingScript(final String policyRoutingScript) { 155 if (policyRoutingScript == null) { 156 this.policyRoutingScript = ""; 157 } else { 158 this.policyRoutingScript = policyRoutingScript; 159 } 160 } 161 162 /** 163 * @return the egress configuration 164 */ getEgress()165 public JsonInfoConfigSgwEgress getEgress() { 166 return this.egress; 167 } 168 169 /** 170 * @param egress the egress configuration to set 171 */ 172 @JsonProperty("egress") setEgress(final JsonInfoConfigSgwEgress egress)173 public void setEgress(final JsonInfoConfigSgwEgress egress) { 174 if (egress == null) { 175 this.egress = new JsonInfoConfigSgwEgress(); 176 } else { 177 this.egress = egress; 178 } 179 } 180 181 /** 182 * @return the status file 183 */ getStatusFile()184 public String getStatusFile() { 185 return this.statusFile; 186 } 187 188 /** 189 * @param statusFile the status file to set 190 */ 191 @JsonProperty("statusFile") setStatusFile(final String statusFile)192 public void setStatusFile(final String statusFile) { 193 if (statusFile == null) { 194 this.statusFile = ""; 195 } else { 196 this.statusFile = statusFile; 197 } 198 } 199 200 /** 201 * @return the tables offset 202 */ getTablesOffset()203 public long getTablesOffset() { 204 return this.tablesOffset; 205 } 206 207 /** 208 * @param tablesOffset the tables offset to set 209 */ 210 @JsonProperty("tablesOffset") setTablesOffset(final long tablesOffset)211 public void setTablesOffset(final long tablesOffset) { 212 this.tablesOffset = tablesOffset; 213 } 214 215 /** 216 * @return the rules offset 217 */ getRulesOffset()218 public long getRulesOffset() { 219 return this.rulesOffset; 220 } 221 222 /** 223 * @param rulesOffset the rules offset to set 224 */ 225 @JsonProperty("rulesOffset") setRulesOffset(final long rulesOffset)226 public void setRulesOffset(final long rulesOffset) { 227 this.rulesOffset = rulesOffset; 228 } 229 230 /** 231 * @return the period 232 */ getPeriod()233 public long getPeriod() { 234 return this.period; 235 } 236 237 /** 238 * @param period the period to set 239 */ 240 @JsonProperty("period") setPeriod(final long period)241 public void setPeriod(final long period) { 242 this.period = period; 243 } 244 245 /** 246 * @return the stable count 247 */ getStableCount()248 public int getStableCount() { 249 return this.stableCount; 250 } 251 252 /** 253 * @param stableCount the stable count to set 254 */ 255 @JsonProperty("stableCount") setStableCount(final int stableCount)256 public void setStableCount(final int stableCount) { 257 this.stableCount = stableCount; 258 } 259 260 /** 261 * @return the threshold 262 */ getThreshold()263 public int getThreshold() { 264 return this.threshold; 265 } 266 267 /** 268 * @param threshold the threshold to set 269 */ 270 @JsonProperty("threshold") setThreshold(final int threshold)271 public void setThreshold(final int threshold) { 272 this.threshold = threshold; 273 } 274 275 /** 276 * @return the costs calculation configuration 277 */ getCostsCalculation()278 public JsonInfoConfigSgwCostsCalculation getCostsCalculation() { 279 return this.costsCalculation; 280 } 281 282 /** 283 * @param costsCalculation the costs calculation configuration to set 284 */ 285 @JsonProperty("costsCalculation") setCostsCalculation(final JsonInfoConfigSgwCostsCalculation costsCalculation)286 public void setCostsCalculation(final JsonInfoConfigSgwCostsCalculation costsCalculation) { 287 if (costsCalculation == null) { 288 this.costsCalculation = new JsonInfoConfigSgwCostsCalculation(); 289 } else { 290 this.costsCalculation = costsCalculation; 291 } 292 } 293 294 /** 295 * @return the maximum-cost-maximum-ETX setting 296 */ getMaxCostMaxEtx()297 public long getMaxCostMaxEtx() { 298 return this.maxCostMaxEtx; 299 } 300 301 /** 302 * @param maxCostMaxEtx the maximum-cost-maximum-ETX setting to set 303 */ 304 @JsonProperty("maxCostMaxEtx") setMaxCostMaxEtx(final long maxCostMaxEtx)305 public void setMaxCostMaxEtx(final long maxCostMaxEtx) { 306 this.maxCostMaxEtx = maxCostMaxEtx; 307 } 308 309 /** 310 * @return the uplink mode 311 */ getUplink()312 public String getUplink() { 313 return this.uplink; 314 } 315 316 /** 317 * @param uplink the uplink mode to set 318 */ 319 @JsonProperty("uplink") setUplink(final String uplink)320 public void setUplink(final String uplink) { 321 if (uplink == null) { 322 this.uplink = ""; 323 } else { 324 this.uplink = uplink; 325 } 326 } 327 328 /** 329 * @return the bandwidth 330 */ getBandwidth()331 public JsonInfoConfigSgwBandwidth getBandwidth() { 332 return this.bandwidth; 333 } 334 335 /** 336 * @param bandwidth the bandwidth to set 337 */ 338 @JsonProperty("bandwidth") setBandwidth(final JsonInfoConfigSgwBandwidth bandwidth)339 public void setBandwidth(final JsonInfoConfigSgwBandwidth bandwidth) { 340 if (bandwidth == null) { 341 this.bandwidth = new JsonInfoConfigSgwBandwidth(); 342 } else { 343 this.bandwidth = bandwidth; 344 } 345 } 346 347 /** 348 * @return the prefix 349 */ getPrefix()350 public JsonInfoConfigSgwPrefix getPrefix() { 351 return this.prefix; 352 } 353 354 /** 355 * @param prefix the prefix to set 356 */ 357 @JsonProperty("prefix") setPrefix(final JsonInfoConfigSgwPrefix prefix)358 public void setPrefix(final JsonInfoConfigSgwPrefix prefix) { 359 if (prefix == null) { 360 this.prefix = new JsonInfoConfigSgwPrefix(); 361 } else { 362 this.prefix = prefix; 363 } 364 } 365 366 @Override hashCode()367 public int hashCode() { 368 final int prime = 31; 369 int result = 1; 370 result = (prime * result) + (this.enabled ? 1231 : 1237); 371 result = (prime * result) + (this.alwaysRemoveServerTunnel ? 1231 : 1237); 372 result = (prime * result) + (this.allowNAT ? 1231 : 1237); 373 result = (prime * result) + (this.uplinkNAT ? 1231 : 1237); 374 result = (prime * result) + this.useCount; 375 result = (prime * result) + this.takeDownPercentage; 376 result = (prime * result) + this.instanceId.hashCode(); 377 result = (prime * result) + this.policyRoutingScript.hashCode(); 378 result = (prime * result) + this.egress.hashCode(); 379 result = (prime * result) + this.statusFile.hashCode(); 380 result = (prime * result) + (int) (this.tablesOffset ^ (this.tablesOffset >>> 32)); 381 result = (prime * result) + (int) (this.rulesOffset ^ (this.rulesOffset >>> 32)); 382 result = (prime * result) + (int) (this.period ^ (this.period >>> 32)); 383 result = (prime * result) + this.stableCount; 384 result = (prime * result) + this.threshold; 385 result = (prime * result) + this.costsCalculation.hashCode(); 386 result = (prime * result) + (int) (this.maxCostMaxEtx ^ (this.maxCostMaxEtx >>> 32)); 387 result = (prime * result) + this.uplink.hashCode(); 388 result = (prime * result) + this.bandwidth.hashCode(); 389 result = (prime * result) + this.prefix.hashCode(); 390 return result; 391 } 392 393 @Override equals(final Object obj)394 public boolean equals(final Object obj) { 395 if (this == obj) { 396 return true; 397 } 398 if (obj == null) { 399 return false; 400 } 401 if (this.getClass() != obj.getClass()) { 402 return false; 403 } 404 final JsonInfoConfigSgw other = (JsonInfoConfigSgw) obj; 405 if (this.enabled != other.enabled) { 406 return false; 407 } 408 if (this.alwaysRemoveServerTunnel != other.alwaysRemoveServerTunnel) { 409 return false; 410 } 411 if (this.allowNAT != other.allowNAT) { 412 return false; 413 } 414 if (this.uplinkNAT != other.uplinkNAT) { 415 return false; 416 } 417 if (this.useCount != other.useCount) { 418 return false; 419 } 420 if (this.takeDownPercentage != other.takeDownPercentage) { 421 return false; 422 } 423 if (!this.instanceId.equals(other.instanceId)) { 424 return false; 425 } 426 if (!this.policyRoutingScript.equals(other.policyRoutingScript)) { 427 return false; 428 } 429 if (!this.egress.equals(other.egress)) { 430 return false; 431 } 432 if (!this.statusFile.equals(other.statusFile)) { 433 return false; 434 } 435 if (this.tablesOffset != other.tablesOffset) { 436 return false; 437 } 438 if (this.rulesOffset != other.rulesOffset) { 439 return false; 440 } 441 if (this.period != other.period) { 442 return false; 443 } 444 if (this.stableCount != other.stableCount) { 445 return false; 446 } 447 if (this.threshold != other.threshold) { 448 return false; 449 } 450 if (!this.costsCalculation.equals(other.costsCalculation)) { 451 return false; 452 } 453 if (this.maxCostMaxEtx != other.maxCostMaxEtx) { 454 return false; 455 } 456 if (!this.uplink.equals(other.uplink)) { 457 return false; 458 } 459 if (!this.bandwidth.equals(other.bandwidth)) { 460 return false; 461 } 462 if (!this.prefix.equals(other.prefix)) { 463 return false; 464 } 465 return true; 466 } 467 468 @Override toString()469 public String toString() { 470 final StringBuilder builder = new StringBuilder(); 471 builder.append("JsonInfoConfigSgw [enabled="); 472 builder.append(this.enabled); 473 builder.append(", alwaysRemoveServerTunnel="); 474 builder.append(this.alwaysRemoveServerTunnel); 475 builder.append(", allowNAT="); 476 builder.append(this.allowNAT); 477 builder.append(", uplinkNAT="); 478 builder.append(this.uplinkNAT); 479 builder.append(", useCount="); 480 builder.append(this.useCount); 481 builder.append(", takeDownPercentage="); 482 builder.append(this.takeDownPercentage); 483 builder.append(", instanceId="); 484 builder.append(this.instanceId); 485 builder.append(", policyRoutingScript="); 486 builder.append(this.policyRoutingScript); 487 builder.append(", egress="); 488 builder.append(this.egress); 489 builder.append(", statusFile="); 490 builder.append(this.statusFile); 491 builder.append(", tablesOffset="); 492 builder.append(this.tablesOffset); 493 builder.append(", rulesOffset="); 494 builder.append(this.rulesOffset); 495 builder.append(", period="); 496 builder.append(this.period); 497 builder.append(", stableCount="); 498 builder.append(this.stableCount); 499 builder.append(", threshold="); 500 builder.append(this.threshold); 501 builder.append(", costsCalculation="); 502 builder.append(this.costsCalculation); 503 builder.append(", maxCostMaxEtx="); 504 builder.append(this.maxCostMaxEtx); 505 builder.append(", uplink="); 506 builder.append(this.uplink); 507 builder.append(", bandwidth="); 508 builder.append(this.bandwidth); 509 builder.append(", prefix="); 510 builder.append(this.prefix); 511 builder.append("]"); 512 return builder.toString(); 513 } 514 }