blob: 285afd3059e122f0e17b9ffe0dac26681cde43e6 [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 OFBsnGentableBucketStatsRequestVer13 implements OFBsnGentableBucketStatsRequest {
35 private static final Logger logger = LoggerFactory.getLogger(OFBsnGentableBucketStatsRequestVer13.class);
36 // version: 1.3
37 final static byte WIRE_VERSION = 4;
38 final static int LENGTH = 26;
39
40 private final static long DEFAULT_XID = 0x0L;
41 private final static Set<OFStatsRequestFlags> DEFAULT_FLAGS = ImmutableSet.<OFStatsRequestFlags>of();
42
43 // OF message fields
44 private final long xid;
45 private final Set<OFStatsRequestFlags> flags;
46 private final GenTableId tableId;
47//
48
49 // package private constructor - used by readers, builders, and factory
50 OFBsnGentableBucketStatsRequestVer13(long xid, Set<OFStatsRequestFlags> flags, GenTableId tableId) {
51 this.xid = xid;
52 this.flags = flags;
53 this.tableId = tableId;
54 }
55
56 // Accessors for OF message fields
57 @Override
58 public OFVersion getVersion() {
59 return OFVersion.OF_13;
60 }
61
62 @Override
63 public OFType getType() {
64 return OFType.STATS_REQUEST;
65 }
66
67 @Override
68 public long getXid() {
69 return xid;
70 }
71
72 @Override
73 public OFStatsType getStatsType() {
74 return OFStatsType.EXPERIMENTER;
75 }
76
77 @Override
78 public Set<OFStatsRequestFlags> getFlags() {
79 return flags;
80 }
81
82 @Override
83 public long getExperimenter() {
84 return 0x5c16c7L;
85 }
86
87 @Override
88 public long getSubtype() {
89 return 0x5L;
90 }
91
92 @Override
93 public GenTableId getTableId() {
94 return tableId;
95 }
96
97
98
99 public OFBsnGentableBucketStatsRequest.Builder createBuilder() {
100 return new BuilderWithParent(this);
101 }
102
103 static class BuilderWithParent implements OFBsnGentableBucketStatsRequest.Builder {
104 final OFBsnGentableBucketStatsRequestVer13 parentMessage;
105
106 // OF message fields
107 private boolean xidSet;
108 private long xid;
109 private boolean flagsSet;
110 private Set<OFStatsRequestFlags> flags;
111 private boolean tableIdSet;
112 private GenTableId tableId;
113
114 BuilderWithParent(OFBsnGentableBucketStatsRequestVer13 parentMessage) {
115 this.parentMessage = parentMessage;
116 }
117
118 @Override
119 public OFVersion getVersion() {
120 return OFVersion.OF_13;
121 }
122
123 @Override
124 public OFType getType() {
125 return OFType.STATS_REQUEST;
126 }
127
128 @Override
129 public long getXid() {
130 return xid;
131 }
132
133 @Override
134 public OFBsnGentableBucketStatsRequest.Builder setXid(long xid) {
135 this.xid = xid;
136 this.xidSet = true;
137 return this;
138 }
139 @Override
140 public OFStatsType getStatsType() {
141 return OFStatsType.EXPERIMENTER;
142 }
143
144 @Override
145 public Set<OFStatsRequestFlags> getFlags() {
146 return flags;
147 }
148
149 @Override
150 public OFBsnGentableBucketStatsRequest.Builder setFlags(Set<OFStatsRequestFlags> flags) {
151 this.flags = flags;
152 this.flagsSet = true;
153 return this;
154 }
155 @Override
156 public long getExperimenter() {
157 return 0x5c16c7L;
158 }
159
160 @Override
161 public long getSubtype() {
162 return 0x5L;
163 }
164
165 @Override
166 public GenTableId getTableId() {
167 return tableId;
168 }
169
170 @Override
171 public OFBsnGentableBucketStatsRequest.Builder setTableId(GenTableId tableId) {
172 this.tableId = tableId;
173 this.tableIdSet = true;
174 return this;
175 }
176
177
178 @Override
179 public OFBsnGentableBucketStatsRequest build() {
180 long xid = this.xidSet ? this.xid : parentMessage.xid;
181 Set<OFStatsRequestFlags> flags = this.flagsSet ? this.flags : parentMessage.flags;
182 if(flags == null)
183 throw new NullPointerException("Property flags must not be null");
184 GenTableId tableId = this.tableIdSet ? this.tableId : parentMessage.tableId;
185 if(tableId == null)
186 throw new NullPointerException("Property tableId must not be null");
187
188 //
189 return new OFBsnGentableBucketStatsRequestVer13(
190 xid,
191 flags,
192 tableId
193 );
194 }
195
196 }
197
198 static class Builder implements OFBsnGentableBucketStatsRequest.Builder {
199 // OF message fields
200 private boolean xidSet;
201 private long xid;
202 private boolean flagsSet;
203 private Set<OFStatsRequestFlags> flags;
204 private boolean tableIdSet;
205 private GenTableId tableId;
206
207 @Override
208 public OFVersion getVersion() {
209 return OFVersion.OF_13;
210 }
211
212 @Override
213 public OFType getType() {
214 return OFType.STATS_REQUEST;
215 }
216
217 @Override
218 public long getXid() {
219 return xid;
220 }
221
222 @Override
223 public OFBsnGentableBucketStatsRequest.Builder setXid(long xid) {
224 this.xid = xid;
225 this.xidSet = true;
226 return this;
227 }
228 @Override
229 public OFStatsType getStatsType() {
230 return OFStatsType.EXPERIMENTER;
231 }
232
233 @Override
234 public Set<OFStatsRequestFlags> getFlags() {
235 return flags;
236 }
237
238 @Override
239 public OFBsnGentableBucketStatsRequest.Builder setFlags(Set<OFStatsRequestFlags> flags) {
240 this.flags = flags;
241 this.flagsSet = true;
242 return this;
243 }
244 @Override
245 public long getExperimenter() {
246 return 0x5c16c7L;
247 }
248
249 @Override
250 public long getSubtype() {
251 return 0x5L;
252 }
253
254 @Override
255 public GenTableId getTableId() {
256 return tableId;
257 }
258
259 @Override
260 public OFBsnGentableBucketStatsRequest.Builder setTableId(GenTableId tableId) {
261 this.tableId = tableId;
262 this.tableIdSet = true;
263 return this;
264 }
265//
266 @Override
267 public OFBsnGentableBucketStatsRequest build() {
268 long xid = this.xidSet ? this.xid : DEFAULT_XID;
269 Set<OFStatsRequestFlags> flags = this.flagsSet ? this.flags : DEFAULT_FLAGS;
270 if(flags == null)
271 throw new NullPointerException("Property flags must not be null");
272 if(!this.tableIdSet)
273 throw new IllegalStateException("Property tableId doesn't have default value -- must be set");
274 if(tableId == null)
275 throw new NullPointerException("Property tableId must not be null");
276
277
278 return new OFBsnGentableBucketStatsRequestVer13(
279 xid,
280 flags,
281 tableId
282 );
283 }
284
285 }
286
287
288 final static Reader READER = new Reader();
289 static class Reader implements OFMessageReader<OFBsnGentableBucketStatsRequest> {
290 @Override
291 public OFBsnGentableBucketStatsRequest readFrom(ChannelBuffer bb) throws OFParseError {
292 int start = bb.readerIndex();
293 // fixed value property version == 4
294 byte version = bb.readByte();
295 if(version != (byte) 0x4)
296 throw new OFParseError("Wrong version: Expected=OFVersion.OF_13(4), got="+version);
297 // fixed value property type == 18
298 byte type = bb.readByte();
299 if(type != (byte) 0x12)
300 throw new OFParseError("Wrong type: Expected=OFType.STATS_REQUEST(18), got="+type);
301 int length = U16.f(bb.readShort());
302 if(length != 26)
303 throw new OFParseError("Wrong length: Expected=26(26), got="+length);
304 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
305 // Buffer does not have all data yet
306 bb.readerIndex(start);
307 return null;
308 }
309 if(logger.isTraceEnabled())
310 logger.trace("readFrom - length={}", length);
311 long xid = U32.f(bb.readInt());
312 // fixed value property statsType == 65535
313 short statsType = bb.readShort();
314 if(statsType != (short) 0xffff)
315 throw new OFParseError("Wrong statsType: Expected=OFStatsType.EXPERIMENTER(65535), got="+statsType);
316 Set<OFStatsRequestFlags> flags = OFStatsRequestFlagsSerializerVer13.readFrom(bb);
317 // pad: 4 bytes
318 bb.skipBytes(4);
319 // fixed value property experimenter == 0x5c16c7L
320 int experimenter = bb.readInt();
321 if(experimenter != 0x5c16c7)
322 throw new OFParseError("Wrong experimenter: Expected=0x5c16c7L(0x5c16c7L), got="+experimenter);
323 // fixed value property subtype == 0x5L
324 int subtype = bb.readInt();
325 if(subtype != 0x5)
326 throw new OFParseError("Wrong subtype: Expected=0x5L(0x5L), got="+subtype);
327 GenTableId tableId = GenTableId.read2Bytes(bb);
328
329 OFBsnGentableBucketStatsRequestVer13 bsnGentableBucketStatsRequestVer13 = new OFBsnGentableBucketStatsRequestVer13(
330 xid,
331 flags,
332 tableId
333 );
334 if(logger.isTraceEnabled())
335 logger.trace("readFrom - read={}", bsnGentableBucketStatsRequestVer13);
336 return bsnGentableBucketStatsRequestVer13;
337 }
338 }
339
340 public void putTo(PrimitiveSink sink) {
341 FUNNEL.funnel(this, sink);
342 }
343
344 final static OFBsnGentableBucketStatsRequestVer13Funnel FUNNEL = new OFBsnGentableBucketStatsRequestVer13Funnel();
345 static class OFBsnGentableBucketStatsRequestVer13Funnel implements Funnel<OFBsnGentableBucketStatsRequestVer13> {
346 private static final long serialVersionUID = 1L;
347 @Override
348 public void funnel(OFBsnGentableBucketStatsRequestVer13 message, PrimitiveSink sink) {
349 // fixed value property version = 4
350 sink.putByte((byte) 0x4);
351 // fixed value property type = 18
352 sink.putByte((byte) 0x12);
353 // fixed value property length = 26
354 sink.putShort((short) 0x1a);
355 sink.putLong(message.xid);
356 // fixed value property statsType = 65535
357 sink.putShort((short) 0xffff);
358 OFStatsRequestFlagsSerializerVer13.putTo(message.flags, sink);
359 // skip pad (4 bytes)
360 // fixed value property experimenter = 0x5c16c7L
361 sink.putInt(0x5c16c7);
362 // fixed value property subtype = 0x5L
363 sink.putInt(0x5);
364 message.tableId.putTo(sink);
365 }
366 }
367
368
369 public void writeTo(ChannelBuffer bb) {
370 WRITER.write(bb, this);
371 }
372
373 final static Writer WRITER = new Writer();
374 static class Writer implements OFMessageWriter<OFBsnGentableBucketStatsRequestVer13> {
375 @Override
376 public void write(ChannelBuffer bb, OFBsnGentableBucketStatsRequestVer13 message) {
377 // fixed value property version = 4
378 bb.writeByte((byte) 0x4);
379 // fixed value property type = 18
380 bb.writeByte((byte) 0x12);
381 // fixed value property length = 26
382 bb.writeShort((short) 0x1a);
383 bb.writeInt(U32.t(message.xid));
384 // fixed value property statsType = 65535
385 bb.writeShort((short) 0xffff);
386 OFStatsRequestFlagsSerializerVer13.writeTo(bb, message.flags);
387 // pad: 4 bytes
388 bb.writeZero(4);
389 // fixed value property experimenter = 0x5c16c7L
390 bb.writeInt(0x5c16c7);
391 // fixed value property subtype = 0x5L
392 bb.writeInt(0x5);
393 message.tableId.write2Bytes(bb);
394
395
396 }
397 }
398
399 @Override
400 public String toString() {
401 StringBuilder b = new StringBuilder("OFBsnGentableBucketStatsRequestVer13(");
402 b.append("xid=").append(xid);
403 b.append(", ");
404 b.append("flags=").append(flags);
405 b.append(", ");
406 b.append("tableId=").append(tableId);
407 b.append(")");
408 return b.toString();
409 }
410
411 @Override
412 public boolean equals(Object obj) {
413 if (this == obj)
414 return true;
415 if (obj == null)
416 return false;
417 if (getClass() != obj.getClass())
418 return false;
419 OFBsnGentableBucketStatsRequestVer13 other = (OFBsnGentableBucketStatsRequestVer13) obj;
420
421 if( xid != other.xid)
422 return false;
423 if (flags == null) {
424 if (other.flags != null)
425 return false;
426 } else if (!flags.equals(other.flags))
427 return false;
428 if (tableId == null) {
429 if (other.tableId != null)
430 return false;
431 } else if (!tableId.equals(other.tableId))
432 return false;
433 return true;
434 }
435
436 @Override
437 public int hashCode() {
438 final int prime = 31;
439 int result = 1;
440
441 result = prime * (int) (xid ^ (xid >>> 32));
442 result = prime * result + ((flags == null) ? 0 : flags.hashCode());
443 result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
444 return result;
445 }
446
447}