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