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