tom | 0eb04ca | 2014-08-25 14:34:51 -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.ver10; |
| 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 OFFeaturesReplyVer10 implements OFFeaturesReply { |
| 37 | private static final Logger logger = LoggerFactory.getLogger(OFFeaturesReplyVer10.class); |
| 38 | // version: 1.0 |
| 39 | final static byte WIRE_VERSION = 1; |
| 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 Set<OFActionType> DEFAULT_ACTIONS = ImmutableSet.<OFActionType>of(); |
| 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 Set<OFActionType> actions; |
| 57 | private final List<OFPortDesc> ports; |
| 58 | // |
| 59 | // Immutable default instance |
| 60 | final static OFFeaturesReplyVer10 DEFAULT = new OFFeaturesReplyVer10( |
| 61 | DEFAULT_XID, DEFAULT_DATAPATH_ID, DEFAULT_N_BUFFERS, DEFAULT_N_TABLES, DEFAULT_CAPABILITIES, DEFAULT_ACTIONS, DEFAULT_PORTS |
| 62 | ); |
| 63 | |
| 64 | // package private constructor - used by readers, builders, and factory |
| 65 | OFFeaturesReplyVer10(long xid, DatapathId datapathId, long nBuffers, short nTables, Set<OFCapabilities> capabilities, Set<OFActionType> actions, 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.actions = actions; |
| 72 | this.ports = ports; |
| 73 | } |
| 74 | |
| 75 | // Accessors for OF message fields |
| 76 | @Override |
| 77 | public OFVersion getVersion() { |
| 78 | return OFVersion.OF_10; |
| 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()throws UnsupportedOperationException { |
| 113 | throw new UnsupportedOperationException("Property reserved not supported in version 1.0"); |
| 114 | } |
| 115 | |
| 116 | @Override |
| 117 | public List<OFPortDesc> getPorts() { |
| 118 | return ports; |
| 119 | } |
| 120 | |
| 121 | @Override |
| 122 | public Set<OFActionType> getActions() { |
| 123 | return actions; |
| 124 | } |
| 125 | |
| 126 | @Override |
| 127 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 128 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.0"); |
| 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 OFFeaturesReplyVer10 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 actionsSet; |
| 152 | private Set<OFActionType> actions; |
| 153 | private boolean portsSet; |
| 154 | private List<OFPortDesc> ports; |
| 155 | |
| 156 | BuilderWithParent(OFFeaturesReplyVer10 parentMessage) { |
| 157 | this.parentMessage = parentMessage; |
| 158 | } |
| 159 | |
| 160 | @Override |
| 161 | public OFVersion getVersion() { |
| 162 | return OFVersion.OF_10; |
| 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()throws UnsupportedOperationException { |
| 227 | throw new UnsupportedOperationException("Property reserved not supported in version 1.0"); |
| 228 | } |
| 229 | |
| 230 | @Override |
| 231 | public OFFeaturesReply.Builder setReserved(long reserved) throws UnsupportedOperationException { |
| 232 | throw new UnsupportedOperationException("Property reserved not supported in version 1.0"); |
| 233 | } |
| 234 | @Override |
| 235 | public List<OFPortDesc> getPorts() { |
| 236 | return ports; |
| 237 | } |
| 238 | |
| 239 | @Override |
| 240 | public OFFeaturesReply.Builder setPorts(List<OFPortDesc> ports) { |
| 241 | this.ports = ports; |
| 242 | this.portsSet = true; |
| 243 | return this; |
| 244 | } |
| 245 | @Override |
| 246 | public Set<OFActionType> getActions() { |
| 247 | return actions; |
| 248 | } |
| 249 | |
| 250 | @Override |
| 251 | public OFFeaturesReply.Builder setActions(Set<OFActionType> actions) { |
| 252 | this.actions = actions; |
| 253 | this.actionsSet = true; |
| 254 | return this; |
| 255 | } |
| 256 | @Override |
| 257 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 258 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.0"); |
| 259 | } |
| 260 | |
| 261 | @Override |
| 262 | public OFFeaturesReply.Builder setAuxiliaryId(OFAuxId auxiliaryId) throws UnsupportedOperationException { |
| 263 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.0"); |
| 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 | Set<OFActionType> actions = this.actionsSet ? this.actions : parentMessage.actions; |
| 279 | if(actions == null) |
| 280 | throw new NullPointerException("Property actions must not be null"); |
| 281 | List<OFPortDesc> ports = this.portsSet ? this.ports : parentMessage.ports; |
| 282 | if(ports == null) |
| 283 | throw new NullPointerException("Property ports must not be null"); |
| 284 | |
| 285 | // |
| 286 | return new OFFeaturesReplyVer10( |
| 287 | xid, |
| 288 | datapathId, |
| 289 | nBuffers, |
| 290 | nTables, |
| 291 | capabilities, |
| 292 | actions, |
| 293 | ports |
| 294 | ); |
| 295 | } |
| 296 | |
| 297 | } |
| 298 | |
| 299 | static class Builder implements OFFeaturesReply.Builder { |
| 300 | // OF message fields |
| 301 | private boolean xidSet; |
| 302 | private long xid; |
| 303 | private boolean datapathIdSet; |
| 304 | private DatapathId datapathId; |
| 305 | private boolean nBuffersSet; |
| 306 | private long nBuffers; |
| 307 | private boolean nTablesSet; |
| 308 | private short nTables; |
| 309 | private boolean capabilitiesSet; |
| 310 | private Set<OFCapabilities> capabilities; |
| 311 | private boolean actionsSet; |
| 312 | private Set<OFActionType> actions; |
| 313 | private boolean portsSet; |
| 314 | private List<OFPortDesc> ports; |
| 315 | |
| 316 | @Override |
| 317 | public OFVersion getVersion() { |
| 318 | return OFVersion.OF_10; |
| 319 | } |
| 320 | |
| 321 | @Override |
| 322 | public OFType getType() { |
| 323 | return OFType.FEATURES_REPLY; |
| 324 | } |
| 325 | |
| 326 | @Override |
| 327 | public long getXid() { |
| 328 | return xid; |
| 329 | } |
| 330 | |
| 331 | @Override |
| 332 | public OFFeaturesReply.Builder setXid(long xid) { |
| 333 | this.xid = xid; |
| 334 | this.xidSet = true; |
| 335 | return this; |
| 336 | } |
| 337 | @Override |
| 338 | public DatapathId getDatapathId() { |
| 339 | return datapathId; |
| 340 | } |
| 341 | |
| 342 | @Override |
| 343 | public OFFeaturesReply.Builder setDatapathId(DatapathId datapathId) { |
| 344 | this.datapathId = datapathId; |
| 345 | this.datapathIdSet = true; |
| 346 | return this; |
| 347 | } |
| 348 | @Override |
| 349 | public long getNBuffers() { |
| 350 | return nBuffers; |
| 351 | } |
| 352 | |
| 353 | @Override |
| 354 | public OFFeaturesReply.Builder setNBuffers(long nBuffers) { |
| 355 | this.nBuffers = nBuffers; |
| 356 | this.nBuffersSet = true; |
| 357 | return this; |
| 358 | } |
| 359 | @Override |
| 360 | public short getNTables() { |
| 361 | return nTables; |
| 362 | } |
| 363 | |
| 364 | @Override |
| 365 | public OFFeaturesReply.Builder setNTables(short nTables) { |
| 366 | this.nTables = nTables; |
| 367 | this.nTablesSet = true; |
| 368 | return this; |
| 369 | } |
| 370 | @Override |
| 371 | public Set<OFCapabilities> getCapabilities() { |
| 372 | return capabilities; |
| 373 | } |
| 374 | |
| 375 | @Override |
| 376 | public OFFeaturesReply.Builder setCapabilities(Set<OFCapabilities> capabilities) { |
| 377 | this.capabilities = capabilities; |
| 378 | this.capabilitiesSet = true; |
| 379 | return this; |
| 380 | } |
| 381 | @Override |
| 382 | public long getReserved()throws UnsupportedOperationException { |
| 383 | throw new UnsupportedOperationException("Property reserved not supported in version 1.0"); |
| 384 | } |
| 385 | |
| 386 | @Override |
| 387 | public OFFeaturesReply.Builder setReserved(long reserved) throws UnsupportedOperationException { |
| 388 | throw new UnsupportedOperationException("Property reserved not supported in version 1.0"); |
| 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() { |
| 403 | return actions; |
| 404 | } |
| 405 | |
| 406 | @Override |
| 407 | public OFFeaturesReply.Builder setActions(Set<OFActionType> actions) { |
| 408 | this.actions = actions; |
| 409 | this.actionsSet = true; |
| 410 | return this; |
| 411 | } |
| 412 | @Override |
| 413 | public OFAuxId getAuxiliaryId()throws UnsupportedOperationException { |
| 414 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.0"); |
| 415 | } |
| 416 | |
| 417 | @Override |
| 418 | public OFFeaturesReply.Builder setAuxiliaryId(OFAuxId auxiliaryId) throws UnsupportedOperationException { |
| 419 | throw new UnsupportedOperationException("Property auxiliaryId not supported in version 1.0"); |
| 420 | } |
| 421 | // |
| 422 | @Override |
| 423 | public OFFeaturesReply build() { |
| 424 | long xid = this.xidSet ? this.xid : DEFAULT_XID; |
| 425 | DatapathId datapathId = this.datapathIdSet ? this.datapathId : DEFAULT_DATAPATH_ID; |
| 426 | if(datapathId == null) |
| 427 | throw new NullPointerException("Property datapathId must not be null"); |
| 428 | long nBuffers = this.nBuffersSet ? this.nBuffers : DEFAULT_N_BUFFERS; |
| 429 | short nTables = this.nTablesSet ? this.nTables : DEFAULT_N_TABLES; |
| 430 | Set<OFCapabilities> capabilities = this.capabilitiesSet ? this.capabilities : DEFAULT_CAPABILITIES; |
| 431 | if(capabilities == null) |
| 432 | throw new NullPointerException("Property capabilities must not be null"); |
| 433 | Set<OFActionType> actions = this.actionsSet ? this.actions : DEFAULT_ACTIONS; |
| 434 | if(actions == null) |
| 435 | throw new NullPointerException("Property actions must not be null"); |
| 436 | List<OFPortDesc> ports = this.portsSet ? this.ports : DEFAULT_PORTS; |
| 437 | if(ports == null) |
| 438 | throw new NullPointerException("Property ports must not be null"); |
| 439 | |
| 440 | |
| 441 | return new OFFeaturesReplyVer10( |
| 442 | xid, |
| 443 | datapathId, |
| 444 | nBuffers, |
| 445 | nTables, |
| 446 | capabilities, |
| 447 | actions, |
| 448 | ports |
| 449 | ); |
| 450 | } |
| 451 | |
| 452 | } |
| 453 | |
| 454 | |
| 455 | final static Reader READER = new Reader(); |
| 456 | static class Reader implements OFMessageReader<OFFeaturesReply> { |
| 457 | @Override |
| 458 | public OFFeaturesReply readFrom(ChannelBuffer bb) throws OFParseError { |
| 459 | int start = bb.readerIndex(); |
| 460 | // fixed value property version == 1 |
| 461 | byte version = bb.readByte(); |
| 462 | if(version != (byte) 0x1) |
| 463 | throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version); |
| 464 | // fixed value property type == 6 |
| 465 | byte type = bb.readByte(); |
| 466 | if(type != (byte) 0x6) |
| 467 | throw new OFParseError("Wrong type: Expected=OFType.FEATURES_REPLY(6), got="+type); |
| 468 | int length = U16.f(bb.readShort()); |
| 469 | if(length < MINIMUM_LENGTH) |
| 470 | throw new OFParseError("Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length); |
| 471 | if(bb.readableBytes() + (bb.readerIndex() - start) < length) { |
| 472 | // Buffer does not have all data yet |
| 473 | bb.readerIndex(start); |
| 474 | return null; |
| 475 | } |
| 476 | if(logger.isTraceEnabled()) |
| 477 | logger.trace("readFrom - length={}", length); |
| 478 | long xid = U32.f(bb.readInt()); |
| 479 | DatapathId datapathId = DatapathId.of(bb.readLong()); |
| 480 | long nBuffers = U32.f(bb.readInt()); |
| 481 | short nTables = U8.f(bb.readByte()); |
| 482 | // pad: 3 bytes |
| 483 | bb.skipBytes(3); |
| 484 | Set<OFCapabilities> capabilities = OFCapabilitiesSerializerVer10.readFrom(bb); |
| 485 | Set<OFActionType> actions = ChannelUtilsVer10.readSupportedActions(bb); |
| 486 | List<OFPortDesc> ports = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFPortDescVer10.READER); |
| 487 | |
| 488 | OFFeaturesReplyVer10 featuresReplyVer10 = new OFFeaturesReplyVer10( |
| 489 | xid, |
| 490 | datapathId, |
| 491 | nBuffers, |
| 492 | nTables, |
| 493 | capabilities, |
| 494 | actions, |
| 495 | ports |
| 496 | ); |
| 497 | if(logger.isTraceEnabled()) |
| 498 | logger.trace("readFrom - read={}", featuresReplyVer10); |
| 499 | return featuresReplyVer10; |
| 500 | } |
| 501 | } |
| 502 | |
| 503 | public void putTo(PrimitiveSink sink) { |
| 504 | FUNNEL.funnel(this, sink); |
| 505 | } |
| 506 | |
| 507 | final static OFFeaturesReplyVer10Funnel FUNNEL = new OFFeaturesReplyVer10Funnel(); |
| 508 | static class OFFeaturesReplyVer10Funnel implements Funnel<OFFeaturesReplyVer10> { |
| 509 | private static final long serialVersionUID = 1L; |
| 510 | @Override |
| 511 | public void funnel(OFFeaturesReplyVer10 message, PrimitiveSink sink) { |
| 512 | // fixed value property version = 1 |
| 513 | sink.putByte((byte) 0x1); |
| 514 | // fixed value property type = 6 |
| 515 | sink.putByte((byte) 0x6); |
| 516 | // FIXME: skip funnel of length |
| 517 | sink.putLong(message.xid); |
| 518 | message.datapathId.putTo(sink); |
| 519 | sink.putLong(message.nBuffers); |
| 520 | sink.putShort(message.nTables); |
| 521 | // skip pad (3 bytes) |
| 522 | OFCapabilitiesSerializerVer10.putTo(message.capabilities, sink); |
| 523 | ChannelUtilsVer10.putSupportedActionsTo(message.actions, sink); |
| 524 | FunnelUtils.putList(message.ports, sink); |
| 525 | } |
| 526 | } |
| 527 | |
| 528 | |
| 529 | public void writeTo(ChannelBuffer bb) { |
| 530 | WRITER.write(bb, this); |
| 531 | } |
| 532 | |
| 533 | final static Writer WRITER = new Writer(); |
| 534 | static class Writer implements OFMessageWriter<OFFeaturesReplyVer10> { |
| 535 | @Override |
| 536 | public void write(ChannelBuffer bb, OFFeaturesReplyVer10 message) { |
| 537 | int startIndex = bb.writerIndex(); |
| 538 | // fixed value property version = 1 |
| 539 | bb.writeByte((byte) 0x1); |
| 540 | // fixed value property type = 6 |
| 541 | bb.writeByte((byte) 0x6); |
| 542 | // length is length of variable message, will be updated at the end |
| 543 | int lengthIndex = bb.writerIndex(); |
| 544 | bb.writeShort(U16.t(0)); |
| 545 | |
| 546 | bb.writeInt(U32.t(message.xid)); |
| 547 | bb.writeLong(message.datapathId.getLong()); |
| 548 | bb.writeInt(U32.t(message.nBuffers)); |
| 549 | bb.writeByte(U8.t(message.nTables)); |
| 550 | // pad: 3 bytes |
| 551 | bb.writeZero(3); |
| 552 | OFCapabilitiesSerializerVer10.writeTo(bb, message.capabilities); |
| 553 | ChannelUtilsVer10.writeSupportedActions(bb, message.actions); |
| 554 | ChannelUtils.writeList(bb, message.ports); |
| 555 | |
| 556 | // update length field |
| 557 | int length = bb.writerIndex() - startIndex; |
| 558 | bb.setShort(lengthIndex, length); |
| 559 | |
| 560 | } |
| 561 | } |
| 562 | |
| 563 | @Override |
| 564 | public String toString() { |
| 565 | StringBuilder b = new StringBuilder("OFFeaturesReplyVer10("); |
| 566 | b.append("xid=").append(xid); |
| 567 | b.append(", "); |
| 568 | b.append("datapathId=").append(datapathId); |
| 569 | b.append(", "); |
| 570 | b.append("nBuffers=").append(nBuffers); |
| 571 | b.append(", "); |
| 572 | b.append("nTables=").append(nTables); |
| 573 | b.append(", "); |
| 574 | b.append("capabilities=").append(capabilities); |
| 575 | b.append(", "); |
| 576 | b.append("actions=").append(actions); |
| 577 | b.append(", "); |
| 578 | b.append("ports=").append(ports); |
| 579 | b.append(")"); |
| 580 | return b.toString(); |
| 581 | } |
| 582 | |
| 583 | @Override |
| 584 | public boolean equals(Object obj) { |
| 585 | if (this == obj) |
| 586 | return true; |
| 587 | if (obj == null) |
| 588 | return false; |
| 589 | if (getClass() != obj.getClass()) |
| 590 | return false; |
| 591 | OFFeaturesReplyVer10 other = (OFFeaturesReplyVer10) obj; |
| 592 | |
| 593 | if( xid != other.xid) |
| 594 | return false; |
| 595 | if (datapathId == null) { |
| 596 | if (other.datapathId != null) |
| 597 | return false; |
| 598 | } else if (!datapathId.equals(other.datapathId)) |
| 599 | return false; |
| 600 | if( nBuffers != other.nBuffers) |
| 601 | return false; |
| 602 | if( nTables != other.nTables) |
| 603 | return false; |
| 604 | if (capabilities == null) { |
| 605 | if (other.capabilities != null) |
| 606 | return false; |
| 607 | } else if (!capabilities.equals(other.capabilities)) |
| 608 | return false; |
| 609 | if (actions == null) { |
| 610 | if (other.actions != null) |
| 611 | return false; |
| 612 | } else if (!actions.equals(other.actions)) |
| 613 | return false; |
| 614 | if (ports == null) { |
| 615 | if (other.ports != null) |
| 616 | return false; |
| 617 | } else if (!ports.equals(other.ports)) |
| 618 | return false; |
| 619 | return true; |
| 620 | } |
| 621 | |
| 622 | @Override |
| 623 | public int hashCode() { |
| 624 | final int prime = 31; |
| 625 | int result = 1; |
| 626 | |
| 627 | result = prime * (int) (xid ^ (xid >>> 32)); |
| 628 | result = prime * result + ((datapathId == null) ? 0 : datapathId.hashCode()); |
| 629 | result = prime * (int) (nBuffers ^ (nBuffers >>> 32)); |
| 630 | result = prime * result + nTables; |
| 631 | result = prime * result + ((capabilities == null) ? 0 : capabilities.hashCode()); |
| 632 | result = prime * result + ((actions == null) ? 0 : actions.hashCode()); |
| 633 | result = prime * result + ((ports == null) ? 0 : ports.hashCode()); |
| 634 | return result; |
| 635 | } |
| 636 | |
| 637 | } |