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.ver12; |
| 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 java.util.List; |
| 31 | import com.google.common.collect.ImmutableList; |
| 32 | import org.jboss.netty.buffer.ChannelBuffer; |
| 33 | import com.google.common.hash.PrimitiveSink; |
| 34 | import com.google.common.hash.Funnel; |
| 35 | |
| 36 | class OFFeaturesReplyVer12 implements OFFeaturesReply { |
| 37 | private static final Logger logger = LoggerFactory.getLogger(OFFeaturesReplyVer12.class); |
| 38 | // version: 1.2 |
| 39 | final static byte WIRE_VERSION = 3; |
| 40 | final static int MINIMUM_LENGTH = 32; |
| 41 | |
| 42 | private final static long DEFAULT_XID = 0x0L; |
| 43 | private final static DatapathId DEFAULT_DATAPATH_ID = DatapathId.NONE; |
| 44 | private final static long DEFAULT_N_BUFFERS = 0x0L; |
| 45 | private final static short DEFAULT_N_TABLES = (short) 0x0; |
| 46 | private final static Set<OFCapabilities> DEFAULT_CAPABILITIES = ImmutableSet.<OFCapabilities>of(); |
| 47 | private final static long DEFAULT_RESERVED = 0x0L; |
| 48 | private final static List<OFPortDesc> DEFAULT_PORTS = ImmutableList.<OFPortDesc>of(); |
| 49 | |
| 50 | // OF message fields |
| 51 | private final long xid; |
| 52 | private final DatapathId datapathId; |
| 53 | private final long nBuffers; |
| 54 | private final short nTables; |
| 55 | private final Set<OFCapabilities> capabilities; |
| 56 | private final long reserved; |
| 57 | private final List<OFPortDesc> ports; |
| 58 | // |
| 59 | // Immutable default instance |
| 60 | final static OFFeaturesReplyVer12 DEFAULT = new OFFeaturesReplyVer12( |
| 61 | DEFAULT_XID, DEFAULT_DATAPATH_ID, DEFAULT_N_BUFFERS, DEFAULT_N_TABLES, DEFAULT_CAPABILITIES, DEFAULT_RESERVED, DEFAULT_PORTS |
| 62 | ); |
| 63 | |
| 64 | // package private constructor - used by readers, builders, and factory |
| 65 | OFFeaturesReplyVer12(long xid, DatapathId datapathId, long nBuffers, short nTables, Set<OFCapabilities> capabilities, long reserved, List<OFPortDesc> ports) { |
| 66 | this.xid = xid; |
| 67 | this.datapathId = datapathId; |
| 68 | this.nBuffers = nBuffers; |
| 69 | this.nTables = nTables; |
| 70 | this.capabilities = capabilities; |
| 71 | this.reserved = reserved; |
| 72 | this.ports = ports; |
| 73 | } |
| 74 | |
| 75 | // Accessors for OF message fields |
| 76 | @Override |
| 77 | public OFVersion getVersion() { |
| 78 | return OFVersion.OF_12; |
| 79 | } |
| 80 | |
| 81 | @Override |
| 82 | public OFType getType() { |
| 83 | return OFType.FEATURES_REPLY; |
| 84 | } |
| 85 | |
| 86 | @Override |
| 87 | public long getXid() { |
| 88 | return xid; |
| 89 | } |
| 90 | |
| 91 | @Override |
| 92 | public DatapathId getDatapathId() { |
| 93 | return datapathId; |
| 94 | } |
| 95 | |
| 96 | @Override |
| 97 | public long getNBuffers() { |
| 98 | return nBuffers; |
| 99 | } |
| 100 | |
| 101 | @Override |
| 102 | public short getNTables() { |
| 103 | return nTables; |
| 104 | } |
| 105 | |
| 106 | @Override |
| 107 | public Set<OFCapabilities> getCapabilities() { |
| 108 | return capabilities; |
| 109 | } |
| 110 | |
| 111 | @Override |
| 112 | public long getReserved() { |
| 113 | return reserved; |
| 114 | } |
| 115 | |
| 116 | @Override |
| 117 | public List<OFPortDesc> getPorts() { |
| 118 | return ports; |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public Set<OFActionType> getActions()throws UnsupportedOperationException { |
| 123 | throw new UnsupportedOperationException("Property actions not supported in version 1.2"); |
| 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 128 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.2"); |
| 129 | } |
| 130 | |
| 131 | |
| 132 | |
| 133 | public OFFeaturesReply.Builder createBuilder() { |
| 134 | return new BuilderWithParent(this); |
| 135 | } |
| 136 | |
| 137 | static class BuilderWithParent implements OFFeaturesReply.Builder { |
| 138 | final OFFeaturesReplyVer12 parentMessage; |
| 139 | |
| 140 | // OF message fields |
| 141 | private boolean xidSet; |
| 142 | private long xid; |
| 143 | private boolean datapathIdSet; |
| 144 | private DatapathId datapathId; |
| 145 | private boolean nBuffersSet; |
| 146 | private long nBuffers; |
| 147 | private boolean nTablesSet; |
| 148 | private short nTables; |
| 149 | private boolean capabilitiesSet; |
| 150 | private Set<OFCapabilities> capabilities; |
| 151 | private boolean reservedSet; |
| 152 | private long reserved; |
| 153 | private boolean portsSet; |
| 154 | private List<OFPortDesc> ports; |
| 155 | |
| 156 | BuilderWithParent(OFFeaturesReplyVer12 parentMessage) { |
| 157 | this.parentMessage = parentMessage; |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public OFVersion getVersion() { |
| 162 | return OFVersion.OF_12; |
| 163 | } |
| 164 | |
| 165 | @Override |
| 166 | public OFType getType() { |
| 167 | return OFType.FEATURES_REPLY; |
| 168 | } |
| 169 | |
| 170 | @Override |
| 171 | public long getXid() { |
| 172 | return xid; |
| 173 | } |
| 174 | |
| 175 | @Override |
| 176 | public OFFeaturesReply.Builder setXid(long xid) { |
| 177 | this.xid = xid; |
| 178 | this.xidSet = true; |
| 179 | return this; |
| 180 | } |
| 181 | @Override |
| 182 | public DatapathId getDatapathId() { |
| 183 | return datapathId; |
| 184 | } |
| 185 | |
| 186 | @Override |
| 187 | public OFFeaturesReply.Builder setDatapathId(DatapathId datapathId) { |
| 188 | this.datapathId = datapathId; |
| 189 | this.datapathIdSet = true; |
| 190 | return this; |
| 191 | } |
| 192 | @Override |
| 193 | public long getNBuffers() { |
| 194 | return nBuffers; |
| 195 | } |
| 196 | |
| 197 | @Override |
| 198 | public OFFeaturesReply.Builder setNBuffers(long nBuffers) { |
| 199 | this.nBuffers = nBuffers; |
| 200 | this.nBuffersSet = true; |
| 201 | return this; |
| 202 | } |
| 203 | @Override |
| 204 | public short getNTables() { |
| 205 | return nTables; |
| 206 | } |
| 207 | |
| 208 | @Override |
| 209 | public OFFeaturesReply.Builder setNTables(short nTables) { |
| 210 | this.nTables = nTables; |
| 211 | this.nTablesSet = true; |
| 212 | return this; |
| 213 | } |
| 214 | @Override |
| 215 | public Set<OFCapabilities> getCapabilities() { |
| 216 | return capabilities; |
| 217 | } |
| 218 | |
| 219 | @Override |
| 220 | public OFFeaturesReply.Builder setCapabilities(Set<OFCapabilities> capabilities) { |
| 221 | this.capabilities = capabilities; |
| 222 | this.capabilitiesSet = true; |
| 223 | return this; |
| 224 | } |
| 225 | @Override |
| 226 | public long getReserved() { |
| 227 | return reserved; |
| 228 | } |
| 229 | |
| 230 | @Override |
| 231 | public OFFeaturesReply.Builder setReserved(long reserved) { |
| 232 | this.reserved = reserved; |
| 233 | this.reservedSet = true; |
| 234 | return this; |
| 235 | } |
| 236 | @Override |
| 237 | public List<OFPortDesc> getPorts() { |
| 238 | return ports; |
| 239 | } |
| 240 | |
| 241 | @Override |
| 242 | public OFFeaturesReply.Builder setPorts(List<OFPortDesc> ports) { |
| 243 | this.ports = ports; |
| 244 | this.portsSet = true; |
| 245 | return this; |
| 246 | } |
| 247 | @Override |
| 248 | public Set<OFActionType> getActions()throws UnsupportedOperationException { |
| 249 | throw new UnsupportedOperationException("Property actions not supported in version 1.2"); |
| 250 | } |
| 251 | |
| 252 | @Override |
| 253 | public OFFeaturesReply.Builder setActions(Set<OFActionType> actions) throws UnsupportedOperationException { |
| 254 | throw new UnsupportedOperationException("Property actions not supported in version 1.2"); |
| 255 | } |
| 256 | @Override |
| 257 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 258 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.2"); |
| 259 | } |
| 260 | |
| 261 | @Override |
| 262 | public OFFeaturesReply.Builder setAuxiliaryId(OFAuxId auxiliaryId) throws UnsupportedOperationException { |
| 263 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.2"); |
| 264 | } |
| 265 | |
| 266 | |
| 267 | @Override |
| 268 | public OFFeaturesReply build() { |
| 269 | long xid = this.xidSet ? this.xid : parentMessage.xid; |
| 270 | DatapathId datapathId = this.datapathIdSet ? this.datapathId : parentMessage.datapathId; |
| 271 | if(datapathId == null) |
| 272 | throw new NullPointerException("Property datapathId must not be null"); |
| 273 | long nBuffers = this.nBuffersSet ? this.nBuffers : parentMessage.nBuffers; |
| 274 | short nTables = this.nTablesSet ? this.nTables : parentMessage.nTables; |
| 275 | Set<OFCapabilities> capabilities = this.capabilitiesSet ? this.capabilities : parentMessage.capabilities; |
| 276 | if(capabilities == null) |
| 277 | throw new NullPointerException("Property capabilities must not be null"); |
| 278 | long reserved = this.reservedSet ? this.reserved : parentMessage.reserved; |
| 279 | List<OFPortDesc> ports = this.portsSet ? this.ports : parentMessage.ports; |
| 280 | if(ports == null) |
| 281 | throw new NullPointerException("Property ports must not be null"); |
| 282 | |
| 283 | // |
| 284 | return new OFFeaturesReplyVer12( |
| 285 | xid, |
| 286 | datapathId, |
| 287 | nBuffers, |
| 288 | nTables, |
| 289 | capabilities, |
| 290 | reserved, |
| 291 | ports |
| 292 | ); |
| 293 | } |
| 294 | |
| 295 | } |
| 296 | |
| 297 | static class Builder implements OFFeaturesReply.Builder { |
| 298 | // OF message fields |
| 299 | private boolean xidSet; |
| 300 | private long xid; |
| 301 | private boolean datapathIdSet; |
| 302 | private DatapathId datapathId; |
| 303 | private boolean nBuffersSet; |
| 304 | private long nBuffers; |
| 305 | private boolean nTablesSet; |
| 306 | private short nTables; |
| 307 | private boolean capabilitiesSet; |
| 308 | private Set<OFCapabilities> capabilities; |
| 309 | private boolean reservedSet; |
| 310 | private long reserved; |
| 311 | private boolean portsSet; |
| 312 | private List<OFPortDesc> ports; |
| 313 | |
| 314 | @Override |
| 315 | public OFVersion getVersion() { |
| 316 | return OFVersion.OF_12; |
| 317 | } |
| 318 | |
| 319 | @Override |
| 320 | public OFType getType() { |
| 321 | return OFType.FEATURES_REPLY; |
| 322 | } |
| 323 | |
| 324 | @Override |
| 325 | public long getXid() { |
| 326 | return xid; |
| 327 | } |
| 328 | |
| 329 | @Override |
| 330 | public OFFeaturesReply.Builder setXid(long xid) { |
| 331 | this.xid = xid; |
| 332 | this.xidSet = true; |
| 333 | return this; |
| 334 | } |
| 335 | @Override |
| 336 | public DatapathId getDatapathId() { |
| 337 | return datapathId; |
| 338 | } |
| 339 | |
| 340 | @Override |
| 341 | public OFFeaturesReply.Builder setDatapathId(DatapathId datapathId) { |
| 342 | this.datapathId = datapathId; |
| 343 | this.datapathIdSet = true; |
| 344 | return this; |
| 345 | } |
| 346 | @Override |
| 347 | public long getNBuffers() { |
| 348 | return nBuffers; |
| 349 | } |
| 350 | |
| 351 | @Override |
| 352 | public OFFeaturesReply.Builder setNBuffers(long nBuffers) { |
| 353 | this.nBuffers = nBuffers; |
| 354 | this.nBuffersSet = true; |
| 355 | return this; |
| 356 | } |
| 357 | @Override |
| 358 | public short getNTables() { |
| 359 | return nTables; |
| 360 | } |
| 361 | |
| 362 | @Override |
| 363 | public OFFeaturesReply.Builder setNTables(short nTables) { |
| 364 | this.nTables = nTables; |
| 365 | this.nTablesSet = true; |
| 366 | return this; |
| 367 | } |
| 368 | @Override |
| 369 | public Set<OFCapabilities> getCapabilities() { |
| 370 | return capabilities; |
| 371 | } |
| 372 | |
| 373 | @Override |
| 374 | public OFFeaturesReply.Builder setCapabilities(Set<OFCapabilities> capabilities) { |
| 375 | this.capabilities = capabilities; |
| 376 | this.capabilitiesSet = true; |
| 377 | return this; |
| 378 | } |
| 379 | @Override |
| 380 | public long getReserved() { |
| 381 | return reserved; |
| 382 | } |
| 383 | |
| 384 | @Override |
| 385 | public OFFeaturesReply.Builder setReserved(long reserved) { |
| 386 | this.reserved = reserved; |
| 387 | this.reservedSet = true; |
| 388 | return this; |
| 389 | } |
| 390 | @Override |
| 391 | public List<OFPortDesc> getPorts() { |
| 392 | return ports; |
| 393 | } |
| 394 | |
| 395 | @Override |
| 396 | public OFFeaturesReply.Builder setPorts(List<OFPortDesc> ports) { |
| 397 | this.ports = ports; |
| 398 | this.portsSet = true; |
| 399 | return this; |
| 400 | } |
| 401 | @Override |
| 402 | public Set<OFActionType> getActions()throws UnsupportedOperationException { |
| 403 | throw new UnsupportedOperationException("Property actions not supported in version 1.2"); |
| 404 | } |
| 405 | |
| 406 | @Override |
| 407 | public OFFeaturesReply.Builder setActions(Set<OFActionType> actions) throws UnsupportedOperationException { |
| 408 | throw new UnsupportedOperationException("Property actions not supported in version 1.2"); |
| 409 | } |
| 410 | @Override |
| 411 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 412 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.2"); |
| 413 | } |
| 414 | |
| 415 | @Override |
| 416 | public OFFeaturesReply.Builder setAuxiliaryId(OFAuxId auxiliaryId) throws UnsupportedOperationException { |
| 417 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.2"); |
| 418 | } |
| 419 | // |
| 420 | @Override |
| 421 | public OFFeaturesReply build() { |
| 422 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 423 | DatapathId datapathId = this.datapathIdSet ? this.datapathId : DEFAULT_DATAPATH_ID; |
| 424 | if(datapathId == null) |
| 425 | throw new NullPointerException("Property datapathId must not be null"); |
| 426 | long nBuffers = this.nBuffersSet ? this.nBuffers : DEFAULT_N_BUFFERS; |
| 427 | short nTables = this.nTablesSet ? this.nTables : DEFAULT_N_TABLES; |
| 428 | Set<OFCapabilities> capabilities = this.capabilitiesSet ? this.capabilities : DEFAULT_CAPABILITIES; |
| 429 | if(capabilities == null) |
| 430 | throw new NullPointerException("Property capabilities must not be null"); |
| 431 | long reserved = this.reservedSet ? this.reserved : DEFAULT_RESERVED; |
| 432 | List<OFPortDesc> ports = this.portsSet ? this.ports : DEFAULT_PORTS; |
| 433 | if(ports == null) |
| 434 | throw new NullPointerException("Property ports must not be null"); |
| 435 | |
| 436 | |
| 437 | return new OFFeaturesReplyVer12( |
| 438 | xid, |
| 439 | datapathId, |
| 440 | nBuffers, |
| 441 | nTables, |
| 442 | capabilities, |
| 443 | reserved, |
| 444 | ports |
| 445 | ); |
| 446 | } |
| 447 | |
| 448 | } |
| 449 | |
| 450 | |
| 451 | final static Reader READER = new Reader(); |
| 452 | static class Reader implements OFMessageReader<OFFeaturesReply> { |
| 453 | @Override |
| 454 | public OFFeaturesReply readFrom(ChannelBuffer bb) throws OFParseError { |
| 455 | int start = bb.readerIndex(); |
| 456 | // fixed value property version == 3 |
| 457 | byte version = bb.readByte(); |
| 458 | if(version != (byte) 0x3) |
| 459 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_12(3), got="+version); |
| 460 | // fixed value property type == 6 |
| 461 | byte type = bb.readByte(); |
| 462 | if(type != (byte) 0x6) |
| 463 | throw new OFParseError("Wrong type: Expected=OFType.FEATURES_REPLY(6), got="+type); |
| 464 | int length = U16.f(bb.readShort()); |
| 465 | if(length < MINIMUM_LENGTH) |
| 466 | throw new OFParseError("Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); |
| 467 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 468 | // Buffer does not have all data yet |
| 469 | bb.readerIndex(start); |
| 470 | return null; |
| 471 | } |
| 472 | if(logger.isTraceEnabled()) |
| 473 | logger.trace("readFrom - length={}", length); |
| 474 | long xid = U32.f(bb.readInt()); |
| 475 | DatapathId datapathId = DatapathId.of(bb.readLong()); |
| 476 | long nBuffers = U32.f(bb.readInt()); |
| 477 | short nTables = U8.f(bb.readByte()); |
| 478 | // pad: 3 bytes |
| 479 | bb.skipBytes(3); |
| 480 | Set<OFCapabilities> capabilities = OFCapabilitiesSerializerVer12.readFrom(bb); |
| 481 | long reserved = U32.f(bb.readInt()); |
| 482 | List<OFPortDesc> ports = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFPortDescVer12.READER); |
| 483 | |
| 484 | OFFeaturesReplyVer12 featuresReplyVer12 = new OFFeaturesReplyVer12( |
| 485 | xid, |
| 486 | datapathId, |
| 487 | nBuffers, |
| 488 | nTables, |
| 489 | capabilities, |
| 490 | reserved, |
| 491 | ports |
| 492 | ); |
| 493 | if(logger.isTraceEnabled()) |
| 494 | logger.trace("readFrom - read={}", featuresReplyVer12); |
| 495 | return featuresReplyVer12; |
| 496 | } |
| 497 | } |
| 498 | |
| 499 | public void putTo(PrimitiveSink sink) { |
| 500 | FUNNEL.funnel(this, sink); |
| 501 | } |
| 502 | |
| 503 | final static OFFeaturesReplyVer12Funnel FUNNEL = new OFFeaturesReplyVer12Funnel(); |
| 504 | static class OFFeaturesReplyVer12Funnel implements Funnel<OFFeaturesReplyVer12> { |
| 505 | private static final long serialVersionUID = 1L; |
| 506 | @Override |
| 507 | public void funnel(OFFeaturesReplyVer12 message, PrimitiveSink sink) { |
| 508 | // fixed value property version = 3 |
| 509 | sink.putByte((byte) 0x3); |
| 510 | // fixed value property type = 6 |
| 511 | sink.putByte((byte) 0x6); |
| 512 | // FIXME: skip funnel of length |
| 513 | sink.putLong(message.xid); |
| 514 | message.datapathId.putTo(sink); |
| 515 | sink.putLong(message.nBuffers); |
| 516 | sink.putShort(message.nTables); |
| 517 | // skip pad (3 bytes) |
| 518 | OFCapabilitiesSerializerVer12.putTo(message.capabilities, sink); |
| 519 | sink.putLong(message.reserved); |
| 520 | FunnelUtils.putList(message.ports, sink); |
| 521 | } |
| 522 | } |
| 523 | |
| 524 | |
| 525 | public void writeTo(ChannelBuffer bb) { |
| 526 | WRITER.write(bb, this); |
| 527 | } |
| 528 | |
| 529 | final static Writer WRITER = new Writer(); |
| 530 | static class Writer implements OFMessageWriter<OFFeaturesReplyVer12> { |
| 531 | @Override |
| 532 | public void write(ChannelBuffer bb, OFFeaturesReplyVer12 message) { |
| 533 | int startIndex = bb.writerIndex(); |
| 534 | // fixed value property version = 3 |
| 535 | bb.writeByte((byte) 0x3); |
| 536 | // fixed value property type = 6 |
| 537 | bb.writeByte((byte) 0x6); |
| 538 | // length is length of variable message, will be updated at the end |
| 539 | int lengthIndex = bb.writerIndex(); |
| 540 | bb.writeShort(U16.t(0)); |
| 541 | |
| 542 | bb.writeInt(U32.t(message.xid)); |
| 543 | bb.writeLong(message.datapathId.getLong()); |
| 544 | bb.writeInt(U32.t(message.nBuffers)); |
| 545 | bb.writeByte(U8.t(message.nTables)); |
| 546 | // pad: 3 bytes |
| 547 | bb.writeZero(3); |
| 548 | OFCapabilitiesSerializerVer12.writeTo(bb, message.capabilities); |
| 549 | bb.writeInt(U32.t(message.reserved)); |
| 550 | ChannelUtils.writeList(bb, message.ports); |
| 551 | |
| 552 | // update length field |
| 553 | int length = bb.writerIndex() - startIndex; |
| 554 | bb.setShort(lengthIndex, length); |
| 555 | |
| 556 | } |
| 557 | } |
| 558 | |
| 559 | @Override |
| 560 | public String toString() { |
| 561 | StringBuilder b = new StringBuilder("OFFeaturesReplyVer12("); |
| 562 | b.append("xid=").append(xid); |
| 563 | b.append(", "); |
| 564 | b.append("datapathId=").append(datapathId); |
| 565 | b.append(", "); |
| 566 | b.append("nBuffers=").append(nBuffers); |
| 567 | b.append(", "); |
| 568 | b.append("nTables=").append(nTables); |
| 569 | b.append(", "); |
| 570 | b.append("capabilities=").append(capabilities); |
| 571 | b.append(", "); |
| 572 | b.append("reserved=").append(reserved); |
| 573 | b.append(", "); |
| 574 | b.append("ports=").append(ports); |
| 575 | b.append(")"); |
| 576 | return b.toString(); |
| 577 | } |
| 578 | |
| 579 | @Override |
| 580 | public boolean equals(Object obj) { |
| 581 | if (this == obj) |
| 582 | return true; |
| 583 | if (obj == null) |
| 584 | return false; |
| 585 | if (getClass() != obj.getClass()) |
| 586 | return false; |
| 587 | OFFeaturesReplyVer12 other = (OFFeaturesReplyVer12) obj; |
| 588 | |
| 589 | if( xid != other.xid) |
| 590 | return false; |
| 591 | if (datapathId == null) { |
| 592 | if (other.datapathId != null) |
| 593 | return false; |
| 594 | } else if (!datapathId.equals(other.datapathId)) |
| 595 | return false; |
| 596 | if( nBuffers != other.nBuffers) |
| 597 | return false; |
| 598 | if( nTables != other.nTables) |
| 599 | return false; |
| 600 | if (capabilities == null) { |
| 601 | if (other.capabilities != null) |
| 602 | return false; |
| 603 | } else if (!capabilities.equals(other.capabilities)) |
| 604 | return false; |
| 605 | if( reserved != other.reserved) |
| 606 | return false; |
| 607 | if (ports == null) { |
| 608 | if (other.ports != null) |
| 609 | return false; |
| 610 | } else if (!ports.equals(other.ports)) |
| 611 | return false; |
| 612 | return true; |
| 613 | } |
| 614 | |
| 615 | @Override |
| 616 | public int hashCode() { |
| 617 | final int prime = 31; |
| 618 | int result = 1; |
| 619 | |
| 620 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 621 | result = prime * result + ((datapathId == null) ? 0 : datapathId.hashCode()); |
| 622 | result = prime * (int) (nBuffers ^ (nBuffers >>> 32)); |
| 623 | result = prime * result + nTables; |
| 624 | result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode()); |
| 625 | result = prime * (int) (reserved ^ (reserved >>> 32)); |
| 626 | result = prime * result + ((ports == null) ? 0 : ports.hashCode()); |
| 627 | return result; |
| 628 | } |
| 629 | |
| 630 | } |