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