blob: f8ceec0d5f9e2773f99580f140291428ba48caac [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.ver12;
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 OFQueueStatsEntryVer12 implements OFQueueStatsEntry {
34 private static final Logger logger = LoggerFactory.getLogger(OFQueueStatsEntryVer12.class);
35 // version: 1.2
36 final static byte WIRE_VERSION = 3;
37 final static int LENGTH = 32;
38
39 private final static OFPort DEFAULT_PORT_NO = OFPort.ANY;
40 private final static long DEFAULT_QUEUE_ID = 0x0L;
41 private final static U64 DEFAULT_TX_BYTES = U64.ZERO;
42 private final static U64 DEFAULT_TX_PACKETS = U64.ZERO;
43 private final static U64 DEFAULT_TX_ERRORS = U64.ZERO;
44
45 // OF message fields
46 private final OFPort portNo;
47 private final long queueId;
48 private final U64 txBytes;
49 private final U64 txPackets;
50 private final U64 txErrors;
51//
52 // Immutable default instance
53 final static OFQueueStatsEntryVer12 DEFAULT = new OFQueueStatsEntryVer12(
54 DEFAULT_PORT_NO, DEFAULT_QUEUE_ID, DEFAULT_TX_BYTES, DEFAULT_TX_PACKETS, DEFAULT_TX_ERRORS
55 );
56
57 // package private constructor - used by readers, builders, and factory
58 OFQueueStatsEntryVer12(OFPort portNo, long queueId, U64 txBytes, U64 txPackets, U64 txErrors) {
59 this.portNo = portNo;
60 this.queueId = queueId;
61 this.txBytes = txBytes;
62 this.txPackets = txPackets;
63 this.txErrors = txErrors;
64 }
65
66 // Accessors for OF message fields
67 @Override
68 public OFPort getPortNo() {
69 return portNo;
70 }
71
72 @Override
73 public long getQueueId() {
74 return queueId;
75 }
76
77 @Override
78 public U64 getTxBytes() {
79 return txBytes;
80 }
81
82 @Override
83 public U64 getTxPackets() {
84 return txPackets;
85 }
86
87 @Override
88 public U64 getTxErrors() {
89 return txErrors;
90 }
91
92 @Override
93 public long getDurationSec()throws UnsupportedOperationException {
94 throw new UnsupportedOperationException("Property durationSec not supported in version 1.2");
95 }
96
97 @Override
98 public long getDurationNsec()throws UnsupportedOperationException {
99 throw new UnsupportedOperationException("Property durationNsec not supported in version 1.2");
100 }
101
102 @Override
103 public OFVersion getVersion() {
104 return OFVersion.OF_12;
105 }
106
107
108
109 public OFQueueStatsEntry.Builder createBuilder() {
110 return new BuilderWithParent(this);
111 }
112
113 static class BuilderWithParent implements OFQueueStatsEntry.Builder {
114 final OFQueueStatsEntryVer12 parentMessage;
115
116 // OF message fields
117 private boolean portNoSet;
118 private OFPort portNo;
119 private boolean queueIdSet;
120 private long queueId;
121 private boolean txBytesSet;
122 private U64 txBytes;
123 private boolean txPacketsSet;
124 private U64 txPackets;
125 private boolean txErrorsSet;
126 private U64 txErrors;
127
128 BuilderWithParent(OFQueueStatsEntryVer12 parentMessage) {
129 this.parentMessage = parentMessage;
130 }
131
132 @Override
133 public OFPort getPortNo() {
134 return portNo;
135 }
136
137 @Override
138 public OFQueueStatsEntry.Builder setPortNo(OFPort portNo) {
139 this.portNo = portNo;
140 this.portNoSet = true;
141 return this;
142 }
143 @Override
144 public long getQueueId() {
145 return queueId;
146 }
147
148 @Override
149 public OFQueueStatsEntry.Builder setQueueId(long queueId) {
150 this.queueId = queueId;
151 this.queueIdSet = true;
152 return this;
153 }
154 @Override
155 public U64 getTxBytes() {
156 return txBytes;
157 }
158
159 @Override
160 public OFQueueStatsEntry.Builder setTxBytes(U64 txBytes) {
161 this.txBytes = txBytes;
162 this.txBytesSet = true;
163 return this;
164 }
165 @Override
166 public U64 getTxPackets() {
167 return txPackets;
168 }
169
170 @Override
171 public OFQueueStatsEntry.Builder setTxPackets(U64 txPackets) {
172 this.txPackets = txPackets;
173 this.txPacketsSet = true;
174 return this;
175 }
176 @Override
177 public U64 getTxErrors() {
178 return txErrors;
179 }
180
181 @Override
182 public OFQueueStatsEntry.Builder setTxErrors(U64 txErrors) {
183 this.txErrors = txErrors;
184 this.txErrorsSet = true;
185 return this;
186 }
187 @Override
188 public long getDurationSec()throws UnsupportedOperationException {
189 throw new UnsupportedOperationException("Property durationSec not supported in version 1.2");
190 }
191
192 @Override
193 public OFQueueStatsEntry.Builder setDurationSec(long durationSec) throws UnsupportedOperationException {
194 throw new UnsupportedOperationException("Property durationSec not supported in version 1.2");
195 }
196 @Override
197 public long getDurationNsec()throws UnsupportedOperationException {
198 throw new UnsupportedOperationException("Property durationNsec not supported in version 1.2");
199 }
200
201 @Override
202 public OFQueueStatsEntry.Builder setDurationNsec(long durationNsec) throws UnsupportedOperationException {
203 throw new UnsupportedOperationException("Property durationNsec not supported in version 1.2");
204 }
205 @Override
206 public OFVersion getVersion() {
207 return OFVersion.OF_12;
208 }
209
210
211
212 @Override
213 public OFQueueStatsEntry build() {
214 OFPort portNo = this.portNoSet ? this.portNo : parentMessage.portNo;
215 if(portNo == null)
216 throw new NullPointerException("Property portNo must not be null");
217 long queueId = this.queueIdSet ? this.queueId : parentMessage.queueId;
218 U64 txBytes = this.txBytesSet ? this.txBytes : parentMessage.txBytes;
219 if(txBytes == null)
220 throw new NullPointerException("Property txBytes must not be null");
221 U64 txPackets = this.txPacketsSet ? this.txPackets : parentMessage.txPackets;
222 if(txPackets == null)
223 throw new NullPointerException("Property txPackets must not be null");
224 U64 txErrors = this.txErrorsSet ? this.txErrors : parentMessage.txErrors;
225 if(txErrors == null)
226 throw new NullPointerException("Property txErrors must not be null");
227
228 //
229 return new OFQueueStatsEntryVer12(
230 portNo,
231 queueId,
232 txBytes,
233 txPackets,
234 txErrors
235 );
236 }
237
238 }
239
240 static class Builder implements OFQueueStatsEntry.Builder {
241 // OF message fields
242 private boolean portNoSet;
243 private OFPort portNo;
244 private boolean queueIdSet;
245 private long queueId;
246 private boolean txBytesSet;
247 private U64 txBytes;
248 private boolean txPacketsSet;
249 private U64 txPackets;
250 private boolean txErrorsSet;
251 private U64 txErrors;
252
253 @Override
254 public OFPort getPortNo() {
255 return portNo;
256 }
257
258 @Override
259 public OFQueueStatsEntry.Builder setPortNo(OFPort portNo) {
260 this.portNo = portNo;
261 this.portNoSet = true;
262 return this;
263 }
264 @Override
265 public long getQueueId() {
266 return queueId;
267 }
268
269 @Override
270 public OFQueueStatsEntry.Builder setQueueId(long queueId) {
271 this.queueId = queueId;
272 this.queueIdSet = true;
273 return this;
274 }
275 @Override
276 public U64 getTxBytes() {
277 return txBytes;
278 }
279
280 @Override
281 public OFQueueStatsEntry.Builder setTxBytes(U64 txBytes) {
282 this.txBytes = txBytes;
283 this.txBytesSet = true;
284 return this;
285 }
286 @Override
287 public U64 getTxPackets() {
288 return txPackets;
289 }
290
291 @Override
292 public OFQueueStatsEntry.Builder setTxPackets(U64 txPackets) {
293 this.txPackets = txPackets;
294 this.txPacketsSet = true;
295 return this;
296 }
297 @Override
298 public U64 getTxErrors() {
299 return txErrors;
300 }
301
302 @Override
303 public OFQueueStatsEntry.Builder setTxErrors(U64 txErrors) {
304 this.txErrors = txErrors;
305 this.txErrorsSet = true;
306 return this;
307 }
308 @Override
309 public long getDurationSec()throws UnsupportedOperationException {
310 throw new UnsupportedOperationException("Property durationSec not supported in version 1.2");
311 }
312
313 @Override
314 public OFQueueStatsEntry.Builder setDurationSec(long durationSec) throws UnsupportedOperationException {
315 throw new UnsupportedOperationException("Property durationSec not supported in version 1.2");
316 }
317 @Override
318 public long getDurationNsec()throws UnsupportedOperationException {
319 throw new UnsupportedOperationException("Property durationNsec not supported in version 1.2");
320 }
321
322 @Override
323 public OFQueueStatsEntry.Builder setDurationNsec(long durationNsec) throws UnsupportedOperationException {
324 throw new UnsupportedOperationException("Property durationNsec not supported in version 1.2");
325 }
326 @Override
327 public OFVersion getVersion() {
328 return OFVersion.OF_12;
329 }
330
331//
332 @Override
333 public OFQueueStatsEntry build() {
334 OFPort portNo = this.portNoSet ? this.portNo : DEFAULT_PORT_NO;
335 if(portNo == null)
336 throw new NullPointerException("Property portNo must not be null");
337 long queueId = this.queueIdSet ? this.queueId : DEFAULT_QUEUE_ID;
338 U64 txBytes = this.txBytesSet ? this.txBytes : DEFAULT_TX_BYTES;
339 if(txBytes == null)
340 throw new NullPointerException("Property txBytes must not be null");
341 U64 txPackets = this.txPacketsSet ? this.txPackets : DEFAULT_TX_PACKETS;
342 if(txPackets == null)
343 throw new NullPointerException("Property txPackets must not be null");
344 U64 txErrors = this.txErrorsSet ? this.txErrors : DEFAULT_TX_ERRORS;
345 if(txErrors == null)
346 throw new NullPointerException("Property txErrors must not be null");
347
348
349 return new OFQueueStatsEntryVer12(
350 portNo,
351 queueId,
352 txBytes,
353 txPackets,
354 txErrors
355 );
356 }
357
358 }
359
360
361 final static Reader READER = new Reader();
362 static class Reader implements OFMessageReader<OFQueueStatsEntry> {
363 @Override
364 public OFQueueStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
365 OFPort portNo = OFPort.read4Bytes(bb);
366 long queueId = U32.f(bb.readInt());
367 U64 txBytes = U64.ofRaw(bb.readLong());
368 U64 txPackets = U64.ofRaw(bb.readLong());
369 U64 txErrors = U64.ofRaw(bb.readLong());
370
371 OFQueueStatsEntryVer12 queueStatsEntryVer12 = new OFQueueStatsEntryVer12(
372 portNo,
373 queueId,
374 txBytes,
375 txPackets,
376 txErrors
377 );
378 if(logger.isTraceEnabled())
379 logger.trace("readFrom - read={}", queueStatsEntryVer12);
380 return queueStatsEntryVer12;
381 }
382 }
383
384 public void putTo(PrimitiveSink sink) {
385 FUNNEL.funnel(this, sink);
386 }
387
388 final static OFQueueStatsEntryVer12Funnel FUNNEL = new OFQueueStatsEntryVer12Funnel();
389 static class OFQueueStatsEntryVer12Funnel implements Funnel<OFQueueStatsEntryVer12> {
390 private static final long serialVersionUID = 1L;
391 @Override
392 public void funnel(OFQueueStatsEntryVer12 message, PrimitiveSink sink) {
393 message.portNo.putTo(sink);
394 sink.putLong(message.queueId);
395 message.txBytes.putTo(sink);
396 message.txPackets.putTo(sink);
397 message.txErrors.putTo(sink);
398 }
399 }
400
401
402 public void writeTo(ChannelBuffer bb) {
403 WRITER.write(bb, this);
404 }
405
406 final static Writer WRITER = new Writer();
407 static class Writer implements OFMessageWriter<OFQueueStatsEntryVer12> {
408 @Override
409 public void write(ChannelBuffer bb, OFQueueStatsEntryVer12 message) {
410 message.portNo.write4Bytes(bb);
411 bb.writeInt(U32.t(message.queueId));
412 bb.writeLong(message.txBytes.getValue());
413 bb.writeLong(message.txPackets.getValue());
414 bb.writeLong(message.txErrors.getValue());
415
416
417 }
418 }
419
420 @Override
421 public String toString() {
422 StringBuilder b = new StringBuilder("OFQueueStatsEntryVer12(");
423 b.append("portNo=").append(portNo);
424 b.append(", ");
425 b.append("queueId=").append(queueId);
426 b.append(", ");
427 b.append("txBytes=").append(txBytes);
428 b.append(", ");
429 b.append("txPackets=").append(txPackets);
430 b.append(", ");
431 b.append("txErrors=").append(txErrors);
432 b.append(")");
433 return b.toString();
434 }
435
436 @Override
437 public boolean equals(Object obj) {
438 if (this == obj)
439 return true;
440 if (obj == null)
441 return false;
442 if (getClass() != obj.getClass())
443 return false;
444 OFQueueStatsEntryVer12 other = (OFQueueStatsEntryVer12) obj;
445
446 if (portNo == null) {
447 if (other.portNo != null)
448 return false;
449 } else if (!portNo.equals(other.portNo))
450 return false;
451 if( queueId != other.queueId)
452 return false;
453 if (txBytes == null) {
454 if (other.txBytes != null)
455 return false;
456 } else if (!txBytes.equals(other.txBytes))
457 return false;
458 if (txPackets == null) {
459 if (other.txPackets != null)
460 return false;
461 } else if (!txPackets.equals(other.txPackets))
462 return false;
463 if (txErrors == null) {
464 if (other.txErrors != null)
465 return false;
466 } else if (!txErrors.equals(other.txErrors))
467 return false;
468 return true;
469 }
470
471 @Override
472 public int hashCode() {
473 final int prime = 31;
474 int result = 1;
475
476 result = prime * result + ((portNo == null) ? 0 : portNo.hashCode());
477 result = prime * (int) (queueId ^ (queueId >>> 32));
478 result = prime * result + ((txBytes == null) ? 0 : txBytes.hashCode());
479 result = prime * result + ((txPackets == null) ? 0 : txPackets.hashCode());
480 result = prime * result + ((txErrors == null) ? 0 : txErrors.hashCode());
481 return result;
482 }
483
484}