blob: 36d9bd7d6ea6a3fa746d5f9d9dbbaea4d3c29bb4 [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 com.google.common.collect.ImmutableSet;
30import org.jboss.netty.buffer.ChannelBuffer;
31import com.google.common.hash.PrimitiveSink;
32import com.google.common.hash.Funnel;
33
34class OFBsnGentableEntryDescStatsRequestVer13 implements OFBsnGentableEntryDescStatsRequest {
35 private static final Logger logger = LoggerFactory.getLogger(OFBsnGentableEntryDescStatsRequestVer13.class);
36 // version: 1.3
37 final static byte WIRE_VERSION = 4;
38 final static int LENGTH = 60;
39
40 private final static long DEFAULT_XID = 0x0L;
41 private final static Set<OFStatsRequestFlags> DEFAULT_FLAGS = ImmutableSet.<OFStatsRequestFlags>of();
42 private final static U128 DEFAULT_CHECKSUM = U128.ZERO;
43 private final static U128 DEFAULT_CHECKSUM_MASK = U128.ZERO;
44
45 // OF message fields
46 private final long xid;
47 private final Set<OFStatsRequestFlags> flags;
48 private final GenTableId tableId;
49 private final U128 checksum;
50 private final U128 checksumMask;
51//
52
53 // package private constructor - used by readers, builders, and factory
54 OFBsnGentableEntryDescStatsRequestVer13(long xid, Set<OFStatsRequestFlags> flags, GenTableId tableId, U128 checksum, U128 checksumMask) {
55 this.xid = xid;
56 this.flags = flags;
57 this.tableId = tableId;
58 this.checksum = checksum;
59 this.checksumMask = checksumMask;
60 }
61
62 // Accessors for OF message fields
63 @Override
64 public OFVersion getVersion() {
65 return OFVersion.OF_13;
66 }
67
68 @Override
69 public OFType getType() {
70 return OFType.STATS_REQUEST;
71 }
72
73 @Override
74 public long getXid() {
75 return xid;
76 }
77
78 @Override
79 public OFStatsType getStatsType() {
80 return OFStatsType.EXPERIMENTER;
81 }
82
83 @Override
84 public Set<OFStatsRequestFlags> getFlags() {
85 return flags;
86 }
87
88 @Override
89 public long getExperimenter() {
90 return 0x5c16c7L;
91 }
92
93 @Override
94 public long getSubtype() {
95 return 0x2L;
96 }
97
98 @Override
99 public GenTableId getTableId() {
100 return tableId;
101 }
102
103 @Override
104 public U128 getChecksum() {
105 return checksum;
106 }
107
108 @Override
109 public U128 getChecksumMask() {
110 return checksumMask;
111 }
112
113
114
115 public OFBsnGentableEntryDescStatsRequest.Builder createBuilder() {
116 return new BuilderWithParent(this);
117 }
118
119 static class BuilderWithParent implements OFBsnGentableEntryDescStatsRequest.Builder {
120 final OFBsnGentableEntryDescStatsRequestVer13 parentMessage;
121
122 // OF message fields
123 private boolean xidSet;
124 private long xid;
125 private boolean flagsSet;
126 private Set<OFStatsRequestFlags> flags;
127 private boolean tableIdSet;
128 private GenTableId tableId;
129 private boolean checksumSet;
130 private U128 checksum;
131 private boolean checksumMaskSet;
132 private U128 checksumMask;
133
134 BuilderWithParent(OFBsnGentableEntryDescStatsRequestVer13 parentMessage) {
135 this.parentMessage = parentMessage;
136 }
137
138 @Override
139 public OFVersion getVersion() {
140 return OFVersion.OF_13;
141 }
142
143 @Override
144 public OFType getType() {
145 return OFType.STATS_REQUEST;
146 }
147
148 @Override
149 public long getXid() {
150 return xid;
151 }
152
153 @Override
154 public OFBsnGentableEntryDescStatsRequest.Builder setXid(long xid) {
155 this.xid = xid;
156 this.xidSet = true;
157 return this;
158 }
159 @Override
160 public OFStatsType getStatsType() {
161 return OFStatsType.EXPERIMENTER;
162 }
163
164 @Override
165 public Set<OFStatsRequestFlags> getFlags() {
166 return flags;
167 }
168
169 @Override
170 public OFBsnGentableEntryDescStatsRequest.Builder setFlags(Set<OFStatsRequestFlags> flags) {
171 this.flags = flags;
172 this.flagsSet = true;
173 return this;
174 }
175 @Override
176 public long getExperimenter() {
177 return 0x5c16c7L;
178 }
179
180 @Override
181 public long getSubtype() {
182 return 0x2L;
183 }
184
185 @Override
186 public GenTableId getTableId() {
187 return tableId;
188 }
189
190 @Override
191 public OFBsnGentableEntryDescStatsRequest.Builder setTableId(GenTableId tableId) {
192 this.tableId = tableId;
193 this.tableIdSet = true;
194 return this;
195 }
196 @Override
197 public U128 getChecksum() {
198 return checksum;
199 }
200
201 @Override
202 public OFBsnGentableEntryDescStatsRequest.Builder setChecksum(U128 checksum) {
203 this.checksum = checksum;
204 this.checksumSet = true;
205 return this;
206 }
207 @Override
208 public U128 getChecksumMask() {
209 return checksumMask;
210 }
211
212 @Override
213 public OFBsnGentableEntryDescStatsRequest.Builder setChecksumMask(U128 checksumMask) {
214 this.checksumMask = checksumMask;
215 this.checksumMaskSet = true;
216 return this;
217 }
218
219
220 @Override
221 public OFBsnGentableEntryDescStatsRequest build() {
222 long xid = this.xidSet ? this.xid : parentMessage.xid;
223 Set<OFStatsRequestFlags> flags = this.flagsSet ? this.flags : parentMessage.flags;
224 if(flags == null)
225 throw new NullPointerException("Property flags must not be null");
226 GenTableId tableId = this.tableIdSet ? this.tableId : parentMessage.tableId;
227 if(tableId == null)
228 throw new NullPointerException("Property tableId must not be null");
229 U128 checksum = this.checksumSet ? this.checksum : parentMessage.checksum;
230 if(checksum == null)
231 throw new NullPointerException("Property checksum must not be null");
232 U128 checksumMask = this.checksumMaskSet ? this.checksumMask : parentMessage.checksumMask;
233 if(checksumMask == null)
234 throw new NullPointerException("Property checksumMask must not be null");
235
236 //
237 return new OFBsnGentableEntryDescStatsRequestVer13(
238 xid,
239 flags,
240 tableId,
241 checksum,
242 checksumMask
243 );
244 }
245
246 }
247
248 static class Builder implements OFBsnGentableEntryDescStatsRequest.Builder {
249 // OF message fields
250 private boolean xidSet;
251 private long xid;
252 private boolean flagsSet;
253 private Set<OFStatsRequestFlags> flags;
254 private boolean tableIdSet;
255 private GenTableId tableId;
256 private boolean checksumSet;
257 private U128 checksum;
258 private boolean checksumMaskSet;
259 private U128 checksumMask;
260
261 @Override
262 public OFVersion getVersion() {
263 return OFVersion.OF_13;
264 }
265
266 @Override
267 public OFType getType() {
268 return OFType.STATS_REQUEST;
269 }
270
271 @Override
272 public long getXid() {
273 return xid;
274 }
275
276 @Override
277 public OFBsnGentableEntryDescStatsRequest.Builder setXid(long xid) {
278 this.xid = xid;
279 this.xidSet = true;
280 return this;
281 }
282 @Override
283 public OFStatsType getStatsType() {
284 return OFStatsType.EXPERIMENTER;
285 }
286
287 @Override
288 public Set<OFStatsRequestFlags> getFlags() {
289 return flags;
290 }
291
292 @Override
293 public OFBsnGentableEntryDescStatsRequest.Builder setFlags(Set<OFStatsRequestFlags> flags) {
294 this.flags = flags;
295 this.flagsSet = true;
296 return this;
297 }
298 @Override
299 public long getExperimenter() {
300 return 0x5c16c7L;
301 }
302
303 @Override
304 public long getSubtype() {
305 return 0x2L;
306 }
307
308 @Override
309 public GenTableId getTableId() {
310 return tableId;
311 }
312
313 @Override
314 public OFBsnGentableEntryDescStatsRequest.Builder setTableId(GenTableId tableId) {
315 this.tableId = tableId;
316 this.tableIdSet = true;
317 return this;
318 }
319 @Override
320 public U128 getChecksum() {
321 return checksum;
322 }
323
324 @Override
325 public OFBsnGentableEntryDescStatsRequest.Builder setChecksum(U128 checksum) {
326 this.checksum = checksum;
327 this.checksumSet = true;
328 return this;
329 }
330 @Override
331 public U128 getChecksumMask() {
332 return checksumMask;
333 }
334
335 @Override
336 public OFBsnGentableEntryDescStatsRequest.Builder setChecksumMask(U128 checksumMask) {
337 this.checksumMask = checksumMask;
338 this.checksumMaskSet = true;
339 return this;
340 }
341//
342 @Override
343 public OFBsnGentableEntryDescStatsRequest build() {
344 long xid = this.xidSet ? this.xid : DEFAULT_XID;
345 Set<OFStatsRequestFlags> flags = this.flagsSet ? this.flags : DEFAULT_FLAGS;
346 if(flags == null)
347 throw new NullPointerException("Property flags must not be null");
348 if(!this.tableIdSet)
349 throw new IllegalStateException("Property tableId doesn't have default value -- must be set");
350 if(tableId == null)
351 throw new NullPointerException("Property tableId must not be null");
352 U128 checksum = this.checksumSet ? this.checksum : DEFAULT_CHECKSUM;
353 if(checksum == null)
354 throw new NullPointerException("Property checksum must not be null");
355 U128 checksumMask = this.checksumMaskSet ? this.checksumMask : DEFAULT_CHECKSUM_MASK;
356 if(checksumMask == null)
357 throw new NullPointerException("Property checksumMask must not be null");
358
359
360 return new OFBsnGentableEntryDescStatsRequestVer13(
361 xid,
362 flags,
363 tableId,
364 checksum,
365 checksumMask
366 );
367 }
368
369 }
370
371
372 final static Reader READER = new Reader();
373 static class Reader implements OFMessageReader<OFBsnGentableEntryDescStatsRequest> {
374 @Override
375 public OFBsnGentableEntryDescStatsRequest readFrom(ChannelBuffer bb) throws OFParseError {
376 int start = bb.readerIndex();
377 // fixed value property version == 4
378 byte version = bb.readByte();
379 if(version != (byte) 0x4)
380 throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got="+version);
381 // fixed value property type == 18
382 byte type = bb.readByte();
383 if(type != (byte) 0x12)
384 throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got="+type);
385 int length = U16.f(bb.readShort());
386 if(length != 60)
387 throw new OFParseError("Wrong length: Expected=60(60), got="+length);
388 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
389 // Buffer does not have all data yet
390 bb.readerIndex(start);
391 return null;
392 }
393 if(logger.isTraceEnabled())
394 logger.trace("readFrom - length={}", length);
395 long xid = U32.f(bb.readInt());
396 // fixed value property statsType == 65535
397 short statsType = bb.readShort();
398 if(statsType != (short) 0xffff)
399 throw new OFParseError("Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got="+statsType);
400 Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb);
401 // pad: 4 bytes
402 bb.skipBytes(4);
403 // fixed value property experimenter == 0x5c16c7L
404 int experimenter = bb.readInt();
405 if(experimenter != 0x5c16c7)
406 throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
407 // fixed value property subtype == 0x2L
408 int subtype = bb.readInt();
409 if(subtype != 0x2)
410 throw new OFParseError("Wrong subtype: Expected=0x2L(0x2L), got="+subtype);
411 GenTableId tableId = GenTableId.read2Bytes(bb);
412 // pad: 2 bytes
413 bb.skipBytes(2);
414 U128 checksum = U128.read16Bytes(bb);
415 U128 checksumMask = U128.read16Bytes(bb);
416
417 OFBsnGentableEntryDescStatsRequestVer13 bsnGentableEntryDescStatsRequestVer13 = new OFBsnGentableEntryDescStatsRequestVer13(
418 xid,
419 flags,
420 tableId,
421 checksum,
422 checksumMask
423 );
424 if(logger.isTraceEnabled())
425 logger.trace("readFrom - read={}", bsnGentableEntryDescStatsRequestVer13);
426 return bsnGentableEntryDescStatsRequestVer13;
427 }
428 }
429
430 public void putTo(PrimitiveSink sink) {
431 FUNNEL.funnel(this, sink);
432 }
433
434 final static OFBsnGentableEntryDescStatsRequestVer13Funnel FUNNEL = new OFBsnGentableEntryDescStatsRequestVer13Funnel();
435 static class OFBsnGentableEntryDescStatsRequestVer13Funnel implements Funnel<OFBsnGentableEntryDescStatsRequestVer13> {
436 private static final long serialVersionUID = 1L;
437 @Override
438 public void funnel(OFBsnGentableEntryDescStatsRequestVer13 message, PrimitiveSink sink) {
439 // fixed value property version = 4
440 sink.putByte((byte) 0x4);
441 // fixed value property type = 18
442 sink.putByte((byte) 0x12);
443 // fixed value property length = 60
444 sink.putShort((short) 0x3c);
445 sink.putLong(message.xid);
446 // fixed value property statsType = 65535
447 sink.putShort((short) 0xffff);
448 OFStatsRequestFlagsSerializerVer13.putTo(message.flags, sink);
449 // skip pad (4 bytes)
450 // fixed value property experimenter = 0x5c16c7L
451 sink.putInt(0x5c16c7);
452 // fixed value property subtype = 0x2L
453 sink.putInt(0x2);
454 message.tableId.putTo(sink);
455 // skip pad (2 bytes)
456 message.checksum.putTo(sink);
457 message.checksumMask.putTo(sink);
458 }
459 }
460
461
462 public void writeTo(ChannelBuffer bb) {
463 WRITER.write(bb, this);
464 }
465
466 final static Writer WRITER = new Writer();
467 static class Writer implements OFMessageWriter<OFBsnGentableEntryDescStatsRequestVer13> {
468 @Override
469 public void write(ChannelBuffer bb, OFBsnGentableEntryDescStatsRequestVer13 message) {
470 // fixed value property version = 4
471 bb.writeByte((byte) 0x4);
472 // fixed value property type = 18
473 bb.writeByte((byte) 0x12);
474 // fixed value property length = 60
475 bb.writeShort((short) 0x3c);
476 bb.writeInt(U32.t(message.xid));
477 // fixed value property statsType = 65535
478 bb.writeShort((short) 0xffff);
479 OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags);
480 // pad: 4 bytes
481 bb.writeZero(4);
482 // fixed value property experimenter = 0x5c16c7L
483 bb.writeInt(0x5c16c7);
484 // fixed value property subtype = 0x2L
485 bb.writeInt(0x2);
486 message.tableId.write2Bytes(bb);
487 // pad: 2 bytes
488 bb.writeZero(2);
489 message.checksum.write16Bytes(bb);
490 message.checksumMask.write16Bytes(bb);
491
492
493 }
494 }
495
496 @Override
497 public String toString() {
498 StringBuilder b = new StringBuilder("OFBsnGentableEntryDescStatsRequestVer13(");
499 b.append("xid=").append(xid);
500 b.append(", ");
501 b.append("flags=").append(flags);
502 b.append(", ");
503 b.append("tableId=").append(tableId);
504 b.append(", ");
505 b.append("checksum=").append(checksum);
506 b.append(", ");
507 b.append("checksumMask=").append(checksumMask);
508 b.append(")");
509 return b.toString();
510 }
511
512 @Override
513 public boolean equals(Object obj) {
514 if (this == obj)
515 return true;
516 if (obj == null)
517 return false;
518 if (getClass() != obj.getClass())
519 return false;
520 OFBsnGentableEntryDescStatsRequestVer13 other = (OFBsnGentableEntryDescStatsRequestVer13) obj;
521
522 if( xid != other.xid)
523 return false;
524 if (flags == null) {
525 if (other.flags != null)
526 return false;
527 } else if (!flags.equals(other.flags))
528 return false;
529 if (tableId == null) {
530 if (other.tableId != null)
531 return false;
532 } else if (!tableId.equals(other.tableId))
533 return false;
534 if (checksum == null) {
535 if (other.checksum != null)
536 return false;
537 } else if (!checksum.equals(other.checksum))
538 return false;
539 if (checksumMask == null) {
540 if (other.checksumMask != null)
541 return false;
542 } else if (!checksumMask.equals(other.checksumMask))
543 return false;
544 return true;
545 }
546
547 @Override
548 public int hashCode() {
549 final int prime = 31;
550 int result = 1;
551
552 result = prime * (int) (xid ^ (xid >>> 32));
553 result = prime * result + ((flags == null) ? 0 : flags.hashCode());
554 result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
555 result = prime * result + ((checksum == null) ? 0 : checksum.hashCode());
556 result = prime * result + ((checksumMask == null) ? 0 : checksumMask.hashCode());
557 return result;
558 }
559
560}