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