alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame^] | 1 | // Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | // Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | // Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | // This library was generated by the LoxiGen Compiler. |
| 5 | // See the file LICENSE.txt which should have been included in the source distribution |
| 6 | |
| 7 | // Automatically generated by LOXI from template of_class.java |
| 8 | // Do not modify |
| 9 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver11; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | import java.util.Set; |
| 29 | import com.google.common.collect.ImmutableSet; |
| 30 | import org.jboss.netty.buffer.ChannelBuffer; |
| 31 | import com.google.common.hash.PrimitiveSink; |
| 32 | import com.google.common.hash.Funnel; |
| 33 | |
| 34 | class OFBsnVportL2GreVer11 implements OFBsnVportL2Gre { |
| 35 | private static final Logger logger = LoggerFactory.getLogger(OFBsnVportL2GreVer11.class); |
| 36 | // version: 1.1 |
| 37 | final static byte WIRE_VERSION = 2; |
| 38 | final static int LENGTH = 64; |
| 39 | |
| 40 | private final static Set<OFBsnVportL2GreFlags> DEFAULT_FLAGS = ImmutableSet.<OFBsnVportL2GreFlags>of(); |
| 41 | private final static OFPort DEFAULT_PORT_NO = OFPort.ANY; |
| 42 | private final static OFPort DEFAULT_LOOPBACK_PORT_NO = OFPort.ANY; |
| 43 | private final static MacAddress DEFAULT_LOCAL_MAC = MacAddress.NONE; |
| 44 | private final static MacAddress DEFAULT_NH_MAC = MacAddress.NONE; |
| 45 | private final static IPv4Address DEFAULT_SRC_IP = IPv4Address.NONE; |
| 46 | private final static IPv4Address DEFAULT_DST_IP = IPv4Address.NONE; |
| 47 | private final static short DEFAULT_DSCP = (short) 0x0; |
| 48 | private final static short DEFAULT_TTL = (short) 0x0; |
| 49 | private final static long DEFAULT_VPN = 0x0L; |
| 50 | private final static long DEFAULT_RATE_LIMIT = 0x0L; |
| 51 | private final static String DEFAULT_IF_NAME = ""; |
| 52 | |
| 53 | // OF message fields |
| 54 | private final Set<OFBsnVportL2GreFlags> flags; |
| 55 | private final OFPort portNo; |
| 56 | private final OFPort loopbackPortNo; |
| 57 | private final MacAddress localMac; |
| 58 | private final MacAddress nhMac; |
| 59 | private final IPv4Address srcIp; |
| 60 | private final IPv4Address dstIp; |
| 61 | private final short dscp; |
| 62 | private final short ttl; |
| 63 | private final long vpn; |
| 64 | private final long rateLimit; |
| 65 | private final String ifName; |
| 66 | // |
| 67 | // Immutable default instance |
| 68 | final static OFBsnVportL2GreVer11 DEFAULT = new OFBsnVportL2GreVer11( |
| 69 | DEFAULT_FLAGS, DEFAULT_PORT_NO, DEFAULT_LOOPBACK_PORT_NO, DEFAULT_LOCAL_MAC, DEFAULT_NH_MAC, DEFAULT_SRC_IP, DEFAULT_DST_IP, DEFAULT_DSCP, DEFAULT_TTL, DEFAULT_VPN, DEFAULT_RATE_LIMIT, DEFAULT_IF_NAME |
| 70 | ); |
| 71 | |
| 72 | // package private constructor - used by readers, builders, and factory |
| 73 | OFBsnVportL2GreVer11(Set<OFBsnVportL2GreFlags> flags, OFPort portNo, OFPort loopbackPortNo, MacAddress localMac, MacAddress nhMac, IPv4Address srcIp, IPv4Address dstIp, short dscp, short ttl, long vpn, long rateLimit, String ifName) { |
| 74 | this.flags = flags; |
| 75 | this.portNo = portNo; |
| 76 | this.loopbackPortNo = loopbackPortNo; |
| 77 | this.localMac = localMac; |
| 78 | this.nhMac = nhMac; |
| 79 | this.srcIp = srcIp; |
| 80 | this.dstIp = dstIp; |
| 81 | this.dscp = dscp; |
| 82 | this.ttl = ttl; |
| 83 | this.vpn = vpn; |
| 84 | this.rateLimit = rateLimit; |
| 85 | this.ifName = ifName; |
| 86 | } |
| 87 | |
| 88 | // Accessors for OF message fields |
| 89 | @Override |
| 90 | public int getType() { |
| 91 | return 0x1; |
| 92 | } |
| 93 | |
| 94 | @Override |
| 95 | public Set<OFBsnVportL2GreFlags> getFlags() { |
| 96 | return flags; |
| 97 | } |
| 98 | |
| 99 | @Override |
| 100 | public OFPort getPortNo() { |
| 101 | return portNo; |
| 102 | } |
| 103 | |
| 104 | @Override |
| 105 | public OFPort getLoopbackPortNo() { |
| 106 | return loopbackPortNo; |
| 107 | } |
| 108 | |
| 109 | @Override |
| 110 | public MacAddress getLocalMac() { |
| 111 | return localMac; |
| 112 | } |
| 113 | |
| 114 | @Override |
| 115 | public MacAddress getNhMac() { |
| 116 | return nhMac; |
| 117 | } |
| 118 | |
| 119 | @Override |
| 120 | public IPv4Address getSrcIp() { |
| 121 | return srcIp; |
| 122 | } |
| 123 | |
| 124 | @Override |
| 125 | public IPv4Address getDstIp() { |
| 126 | return dstIp; |
| 127 | } |
| 128 | |
| 129 | @Override |
| 130 | public short getDscp() { |
| 131 | return dscp; |
| 132 | } |
| 133 | |
| 134 | @Override |
| 135 | public short getTtl() { |
| 136 | return ttl; |
| 137 | } |
| 138 | |
| 139 | @Override |
| 140 | public long getVpn() { |
| 141 | return vpn; |
| 142 | } |
| 143 | |
| 144 | @Override |
| 145 | public long getRateLimit() { |
| 146 | return rateLimit; |
| 147 | } |
| 148 | |
| 149 | @Override |
| 150 | public String getIfName() { |
| 151 | return ifName; |
| 152 | } |
| 153 | |
| 154 | @Override |
| 155 | public OFVersion getVersion() { |
| 156 | return OFVersion.OF_11; |
| 157 | } |
| 158 | |
| 159 | |
| 160 | |
| 161 | public OFBsnVportL2Gre.Builder createBuilder() { |
| 162 | return new BuilderWithParent(this); |
| 163 | } |
| 164 | |
| 165 | static class BuilderWithParent implements OFBsnVportL2Gre.Builder { |
| 166 | final OFBsnVportL2GreVer11 parentMessage; |
| 167 | |
| 168 | // OF message fields |
| 169 | private boolean flagsSet; |
| 170 | private Set<OFBsnVportL2GreFlags> flags; |
| 171 | private boolean portNoSet; |
| 172 | private OFPort portNo; |
| 173 | private boolean loopbackPortNoSet; |
| 174 | private OFPort loopbackPortNo; |
| 175 | private boolean localMacSet; |
| 176 | private MacAddress localMac; |
| 177 | private boolean nhMacSet; |
| 178 | private MacAddress nhMac; |
| 179 | private boolean srcIpSet; |
| 180 | private IPv4Address srcIp; |
| 181 | private boolean dstIpSet; |
| 182 | private IPv4Address dstIp; |
| 183 | private boolean dscpSet; |
| 184 | private short dscp; |
| 185 | private boolean ttlSet; |
| 186 | private short ttl; |
| 187 | private boolean vpnSet; |
| 188 | private long vpn; |
| 189 | private boolean rateLimitSet; |
| 190 | private long rateLimit; |
| 191 | private boolean ifNameSet; |
| 192 | private String ifName; |
| 193 | |
| 194 | BuilderWithParent(OFBsnVportL2GreVer11 parentMessage) { |
| 195 | this.parentMessage = parentMessage; |
| 196 | } |
| 197 | |
| 198 | @Override |
| 199 | public int getType() { |
| 200 | return 0x1; |
| 201 | } |
| 202 | |
| 203 | @Override |
| 204 | public Set<OFBsnVportL2GreFlags> getFlags() { |
| 205 | return flags; |
| 206 | } |
| 207 | |
| 208 | @Override |
| 209 | public OFBsnVportL2Gre.Builder setFlags(Set<OFBsnVportL2GreFlags> flags) { |
| 210 | this.flags = flags; |
| 211 | this.flagsSet = true; |
| 212 | return this; |
| 213 | } |
| 214 | @Override |
| 215 | public OFPort getPortNo() { |
| 216 | return portNo; |
| 217 | } |
| 218 | |
| 219 | @Override |
| 220 | public OFBsnVportL2Gre.Builder setPortNo(OFPort portNo) { |
| 221 | this.portNo = portNo; |
| 222 | this.portNoSet = true; |
| 223 | return this; |
| 224 | } |
| 225 | @Override |
| 226 | public OFPort getLoopbackPortNo() { |
| 227 | return loopbackPortNo; |
| 228 | } |
| 229 | |
| 230 | @Override |
| 231 | public OFBsnVportL2Gre.Builder setLoopbackPortNo(OFPort loopbackPortNo) { |
| 232 | this.loopbackPortNo = loopbackPortNo; |
| 233 | this.loopbackPortNoSet = true; |
| 234 | return this; |
| 235 | } |
| 236 | @Override |
| 237 | public MacAddress getLocalMac() { |
| 238 | return localMac; |
| 239 | } |
| 240 | |
| 241 | @Override |
| 242 | public OFBsnVportL2Gre.Builder setLocalMac(MacAddress localMac) { |
| 243 | this.localMac = localMac; |
| 244 | this.localMacSet = true; |
| 245 | return this; |
| 246 | } |
| 247 | @Override |
| 248 | public MacAddress getNhMac() { |
| 249 | return nhMac; |
| 250 | } |
| 251 | |
| 252 | @Override |
| 253 | public OFBsnVportL2Gre.Builder setNhMac(MacAddress nhMac) { |
| 254 | this.nhMac = nhMac; |
| 255 | this.nhMacSet = true; |
| 256 | return this; |
| 257 | } |
| 258 | @Override |
| 259 | public IPv4Address getSrcIp() { |
| 260 | return srcIp; |
| 261 | } |
| 262 | |
| 263 | @Override |
| 264 | public OFBsnVportL2Gre.Builder setSrcIp(IPv4Address srcIp) { |
| 265 | this.srcIp = srcIp; |
| 266 | this.srcIpSet = true; |
| 267 | return this; |
| 268 | } |
| 269 | @Override |
| 270 | public IPv4Address getDstIp() { |
| 271 | return dstIp; |
| 272 | } |
| 273 | |
| 274 | @Override |
| 275 | public OFBsnVportL2Gre.Builder setDstIp(IPv4Address dstIp) { |
| 276 | this.dstIp = dstIp; |
| 277 | this.dstIpSet = true; |
| 278 | return this; |
| 279 | } |
| 280 | @Override |
| 281 | public short getDscp() { |
| 282 | return dscp; |
| 283 | } |
| 284 | |
| 285 | @Override |
| 286 | public OFBsnVportL2Gre.Builder setDscp(short dscp) { |
| 287 | this.dscp = dscp; |
| 288 | this.dscpSet = true; |
| 289 | return this; |
| 290 | } |
| 291 | @Override |
| 292 | public short getTtl() { |
| 293 | return ttl; |
| 294 | } |
| 295 | |
| 296 | @Override |
| 297 | public OFBsnVportL2Gre.Builder setTtl(short ttl) { |
| 298 | this.ttl = ttl; |
| 299 | this.ttlSet = true; |
| 300 | return this; |
| 301 | } |
| 302 | @Override |
| 303 | public long getVpn() { |
| 304 | return vpn; |
| 305 | } |
| 306 | |
| 307 | @Override |
| 308 | public OFBsnVportL2Gre.Builder setVpn(long vpn) { |
| 309 | this.vpn = vpn; |
| 310 | this.vpnSet = true; |
| 311 | return this; |
| 312 | } |
| 313 | @Override |
| 314 | public long getRateLimit() { |
| 315 | return rateLimit; |
| 316 | } |
| 317 | |
| 318 | @Override |
| 319 | public OFBsnVportL2Gre.Builder setRateLimit(long rateLimit) { |
| 320 | this.rateLimit = rateLimit; |
| 321 | this.rateLimitSet = true; |
| 322 | return this; |
| 323 | } |
| 324 | @Override |
| 325 | public String getIfName() { |
| 326 | return ifName; |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public OFBsnVportL2Gre.Builder setIfName(String ifName) { |
| 331 | this.ifName = ifName; |
| 332 | this.ifNameSet = true; |
| 333 | return this; |
| 334 | } |
| 335 | @Override |
| 336 | public OFVersion getVersion() { |
| 337 | return OFVersion.OF_11; |
| 338 | } |
| 339 | |
| 340 | |
| 341 | |
| 342 | @Override |
| 343 | public OFBsnVportL2Gre build() { |
| 344 | Set<OFBsnVportL2GreFlags> flags = this.flagsSet ? this.flags : parentMessage.flags; |
| 345 | if(flags == null) |
| 346 | throw new NullPointerException("Property flags must not be null"); |
| 347 | OFPort portNo = this.portNoSet ? this.portNo : parentMessage.portNo; |
| 348 | if(portNo == null) |
| 349 | throw new NullPointerException("Property portNo must not be null"); |
| 350 | OFPort loopbackPortNo = this.loopbackPortNoSet ? this.loopbackPortNo : parentMessage.loopbackPortNo; |
| 351 | if(loopbackPortNo == null) |
| 352 | throw new NullPointerException("Property loopbackPortNo must not be null"); |
| 353 | MacAddress localMac = this.localMacSet ? this.localMac : parentMessage.localMac; |
| 354 | if(localMac == null) |
| 355 | throw new NullPointerException("Property localMac must not be null"); |
| 356 | MacAddress nhMac = this.nhMacSet ? this.nhMac : parentMessage.nhMac; |
| 357 | if(nhMac == null) |
| 358 | throw new NullPointerException("Property nhMac must not be null"); |
| 359 | IPv4Address srcIp = this.srcIpSet ? this.srcIp : parentMessage.srcIp; |
| 360 | if(srcIp == null) |
| 361 | throw new NullPointerException("Property srcIp must not be null"); |
| 362 | IPv4Address dstIp = this.dstIpSet ? this.dstIp : parentMessage.dstIp; |
| 363 | if(dstIp == null) |
| 364 | throw new NullPointerException("Property dstIp must not be null"); |
| 365 | short dscp = this.dscpSet ? this.dscp : parentMessage.dscp; |
| 366 | short ttl = this.ttlSet ? this.ttl : parentMessage.ttl; |
| 367 | long vpn = this.vpnSet ? this.vpn : parentMessage.vpn; |
| 368 | long rateLimit = this.rateLimitSet ? this.rateLimit : parentMessage.rateLimit; |
| 369 | String ifName = this.ifNameSet ? this.ifName : parentMessage.ifName; |
| 370 | if(ifName == null) |
| 371 | throw new NullPointerException("Property ifName must not be null"); |
| 372 | |
| 373 | // |
| 374 | return new OFBsnVportL2GreVer11( |
| 375 | flags, |
| 376 | portNo, |
| 377 | loopbackPortNo, |
| 378 | localMac, |
| 379 | nhMac, |
| 380 | srcIp, |
| 381 | dstIp, |
| 382 | dscp, |
| 383 | ttl, |
| 384 | vpn, |
| 385 | rateLimit, |
| 386 | ifName |
| 387 | ); |
| 388 | } |
| 389 | |
| 390 | } |
| 391 | |
| 392 | static class Builder implements OFBsnVportL2Gre.Builder { |
| 393 | // OF message fields |
| 394 | private boolean flagsSet; |
| 395 | private Set<OFBsnVportL2GreFlags> flags; |
| 396 | private boolean portNoSet; |
| 397 | private OFPort portNo; |
| 398 | private boolean loopbackPortNoSet; |
| 399 | private OFPort loopbackPortNo; |
| 400 | private boolean localMacSet; |
| 401 | private MacAddress localMac; |
| 402 | private boolean nhMacSet; |
| 403 | private MacAddress nhMac; |
| 404 | private boolean srcIpSet; |
| 405 | private IPv4Address srcIp; |
| 406 | private boolean dstIpSet; |
| 407 | private IPv4Address dstIp; |
| 408 | private boolean dscpSet; |
| 409 | private short dscp; |
| 410 | private boolean ttlSet; |
| 411 | private short ttl; |
| 412 | private boolean vpnSet; |
| 413 | private long vpn; |
| 414 | private boolean rateLimitSet; |
| 415 | private long rateLimit; |
| 416 | private boolean ifNameSet; |
| 417 | private String ifName; |
| 418 | |
| 419 | @Override |
| 420 | public int getType() { |
| 421 | return 0x1; |
| 422 | } |
| 423 | |
| 424 | @Override |
| 425 | public Set<OFBsnVportL2GreFlags> getFlags() { |
| 426 | return flags; |
| 427 | } |
| 428 | |
| 429 | @Override |
| 430 | public OFBsnVportL2Gre.Builder setFlags(Set<OFBsnVportL2GreFlags> flags) { |
| 431 | this.flags = flags; |
| 432 | this.flagsSet = true; |
| 433 | return this; |
| 434 | } |
| 435 | @Override |
| 436 | public OFPort getPortNo() { |
| 437 | return portNo; |
| 438 | } |
| 439 | |
| 440 | @Override |
| 441 | public OFBsnVportL2Gre.Builder setPortNo(OFPort portNo) { |
| 442 | this.portNo = portNo; |
| 443 | this.portNoSet = true; |
| 444 | return this; |
| 445 | } |
| 446 | @Override |
| 447 | public OFPort getLoopbackPortNo() { |
| 448 | return loopbackPortNo; |
| 449 | } |
| 450 | |
| 451 | @Override |
| 452 | public OFBsnVportL2Gre.Builder setLoopbackPortNo(OFPort loopbackPortNo) { |
| 453 | this.loopbackPortNo = loopbackPortNo; |
| 454 | this.loopbackPortNoSet = true; |
| 455 | return this; |
| 456 | } |
| 457 | @Override |
| 458 | public MacAddress getLocalMac() { |
| 459 | return localMac; |
| 460 | } |
| 461 | |
| 462 | @Override |
| 463 | public OFBsnVportL2Gre.Builder setLocalMac(MacAddress localMac) { |
| 464 | this.localMac = localMac; |
| 465 | this.localMacSet = true; |
| 466 | return this; |
| 467 | } |
| 468 | @Override |
| 469 | public MacAddress getNhMac() { |
| 470 | return nhMac; |
| 471 | } |
| 472 | |
| 473 | @Override |
| 474 | public OFBsnVportL2Gre.Builder setNhMac(MacAddress nhMac) { |
| 475 | this.nhMac = nhMac; |
| 476 | this.nhMacSet = true; |
| 477 | return this; |
| 478 | } |
| 479 | @Override |
| 480 | public IPv4Address getSrcIp() { |
| 481 | return srcIp; |
| 482 | } |
| 483 | |
| 484 | @Override |
| 485 | public OFBsnVportL2Gre.Builder setSrcIp(IPv4Address srcIp) { |
| 486 | this.srcIp = srcIp; |
| 487 | this.srcIpSet = true; |
| 488 | return this; |
| 489 | } |
| 490 | @Override |
| 491 | public IPv4Address getDstIp() { |
| 492 | return dstIp; |
| 493 | } |
| 494 | |
| 495 | @Override |
| 496 | public OFBsnVportL2Gre.Builder setDstIp(IPv4Address dstIp) { |
| 497 | this.dstIp = dstIp; |
| 498 | this.dstIpSet = true; |
| 499 | return this; |
| 500 | } |
| 501 | @Override |
| 502 | public short getDscp() { |
| 503 | return dscp; |
| 504 | } |
| 505 | |
| 506 | @Override |
| 507 | public OFBsnVportL2Gre.Builder setDscp(short dscp) { |
| 508 | this.dscp = dscp; |
| 509 | this.dscpSet = true; |
| 510 | return this; |
| 511 | } |
| 512 | @Override |
| 513 | public short getTtl() { |
| 514 | return ttl; |
| 515 | } |
| 516 | |
| 517 | @Override |
| 518 | public OFBsnVportL2Gre.Builder setTtl(short ttl) { |
| 519 | this.ttl = ttl; |
| 520 | this.ttlSet = true; |
| 521 | return this; |
| 522 | } |
| 523 | @Override |
| 524 | public long getVpn() { |
| 525 | return vpn; |
| 526 | } |
| 527 | |
| 528 | @Override |
| 529 | public OFBsnVportL2Gre.Builder setVpn(long vpn) { |
| 530 | this.vpn = vpn; |
| 531 | this.vpnSet = true; |
| 532 | return this; |
| 533 | } |
| 534 | @Override |
| 535 | public long getRateLimit() { |
| 536 | return rateLimit; |
| 537 | } |
| 538 | |
| 539 | @Override |
| 540 | public OFBsnVportL2Gre.Builder setRateLimit(long rateLimit) { |
| 541 | this.rateLimit = rateLimit; |
| 542 | this.rateLimitSet = true; |
| 543 | return this; |
| 544 | } |
| 545 | @Override |
| 546 | public String getIfName() { |
| 547 | return ifName; |
| 548 | } |
| 549 | |
| 550 | @Override |
| 551 | public OFBsnVportL2Gre.Builder setIfName(String ifName) { |
| 552 | this.ifName = ifName; |
| 553 | this.ifNameSet = true; |
| 554 | return this; |
| 555 | } |
| 556 | @Override |
| 557 | public OFVersion getVersion() { |
| 558 | return OFVersion.OF_11; |
| 559 | } |
| 560 | |
| 561 | // |
| 562 | @Override |
| 563 | public OFBsnVportL2Gre build() { |
| 564 | Set<OFBsnVportL2GreFlags> flags = this.flagsSet ? this.flags : DEFAULT_FLAGS; |
| 565 | if(flags == null) |
| 566 | throw new NullPointerException("Property flags must not be null"); |
| 567 | OFPort portNo = this.portNoSet ? this.portNo : DEFAULT_PORT_NO; |
| 568 | if(portNo == null) |
| 569 | throw new NullPointerException("Property portNo must not be null"); |
| 570 | OFPort loopbackPortNo = this.loopbackPortNoSet ? this.loopbackPortNo : DEFAULT_LOOPBACK_PORT_NO; |
| 571 | if(loopbackPortNo == null) |
| 572 | throw new NullPointerException("Property loopbackPortNo must not be null"); |
| 573 | MacAddress localMac = this.localMacSet ? this.localMac : DEFAULT_LOCAL_MAC; |
| 574 | if(localMac == null) |
| 575 | throw new NullPointerException("Property localMac must not be null"); |
| 576 | MacAddress nhMac = this.nhMacSet ? this.nhMac : DEFAULT_NH_MAC; |
| 577 | if(nhMac == null) |
| 578 | throw new NullPointerException("Property nhMac must not be null"); |
| 579 | IPv4Address srcIp = this.srcIpSet ? this.srcIp : DEFAULT_SRC_IP; |
| 580 | if(srcIp == null) |
| 581 | throw new NullPointerException("Property srcIp must not be null"); |
| 582 | IPv4Address dstIp = this.dstIpSet ? this.dstIp : DEFAULT_DST_IP; |
| 583 | if(dstIp == null) |
| 584 | throw new NullPointerException("Property dstIp must not be null"); |
| 585 | short dscp = this.dscpSet ? this.dscp : DEFAULT_DSCP; |
| 586 | short ttl = this.ttlSet ? this.ttl : DEFAULT_TTL; |
| 587 | long vpn = this.vpnSet ? this.vpn : DEFAULT_VPN; |
| 588 | long rateLimit = this.rateLimitSet ? this.rateLimit : DEFAULT_RATE_LIMIT; |
| 589 | String ifName = this.ifNameSet ? this.ifName : DEFAULT_IF_NAME; |
| 590 | if(ifName == null) |
| 591 | throw new NullPointerException("Property ifName must not be null"); |
| 592 | |
| 593 | |
| 594 | return new OFBsnVportL2GreVer11( |
| 595 | flags, |
| 596 | portNo, |
| 597 | loopbackPortNo, |
| 598 | localMac, |
| 599 | nhMac, |
| 600 | srcIp, |
| 601 | dstIp, |
| 602 | dscp, |
| 603 | ttl, |
| 604 | vpn, |
| 605 | rateLimit, |
| 606 | ifName |
| 607 | ); |
| 608 | } |
| 609 | |
| 610 | } |
| 611 | |
| 612 | |
| 613 | final static Reader READER = new Reader(); |
| 614 | static class Reader implements OFMessageReader<OFBsnVportL2Gre> { |
| 615 | @Override |
| 616 | public OFBsnVportL2Gre readFrom(ChannelBuffer bb) throws OFParseError { |
| 617 | int start = bb.readerIndex(); |
| 618 | // fixed value property type == 0x1 |
| 619 | short type = bb.readShort(); |
| 620 | if(type != (short) 0x1) |
| 621 | throw new OFParseError("Wrong type: Expected=0x1(0x1), got="+type); |
| 622 | int length = U16.f(bb.readShort()); |
| 623 | if(length != 64) |
| 624 | throw new OFParseError("Wrong length: Expected=64(64), got="+length); |
| 625 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 626 | // Buffer does not have all data yet |
| 627 | bb.readerIndex(start); |
| 628 | return null; |
| 629 | } |
| 630 | if(logger.isTraceEnabled()) |
| 631 | logger.trace("readFrom - length={}", length); |
| 632 | Set<OFBsnVportL2GreFlags> flags = OFBsnVportL2GreFlagsSerializerVer11.readFrom(bb); |
| 633 | OFPort portNo = OFPort.read4Bytes(bb); |
| 634 | OFPort loopbackPortNo = OFPort.read4Bytes(bb); |
| 635 | MacAddress localMac = MacAddress.read6Bytes(bb); |
| 636 | MacAddress nhMac = MacAddress.read6Bytes(bb); |
| 637 | IPv4Address srcIp = IPv4Address.read4Bytes(bb); |
| 638 | IPv4Address dstIp = IPv4Address.read4Bytes(bb); |
| 639 | short dscp = U8.f(bb.readByte()); |
| 640 | short ttl = U8.f(bb.readByte()); |
| 641 | // pad: 2 bytes |
| 642 | bb.skipBytes(2); |
| 643 | long vpn = U32.f(bb.readInt()); |
| 644 | long rateLimit = U32.f(bb.readInt()); |
| 645 | String ifName = ChannelUtils.readFixedLengthString(bb, 16); |
| 646 | |
| 647 | OFBsnVportL2GreVer11 bsnVportL2GreVer11 = new OFBsnVportL2GreVer11( |
| 648 | flags, |
| 649 | portNo, |
| 650 | loopbackPortNo, |
| 651 | localMac, |
| 652 | nhMac, |
| 653 | srcIp, |
| 654 | dstIp, |
| 655 | dscp, |
| 656 | ttl, |
| 657 | vpn, |
| 658 | rateLimit, |
| 659 | ifName |
| 660 | ); |
| 661 | if(logger.isTraceEnabled()) |
| 662 | logger.trace("readFrom - read={}", bsnVportL2GreVer11); |
| 663 | return bsnVportL2GreVer11; |
| 664 | } |
| 665 | } |
| 666 | |
| 667 | public void putTo(PrimitiveSink sink) { |
| 668 | FUNNEL.funnel(this, sink); |
| 669 | } |
| 670 | |
| 671 | final static OFBsnVportL2GreVer11Funnel FUNNEL = new OFBsnVportL2GreVer11Funnel(); |
| 672 | static class OFBsnVportL2GreVer11Funnel implements Funnel<OFBsnVportL2GreVer11> { |
| 673 | private static final long serialVersionUID = 1L; |
| 674 | @Override |
| 675 | public void funnel(OFBsnVportL2GreVer11 message, PrimitiveSink sink) { |
| 676 | // fixed value property type = 0x1 |
| 677 | sink.putShort((short) 0x1); |
| 678 | // fixed value property length = 64 |
| 679 | sink.putShort((short) 0x40); |
| 680 | OFBsnVportL2GreFlagsSerializerVer11.putTo(message.flags, sink); |
| 681 | message.portNo.putTo(sink); |
| 682 | message.loopbackPortNo.putTo(sink); |
| 683 | message.localMac.putTo(sink); |
| 684 | message.nhMac.putTo(sink); |
| 685 | message.srcIp.putTo(sink); |
| 686 | message.dstIp.putTo(sink); |
| 687 | sink.putShort(message.dscp); |
| 688 | sink.putShort(message.ttl); |
| 689 | // skip pad (2 bytes) |
| 690 | sink.putLong(message.vpn); |
| 691 | sink.putLong(message.rateLimit); |
| 692 | sink.putUnencodedChars(message.ifName); |
| 693 | } |
| 694 | } |
| 695 | |
| 696 | |
| 697 | public void writeTo(ChannelBuffer bb) { |
| 698 | WRITER.write(bb, this); |
| 699 | } |
| 700 | |
| 701 | final static Writer WRITER = new Writer(); |
| 702 | static class Writer implements OFMessageWriter<OFBsnVportL2GreVer11> { |
| 703 | @Override |
| 704 | public void write(ChannelBuffer bb, OFBsnVportL2GreVer11 message) { |
| 705 | // fixed value property type = 0x1 |
| 706 | bb.writeShort((short) 0x1); |
| 707 | // fixed value property length = 64 |
| 708 | bb.writeShort((short) 0x40); |
| 709 | OFBsnVportL2GreFlagsSerializerVer11.writeTo(bb, message.flags); |
| 710 | message.portNo.write4Bytes(bb); |
| 711 | message.loopbackPortNo.write4Bytes(bb); |
| 712 | message.localMac.write6Bytes(bb); |
| 713 | message.nhMac.write6Bytes(bb); |
| 714 | message.srcIp.write4Bytes(bb); |
| 715 | message.dstIp.write4Bytes(bb); |
| 716 | bb.writeByte(U8.t(message.dscp)); |
| 717 | bb.writeByte(U8.t(message.ttl)); |
| 718 | // pad: 2 bytes |
| 719 | bb.writeZero(2); |
| 720 | bb.writeInt(U32.t(message.vpn)); |
| 721 | bb.writeInt(U32.t(message.rateLimit)); |
| 722 | ChannelUtils.writeFixedLengthString(bb, message.ifName, 16); |
| 723 | |
| 724 | |
| 725 | } |
| 726 | } |
| 727 | |
| 728 | @Override |
| 729 | public String toString() { |
| 730 | StringBuilder b = new StringBuilder("OFBsnVportL2GreVer11("); |
| 731 | b.append("flags=").append(flags); |
| 732 | b.append(", "); |
| 733 | b.append("portNo=").append(portNo); |
| 734 | b.append(", "); |
| 735 | b.append("loopbackPortNo=").append(loopbackPortNo); |
| 736 | b.append(", "); |
| 737 | b.append("localMac=").append(localMac); |
| 738 | b.append(", "); |
| 739 | b.append("nhMac=").append(nhMac); |
| 740 | b.append(", "); |
| 741 | b.append("srcIp=").append(srcIp); |
| 742 | b.append(", "); |
| 743 | b.append("dstIp=").append(dstIp); |
| 744 | b.append(", "); |
| 745 | b.append("dscp=").append(dscp); |
| 746 | b.append(", "); |
| 747 | b.append("ttl=").append(ttl); |
| 748 | b.append(", "); |
| 749 | b.append("vpn=").append(vpn); |
| 750 | b.append(", "); |
| 751 | b.append("rateLimit=").append(rateLimit); |
| 752 | b.append(", "); |
| 753 | b.append("ifName=").append(ifName); |
| 754 | b.append(")"); |
| 755 | return b.toString(); |
| 756 | } |
| 757 | |
| 758 | @Override |
| 759 | public boolean equals(Object obj) { |
| 760 | if (this == obj) |
| 761 | return true; |
| 762 | if (obj == null) |
| 763 | return false; |
| 764 | if (getClass() != obj.getClass()) |
| 765 | return false; |
| 766 | OFBsnVportL2GreVer11 other = (OFBsnVportL2GreVer11) obj; |
| 767 | |
| 768 | if (flags == null) { |
| 769 | if (other.flags != null) |
| 770 | return false; |
| 771 | } else if (!flags.equals(other.flags)) |
| 772 | return false; |
| 773 | if (portNo == null) { |
| 774 | if (other.portNo != null) |
| 775 | return false; |
| 776 | } else if (!portNo.equals(other.portNo)) |
| 777 | return false; |
| 778 | if (loopbackPortNo == null) { |
| 779 | if (other.loopbackPortNo != null) |
| 780 | return false; |
| 781 | } else if (!loopbackPortNo.equals(other.loopbackPortNo)) |
| 782 | return false; |
| 783 | if (localMac == null) { |
| 784 | if (other.localMac != null) |
| 785 | return false; |
| 786 | } else if (!localMac.equals(other.localMac)) |
| 787 | return false; |
| 788 | if (nhMac == null) { |
| 789 | if (other.nhMac != null) |
| 790 | return false; |
| 791 | } else if (!nhMac.equals(other.nhMac)) |
| 792 | return false; |
| 793 | if (srcIp == null) { |
| 794 | if (other.srcIp != null) |
| 795 | return false; |
| 796 | } else if (!srcIp.equals(other.srcIp)) |
| 797 | return false; |
| 798 | if (dstIp == null) { |
| 799 | if (other.dstIp != null) |
| 800 | return false; |
| 801 | } else if (!dstIp.equals(other.dstIp)) |
| 802 | return false; |
| 803 | if( dscp != other.dscp) |
| 804 | return false; |
| 805 | if( ttl != other.ttl) |
| 806 | return false; |
| 807 | if( vpn != other.vpn) |
| 808 | return false; |
| 809 | if( rateLimit != other.rateLimit) |
| 810 | return false; |
| 811 | if (ifName == null) { |
| 812 | if (other.ifName != null) |
| 813 | return false; |
| 814 | } else if (!ifName.equals(other.ifName)) |
| 815 | return false; |
| 816 | return true; |
| 817 | } |
| 818 | |
| 819 | @Override |
| 820 | public int hashCode() { |
| 821 | final int prime = 31; |
| 822 | int result = 1; |
| 823 | |
| 824 | result = prime * result + ((flags == null) ? 0 : flags.hashCode()); |
| 825 | result = prime * result + ((portNo == null) ? 0 : portNo.hashCode()); |
| 826 | result = prime * result + ((loopbackPortNo == null) ? 0 : loopbackPortNo.hashCode()); |
| 827 | result = prime * result + ((localMac == null) ? 0 : localMac.hashCode()); |
| 828 | result = prime * result + ((nhMac == null) ? 0 : nhMac.hashCode()); |
| 829 | result = prime * result + ((srcIp == null) ? 0 : srcIp.hashCode()); |
| 830 | result = prime * result + ((dstIp == null) ? 0 : dstIp.hashCode()); |
| 831 | result = prime * result + dscp; |
| 832 | result = prime * result + ttl; |
| 833 | result = prime * (int) (vpn ^ (vpn >>> 32)); |
| 834 | result = prime * (int) (rateLimit ^ (rateLimit >>> 32)); |
| 835 | result = prime * result + ((ifName == null) ? 0 : ifName.hashCode()); |
| 836 | return result; |
| 837 | } |
| 838 | |
| 839 | } |