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