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