blob: 66bd513c2805ea49105f37df2afc4a493a60d0ed [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 org.jboss.netty.buffer.ChannelBuffer;
30import com.google.common.hash.PrimitiveSink;
31import com.google.common.hash.Funnel;
32
33class OFOxmBsnLagIdVer13 implements OFOxmBsnLagId {
34 private static final Logger logger = LoggerFactory.getLogger(OFOxmBsnLagIdVer13.class);
35 // version: 1.3
36 final static byte WIRE_VERSION = 4;
37 final static int LENGTH = 8;
38
39 private final static LagId DEFAULT_VALUE = LagId.NONE;
40
41 // OF message fields
42 private final LagId value;
43//
44 // Immutable default instance
45 final static OFOxmBsnLagIdVer13 DEFAULT = new OFOxmBsnLagIdVer13(
46 DEFAULT_VALUE
47 );
48
49 // package private constructor - used by readers, builders, and factory
50 OFOxmBsnLagIdVer13(LagId value) {
51 this.value = value;
52 }
53
54 // Accessors for OF message fields
55 @Override
56 public long getTypeLen() {
57 return 0x30204L;
58 }
59
60 @Override
61 public LagId getValue() {
62 return value;
63 }
64
65 @Override
66 public MatchField<LagId> getMatchField() {
67 return MatchField.BSN_LAG_ID;
68 }
69
70 @Override
71 public boolean isMasked() {
72 return false;
73 }
74
75 public OFOxm<LagId> getCanonical() {
76 // exact match OXM is always canonical
77 return this;
78 }
79
80 @Override
81 public LagId getMask()throws UnsupportedOperationException {
82 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
83 }
84
85 @Override
86 public OFVersion getVersion() {
87 return OFVersion.OF_13;
88 }
89
90
91
92 public OFOxmBsnLagId.Builder createBuilder() {
93 return new BuilderWithParent(this);
94 }
95
96 static class BuilderWithParent implements OFOxmBsnLagId.Builder {
97 final OFOxmBsnLagIdVer13 parentMessage;
98
99 // OF message fields
100 private boolean valueSet;
101 private LagId value;
102
103 BuilderWithParent(OFOxmBsnLagIdVer13 parentMessage) {
104 this.parentMessage = parentMessage;
105 }
106
107 @Override
108 public long getTypeLen() {
109 return 0x30204L;
110 }
111
112 @Override
113 public LagId getValue() {
114 return value;
115 }
116
117 @Override
118 public OFOxmBsnLagId.Builder setValue(LagId value) {
119 this.value = value;
120 this.valueSet = true;
121 return this;
122 }
123 @Override
124 public MatchField<LagId> getMatchField() {
125 return MatchField.BSN_LAG_ID;
126 }
127
128 @Override
129 public boolean isMasked() {
130 return false;
131 }
132
133 @Override
134 public OFOxm<LagId> getCanonical()throws UnsupportedOperationException {
135 throw new UnsupportedOperationException("Property canonical not supported in version 1.3");
136 }
137
138 @Override
139 public LagId getMask()throws UnsupportedOperationException {
140 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
141 }
142
143 @Override
144 public OFVersion getVersion() {
145 return OFVersion.OF_13;
146 }
147
148
149
150 @Override
151 public OFOxmBsnLagId build() {
152 LagId value = this.valueSet ? this.value : parentMessage.value;
153 if(value == null)
154 throw new NullPointerException("Property value must not be null");
155
156 //
157 return new OFOxmBsnLagIdVer13(
158 value
159 );
160 }
161
162 }
163
164 static class Builder implements OFOxmBsnLagId.Builder {
165 // OF message fields
166 private boolean valueSet;
167 private LagId value;
168
169 @Override
170 public long getTypeLen() {
171 return 0x30204L;
172 }
173
174 @Override
175 public LagId getValue() {
176 return value;
177 }
178
179 @Override
180 public OFOxmBsnLagId.Builder setValue(LagId value) {
181 this.value = value;
182 this.valueSet = true;
183 return this;
184 }
185 @Override
186 public MatchField<LagId> getMatchField() {
187 return MatchField.BSN_LAG_ID;
188 }
189
190 @Override
191 public boolean isMasked() {
192 return false;
193 }
194
195 @Override
196 public OFOxm<LagId> getCanonical()throws UnsupportedOperationException {
197 throw new UnsupportedOperationException("Property canonical not supported in version 1.3");
198 }
199
200 @Override
201 public LagId getMask()throws UnsupportedOperationException {
202 throw new UnsupportedOperationException("Property mask not supported in version 1.3");
203 }
204
205 @Override
206 public OFVersion getVersion() {
207 return OFVersion.OF_13;
208 }
209
210//
211 @Override
212 public OFOxmBsnLagId build() {
213 LagId value = this.valueSet ? this.value : DEFAULT_VALUE;
214 if(value == null)
215 throw new NullPointerException("Property value must not be null");
216
217
218 return new OFOxmBsnLagIdVer13(
219 value
220 );
221 }
222
223 }
224
225
226 final static Reader READER = new Reader();
227 static class Reader implements OFMessageReader<OFOxmBsnLagId> {
228 @Override
229 public OFOxmBsnLagId readFrom(ChannelBuffer bb) throws OFParseError {
230 // fixed value property typeLen == 0x30204L
231 int typeLen = bb.readInt();
232 if(typeLen != 0x30204)
233 throw new OFParseError("Wrong typeLen: Expected=0x30204L(0x30204L), got="+typeLen);
234 LagId value = LagId.read4Bytes(bb);
235
236 OFOxmBsnLagIdVer13 oxmBsnLagIdVer13 = new OFOxmBsnLagIdVer13(
237 value
238 );
239 if(logger.isTraceEnabled())
240 logger.trace("readFrom - read={}", oxmBsnLagIdVer13);
241 return oxmBsnLagIdVer13;
242 }
243 }
244
245 public void putTo(PrimitiveSink sink) {
246 FUNNEL.funnel(this, sink);
247 }
248
249 final static OFOxmBsnLagIdVer13Funnel FUNNEL = new OFOxmBsnLagIdVer13Funnel();
250 static class OFOxmBsnLagIdVer13Funnel implements Funnel<OFOxmBsnLagIdVer13> {
251 private static final long serialVersionUID = 1L;
252 @Override
253 public void funnel(OFOxmBsnLagIdVer13 message, PrimitiveSink sink) {
254 // fixed value property typeLen = 0x30204L
255 sink.putInt(0x30204);
256 message.value.putTo(sink);
257 }
258 }
259
260
261 public void writeTo(ChannelBuffer bb) {
262 WRITER.write(bb, this);
263 }
264
265 final static Writer WRITER = new Writer();
266 static class Writer implements OFMessageWriter<OFOxmBsnLagIdVer13> {
267 @Override
268 public void write(ChannelBuffer bb, OFOxmBsnLagIdVer13 message) {
269 // fixed value property typeLen = 0x30204L
270 bb.writeInt(0x30204);
271 message.value.write4Bytes(bb);
272
273
274 }
275 }
276
277 @Override
278 public String toString() {
279 StringBuilder b = new StringBuilder("OFOxmBsnLagIdVer13(");
280 b.append("value=").append(value);
281 b.append(")");
282 return b.toString();
283 }
284
285 @Override
286 public boolean equals(Object obj) {
287 if (this == obj)
288 return true;
289 if (obj == null)
290 return false;
291 if (getClass() != obj.getClass())
292 return false;
293 OFOxmBsnLagIdVer13 other = (OFOxmBsnLagIdVer13) obj;
294
295 if (value == null) {
296 if (other.value != null)
297 return false;
298 } else if (!value.equals(other.value))
299 return false;
300 return true;
301 }
302
303 @Override
304 public int hashCode() {
305 final int prime = 31;
306 int result = 1;
307
308 result = prime * result + ((value == null) ? 0 : value.hashCode());
309 return result;
310 }
311
312}