blob: cbd6ace18788fb00dea5e047173aceb9c8289993 [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.List;
29import com.google.common.collect.ImmutableList;
30import java.util.Set;
31import org.jboss.netty.buffer.ChannelBuffer;
32import com.google.common.hash.PrimitiveSink;
33import com.google.common.hash.Funnel;
34
35class OFFlowStatsEntryVer12 implements OFFlowStatsEntry {
36 private static final Logger logger = LoggerFactory.getLogger(OFFlowStatsEntryVer12.class);
37 // version: 1.2
38 final static byte WIRE_VERSION = 3;
39 final static int MINIMUM_LENGTH = 56;
40
41 private final static TableId DEFAULT_TABLE_ID = TableId.ALL;
42 private final static long DEFAULT_DURATION_SEC = 0x0L;
43 private final static long DEFAULT_DURATION_NSEC = 0x0L;
44 private final static int DEFAULT_PRIORITY = 0x0;
45 private final static int DEFAULT_IDLE_TIMEOUT = 0x0;
46 private final static int DEFAULT_HARD_TIMEOUT = 0x0;
47 private final static U64 DEFAULT_COOKIE = U64.ZERO;
48 private final static U64 DEFAULT_PACKET_COUNT = U64.ZERO;
49 private final static U64 DEFAULT_BYTE_COUNT = U64.ZERO;
50 private final static Match DEFAULT_MATCH = OFFactoryVer12.MATCH_WILDCARD_ALL;
51 private final static List<OFInstruction> DEFAULT_INSTRUCTIONS = ImmutableList.<OFInstruction>of();
52
53 // OF message fields
54 private final TableId tableId;
55 private final long durationSec;
56 private final long durationNsec;
57 private final int priority;
58 private final int idleTimeout;
59 private final int hardTimeout;
60 private final U64 cookie;
61 private final U64 packetCount;
62 private final U64 byteCount;
63 private final Match match;
64 private final List<OFInstruction> instructions;
65//
66 // Immutable default instance
67 final static OFFlowStatsEntryVer12 DEFAULT = new OFFlowStatsEntryVer12(
68 DEFAULT_TABLE_ID, DEFAULT_DURATION_SEC, DEFAULT_DURATION_NSEC, DEFAULT_PRIORITY, DEFAULT_IDLE_TIMEOUT, DEFAULT_HARD_TIMEOUT, DEFAULT_COOKIE, DEFAULT_PACKET_COUNT, DEFAULT_BYTE_COUNT, DEFAULT_MATCH, DEFAULT_INSTRUCTIONS
69 );
70
71 // package private constructor - used by readers, builders, and factory
72 OFFlowStatsEntryVer12(TableId tableId, long durationSec, long durationNsec, int priority, int idleTimeout, int hardTimeout, U64 cookie, U64 packetCount, U64 byteCount, Match match, List<OFInstruction> instructions) {
73 this.tableId = tableId;
74 this.durationSec = durationSec;
75 this.durationNsec = durationNsec;
76 this.priority = priority;
77 this.idleTimeout = idleTimeout;
78 this.hardTimeout = hardTimeout;
79 this.cookie = cookie;
80 this.packetCount = packetCount;
81 this.byteCount = byteCount;
82 this.match = match;
83 this.instructions = instructions;
84 }
85
86 // Accessors for OF message fields
87 @Override
88 public TableId getTableId() {
89 return tableId;
90 }
91
92 @Override
93 public long getDurationSec() {
94 return durationSec;
95 }
96
97 @Override
98 public long getDurationNsec() {
99 return durationNsec;
100 }
101
102 @Override
103 public int getPriority() {
104 return priority;
105 }
106
107 @Override
108 public int getIdleTimeout() {
109 return idleTimeout;
110 }
111
112 @Override
113 public int getHardTimeout() {
114 return hardTimeout;
115 }
116
117 @Override
118 public U64 getCookie() {
119 return cookie;
120 }
121
122 @Override
123 public U64 getPacketCount() {
124 return packetCount;
125 }
126
127 @Override
128 public U64 getByteCount() {
129 return byteCount;
130 }
131
132 @Override
133 public Match getMatch() {
134 return match;
135 }
136
137 @Override
138 public List<OFInstruction> getInstructions() {
139 return instructions;
140 }
141
142 @Override
143 public List<OFAction> getActions()throws UnsupportedOperationException {
144 throw new UnsupportedOperationException("Property actions not supported in version 1.2");
145 }
146
147 @Override
148 public Set<OFFlowModFlags> getFlags()throws UnsupportedOperationException {
149 throw new UnsupportedOperationException("Property flags not supported in version 1.2");
150 }
151
152 @Override
153 public OFVersion getVersion() {
154 return OFVersion.OF_12;
155 }
156
157
158
159 public OFFlowStatsEntry.Builder createBuilder() {
160 return new BuilderWithParent(this);
161 }
162
163 static class BuilderWithParent implements OFFlowStatsEntry.Builder {
164 final OFFlowStatsEntryVer12 parentMessage;
165
166 // OF message fields
167 private boolean tableIdSet;
168 private TableId tableId;
169 private boolean durationSecSet;
170 private long durationSec;
171 private boolean durationNsecSet;
172 private long durationNsec;
173 private boolean prioritySet;
174 private int priority;
175 private boolean idleTimeoutSet;
176 private int idleTimeout;
177 private boolean hardTimeoutSet;
178 private int hardTimeout;
179 private boolean cookieSet;
180 private U64 cookie;
181 private boolean packetCountSet;
182 private U64 packetCount;
183 private boolean byteCountSet;
184 private U64 byteCount;
185 private boolean matchSet;
186 private Match match;
187 private boolean instructionsSet;
188 private List<OFInstruction> instructions;
189
190 BuilderWithParent(OFFlowStatsEntryVer12 parentMessage) {
191 this.parentMessage = parentMessage;
192 }
193
194 @Override
195 public TableId getTableId() {
196 return tableId;
197 }
198
199 @Override
200 public OFFlowStatsEntry.Builder setTableId(TableId tableId) {
201 this.tableId = tableId;
202 this.tableIdSet = true;
203 return this;
204 }
205 @Override
206 public long getDurationSec() {
207 return durationSec;
208 }
209
210 @Override
211 public OFFlowStatsEntry.Builder setDurationSec(long durationSec) {
212 this.durationSec = durationSec;
213 this.durationSecSet = true;
214 return this;
215 }
216 @Override
217 public long getDurationNsec() {
218 return durationNsec;
219 }
220
221 @Override
222 public OFFlowStatsEntry.Builder setDurationNsec(long durationNsec) {
223 this.durationNsec = durationNsec;
224 this.durationNsecSet = true;
225 return this;
226 }
227 @Override
228 public int getPriority() {
229 return priority;
230 }
231
232 @Override
233 public OFFlowStatsEntry.Builder setPriority(int priority) {
234 this.priority = priority;
235 this.prioritySet = true;
236 return this;
237 }
238 @Override
239 public int getIdleTimeout() {
240 return idleTimeout;
241 }
242
243 @Override
244 public OFFlowStatsEntry.Builder setIdleTimeout(int idleTimeout) {
245 this.idleTimeout = idleTimeout;
246 this.idleTimeoutSet = true;
247 return this;
248 }
249 @Override
250 public int getHardTimeout() {
251 return hardTimeout;
252 }
253
254 @Override
255 public OFFlowStatsEntry.Builder setHardTimeout(int hardTimeout) {
256 this.hardTimeout = hardTimeout;
257 this.hardTimeoutSet = true;
258 return this;
259 }
260 @Override
261 public U64 getCookie() {
262 return cookie;
263 }
264
265 @Override
266 public OFFlowStatsEntry.Builder setCookie(U64 cookie) {
267 this.cookie = cookie;
268 this.cookieSet = true;
269 return this;
270 }
271 @Override
272 public U64 getPacketCount() {
273 return packetCount;
274 }
275
276 @Override
277 public OFFlowStatsEntry.Builder setPacketCount(U64 packetCount) {
278 this.packetCount = packetCount;
279 this.packetCountSet = true;
280 return this;
281 }
282 @Override
283 public U64 getByteCount() {
284 return byteCount;
285 }
286
287 @Override
288 public OFFlowStatsEntry.Builder setByteCount(U64 byteCount) {
289 this.byteCount = byteCount;
290 this.byteCountSet = true;
291 return this;
292 }
293 @Override
294 public Match getMatch() {
295 return match;
296 }
297
298 @Override
299 public OFFlowStatsEntry.Builder setMatch(Match match) {
300 this.match = match;
301 this.matchSet = true;
302 return this;
303 }
304 @Override
305 public List<OFInstruction> getInstructions() {
306 return instructions;
307 }
308
309 @Override
310 public OFFlowStatsEntry.Builder setInstructions(List<OFInstruction> instructions) {
311 this.instructions = instructions;
312 this.instructionsSet = true;
313 return this;
314 }
315 @Override
316 public List<OFAction> getActions()throws UnsupportedOperationException {
317 throw new UnsupportedOperationException("Property actions not supported in version 1.2");
318 }
319
320 @Override
321 public OFFlowStatsEntry.Builder setActions(List<OFAction> actions) throws UnsupportedOperationException {
322 throw new UnsupportedOperationException("Property actions not supported in version 1.2");
323 }
324 @Override
325 public Set<OFFlowModFlags> getFlags()throws UnsupportedOperationException {
326 throw new UnsupportedOperationException("Property flags not supported in version 1.2");
327 }
328
329 @Override
330 public OFFlowStatsEntry.Builder setFlags(Set<OFFlowModFlags> flags) throws UnsupportedOperationException {
331 throw new UnsupportedOperationException("Property flags not supported in version 1.2");
332 }
333 @Override
334 public OFVersion getVersion() {
335 return OFVersion.OF_12;
336 }
337
338
339
340 @Override
341 public OFFlowStatsEntry build() {
342 TableId tableId = this.tableIdSet ? this.tableId : parentMessage.tableId;
343 if(tableId == null)
344 throw new NullPointerException("Property tableId must not be null");
345 long durationSec = this.durationSecSet ? this.durationSec : parentMessage.durationSec;
346 long durationNsec = this.durationNsecSet ? this.durationNsec : parentMessage.durationNsec;
347 int priority = this.prioritySet ? this.priority : parentMessage.priority;
348 int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : parentMessage.idleTimeout;
349 int hardTimeout = this.hardTimeoutSet ? this.hardTimeout : parentMessage.hardTimeout;
350 U64 cookie = this.cookieSet ? this.cookie : parentMessage.cookie;
351 if(cookie == null)
352 throw new NullPointerException("Property cookie must not be null");
353 U64 packetCount = this.packetCountSet ? this.packetCount : parentMessage.packetCount;
354 if(packetCount == null)
355 throw new NullPointerException("Property packetCount must not be null");
356 U64 byteCount = this.byteCountSet ? this.byteCount : parentMessage.byteCount;
357 if(byteCount == null)
358 throw new NullPointerException("Property byteCount must not be null");
359 Match match = this.matchSet ? this.match : parentMessage.match;
360 if(match == null)
361 throw new NullPointerException("Property match must not be null");
362 List<OFInstruction> instructions = this.instructionsSet ? this.instructions : parentMessage.instructions;
363 if(instructions == null)
364 throw new NullPointerException("Property instructions must not be null");
365
366 //
367 return new OFFlowStatsEntryVer12(
368 tableId,
369 durationSec,
370 durationNsec,
371 priority,
372 idleTimeout,
373 hardTimeout,
374 cookie,
375 packetCount,
376 byteCount,
377 match,
378 instructions
379 );
380 }
381
382 }
383
384 static class Builder implements OFFlowStatsEntry.Builder {
385 // OF message fields
386 private boolean tableIdSet;
387 private TableId tableId;
388 private boolean durationSecSet;
389 private long durationSec;
390 private boolean durationNsecSet;
391 private long durationNsec;
392 private boolean prioritySet;
393 private int priority;
394 private boolean idleTimeoutSet;
395 private int idleTimeout;
396 private boolean hardTimeoutSet;
397 private int hardTimeout;
398 private boolean cookieSet;
399 private U64 cookie;
400 private boolean packetCountSet;
401 private U64 packetCount;
402 private boolean byteCountSet;
403 private U64 byteCount;
404 private boolean matchSet;
405 private Match match;
406 private boolean instructionsSet;
407 private List<OFInstruction> instructions;
408
409 @Override
410 public TableId getTableId() {
411 return tableId;
412 }
413
414 @Override
415 public OFFlowStatsEntry.Builder setTableId(TableId tableId) {
416 this.tableId = tableId;
417 this.tableIdSet = true;
418 return this;
419 }
420 @Override
421 public long getDurationSec() {
422 return durationSec;
423 }
424
425 @Override
426 public OFFlowStatsEntry.Builder setDurationSec(long durationSec) {
427 this.durationSec = durationSec;
428 this.durationSecSet = true;
429 return this;
430 }
431 @Override
432 public long getDurationNsec() {
433 return durationNsec;
434 }
435
436 @Override
437 public OFFlowStatsEntry.Builder setDurationNsec(long durationNsec) {
438 this.durationNsec = durationNsec;
439 this.durationNsecSet = true;
440 return this;
441 }
442 @Override
443 public int getPriority() {
444 return priority;
445 }
446
447 @Override
448 public OFFlowStatsEntry.Builder setPriority(int priority) {
449 this.priority = priority;
450 this.prioritySet = true;
451 return this;
452 }
453 @Override
454 public int getIdleTimeout() {
455 return idleTimeout;
456 }
457
458 @Override
459 public OFFlowStatsEntry.Builder setIdleTimeout(int idleTimeout) {
460 this.idleTimeout = idleTimeout;
461 this.idleTimeoutSet = true;
462 return this;
463 }
464 @Override
465 public int getHardTimeout() {
466 return hardTimeout;
467 }
468
469 @Override
470 public OFFlowStatsEntry.Builder setHardTimeout(int hardTimeout) {
471 this.hardTimeout = hardTimeout;
472 this.hardTimeoutSet = true;
473 return this;
474 }
475 @Override
476 public U64 getCookie() {
477 return cookie;
478 }
479
480 @Override
481 public OFFlowStatsEntry.Builder setCookie(U64 cookie) {
482 this.cookie = cookie;
483 this.cookieSet = true;
484 return this;
485 }
486 @Override
487 public U64 getPacketCount() {
488 return packetCount;
489 }
490
491 @Override
492 public OFFlowStatsEntry.Builder setPacketCount(U64 packetCount) {
493 this.packetCount = packetCount;
494 this.packetCountSet = true;
495 return this;
496 }
497 @Override
498 public U64 getByteCount() {
499 return byteCount;
500 }
501
502 @Override
503 public OFFlowStatsEntry.Builder setByteCount(U64 byteCount) {
504 this.byteCount = byteCount;
505 this.byteCountSet = true;
506 return this;
507 }
508 @Override
509 public Match getMatch() {
510 return match;
511 }
512
513 @Override
514 public OFFlowStatsEntry.Builder setMatch(Match match) {
515 this.match = match;
516 this.matchSet = true;
517 return this;
518 }
519 @Override
520 public List<OFInstruction> getInstructions() {
521 return instructions;
522 }
523
524 @Override
525 public OFFlowStatsEntry.Builder setInstructions(List<OFInstruction> instructions) {
526 this.instructions = instructions;
527 this.instructionsSet = true;
528 return this;
529 }
530 @Override
531 public List<OFAction> getActions()throws UnsupportedOperationException {
532 throw new UnsupportedOperationException("Property actions not supported in version 1.2");
533 }
534
535 @Override
536 public OFFlowStatsEntry.Builder setActions(List<OFAction> actions) throws UnsupportedOperationException {
537 throw new UnsupportedOperationException("Property actions not supported in version 1.2");
538 }
539 @Override
540 public Set<OFFlowModFlags> getFlags()throws UnsupportedOperationException {
541 throw new UnsupportedOperationException("Property flags not supported in version 1.2");
542 }
543
544 @Override
545 public OFFlowStatsEntry.Builder setFlags(Set<OFFlowModFlags> flags) throws UnsupportedOperationException {
546 throw new UnsupportedOperationException("Property flags not supported in version 1.2");
547 }
548 @Override
549 public OFVersion getVersion() {
550 return OFVersion.OF_12;
551 }
552
553//
554 @Override
555 public OFFlowStatsEntry build() {
556 TableId tableId = this.tableIdSet ? this.tableId : DEFAULT_TABLE_ID;
557 if(tableId == null)
558 throw new NullPointerException("Property tableId must not be null");
559 long durationSec = this.durationSecSet ? this.durationSec : DEFAULT_DURATION_SEC;
560 long durationNsec = this.durationNsecSet ? this.durationNsec : DEFAULT_DURATION_NSEC;
561 int priority = this.prioritySet ? this.priority : DEFAULT_PRIORITY;
562 int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : DEFAULT_IDLE_TIMEOUT;
563 int hardTimeout = this.hardTimeoutSet ? this.hardTimeout : DEFAULT_HARD_TIMEOUT;
564 U64 cookie = this.cookieSet ? this.cookie : DEFAULT_COOKIE;
565 if(cookie == null)
566 throw new NullPointerException("Property cookie must not be null");
567 U64 packetCount = this.packetCountSet ? this.packetCount : DEFAULT_PACKET_COUNT;
568 if(packetCount == null)
569 throw new NullPointerException("Property packetCount must not be null");
570 U64 byteCount = this.byteCountSet ? this.byteCount : DEFAULT_BYTE_COUNT;
571 if(byteCount == null)
572 throw new NullPointerException("Property byteCount must not be null");
573 Match match = this.matchSet ? this.match : DEFAULT_MATCH;
574 if(match == null)
575 throw new NullPointerException("Property match must not be null");
576 List<OFInstruction> instructions = this.instructionsSet ? this.instructions : DEFAULT_INSTRUCTIONS;
577 if(instructions == null)
578 throw new NullPointerException("Property instructions must not be null");
579
580
581 return new OFFlowStatsEntryVer12(
582 tableId,
583 durationSec,
584 durationNsec,
585 priority,
586 idleTimeout,
587 hardTimeout,
588 cookie,
589 packetCount,
590 byteCount,
591 match,
592 instructions
593 );
594 }
595
596 }
597
598
599 final static Reader READER = new Reader();
600 static class Reader implements OFMessageReader<OFFlowStatsEntry> {
601 @Override
602 public OFFlowStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
603 int start = bb.readerIndex();
604 int length = U16.f(bb.readShort());
605 if(length < MINIMUM_LENGTH)
606 throw new OFParseError("Wrong length: Expected to be >= " + MINIMUM_LENGTH + ", was: " + length);
607 if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
608 // Buffer does not have all data yet
609 bb.readerIndex(start);
610 return null;
611 }
612 if(logger.isTraceEnabled())
613 logger.trace("readFrom - length={}", length);
614 TableId tableId = TableId.readByte(bb);
615 // pad: 1 bytes
616 bb.skipBytes(1);
617 long durationSec = U32.f(bb.readInt());
618 long durationNsec = U32.f(bb.readInt());
619 int priority = U16.f(bb.readShort());
620 int idleTimeout = U16.f(bb.readShort());
621 int hardTimeout = U16.f(bb.readShort());
622 // pad: 6 bytes
623 bb.skipBytes(6);
624 U64 cookie = U64.ofRaw(bb.readLong());
625 U64 packetCount = U64.ofRaw(bb.readLong());
626 U64 byteCount = U64.ofRaw(bb.readLong());
627 Match match = ChannelUtilsVer12.readOFMatch(bb);
628 List<OFInstruction> instructions = ChannelUtils.readList(bb, length - (bb.readerIndex() - start), OFInstructionVer12.READER);
629
630 OFFlowStatsEntryVer12 flowStatsEntryVer12 = new OFFlowStatsEntryVer12(
631 tableId,
632 durationSec,
633 durationNsec,
634 priority,
635 idleTimeout,
636 hardTimeout,
637 cookie,
638 packetCount,
639 byteCount,
640 match,
641 instructions
642 );
643 if(logger.isTraceEnabled())
644 logger.trace("readFrom - read={}", flowStatsEntryVer12);
645 return flowStatsEntryVer12;
646 }
647 }
648
649 public void putTo(PrimitiveSink sink) {
650 FUNNEL.funnel(this, sink);
651 }
652
653 final static OFFlowStatsEntryVer12Funnel FUNNEL = new OFFlowStatsEntryVer12Funnel();
654 static class OFFlowStatsEntryVer12Funnel implements Funnel<OFFlowStatsEntryVer12> {
655 private static final long serialVersionUID = 1L;
656 @Override
657 public void funnel(OFFlowStatsEntryVer12 message, PrimitiveSink sink) {
658 // FIXME: skip funnel of length
659 message.tableId.putTo(sink);
660 // skip pad (1 bytes)
661 sink.putLong(message.durationSec);
662 sink.putLong(message.durationNsec);
663 sink.putInt(message.priority);
664 sink.putInt(message.idleTimeout);
665 sink.putInt(message.hardTimeout);
666 // skip pad (6 bytes)
667 message.cookie.putTo(sink);
668 message.packetCount.putTo(sink);
669 message.byteCount.putTo(sink);
670 message.match.putTo(sink);
671 FunnelUtils.putList(message.instructions, sink);
672 }
673 }
674
675
676 public void writeTo(ChannelBuffer bb) {
677 WRITER.write(bb, this);
678 }
679
680 final static Writer WRITER = new Writer();
681 static class Writer implements OFMessageWriter<OFFlowStatsEntryVer12> {
682 @Override
683 public void write(ChannelBuffer bb, OFFlowStatsEntryVer12 message) {
684 int startIndex = bb.writerIndex();
685 // length is length of variable message, will be updated at the end
686 int lengthIndex = bb.writerIndex();
687 bb.writeShort(U16.t(0));
688
689 message.tableId.writeByte(bb);
690 // pad: 1 bytes
691 bb.writeZero(1);
692 bb.writeInt(U32.t(message.durationSec));
693 bb.writeInt(U32.t(message.durationNsec));
694 bb.writeShort(U16.t(message.priority));
695 bb.writeShort(U16.t(message.idleTimeout));
696 bb.writeShort(U16.t(message.hardTimeout));
697 // pad: 6 bytes
698 bb.writeZero(6);
699 bb.writeLong(message.cookie.getValue());
700 bb.writeLong(message.packetCount.getValue());
701 bb.writeLong(message.byteCount.getValue());
702 message.match.writeTo(bb);
703 ChannelUtils.writeList(bb, message.instructions);
704
705 // update length field
706 int length = bb.writerIndex() - startIndex;
707 bb.setShort(lengthIndex, length);
708
709 }
710 }
711
712 @Override
713 public String toString() {
714 StringBuilder b = new StringBuilder("OFFlowStatsEntryVer12(");
715 b.append("tableId=").append(tableId);
716 b.append(", ");
717 b.append("durationSec=").append(durationSec);
718 b.append(", ");
719 b.append("durationNsec=").append(durationNsec);
720 b.append(", ");
721 b.append("priority=").append(priority);
722 b.append(", ");
723 b.append("idleTimeout=").append(idleTimeout);
724 b.append(", ");
725 b.append("hardTimeout=").append(hardTimeout);
726 b.append(", ");
727 b.append("cookie=").append(cookie);
728 b.append(", ");
729 b.append("packetCount=").append(packetCount);
730 b.append(", ");
731 b.append("byteCount=").append(byteCount);
732 b.append(", ");
733 b.append("match=").append(match);
734 b.append(", ");
735 b.append("instructions=").append(instructions);
736 b.append(")");
737 return b.toString();
738 }
739
740 @Override
741 public boolean equals(Object obj) {
742 if (this == obj)
743 return true;
744 if (obj == null)
745 return false;
746 if (getClass() != obj.getClass())
747 return false;
748 OFFlowStatsEntryVer12 other = (OFFlowStatsEntryVer12) obj;
749
750 if (tableId == null) {
751 if (other.tableId != null)
752 return false;
753 } else if (!tableId.equals(other.tableId))
754 return false;
755 if( durationSec != other.durationSec)
756 return false;
757 if( durationNsec != other.durationNsec)
758 return false;
759 if( priority != other.priority)
760 return false;
761 if( idleTimeout != other.idleTimeout)
762 return false;
763 if( hardTimeout != other.hardTimeout)
764 return false;
765 if (cookie == null) {
766 if (other.cookie != null)
767 return false;
768 } else if (!cookie.equals(other.cookie))
769 return false;
770 if (packetCount == null) {
771 if (other.packetCount != null)
772 return false;
773 } else if (!packetCount.equals(other.packetCount))
774 return false;
775 if (byteCount == null) {
776 if (other.byteCount != null)
777 return false;
778 } else if (!byteCount.equals(other.byteCount))
779 return false;
780 if (match == null) {
781 if (other.match != null)
782 return false;
783 } else if (!match.equals(other.match))
784 return false;
785 if (instructions == null) {
786 if (other.instructions != null)
787 return false;
788 } else if (!instructions.equals(other.instructions))
789 return false;
790 return true;
791 }
792
793 @Override
794 public int hashCode() {
795 final int prime = 31;
796 int result = 1;
797
798 result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
799 result = prime * (int) (durationSec ^ (durationSec >>> 32));
800 result = prime * (int) (durationNsec ^ (durationNsec >>> 32));
801 result = prime * result + priority;
802 result = prime * result + idleTimeout;
803 result = prime * result + hardTimeout;
804 result = prime * result + ((cookie == null) ? 0 : cookie.hashCode());
805 result = prime * result + ((packetCount == null) ? 0 : packetCount.hashCode());
806 result = prime * result + ((byteCount == null) ? 0 : byteCount.hashCode());
807 result = prime * result + ((match == null) ? 0 : match.hashCode());
808 result = prime * result + ((instructions == null) ? 0 : instructions.hashCode());
809 return result;
810 }
811
812}