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 OFTableStatsEntryVer11 implements OFTableStatsEntry { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFTableStatsEntryVer11.class); |
| 35 | // version: 1.1 |
| 36 | final static byte WIRE_VERSION = 2; |
| 37 | final static int LENGTH = 88; |
| 38 | |
| 39 | private final static TableId DEFAULT_TABLE_ID = TableId.ALL; |
| 40 | private final static String DEFAULT_NAME = ""; |
| 41 | private final static int DEFAULT_WILDCARDS = 0x0; |
| 42 | private final static long DEFAULT_INSTRUCTIONS = 0x0L; |
| 43 | private final static long DEFAULT_WRITE_ACTIONS = 0x0L; |
| 44 | private final static long DEFAULT_APPLY_ACTIONS = 0x0L; |
| 45 | private final static long DEFAULT_CONFIG = 0x0L; |
| 46 | private final static long DEFAULT_MAX_ENTRIES = 0x0L; |
| 47 | private final static long DEFAULT_ACTIVE_COUNT = 0x0L; |
| 48 | private final static U64 DEFAULT_LOOKUP_COUNT = U64.ZERO; |
| 49 | private final static U64 DEFAULT_MATCHED_COUNT = U64.ZERO; |
| 50 | |
| 51 | // OF message fields |
| 52 | private final TableId tableId; |
| 53 | private final String name; |
| 54 | private final int wildcards; |
| 55 | private final OFMatchBmap match; |
| 56 | private final long instructions; |
| 57 | private final long writeActions; |
| 58 | private final long applyActions; |
| 59 | private final long config; |
| 60 | private final long maxEntries; |
| 61 | private final long activeCount; |
| 62 | private final U64 lookupCount; |
| 63 | private final U64 matchedCount; |
| 64 | // |
| 65 | |
| 66 | // package private constructor - used by readers, builders, and factory |
| 67 | OFTableStatsEntryVer11(TableId tableId, String name, int wildcards, OFMatchBmap match, long instructions, long writeActions, long applyActions, long config, long maxEntries, long activeCount, U64 lookupCount, U64 matchedCount) { |
| 68 | this.tableId = tableId; |
| 69 | this.name = name; |
| 70 | this.wildcards = wildcards; |
| 71 | this.match = match; |
| 72 | this.instructions = instructions; |
| 73 | this.writeActions = writeActions; |
| 74 | this.applyActions = applyActions; |
| 75 | this.config = config; |
| 76 | this.maxEntries = maxEntries; |
| 77 | this.activeCount = activeCount; |
| 78 | this.lookupCount = lookupCount; |
| 79 | this.matchedCount = matchedCount; |
| 80 | } |
| 81 | |
| 82 | // Accessors for OF message fields |
| 83 | @Override |
| 84 | public TableId getTableId() { |
| 85 | return tableId; |
| 86 | } |
| 87 | |
| 88 | @Override |
| 89 | public String getName() { |
| 90 | return name; |
| 91 | } |
| 92 | |
| 93 | @Override |
| 94 | public OFMatchBmap getMatch() { |
| 95 | return match; |
| 96 | } |
| 97 | |
| 98 | @Override |
| 99 | public int getWildcards() { |
| 100 | return wildcards; |
| 101 | } |
| 102 | |
| 103 | @Override |
| 104 | public long getWriteActions() { |
| 105 | return writeActions; |
| 106 | } |
| 107 | |
| 108 | @Override |
| 109 | public long getApplyActions() { |
| 110 | return applyActions; |
| 111 | } |
| 112 | |
| 113 | @Override |
| 114 | public U64 getWriteSetfields()throws UnsupportedOperationException { |
| 115 | throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.1"); |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public U64 getApplySetfields()throws UnsupportedOperationException { |
| 120 | throw new UnsupportedOperationException("Property applySetfields not supported in version 1.1"); |
| 121 | } |
| 122 | |
| 123 | @Override |
| 124 | public U64 getMetadataMatch()throws UnsupportedOperationException { |
| 125 | throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.1"); |
| 126 | } |
| 127 | |
| 128 | @Override |
| 129 | public U64 getMetadataWrite()throws UnsupportedOperationException { |
| 130 | throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.1"); |
| 131 | } |
| 132 | |
| 133 | @Override |
| 134 | public long getInstructions() { |
| 135 | return instructions; |
| 136 | } |
| 137 | |
| 138 | @Override |
| 139 | public long getConfig() { |
| 140 | return config; |
| 141 | } |
| 142 | |
| 143 | @Override |
| 144 | public long getMaxEntries() { |
| 145 | return maxEntries; |
| 146 | } |
| 147 | |
| 148 | @Override |
| 149 | public long getActiveCount() { |
| 150 | return activeCount; |
| 151 | } |
| 152 | |
| 153 | @Override |
| 154 | public U64 getLookupCount() { |
| 155 | return lookupCount; |
| 156 | } |
| 157 | |
| 158 | @Override |
| 159 | public U64 getMatchedCount() { |
| 160 | return matchedCount; |
| 161 | } |
| 162 | |
| 163 | @Override |
| 164 | public OFVersion getVersion() { |
| 165 | return OFVersion.OF_11; |
| 166 | } |
| 167 | |
| 168 | |
| 169 | |
| 170 | public OFTableStatsEntry.Builder createBuilder() { |
| 171 | return new BuilderWithParent(this); |
| 172 | } |
| 173 | |
| 174 | static class BuilderWithParent implements OFTableStatsEntry.Builder { |
| 175 | final OFTableStatsEntryVer11 parentMessage; |
| 176 | |
| 177 | // OF message fields |
| 178 | private boolean tableIdSet; |
| 179 | private TableId tableId; |
| 180 | private boolean nameSet; |
| 181 | private String name; |
| 182 | private boolean wildcardsSet; |
| 183 | private int wildcards; |
| 184 | private boolean matchSet; |
| 185 | private OFMatchBmap match; |
| 186 | private boolean instructionsSet; |
| 187 | private long instructions; |
| 188 | private boolean writeActionsSet; |
| 189 | private long writeActions; |
| 190 | private boolean applyActionsSet; |
| 191 | private long applyActions; |
| 192 | private boolean configSet; |
| 193 | private long config; |
| 194 | private boolean maxEntriesSet; |
| 195 | private long maxEntries; |
| 196 | private boolean activeCountSet; |
| 197 | private long activeCount; |
| 198 | private boolean lookupCountSet; |
| 199 | private U64 lookupCount; |
| 200 | private boolean matchedCountSet; |
| 201 | private U64 matchedCount; |
| 202 | |
| 203 | BuilderWithParent(OFTableStatsEntryVer11 parentMessage) { |
| 204 | this.parentMessage = parentMessage; |
| 205 | } |
| 206 | |
| 207 | @Override |
| 208 | public TableId getTableId() { |
| 209 | return tableId; |
| 210 | } |
| 211 | |
| 212 | @Override |
| 213 | public OFTableStatsEntry.Builder setTableId(TableId tableId) { |
| 214 | this.tableId = tableId; |
| 215 | this.tableIdSet = true; |
| 216 | return this; |
| 217 | } |
| 218 | @Override |
| 219 | public String getName() { |
| 220 | return name; |
| 221 | } |
| 222 | |
| 223 | @Override |
| 224 | public OFTableStatsEntry.Builder setName(String name) { |
| 225 | this.name = name; |
| 226 | this.nameSet = true; |
| 227 | return this; |
| 228 | } |
| 229 | @Override |
| 230 | public OFMatchBmap getMatch() { |
| 231 | return match; |
| 232 | } |
| 233 | |
| 234 | @Override |
| 235 | public OFTableStatsEntry.Builder setMatch(OFMatchBmap match) { |
| 236 | this.match = match; |
| 237 | this.matchSet = true; |
| 238 | return this; |
| 239 | } |
| 240 | @Override |
| 241 | public int getWildcards() { |
| 242 | return wildcards; |
| 243 | } |
| 244 | |
| 245 | @Override |
| 246 | public OFTableStatsEntry.Builder setWildcards(int wildcards) { |
| 247 | this.wildcards = wildcards; |
| 248 | this.wildcardsSet = true; |
| 249 | return this; |
| 250 | } |
| 251 | @Override |
| 252 | public long getWriteActions() { |
| 253 | return writeActions; |
| 254 | } |
| 255 | |
| 256 | @Override |
| 257 | public OFTableStatsEntry.Builder setWriteActions(long writeActions) { |
| 258 | this.writeActions = writeActions; |
| 259 | this.writeActionsSet = true; |
| 260 | return this; |
| 261 | } |
| 262 | @Override |
| 263 | public long getApplyActions() { |
| 264 | return applyActions; |
| 265 | } |
| 266 | |
| 267 | @Override |
| 268 | public OFTableStatsEntry.Builder setApplyActions(long applyActions) { |
| 269 | this.applyActions = applyActions; |
| 270 | this.applyActionsSet = true; |
| 271 | return this; |
| 272 | } |
| 273 | @Override |
| 274 | public U64 getWriteSetfields()throws UnsupportedOperationException { |
| 275 | throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.1"); |
| 276 | } |
| 277 | |
| 278 | @Override |
| 279 | public OFTableStatsEntry.Builder setWriteSetfields(U64 writeSetfields) throws UnsupportedOperationException { |
| 280 | throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.1"); |
| 281 | } |
| 282 | @Override |
| 283 | public U64 getApplySetfields()throws UnsupportedOperationException { |
| 284 | throw new UnsupportedOperationException("Property applySetfields not supported in version 1.1"); |
| 285 | } |
| 286 | |
| 287 | @Override |
| 288 | public OFTableStatsEntry.Builder setApplySetfields(U64 applySetfields) throws UnsupportedOperationException { |
| 289 | throw new UnsupportedOperationException("Property applySetfields not supported in version 1.1"); |
| 290 | } |
| 291 | @Override |
| 292 | public U64 getMetadataMatch()throws UnsupportedOperationException { |
| 293 | throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.1"); |
| 294 | } |
| 295 | |
| 296 | @Override |
| 297 | public OFTableStatsEntry.Builder setMetadataMatch(U64 metadataMatch) throws UnsupportedOperationException { |
| 298 | throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.1"); |
| 299 | } |
| 300 | @Override |
| 301 | public U64 getMetadataWrite()throws UnsupportedOperationException { |
| 302 | throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.1"); |
| 303 | } |
| 304 | |
| 305 | @Override |
| 306 | public OFTableStatsEntry.Builder setMetadataWrite(U64 metadataWrite) throws UnsupportedOperationException { |
| 307 | throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.1"); |
| 308 | } |
| 309 | @Override |
| 310 | public long getInstructions() { |
| 311 | return instructions; |
| 312 | } |
| 313 | |
| 314 | @Override |
| 315 | public OFTableStatsEntry.Builder setInstructions(long instructions) { |
| 316 | this.instructions = instructions; |
| 317 | this.instructionsSet = true; |
| 318 | return this; |
| 319 | } |
| 320 | @Override |
| 321 | public long getConfig() { |
| 322 | return config; |
| 323 | } |
| 324 | |
| 325 | @Override |
| 326 | public OFTableStatsEntry.Builder setConfig(long config) { |
| 327 | this.config = config; |
| 328 | this.configSet = true; |
| 329 | return this; |
| 330 | } |
| 331 | @Override |
| 332 | public long getMaxEntries() { |
| 333 | return maxEntries; |
| 334 | } |
| 335 | |
| 336 | @Override |
| 337 | public OFTableStatsEntry.Builder setMaxEntries(long maxEntries) { |
| 338 | this.maxEntries = maxEntries; |
| 339 | this.maxEntriesSet = true; |
| 340 | return this; |
| 341 | } |
| 342 | @Override |
| 343 | public long getActiveCount() { |
| 344 | return activeCount; |
| 345 | } |
| 346 | |
| 347 | @Override |
| 348 | public OFTableStatsEntry.Builder setActiveCount(long activeCount) { |
| 349 | this.activeCount = activeCount; |
| 350 | this.activeCountSet = true; |
| 351 | return this; |
| 352 | } |
| 353 | @Override |
| 354 | public U64 getLookupCount() { |
| 355 | return lookupCount; |
| 356 | } |
| 357 | |
| 358 | @Override |
| 359 | public OFTableStatsEntry.Builder setLookupCount(U64 lookupCount) { |
| 360 | this.lookupCount = lookupCount; |
| 361 | this.lookupCountSet = true; |
| 362 | return this; |
| 363 | } |
| 364 | @Override |
| 365 | public U64 getMatchedCount() { |
| 366 | return matchedCount; |
| 367 | } |
| 368 | |
| 369 | @Override |
| 370 | public OFTableStatsEntry.Builder setMatchedCount(U64 matchedCount) { |
| 371 | this.matchedCount = matchedCount; |
| 372 | this.matchedCountSet = true; |
| 373 | return this; |
| 374 | } |
| 375 | @Override |
| 376 | public OFVersion getVersion() { |
| 377 | return OFVersion.OF_11; |
| 378 | } |
| 379 | |
| 380 | |
| 381 | |
| 382 | @Override |
| 383 | public OFTableStatsEntry build() { |
| 384 | TableId tableId = this.tableIdSet ? this.tableId : parentMessage.tableId; |
| 385 | if(tableId == null) |
| 386 | throw new NullPointerException("Property tableId must not be null"); |
| 387 | String name = this.nameSet ? this.name : parentMessage.name; |
| 388 | if(name == null) |
| 389 | throw new NullPointerException("Property name must not be null"); |
| 390 | int wildcards = this.wildcardsSet ? this.wildcards : parentMessage.wildcards; |
| 391 | OFMatchBmap match = this.matchSet ? this.match : parentMessage.match; |
| 392 | if(match == null) |
| 393 | throw new NullPointerException("Property match must not be null"); |
| 394 | long instructions = this.instructionsSet ? this.instructions : parentMessage.instructions; |
| 395 | long writeActions = this.writeActionsSet ? this.writeActions : parentMessage.writeActions; |
| 396 | long applyActions = this.applyActionsSet ? this.applyActions : parentMessage.applyActions; |
| 397 | long config = this.configSet ? this.config : parentMessage.config; |
| 398 | long maxEntries = this.maxEntriesSet ? this.maxEntries : parentMessage.maxEntries; |
| 399 | long activeCount = this.activeCountSet ? this.activeCount : parentMessage.activeCount; |
| 400 | U64 lookupCount = this.lookupCountSet ? this.lookupCount : parentMessage.lookupCount; |
| 401 | if(lookupCount == null) |
| 402 | throw new NullPointerException("Property lookupCount must not be null"); |
| 403 | U64 matchedCount = this.matchedCountSet ? this.matchedCount : parentMessage.matchedCount; |
| 404 | if(matchedCount == null) |
| 405 | throw new NullPointerException("Property matchedCount must not be null"); |
| 406 | |
| 407 | // |
| 408 | return new OFTableStatsEntryVer11( |
| 409 | tableId, |
| 410 | name, |
| 411 | wildcards, |
| 412 | match, |
| 413 | instructions, |
| 414 | writeActions, |
| 415 | applyActions, |
| 416 | config, |
| 417 | maxEntries, |
| 418 | activeCount, |
| 419 | lookupCount, |
| 420 | matchedCount |
| 421 | ); |
| 422 | } |
| 423 | |
| 424 | } |
| 425 | |
| 426 | static class Builder implements OFTableStatsEntry.Builder { |
| 427 | // OF message fields |
| 428 | private boolean tableIdSet; |
| 429 | private TableId tableId; |
| 430 | private boolean nameSet; |
| 431 | private String name; |
| 432 | private boolean wildcardsSet; |
| 433 | private int wildcards; |
| 434 | private boolean matchSet; |
| 435 | private OFMatchBmap match; |
| 436 | private boolean instructionsSet; |
| 437 | private long instructions; |
| 438 | private boolean writeActionsSet; |
| 439 | private long writeActions; |
| 440 | private boolean applyActionsSet; |
| 441 | private long applyActions; |
| 442 | private boolean configSet; |
| 443 | private long config; |
| 444 | private boolean maxEntriesSet; |
| 445 | private long maxEntries; |
| 446 | private boolean activeCountSet; |
| 447 | private long activeCount; |
| 448 | private boolean lookupCountSet; |
| 449 | private U64 lookupCount; |
| 450 | private boolean matchedCountSet; |
| 451 | private U64 matchedCount; |
| 452 | |
| 453 | @Override |
| 454 | public TableId getTableId() { |
| 455 | return tableId; |
| 456 | } |
| 457 | |
| 458 | @Override |
| 459 | public OFTableStatsEntry.Builder setTableId(TableId tableId) { |
| 460 | this.tableId = tableId; |
| 461 | this.tableIdSet = true; |
| 462 | return this; |
| 463 | } |
| 464 | @Override |
| 465 | public String getName() { |
| 466 | return name; |
| 467 | } |
| 468 | |
| 469 | @Override |
| 470 | public OFTableStatsEntry.Builder setName(String name) { |
| 471 | this.name = name; |
| 472 | this.nameSet = true; |
| 473 | return this; |
| 474 | } |
| 475 | @Override |
| 476 | public OFMatchBmap getMatch() { |
| 477 | return match; |
| 478 | } |
| 479 | |
| 480 | @Override |
| 481 | public OFTableStatsEntry.Builder setMatch(OFMatchBmap match) { |
| 482 | this.match = match; |
| 483 | this.matchSet = true; |
| 484 | return this; |
| 485 | } |
| 486 | @Override |
| 487 | public int getWildcards() { |
| 488 | return wildcards; |
| 489 | } |
| 490 | |
| 491 | @Override |
| 492 | public OFTableStatsEntry.Builder setWildcards(int wildcards) { |
| 493 | this.wildcards = wildcards; |
| 494 | this.wildcardsSet = true; |
| 495 | return this; |
| 496 | } |
| 497 | @Override |
| 498 | public long getWriteActions() { |
| 499 | return writeActions; |
| 500 | } |
| 501 | |
| 502 | @Override |
| 503 | public OFTableStatsEntry.Builder setWriteActions(long writeActions) { |
| 504 | this.writeActions = writeActions; |
| 505 | this.writeActionsSet = true; |
| 506 | return this; |
| 507 | } |
| 508 | @Override |
| 509 | public long getApplyActions() { |
| 510 | return applyActions; |
| 511 | } |
| 512 | |
| 513 | @Override |
| 514 | public OFTableStatsEntry.Builder setApplyActions(long applyActions) { |
| 515 | this.applyActions = applyActions; |
| 516 | this.applyActionsSet = true; |
| 517 | return this; |
| 518 | } |
| 519 | @Override |
| 520 | public U64 getWriteSetfields()throws UnsupportedOperationException { |
| 521 | throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.1"); |
| 522 | } |
| 523 | |
| 524 | @Override |
| 525 | public OFTableStatsEntry.Builder setWriteSetfields(U64 writeSetfields) throws UnsupportedOperationException { |
| 526 | throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.1"); |
| 527 | } |
| 528 | @Override |
| 529 | public U64 getApplySetfields()throws UnsupportedOperationException { |
| 530 | throw new UnsupportedOperationException("Property applySetfields not supported in version 1.1"); |
| 531 | } |
| 532 | |
| 533 | @Override |
| 534 | public OFTableStatsEntry.Builder setApplySetfields(U64 applySetfields) throws UnsupportedOperationException { |
| 535 | throw new UnsupportedOperationException("Property applySetfields not supported in version 1.1"); |
| 536 | } |
| 537 | @Override |
| 538 | public U64 getMetadataMatch()throws UnsupportedOperationException { |
| 539 | throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.1"); |
| 540 | } |
| 541 | |
| 542 | @Override |
| 543 | public OFTableStatsEntry.Builder setMetadataMatch(U64 metadataMatch) throws UnsupportedOperationException { |
| 544 | throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.1"); |
| 545 | } |
| 546 | @Override |
| 547 | public U64 getMetadataWrite()throws UnsupportedOperationException { |
| 548 | throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.1"); |
| 549 | } |
| 550 | |
| 551 | @Override |
| 552 | public OFTableStatsEntry.Builder setMetadataWrite(U64 metadataWrite) throws UnsupportedOperationException { |
| 553 | throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.1"); |
| 554 | } |
| 555 | @Override |
| 556 | public long getInstructions() { |
| 557 | return instructions; |
| 558 | } |
| 559 | |
| 560 | @Override |
| 561 | public OFTableStatsEntry.Builder setInstructions(long instructions) { |
| 562 | this.instructions = instructions; |
| 563 | this.instructionsSet = true; |
| 564 | return this; |
| 565 | } |
| 566 | @Override |
| 567 | public long getConfig() { |
| 568 | return config; |
| 569 | } |
| 570 | |
| 571 | @Override |
| 572 | public OFTableStatsEntry.Builder setConfig(long config) { |
| 573 | this.config = config; |
| 574 | this.configSet = true; |
| 575 | return this; |
| 576 | } |
| 577 | @Override |
| 578 | public long getMaxEntries() { |
| 579 | return maxEntries; |
| 580 | } |
| 581 | |
| 582 | @Override |
| 583 | public OFTableStatsEntry.Builder setMaxEntries(long maxEntries) { |
| 584 | this.maxEntries = maxEntries; |
| 585 | this.maxEntriesSet = true; |
| 586 | return this; |
| 587 | } |
| 588 | @Override |
| 589 | public long getActiveCount() { |
| 590 | return activeCount; |
| 591 | } |
| 592 | |
| 593 | @Override |
| 594 | public OFTableStatsEntry.Builder setActiveCount(long activeCount) { |
| 595 | this.activeCount = activeCount; |
| 596 | this.activeCountSet = true; |
| 597 | return this; |
| 598 | } |
| 599 | @Override |
| 600 | public U64 getLookupCount() { |
| 601 | return lookupCount; |
| 602 | } |
| 603 | |
| 604 | @Override |
| 605 | public OFTableStatsEntry.Builder setLookupCount(U64 lookupCount) { |
| 606 | this.lookupCount = lookupCount; |
| 607 | this.lookupCountSet = true; |
| 608 | return this; |
| 609 | } |
| 610 | @Override |
| 611 | public U64 getMatchedCount() { |
| 612 | return matchedCount; |
| 613 | } |
| 614 | |
| 615 | @Override |
| 616 | public OFTableStatsEntry.Builder setMatchedCount(U64 matchedCount) { |
| 617 | this.matchedCount = matchedCount; |
| 618 | this.matchedCountSet = true; |
| 619 | return this; |
| 620 | } |
| 621 | @Override |
| 622 | public OFVersion getVersion() { |
| 623 | return OFVersion.OF_11; |
| 624 | } |
| 625 | |
| 626 | // |
| 627 | @Override |
| 628 | public OFTableStatsEntry build() { |
| 629 | TableId tableId = this.tableIdSet ? this.tableId : DEFAULT_TABLE_ID; |
| 630 | if(tableId == null) |
| 631 | throw new NullPointerException("Property tableId must not be null"); |
| 632 | String name = this.nameSet ? this.name : DEFAULT_NAME; |
| 633 | if(name == null) |
| 634 | throw new NullPointerException("Property name must not be null"); |
| 635 | int wildcards = this.wildcardsSet ? this.wildcards : DEFAULT_WILDCARDS; |
| 636 | if(!this.matchSet) |
| 637 | throw new IllegalStateException("Property match doesn't have default value -- must be set"); |
| 638 | if(match == null) |
| 639 | throw new NullPointerException("Property match must not be null"); |
| 640 | long instructions = this.instructionsSet ? this.instructions : DEFAULT_INSTRUCTIONS; |
| 641 | long writeActions = this.writeActionsSet ? this.writeActions : DEFAULT_WRITE_ACTIONS; |
| 642 | long applyActions = this.applyActionsSet ? this.applyActions : DEFAULT_APPLY_ACTIONS; |
| 643 | long config = this.configSet ? this.config : DEFAULT_CONFIG; |
| 644 | long maxEntries = this.maxEntriesSet ? this.maxEntries : DEFAULT_MAX_ENTRIES; |
| 645 | long activeCount = this.activeCountSet ? this.activeCount : DEFAULT_ACTIVE_COUNT; |
| 646 | U64 lookupCount = this.lookupCountSet ? this.lookupCount : DEFAULT_LOOKUP_COUNT; |
| 647 | if(lookupCount == null) |
| 648 | throw new NullPointerException("Property lookupCount must not be null"); |
| 649 | U64 matchedCount = this.matchedCountSet ? this.matchedCount : DEFAULT_MATCHED_COUNT; |
| 650 | if(matchedCount == null) |
| 651 | throw new NullPointerException("Property matchedCount must not be null"); |
| 652 | |
| 653 | |
| 654 | return new OFTableStatsEntryVer11( |
| 655 | tableId, |
| 656 | name, |
| 657 | wildcards, |
| 658 | match, |
| 659 | instructions, |
| 660 | writeActions, |
| 661 | applyActions, |
| 662 | config, |
| 663 | maxEntries, |
| 664 | activeCount, |
| 665 | lookupCount, |
| 666 | matchedCount |
| 667 | ); |
| 668 | } |
| 669 | |
| 670 | } |
| 671 | |
| 672 | |
| 673 | final static Reader READER = new Reader(); |
| 674 | static class Reader implements OFMessageReader<OFTableStatsEntry> { |
| 675 | @Override |
| 676 | public OFTableStatsEntry readFrom(ChannelBuffer bb) throws OFParseError { |
| 677 | TableId tableId = TableId.readByte(bb); |
| 678 | // pad: 7 bytes |
| 679 | bb.skipBytes(7); |
| 680 | String name = ChannelUtils.readFixedLengthString(bb, 32); |
| 681 | int wildcards = bb.readInt(); |
| 682 | OFMatchBmap match = ChannelUtilsVer11.readOFMatchBmap(bb); |
| 683 | long instructions = U32.f(bb.readInt()); |
| 684 | long writeActions = U32.f(bb.readInt()); |
| 685 | long applyActions = U32.f(bb.readInt()); |
| 686 | long config = U32.f(bb.readInt()); |
| 687 | long maxEntries = U32.f(bb.readInt()); |
| 688 | long activeCount = U32.f(bb.readInt()); |
| 689 | U64 lookupCount = U64.ofRaw(bb.readLong()); |
| 690 | U64 matchedCount = U64.ofRaw(bb.readLong()); |
| 691 | |
| 692 | OFTableStatsEntryVer11 tableStatsEntryVer11 = new OFTableStatsEntryVer11( |
| 693 | tableId, |
| 694 | name, |
| 695 | wildcards, |
| 696 | match, |
| 697 | instructions, |
| 698 | writeActions, |
| 699 | applyActions, |
| 700 | config, |
| 701 | maxEntries, |
| 702 | activeCount, |
| 703 | lookupCount, |
| 704 | matchedCount |
| 705 | ); |
| 706 | if(logger.isTraceEnabled()) |
| 707 | logger.trace("readFrom - read={}", tableStatsEntryVer11); |
| 708 | return tableStatsEntryVer11; |
| 709 | } |
| 710 | } |
| 711 | |
| 712 | public void putTo(PrimitiveSink sink) { |
| 713 | FUNNEL.funnel(this, sink); |
| 714 | } |
| 715 | |
| 716 | final static OFTableStatsEntryVer11Funnel FUNNEL = new OFTableStatsEntryVer11Funnel(); |
| 717 | static class OFTableStatsEntryVer11Funnel implements Funnel<OFTableStatsEntryVer11> { |
| 718 | private static final long serialVersionUID = 1L; |
| 719 | @Override |
| 720 | public void funnel(OFTableStatsEntryVer11 message, PrimitiveSink sink) { |
| 721 | message.tableId.putTo(sink); |
| 722 | // skip pad (7 bytes) |
| 723 | sink.putUnencodedChars(message.name); |
| 724 | sink.putInt(message.wildcards); |
| 725 | message.match.putTo(sink); |
| 726 | sink.putLong(message.instructions); |
| 727 | sink.putLong(message.writeActions); |
| 728 | sink.putLong(message.applyActions); |
| 729 | sink.putLong(message.config); |
| 730 | sink.putLong(message.maxEntries); |
| 731 | sink.putLong(message.activeCount); |
| 732 | message.lookupCount.putTo(sink); |
| 733 | message.matchedCount.putTo(sink); |
| 734 | } |
| 735 | } |
| 736 | |
| 737 | |
| 738 | public void writeTo(ChannelBuffer bb) { |
| 739 | WRITER.write(bb, this); |
| 740 | } |
| 741 | |
| 742 | final static Writer WRITER = new Writer(); |
| 743 | static class Writer implements OFMessageWriter<OFTableStatsEntryVer11> { |
| 744 | @Override |
| 745 | public void write(ChannelBuffer bb, OFTableStatsEntryVer11 message) { |
| 746 | message.tableId.writeByte(bb); |
| 747 | // pad: 7 bytes |
| 748 | bb.writeZero(7); |
| 749 | ChannelUtils.writeFixedLengthString(bb, message.name, 32); |
| 750 | bb.writeInt(message.wildcards); |
| 751 | ChannelUtilsVer11.writeOFMatchBmap(bb, message.match); |
| 752 | bb.writeInt(U32.t(message.instructions)); |
| 753 | bb.writeInt(U32.t(message.writeActions)); |
| 754 | bb.writeInt(U32.t(message.applyActions)); |
| 755 | bb.writeInt(U32.t(message.config)); |
| 756 | bb.writeInt(U32.t(message.maxEntries)); |
| 757 | bb.writeInt(U32.t(message.activeCount)); |
| 758 | bb.writeLong(message.lookupCount.getValue()); |
| 759 | bb.writeLong(message.matchedCount.getValue()); |
| 760 | |
| 761 | |
| 762 | } |
| 763 | } |
| 764 | |
| 765 | @Override |
| 766 | public String toString() { |
| 767 | StringBuilder b = new StringBuilder("OFTableStatsEntryVer11("); |
| 768 | b.append("tableId=").append(tableId); |
| 769 | b.append(", "); |
| 770 | b.append("name=").append(name); |
| 771 | b.append(", "); |
| 772 | b.append("wildcards=").append(wildcards); |
| 773 | b.append(", "); |
| 774 | b.append("match=").append(match); |
| 775 | b.append(", "); |
| 776 | b.append("instructions=").append(instructions); |
| 777 | b.append(", "); |
| 778 | b.append("writeActions=").append(writeActions); |
| 779 | b.append(", "); |
| 780 | b.append("applyActions=").append(applyActions); |
| 781 | b.append(", "); |
| 782 | b.append("config=").append(config); |
| 783 | b.append(", "); |
| 784 | b.append("maxEntries=").append(maxEntries); |
| 785 | b.append(", "); |
| 786 | b.append("activeCount=").append(activeCount); |
| 787 | b.append(", "); |
| 788 | b.append("lookupCount=").append(lookupCount); |
| 789 | b.append(", "); |
| 790 | b.append("matchedCount=").append(matchedCount); |
| 791 | b.append(")"); |
| 792 | return b.toString(); |
| 793 | } |
| 794 | |
| 795 | @Override |
| 796 | public boolean equals(Object obj) { |
| 797 | if (this == obj) |
| 798 | return true; |
| 799 | if (obj == null) |
| 800 | return false; |
| 801 | if (getClass() != obj.getClass()) |
| 802 | return false; |
| 803 | OFTableStatsEntryVer11 other = (OFTableStatsEntryVer11) obj; |
| 804 | |
| 805 | if (tableId == null) { |
| 806 | if (other.tableId != null) |
| 807 | return false; |
| 808 | } else if (!tableId.equals(other.tableId)) |
| 809 | return false; |
| 810 | if (name == null) { |
| 811 | if (other.name != null) |
| 812 | return false; |
| 813 | } else if (!name.equals(other.name)) |
| 814 | return false; |
| 815 | if( wildcards != other.wildcards) |
| 816 | return false; |
| 817 | if (match == null) { |
| 818 | if (other.match != null) |
| 819 | return false; |
| 820 | } else if (!match.equals(other.match)) |
| 821 | return false; |
| 822 | if( instructions != other.instructions) |
| 823 | return false; |
| 824 | if( writeActions != other.writeActions) |
| 825 | return false; |
| 826 | if( applyActions != other.applyActions) |
| 827 | return false; |
| 828 | if( config != other.config) |
| 829 | return false; |
| 830 | if( maxEntries != other.maxEntries) |
| 831 | return false; |
| 832 | if( activeCount != other.activeCount) |
| 833 | return false; |
| 834 | if (lookupCount == null) { |
| 835 | if (other.lookupCount != null) |
| 836 | return false; |
| 837 | } else if (!lookupCount.equals(other.lookupCount)) |
| 838 | return false; |
| 839 | if (matchedCount == null) { |
| 840 | if (other.matchedCount != null) |
| 841 | return false; |
| 842 | } else if (!matchedCount.equals(other.matchedCount)) |
| 843 | return false; |
| 844 | return true; |
| 845 | } |
| 846 | |
| 847 | @Override |
| 848 | public int hashCode() { |
| 849 | final int prime = 31; |
| 850 | int result = 1; |
| 851 | |
| 852 | result = prime * result + ((tableId == null) ? 0 : tableId.hashCode()); |
| 853 | result = prime * result + ((name == null) ? 0 : name.hashCode()); |
| 854 | result = prime * result + wildcards; |
| 855 | result = prime * result + ((match == null) ? 0 : match.hashCode()); |
| 856 | result = prime * (int) (instructions ^ (instructions >>> 32)); |
| 857 | result = prime * (int) (writeActions ^ (writeActions >>> 32)); |
| 858 | result = prime * (int) (applyActions ^ (applyActions >>> 32)); |
| 859 | result = prime * (int) (config ^ (config >>> 32)); |
| 860 | result = prime * (int) (maxEntries ^ (maxEntries >>> 32)); |
| 861 | result = prime * (int) (activeCount ^ (activeCount >>> 32)); |
| 862 | result = prime * result + ((lookupCount == null) ? 0 : lookupCount.hashCode()); |
| 863 | result = prime * result + ((matchedCount == null) ? 0 : matchedCount.hashCode()); |
| 864 | return result; |
| 865 | } |
| 866 | |
| 867 | } |