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