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.ver13; |
| 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 org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFPortStatsEntryVer13 implements OFPortStatsEntry { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFPortStatsEntryVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 112; |
| 38 | |
| 39 | private final static OFPort DEFAULT_PORT_NO = OFPort.ANY; |
| 40 | private final static U64 DEFAULT_RX_PACKETS = U64.ZERO; |
| 41 | private final static U64 DEFAULT_TX_PACKETS = U64.ZERO; |
| 42 | private final static U64 DEFAULT_RX_BYTES = U64.ZERO; |
| 43 | private final static U64 DEFAULT_TX_BYTES = U64.ZERO; |
| 44 | private final static U64 DEFAULT_RX_DROPPED = U64.ZERO; |
| 45 | private final static U64 DEFAULT_TX_DROPPED = U64.ZERO; |
| 46 | private final static U64 DEFAULT_RX_ERRORS = U64.ZERO; |
| 47 | private final static U64 DEFAULT_TX_ERRORS = U64.ZERO; |
| 48 | private final static U64 DEFAULT_RX_FRAME_ERR = U64.ZERO; |
| 49 | private final static U64 DEFAULT_RX_OVER_ERR = U64.ZERO; |
| 50 | private final static U64 DEFAULT_RX_CRC_ERR = U64.ZERO; |
| 51 | private final static U64 DEFAULT_COLLISIONS = U64.ZERO; |
| 52 | private final static long DEFAULT_DURATION_SEC = 0x0L; |
| 53 | private final static long DEFAULT_DURATION_NSEC = 0x0L; |
| 54 | |
| 55 | // OF message fields |
| 56 | private final OFPort portNo; |
| 57 | private final U64 rxPackets; |
| 58 | private final U64 txPackets; |
| 59 | private final U64 rxBytes; |
| 60 | private final U64 txBytes; |
| 61 | private final U64 rxDropped; |
| 62 | private final U64 txDropped; |
| 63 | private final U64 rxErrors; |
| 64 | private final U64 txErrors; |
| 65 | private final U64 rxFrameErr; |
| 66 | private final U64 rxOverErr; |
| 67 | private final U64 rxCrcErr; |
| 68 | private final U64 collisions; |
| 69 | private final long durationSec; |
| 70 | private final long durationNsec; |
| 71 | // |
| 72 | // Immutable default instance |
| 73 | final static OFPortStatsEntryVer13 DEFAULT = new OFPortStatsEntryVer13( |
| 74 | DEFAULT_PORT_NO, DEFAULT_RX_PACKETS, DEFAULT_TX_PACKETS, DEFAULT_RX_BYTES, DEFAULT_TX_BYTES, DEFAULT_RX_DROPPED, DEFAULT_TX_DROPPED, DEFAULT_RX_ERRORS, DEFAULT_TX_ERRORS, DEFAULT_RX_FRAME_ERR, DEFAULT_RX_OVER_ERR, DEFAULT_RX_CRC_ERR, DEFAULT_COLLISIONS, DEFAULT_DURATION_SEC, DEFAULT_DURATION_NSEC |
| 75 | ); |
| 76 | |
| 77 | // package private constructor - used by readers, builders, and factory |
| 78 | OFPortStatsEntryVer13(OFPort portNo, U64 rxPackets, U64 txPackets, U64 rxBytes, U64 txBytes, U64 rxDropped, U64 txDropped, U64 rxErrors, U64 txErrors, U64 rxFrameErr, U64 rxOverErr, U64 rxCrcErr, U64 collisions, long durationSec, long durationNsec) { |
| 79 | this.portNo = portNo; |
| 80 | this.rxPackets = rxPackets; |
| 81 | this.txPackets = txPackets; |
| 82 | this.rxBytes = rxBytes; |
| 83 | this.txBytes = txBytes; |
| 84 | this.rxDropped = rxDropped; |
| 85 | this.txDropped = txDropped; |
| 86 | this.rxErrors = rxErrors; |
| 87 | this.txErrors = txErrors; |
| 88 | this.rxFrameErr = rxFrameErr; |
| 89 | this.rxOverErr = rxOverErr; |
| 90 | this.rxCrcErr = rxCrcErr; |
| 91 | this.collisions = collisions; |
| 92 | this.durationSec = durationSec; |
| 93 | this.durationNsec = durationNsec; |
| 94 | } |
| 95 | |
| 96 | // Accessors for OF message fields |
| 97 | @Override |
| 98 | public OFPort getPortNo() { |
| 99 | return portNo; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public U64 getRxPackets() { |
| 104 | return rxPackets; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public U64 getTxPackets() { |
| 109 | return txPackets; |
| 110 | } |
| 111 | |
| 112 | @Override |
| 113 | public U64 getRxBytes() { |
| 114 | return rxBytes; |
| 115 | } |
| 116 | |
| 117 | @Override |
| 118 | public U64 getTxBytes() { |
| 119 | return txBytes; |
| 120 | } |
| 121 | |
| 122 | @Override |
| 123 | public U64 getRxDropped() { |
| 124 | return rxDropped; |
| 125 | } |
| 126 | |
| 127 | @Override |
| 128 | public U64 getTxDropped() { |
| 129 | return txDropped; |
| 130 | } |
| 131 | |
| 132 | @Override |
| 133 | public U64 getRxErrors() { |
| 134 | return rxErrors; |
| 135 | } |
| 136 | |
| 137 | @Override |
| 138 | public U64 getTxErrors() { |
| 139 | return txErrors; |
| 140 | } |
| 141 | |
| 142 | @Override |
| 143 | public U64 getRxFrameErr() { |
| 144 | return rxFrameErr; |
| 145 | } |
| 146 | |
| 147 | @Override |
| 148 | public U64 getRxOverErr() { |
| 149 | return rxOverErr; |
| 150 | } |
| 151 | |
| 152 | @Override |
| 153 | public U64 getRxCrcErr() { |
| 154 | return rxCrcErr; |
| 155 | } |
| 156 | |
| 157 | @Override |
| 158 | public U64 getCollisions() { |
| 159 | return collisions; |
| 160 | } |
| 161 | |
| 162 | @Override |
| 163 | public long getDurationSec() { |
| 164 | return durationSec; |
| 165 | } |
| 166 | |
| 167 | @Override |
| 168 | public long getDurationNsec() { |
| 169 | return durationNsec; |
| 170 | } |
| 171 | |
| 172 | @Override |
| 173 | public OFVersion getVersion() { |
| 174 | return OFVersion.OF_13; |
| 175 | } |
| 176 | |
| 177 | |
| 178 | |
| 179 | public OFPortStatsEntry.Builder createBuilder() { |
| 180 | return new BuilderWithParent(this); |
| 181 | } |
| 182 | |
| 183 | static class BuilderWithParent implements OFPortStatsEntry.Builder { |
| 184 | final OFPortStatsEntryVer13 parentMessage; |
| 185 | |
| 186 | // OF message fields |
| 187 | private boolean portNoSet; |
| 188 | private OFPort portNo; |
| 189 | private boolean rxPacketsSet; |
| 190 | private U64 rxPackets; |
| 191 | private boolean txPacketsSet; |
| 192 | private U64 txPackets; |
| 193 | private boolean rxBytesSet; |
| 194 | private U64 rxBytes; |
| 195 | private boolean txBytesSet; |
| 196 | private U64 txBytes; |
| 197 | private boolean rxDroppedSet; |
| 198 | private U64 rxDropped; |
| 199 | private boolean txDroppedSet; |
| 200 | private U64 txDropped; |
| 201 | private boolean rxErrorsSet; |
| 202 | private U64 rxErrors; |
| 203 | private boolean txErrorsSet; |
| 204 | private U64 txErrors; |
| 205 | private boolean rxFrameErrSet; |
| 206 | private U64 rxFrameErr; |
| 207 | private boolean rxOverErrSet; |
| 208 | private U64 rxOverErr; |
| 209 | private boolean rxCrcErrSet; |
| 210 | private U64 rxCrcErr; |
| 211 | private boolean collisionsSet; |
| 212 | private U64 collisions; |
| 213 | private boolean durationSecSet; |
| 214 | private long durationSec; |
| 215 | private boolean durationNsecSet; |
| 216 | private long durationNsec; |
| 217 | |
| 218 | BuilderWithParent(OFPortStatsEntryVer13 parentMessage) { |
| 219 | this.parentMessage = parentMessage; |
| 220 | } |
| 221 | |
| 222 | @Override |
| 223 | public OFPort getPortNo() { |
| 224 | return portNo; |
| 225 | } |
| 226 | |
| 227 | @Override |
| 228 | public OFPortStatsEntry.Builder setPortNo(OFPort portNo) { |
| 229 | this.portNo = portNo; |
| 230 | this.portNoSet = true; |
| 231 | return this; |
| 232 | } |
| 233 | @Override |
| 234 | public U64 getRxPackets() { |
| 235 | return rxPackets; |
| 236 | } |
| 237 | |
| 238 | @Override |
| 239 | public OFPortStatsEntry.Builder setRxPackets(U64 rxPackets) { |
| 240 | this.rxPackets = rxPackets; |
| 241 | this.rxPacketsSet = true; |
| 242 | return this; |
| 243 | } |
| 244 | @Override |
| 245 | public U64 getTxPackets() { |
| 246 | return txPackets; |
| 247 | } |
| 248 | |
| 249 | @Override |
| 250 | public OFPortStatsEntry.Builder setTxPackets(U64 txPackets) { |
| 251 | this.txPackets = txPackets; |
| 252 | this.txPacketsSet = true; |
| 253 | return this; |
| 254 | } |
| 255 | @Override |
| 256 | public U64 getRxBytes() { |
| 257 | return rxBytes; |
| 258 | } |
| 259 | |
| 260 | @Override |
| 261 | public OFPortStatsEntry.Builder setRxBytes(U64 rxBytes) { |
| 262 | this.rxBytes = rxBytes; |
| 263 | this.rxBytesSet = true; |
| 264 | return this; |
| 265 | } |
| 266 | @Override |
| 267 | public U64 getTxBytes() { |
| 268 | return txBytes; |
| 269 | } |
| 270 | |
| 271 | @Override |
| 272 | public OFPortStatsEntry.Builder setTxBytes(U64 txBytes) { |
| 273 | this.txBytes = txBytes; |
| 274 | this.txBytesSet = true; |
| 275 | return this; |
| 276 | } |
| 277 | @Override |
| 278 | public U64 getRxDropped() { |
| 279 | return rxDropped; |
| 280 | } |
| 281 | |
| 282 | @Override |
| 283 | public OFPortStatsEntry.Builder setRxDropped(U64 rxDropped) { |
| 284 | this.rxDropped = rxDropped; |
| 285 | this.rxDroppedSet = true; |
| 286 | return this; |
| 287 | } |
| 288 | @Override |
| 289 | public U64 getTxDropped() { |
| 290 | return txDropped; |
| 291 | } |
| 292 | |
| 293 | @Override |
| 294 | public OFPortStatsEntry.Builder setTxDropped(U64 txDropped) { |
| 295 | this.txDropped = txDropped; |
| 296 | this.txDroppedSet = true; |
| 297 | return this; |
| 298 | } |
| 299 | @Override |
| 300 | public U64 getRxErrors() { |
| 301 | return rxErrors; |
| 302 | } |
| 303 | |
| 304 | @Override |
| 305 | public OFPortStatsEntry.Builder setRxErrors(U64 rxErrors) { |
| 306 | this.rxErrors = rxErrors; |
| 307 | this.rxErrorsSet = true; |
| 308 | return this; |
| 309 | } |
| 310 | @Override |
| 311 | public U64 getTxErrors() { |
| 312 | return txErrors; |
| 313 | } |
| 314 | |
| 315 | @Override |
| 316 | public OFPortStatsEntry.Builder setTxErrors(U64 txErrors) { |
| 317 | this.txErrors = txErrors; |
| 318 | this.txErrorsSet = true; |
| 319 | return this; |
| 320 | } |
| 321 | @Override |
| 322 | public U64 getRxFrameErr() { |
| 323 | return rxFrameErr; |
| 324 | } |
| 325 | |
| 326 | @Override |
| 327 | public OFPortStatsEntry.Builder setRxFrameErr(U64 rxFrameErr) { |
| 328 | this.rxFrameErr = rxFrameErr; |
| 329 | this.rxFrameErrSet = true; |
| 330 | return this; |
| 331 | } |
| 332 | @Override |
| 333 | public U64 getRxOverErr() { |
| 334 | return rxOverErr; |
| 335 | } |
| 336 | |
| 337 | @Override |
| 338 | public OFPortStatsEntry.Builder setRxOverErr(U64 rxOverErr) { |
| 339 | this.rxOverErr = rxOverErr; |
| 340 | this.rxOverErrSet = true; |
| 341 | return this; |
| 342 | } |
| 343 | @Override |
| 344 | public U64 getRxCrcErr() { |
| 345 | return rxCrcErr; |
| 346 | } |
| 347 | |
| 348 | @Override |
| 349 | public OFPortStatsEntry.Builder setRxCrcErr(U64 rxCrcErr) { |
| 350 | this.rxCrcErr = rxCrcErr; |
| 351 | this.rxCrcErrSet = true; |
| 352 | return this; |
| 353 | } |
| 354 | @Override |
| 355 | public U64 getCollisions() { |
| 356 | return collisions; |
| 357 | } |
| 358 | |
| 359 | @Override |
| 360 | public OFPortStatsEntry.Builder setCollisions(U64 collisions) { |
| 361 | this.collisions = collisions; |
| 362 | this.collisionsSet = true; |
| 363 | return this; |
| 364 | } |
| 365 | @Override |
| 366 | public long getDurationSec() { |
| 367 | return durationSec; |
| 368 | } |
| 369 | |
| 370 | @Override |
| 371 | public OFPortStatsEntry.Builder setDurationSec(long durationSec) { |
| 372 | this.durationSec = durationSec; |
| 373 | this.durationSecSet = true; |
| 374 | return this; |
| 375 | } |
| 376 | @Override |
| 377 | public long getDurationNsec() { |
| 378 | return durationNsec; |
| 379 | } |
| 380 | |
| 381 | @Override |
| 382 | public OFPortStatsEntry.Builder setDurationNsec(long durationNsec) { |
| 383 | this.durationNsec = durationNsec; |
| 384 | this.durationNsecSet = true; |
| 385 | return this; |
| 386 | } |
| 387 | @Override |
| 388 | public OFVersion getVersion() { |
| 389 | return OFVersion.OF_13; |
| 390 | } |
| 391 | |
| 392 | |
| 393 | |
| 394 | @Override |
| 395 | public OFPortStatsEntry build() { |
| 396 | OFPort portNo = this.portNoSet ? this.portNo : parentMessage.portNo; |
| 397 | if(portNo == null) |
| 398 | throw new NullPointerException("Property portNo must not be null"); |
| 399 | U64 rxPackets = this.rxPacketsSet ? this.rxPackets : parentMessage.rxPackets; |
| 400 | if(rxPackets == null) |
| 401 | throw new NullPointerException("Property rxPackets must not be null"); |
| 402 | U64 txPackets = this.txPacketsSet ? this.txPackets : parentMessage.txPackets; |
| 403 | if(txPackets == null) |
| 404 | throw new NullPointerException("Property txPackets must not be null"); |
| 405 | U64 rxBytes = this.rxBytesSet ? this.rxBytes : parentMessage.rxBytes; |
| 406 | if(rxBytes == null) |
| 407 | throw new NullPointerException("Property rxBytes must not be null"); |
| 408 | U64 txBytes = this.txBytesSet ? this.txBytes : parentMessage.txBytes; |
| 409 | if(txBytes == null) |
| 410 | throw new NullPointerException("Property txBytes must not be null"); |
| 411 | U64 rxDropped = this.rxDroppedSet ? this.rxDropped : parentMessage.rxDropped; |
| 412 | if(rxDropped == null) |
| 413 | throw new NullPointerException("Property rxDropped must not be null"); |
| 414 | U64 txDropped = this.txDroppedSet ? this.txDropped : parentMessage.txDropped; |
| 415 | if(txDropped == null) |
| 416 | throw new NullPointerException("Property txDropped must not be null"); |
| 417 | U64 rxErrors = this.rxErrorsSet ? this.rxErrors : parentMessage.rxErrors; |
| 418 | if(rxErrors == null) |
| 419 | throw new NullPointerException("Property rxErrors must not be null"); |
| 420 | U64 txErrors = this.txErrorsSet ? this.txErrors : parentMessage.txErrors; |
| 421 | if(txErrors == null) |
| 422 | throw new NullPointerException("Property txErrors must not be null"); |
| 423 | U64 rxFrameErr = this.rxFrameErrSet ? this.rxFrameErr : parentMessage.rxFrameErr; |
| 424 | if(rxFrameErr == null) |
| 425 | throw new NullPointerException("Property rxFrameErr must not be null"); |
| 426 | U64 rxOverErr = this.rxOverErrSet ? this.rxOverErr : parentMessage.rxOverErr; |
| 427 | if(rxOverErr == null) |
| 428 | throw new NullPointerException("Property rxOverErr must not be null"); |
| 429 | U64 rxCrcErr = this.rxCrcErrSet ? this.rxCrcErr : parentMessage.rxCrcErr; |
| 430 | if(rxCrcErr == null) |
| 431 | throw new NullPointerException("Property rxCrcErr must not be null"); |
| 432 | U64 collisions = this.collisionsSet ? this.collisions : parentMessage.collisions; |
| 433 | if(collisions == null) |
| 434 | throw new NullPointerException("Property collisions must not be null"); |
| 435 | long durationSec = this.durationSecSet ? this.durationSec : parentMessage.durationSec; |
| 436 | long durationNsec = this.durationNsecSet ? this.durationNsec : parentMessage.durationNsec; |
| 437 | |
| 438 | // |
| 439 | return new OFPortStatsEntryVer13( |
| 440 | portNo, |
| 441 | rxPackets, |
| 442 | txPackets, |
| 443 | rxBytes, |
| 444 | txBytes, |
| 445 | rxDropped, |
| 446 | txDropped, |
| 447 | rxErrors, |
| 448 | txErrors, |
| 449 | rxFrameErr, |
| 450 | rxOverErr, |
| 451 | rxCrcErr, |
| 452 | collisions, |
| 453 | durationSec, |
| 454 | durationNsec |
| 455 | ); |
| 456 | } |
| 457 | |
| 458 | } |
| 459 | |
| 460 | static class Builder implements OFPortStatsEntry.Builder { |
| 461 | // OF message fields |
| 462 | private boolean portNoSet; |
| 463 | private OFPort portNo; |
| 464 | private boolean rxPacketsSet; |
| 465 | private U64 rxPackets; |
| 466 | private boolean txPacketsSet; |
| 467 | private U64 txPackets; |
| 468 | private boolean rxBytesSet; |
| 469 | private U64 rxBytes; |
| 470 | private boolean txBytesSet; |
| 471 | private U64 txBytes; |
| 472 | private boolean rxDroppedSet; |
| 473 | private U64 rxDropped; |
| 474 | private boolean txDroppedSet; |
| 475 | private U64 txDropped; |
| 476 | private boolean rxErrorsSet; |
| 477 | private U64 rxErrors; |
| 478 | private boolean txErrorsSet; |
| 479 | private U64 txErrors; |
| 480 | private boolean rxFrameErrSet; |
| 481 | private U64 rxFrameErr; |
| 482 | private boolean rxOverErrSet; |
| 483 | private U64 rxOverErr; |
| 484 | private boolean rxCrcErrSet; |
| 485 | private U64 rxCrcErr; |
| 486 | private boolean collisionsSet; |
| 487 | private U64 collisions; |
| 488 | private boolean durationSecSet; |
| 489 | private long durationSec; |
| 490 | private boolean durationNsecSet; |
| 491 | private long durationNsec; |
| 492 | |
| 493 | @Override |
| 494 | public OFPort getPortNo() { |
| 495 | return portNo; |
| 496 | } |
| 497 | |
| 498 | @Override |
| 499 | public OFPortStatsEntry.Builder setPortNo(OFPort portNo) { |
| 500 | this.portNo = portNo; |
| 501 | this.portNoSet = true; |
| 502 | return this; |
| 503 | } |
| 504 | @Override |
| 505 | public U64 getRxPackets() { |
| 506 | return rxPackets; |
| 507 | } |
| 508 | |
| 509 | @Override |
| 510 | public OFPortStatsEntry.Builder setRxPackets(U64 rxPackets) { |
| 511 | this.rxPackets = rxPackets; |
| 512 | this.rxPacketsSet = true; |
| 513 | return this; |
| 514 | } |
| 515 | @Override |
| 516 | public U64 getTxPackets() { |
| 517 | return txPackets; |
| 518 | } |
| 519 | |
| 520 | @Override |
| 521 | public OFPortStatsEntry.Builder setTxPackets(U64 txPackets) { |
| 522 | this.txPackets = txPackets; |
| 523 | this.txPacketsSet = true; |
| 524 | return this; |
| 525 | } |
| 526 | @Override |
| 527 | public U64 getRxBytes() { |
| 528 | return rxBytes; |
| 529 | } |
| 530 | |
| 531 | @Override |
| 532 | public OFPortStatsEntry.Builder setRxBytes(U64 rxBytes) { |
| 533 | this.rxBytes = rxBytes; |
| 534 | this.rxBytesSet = true; |
| 535 | return this; |
| 536 | } |
| 537 | @Override |
| 538 | public U64 getTxBytes() { |
| 539 | return txBytes; |
| 540 | } |
| 541 | |
| 542 | @Override |
| 543 | public OFPortStatsEntry.Builder setTxBytes(U64 txBytes) { |
| 544 | this.txBytes = txBytes; |
| 545 | this.txBytesSet = true; |
| 546 | return this; |
| 547 | } |
| 548 | @Override |
| 549 | public U64 getRxDropped() { |
| 550 | return rxDropped; |
| 551 | } |
| 552 | |
| 553 | @Override |
| 554 | public OFPortStatsEntry.Builder setRxDropped(U64 rxDropped) { |
| 555 | this.rxDropped = rxDropped; |
| 556 | this.rxDroppedSet = true; |
| 557 | return this; |
| 558 | } |
| 559 | @Override |
| 560 | public U64 getTxDropped() { |
| 561 | return txDropped; |
| 562 | } |
| 563 | |
| 564 | @Override |
| 565 | public OFPortStatsEntry.Builder setTxDropped(U64 txDropped) { |
| 566 | this.txDropped = txDropped; |
| 567 | this.txDroppedSet = true; |
| 568 | return this; |
| 569 | } |
| 570 | @Override |
| 571 | public U64 getRxErrors() { |
| 572 | return rxErrors; |
| 573 | } |
| 574 | |
| 575 | @Override |
| 576 | public OFPortStatsEntry.Builder setRxErrors(U64 rxErrors) { |
| 577 | this.rxErrors = rxErrors; |
| 578 | this.rxErrorsSet = true; |
| 579 | return this; |
| 580 | } |
| 581 | @Override |
| 582 | public U64 getTxErrors() { |
| 583 | return txErrors; |
| 584 | } |
| 585 | |
| 586 | @Override |
| 587 | public OFPortStatsEntry.Builder setTxErrors(U64 txErrors) { |
| 588 | this.txErrors = txErrors; |
| 589 | this.txErrorsSet = true; |
| 590 | return this; |
| 591 | } |
| 592 | @Override |
| 593 | public U64 getRxFrameErr() { |
| 594 | return rxFrameErr; |
| 595 | } |
| 596 | |
| 597 | @Override |
| 598 | public OFPortStatsEntry.Builder setRxFrameErr(U64 rxFrameErr) { |
| 599 | this.rxFrameErr = rxFrameErr; |
| 600 | this.rxFrameErrSet = true; |
| 601 | return this; |
| 602 | } |
| 603 | @Override |
| 604 | public U64 getRxOverErr() { |
| 605 | return rxOverErr; |
| 606 | } |
| 607 | |
| 608 | @Override |
| 609 | public OFPortStatsEntry.Builder setRxOverErr(U64 rxOverErr) { |
| 610 | this.rxOverErr = rxOverErr; |
| 611 | this.rxOverErrSet = true; |
| 612 | return this; |
| 613 | } |
| 614 | @Override |
| 615 | public U64 getRxCrcErr() { |
| 616 | return rxCrcErr; |
| 617 | } |
| 618 | |
| 619 | @Override |
| 620 | public OFPortStatsEntry.Builder setRxCrcErr(U64 rxCrcErr) { |
| 621 | this.rxCrcErr = rxCrcErr; |
| 622 | this.rxCrcErrSet = true; |
| 623 | return this; |
| 624 | } |
| 625 | @Override |
| 626 | public U64 getCollisions() { |
| 627 | return collisions; |
| 628 | } |
| 629 | |
| 630 | @Override |
| 631 | public OFPortStatsEntry.Builder setCollisions(U64 collisions) { |
| 632 | this.collisions = collisions; |
| 633 | this.collisionsSet = true; |
| 634 | return this; |
| 635 | } |
| 636 | @Override |
| 637 | public long getDurationSec() { |
| 638 | return durationSec; |
| 639 | } |
| 640 | |
| 641 | @Override |
| 642 | public OFPortStatsEntry.Builder setDurationSec(long durationSec) { |
| 643 | this.durationSec = durationSec; |
| 644 | this.durationSecSet = true; |
| 645 | return this; |
| 646 | } |
| 647 | @Override |
| 648 | public long getDurationNsec() { |
| 649 | return durationNsec; |
| 650 | } |
| 651 | |
| 652 | @Override |
| 653 | public OFPortStatsEntry.Builder setDurationNsec(long durationNsec) { |
| 654 | this.durationNsec = durationNsec; |
| 655 | this.durationNsecSet = true; |
| 656 | return this; |
| 657 | } |
| 658 | @Override |
| 659 | public OFVersion getVersion() { |
| 660 | return OFVersion.OF_13; |
| 661 | } |
| 662 | |
| 663 | // |
| 664 | @Override |
| 665 | public OFPortStatsEntry build() { |
| 666 | OFPort portNo = this.portNoSet ? this.portNo : DEFAULT_PORT_NO; |
| 667 | if(portNo == null) |
| 668 | throw new NullPointerException("Property portNo must not be null"); |
| 669 | U64 rxPackets = this.rxPacketsSet ? this.rxPackets : DEFAULT_RX_PACKETS; |
| 670 | if(rxPackets == null) |
| 671 | throw new NullPointerException("Property rxPackets must not be null"); |
| 672 | U64 txPackets = this.txPacketsSet ? this.txPackets : DEFAULT_TX_PACKETS; |
| 673 | if(txPackets == null) |
| 674 | throw new NullPointerException("Property txPackets must not be null"); |
| 675 | U64 rxBytes = this.rxBytesSet ? this.rxBytes : DEFAULT_RX_BYTES; |
| 676 | if(rxBytes == null) |
| 677 | throw new NullPointerException("Property rxBytes must not be null"); |
| 678 | U64 txBytes = this.txBytesSet ? this.txBytes : DEFAULT_TX_BYTES; |
| 679 | if(txBytes == null) |
| 680 | throw new NullPointerException("Property txBytes must not be null"); |
| 681 | U64 rxDropped = this.rxDroppedSet ? this.rxDropped : DEFAULT_RX_DROPPED; |
| 682 | if(rxDropped == null) |
| 683 | throw new NullPointerException("Property rxDropped must not be null"); |
| 684 | U64 txDropped = this.txDroppedSet ? this.txDropped : DEFAULT_TX_DROPPED; |
| 685 | if(txDropped == null) |
| 686 | throw new NullPointerException("Property txDropped must not be null"); |
| 687 | U64 rxErrors = this.rxErrorsSet ? this.rxErrors : DEFAULT_RX_ERRORS; |
| 688 | if(rxErrors == null) |
| 689 | throw new NullPointerException("Property rxErrors must not be null"); |
| 690 | U64 txErrors = this.txErrorsSet ? this.txErrors : DEFAULT_TX_ERRORS; |
| 691 | if(txErrors == null) |
| 692 | throw new NullPointerException("Property txErrors must not be null"); |
| 693 | U64 rxFrameErr = this.rxFrameErrSet ? this.rxFrameErr : DEFAULT_RX_FRAME_ERR; |
| 694 | if(rxFrameErr == null) |
| 695 | throw new NullPointerException("Property rxFrameErr must not be null"); |
| 696 | U64 rxOverErr = this.rxOverErrSet ? this.rxOverErr : DEFAULT_RX_OVER_ERR; |
| 697 | if(rxOverErr == null) |
| 698 | throw new NullPointerException("Property rxOverErr must not be null"); |
| 699 | U64 rxCrcErr = this.rxCrcErrSet ? this.rxCrcErr : DEFAULT_RX_CRC_ERR; |
| 700 | if(rxCrcErr == null) |
| 701 | throw new NullPointerException("Property rxCrcErr must not be null"); |
| 702 | U64 collisions = this.collisionsSet ? this.collisions : DEFAULT_COLLISIONS; |
| 703 | if(collisions == null) |
| 704 | throw new NullPointerException("Property collisions must not be null"); |
| 705 | long durationSec = this.durationSecSet ? this.durationSec : DEFAULT_DURATION_SEC; |
| 706 | long durationNsec = this.durationNsecSet ? this.durationNsec : DEFAULT_DURATION_NSEC; |
| 707 | |
| 708 | |
| 709 | return new OFPortStatsEntryVer13( |
| 710 | portNo, |
| 711 | rxPackets, |
| 712 | txPackets, |
| 713 | rxBytes, |
| 714 | txBytes, |
| 715 | rxDropped, |
| 716 | txDropped, |
| 717 | rxErrors, |
| 718 | txErrors, |
| 719 | rxFrameErr, |
| 720 | rxOverErr, |
| 721 | rxCrcErr, |
| 722 | collisions, |
| 723 | durationSec, |
| 724 | durationNsec |
| 725 | ); |
| 726 | } |
| 727 | |
| 728 | } |
| 729 | |
| 730 | |
| 731 | final static Reader READER = new Reader(); |
| 732 | static class Reader implements OFMessageReader<OFPortStatsEntry> { |
| 733 | @Override |
| 734 | public OFPortStatsEntry readFrom(ChannelBuffer bb) throws OFParseError { |
| 735 | OFPort portNo = OFPort.read4Bytes(bb); |
| 736 | // pad: 4 bytes |
| 737 | bb.skipBytes(4); |
| 738 | U64 rxPackets = U64.ofRaw(bb.readLong()); |
| 739 | U64 txPackets = U64.ofRaw(bb.readLong()); |
| 740 | U64 rxBytes = U64.ofRaw(bb.readLong()); |
| 741 | U64 txBytes = U64.ofRaw(bb.readLong()); |
| 742 | U64 rxDropped = U64.ofRaw(bb.readLong()); |
| 743 | U64 txDropped = U64.ofRaw(bb.readLong()); |
| 744 | U64 rxErrors = U64.ofRaw(bb.readLong()); |
| 745 | U64 txErrors = U64.ofRaw(bb.readLong()); |
| 746 | U64 rxFrameErr = U64.ofRaw(bb.readLong()); |
| 747 | U64 rxOverErr = U64.ofRaw(bb.readLong()); |
| 748 | U64 rxCrcErr = U64.ofRaw(bb.readLong()); |
| 749 | U64 collisions = U64.ofRaw(bb.readLong()); |
| 750 | long durationSec = U32.f(bb.readInt()); |
| 751 | long durationNsec = U32.f(bb.readInt()); |
| 752 | |
| 753 | OFPortStatsEntryVer13 portStatsEntryVer13 = new OFPortStatsEntryVer13( |
| 754 | portNo, |
| 755 | rxPackets, |
| 756 | txPackets, |
| 757 | rxBytes, |
| 758 | txBytes, |
| 759 | rxDropped, |
| 760 | txDropped, |
| 761 | rxErrors, |
| 762 | txErrors, |
| 763 | rxFrameErr, |
| 764 | rxOverErr, |
| 765 | rxCrcErr, |
| 766 | collisions, |
| 767 | durationSec, |
| 768 | durationNsec |
| 769 | ); |
| 770 | if(logger.isTraceEnabled()) |
| 771 | logger.trace("readFrom - read={}", portStatsEntryVer13); |
| 772 | return portStatsEntryVer13; |
| 773 | } |
| 774 | } |
| 775 | |
| 776 | public void putTo(PrimitiveSink sink) { |
| 777 | FUNNEL.funnel(this, sink); |
| 778 | } |
| 779 | |
| 780 | final static OFPortStatsEntryVer13Funnel FUNNEL = new OFPortStatsEntryVer13Funnel(); |
| 781 | static class OFPortStatsEntryVer13Funnel implements Funnel<OFPortStatsEntryVer13> { |
| 782 | private static final long serialVersionUID = 1L; |
| 783 | @Override |
| 784 | public void funnel(OFPortStatsEntryVer13 message, PrimitiveSink sink) { |
| 785 | message.portNo.putTo(sink); |
| 786 | // skip pad (4 bytes) |
| 787 | message.rxPackets.putTo(sink); |
| 788 | message.txPackets.putTo(sink); |
| 789 | message.rxBytes.putTo(sink); |
| 790 | message.txBytes.putTo(sink); |
| 791 | message.rxDropped.putTo(sink); |
| 792 | message.txDropped.putTo(sink); |
| 793 | message.rxErrors.putTo(sink); |
| 794 | message.txErrors.putTo(sink); |
| 795 | message.rxFrameErr.putTo(sink); |
| 796 | message.rxOverErr.putTo(sink); |
| 797 | message.rxCrcErr.putTo(sink); |
| 798 | message.collisions.putTo(sink); |
| 799 | sink.putLong(message.durationSec); |
| 800 | sink.putLong(message.durationNsec); |
| 801 | } |
| 802 | } |
| 803 | |
| 804 | |
| 805 | public void writeTo(ChannelBuffer bb) { |
| 806 | WRITER.write(bb, this); |
| 807 | } |
| 808 | |
| 809 | final static Writer WRITER = new Writer(); |
| 810 | static class Writer implements OFMessageWriter<OFPortStatsEntryVer13> { |
| 811 | @Override |
| 812 | public void write(ChannelBuffer bb, OFPortStatsEntryVer13 message) { |
| 813 | message.portNo.write4Bytes(bb); |
| 814 | // pad: 4 bytes |
| 815 | bb.writeZero(4); |
| 816 | bb.writeLong(message.rxPackets.getValue()); |
| 817 | bb.writeLong(message.txPackets.getValue()); |
| 818 | bb.writeLong(message.rxBytes.getValue()); |
| 819 | bb.writeLong(message.txBytes.getValue()); |
| 820 | bb.writeLong(message.rxDropped.getValue()); |
| 821 | bb.writeLong(message.txDropped.getValue()); |
| 822 | bb.writeLong(message.rxErrors.getValue()); |
| 823 | bb.writeLong(message.txErrors.getValue()); |
| 824 | bb.writeLong(message.rxFrameErr.getValue()); |
| 825 | bb.writeLong(message.rxOverErr.getValue()); |
| 826 | bb.writeLong(message.rxCrcErr.getValue()); |
| 827 | bb.writeLong(message.collisions.getValue()); |
| 828 | bb.writeInt(U32.t(message.durationSec)); |
| 829 | bb.writeInt(U32.t(message.durationNsec)); |
| 830 | |
| 831 | |
| 832 | } |
| 833 | } |
| 834 | |
| 835 | @Override |
| 836 | public String toString() { |
| 837 | StringBuilder b = new StringBuilder("OFPortStatsEntryVer13("); |
| 838 | b.append("portNo=").append(portNo); |
| 839 | b.append(", "); |
| 840 | b.append("rxPackets=").append(rxPackets); |
| 841 | b.append(", "); |
| 842 | b.append("txPackets=").append(txPackets); |
| 843 | b.append(", "); |
| 844 | b.append("rxBytes=").append(rxBytes); |
| 845 | b.append(", "); |
| 846 | b.append("txBytes=").append(txBytes); |
| 847 | b.append(", "); |
| 848 | b.append("rxDropped=").append(rxDropped); |
| 849 | b.append(", "); |
| 850 | b.append("txDropped=").append(txDropped); |
| 851 | b.append(", "); |
| 852 | b.append("rxErrors=").append(rxErrors); |
| 853 | b.append(", "); |
| 854 | b.append("txErrors=").append(txErrors); |
| 855 | b.append(", "); |
| 856 | b.append("rxFrameErr=").append(rxFrameErr); |
| 857 | b.append(", "); |
| 858 | b.append("rxOverErr=").append(rxOverErr); |
| 859 | b.append(", "); |
| 860 | b.append("rxCrcErr=").append(rxCrcErr); |
| 861 | b.append(", "); |
| 862 | b.append("collisions=").append(collisions); |
| 863 | b.append(", "); |
| 864 | b.append("durationSec=").append(durationSec); |
| 865 | b.append(", "); |
| 866 | b.append("durationNsec=").append(durationNsec); |
| 867 | b.append(")"); |
| 868 | return b.toString(); |
| 869 | } |
| 870 | |
| 871 | @Override |
| 872 | public boolean equals(Object obj) { |
| 873 | if (this == obj) |
| 874 | return true; |
| 875 | if (obj == null) |
| 876 | return false; |
| 877 | if (getClass() != obj.getClass()) |
| 878 | return false; |
| 879 | OFPortStatsEntryVer13 other = (OFPortStatsEntryVer13) obj; |
| 880 | |
| 881 | if (portNo == null) { |
| 882 | if (other.portNo != null) |
| 883 | return false; |
| 884 | } else if (!portNo.equals(other.portNo)) |
| 885 | return false; |
| 886 | if (rxPackets == null) { |
| 887 | if (other.rxPackets != null) |
| 888 | return false; |
| 889 | } else if (!rxPackets.equals(other.rxPackets)) |
| 890 | return false; |
| 891 | if (txPackets == null) { |
| 892 | if (other.txPackets != null) |
| 893 | return false; |
| 894 | } else if (!txPackets.equals(other.txPackets)) |
| 895 | return false; |
| 896 | if (rxBytes == null) { |
| 897 | if (other.rxBytes != null) |
| 898 | return false; |
| 899 | } else if (!rxBytes.equals(other.rxBytes)) |
| 900 | return false; |
| 901 | if (txBytes == null) { |
| 902 | if (other.txBytes != null) |
| 903 | return false; |
| 904 | } else if (!txBytes.equals(other.txBytes)) |
| 905 | return false; |
| 906 | if (rxDropped == null) { |
| 907 | if (other.rxDropped != null) |
| 908 | return false; |
| 909 | } else if (!rxDropped.equals(other.rxDropped)) |
| 910 | return false; |
| 911 | if (txDropped == null) { |
| 912 | if (other.txDropped != null) |
| 913 | return false; |
| 914 | } else if (!txDropped.equals(other.txDropped)) |
| 915 | return false; |
| 916 | if (rxErrors == null) { |
| 917 | if (other.rxErrors != null) |
| 918 | return false; |
| 919 | } else if (!rxErrors.equals(other.rxErrors)) |
| 920 | return false; |
| 921 | if (txErrors == null) { |
| 922 | if (other.txErrors != null) |
| 923 | return false; |
| 924 | } else if (!txErrors.equals(other.txErrors)) |
| 925 | return false; |
| 926 | if (rxFrameErr == null) { |
| 927 | if (other.rxFrameErr != null) |
| 928 | return false; |
| 929 | } else if (!rxFrameErr.equals(other.rxFrameErr)) |
| 930 | return false; |
| 931 | if (rxOverErr == null) { |
| 932 | if (other.rxOverErr != null) |
| 933 | return false; |
| 934 | } else if (!rxOverErr.equals(other.rxOverErr)) |
| 935 | return false; |
| 936 | if (rxCrcErr == null) { |
| 937 | if (other.rxCrcErr != null) |
| 938 | return false; |
| 939 | } else if (!rxCrcErr.equals(other.rxCrcErr)) |
| 940 | return false; |
| 941 | if (collisions == null) { |
| 942 | if (other.collisions != null) |
| 943 | return false; |
| 944 | } else if (!collisions.equals(other.collisions)) |
| 945 | return false; |
| 946 | if( durationSec != other.durationSec) |
| 947 | return false; |
| 948 | if( durationNsec != other.durationNsec) |
| 949 | return false; |
| 950 | return true; |
| 951 | } |
| 952 | |
| 953 | @Override |
| 954 | public int hashCode() { |
| 955 | final int prime = 31; |
| 956 | int result = 1; |
| 957 | |
| 958 | result = prime * result + ((portNo == null) ? 0 : portNo.hashCode()); |
| 959 | result = prime * result + ((rxPackets == null) ? 0 : rxPackets.hashCode()); |
| 960 | result = prime * result + ((txPackets == null) ? 0 : txPackets.hashCode()); |
| 961 | result = prime * result + ((rxBytes == null) ? 0 : rxBytes.hashCode()); |
| 962 | result = prime * result + ((txBytes == null) ? 0 : txBytes.hashCode()); |
| 963 | result = prime * result + ((rxDropped == null) ? 0 : rxDropped.hashCode()); |
| 964 | result = prime * result + ((txDropped == null) ? 0 : txDropped.hashCode()); |
| 965 | result = prime * result + ((rxErrors == null) ? 0 : rxErrors.hashCode()); |
| 966 | result = prime * result + ((txErrors == null) ? 0 : txErrors.hashCode()); |
| 967 | result = prime * result + ((rxFrameErr == null) ? 0 : rxFrameErr.hashCode()); |
| 968 | result = prime * result + ((rxOverErr == null) ? 0 : rxOverErr.hashCode()); |
| 969 | result = prime * result + ((rxCrcErr == null) ? 0 : rxCrcErr.hashCode()); |
| 970 | result = prime * result + ((collisions == null) ? 0 : collisions.hashCode()); |
| 971 | result = prime * (int) (durationSec ^ (durationSec >>> 32)); |
| 972 | result = prime * (int) (durationNsec ^ (durationNsec >>> 32)); |
| 973 | return result; |
| 974 | } |
| 975 | |
| 976 | } |