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