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