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