blob: a9f2d0dbb4c6014d1fc5eef7e5c857d013b7eaf7 [file] [log] [blame]
// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
// Copyright (c) 2011, 2012 Open Networking Foundation
// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
// This library was generated by the LoxiGen Compiler.
// See the file LICENSE.txt which should have been included in the source distribution
// Automatically generated by LOXI from template of_class.java
// Do not modify
package org.projectfloodlight.openflow.protocol.ver10;
import org.projectfloodlight.openflow.protocol.*;
import org.projectfloodlight.openflow.protocol.action.*;
import org.projectfloodlight.openflow.protocol.actionid.*;
import org.projectfloodlight.openflow.protocol.bsntlv.*;
import org.projectfloodlight.openflow.protocol.errormsg.*;
import org.projectfloodlight.openflow.protocol.meterband.*;
import org.projectfloodlight.openflow.protocol.instruction.*;
import org.projectfloodlight.openflow.protocol.instructionid.*;
import org.projectfloodlight.openflow.protocol.match.*;
import org.projectfloodlight.openflow.protocol.oxm.*;
import org.projectfloodlight.openflow.protocol.queueprop.*;
import org.projectfloodlight.openflow.types.*;
import org.projectfloodlight.openflow.util.*;
import org.projectfloodlight.openflow.exceptions.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Set;
import org.jboss.netty.buffer.ChannelBuffer;
import com.google.common.hash.PrimitiveSink;
import com.google.common.hash.Funnel;
class OFFlowRemovedVer10 implements OFFlowRemoved {
private static final Logger logger = LoggerFactory.getLogger(OFFlowRemovedVer10.class);
// version: 1.0
final static byte WIRE_VERSION = 1;
final static int LENGTH = 88;
private final static long DEFAULT_XID = 0x0L;
private final static Match DEFAULT_MATCH = OFFactoryVer10.MATCH_WILDCARD_ALL;
private final static U64 DEFAULT_COOKIE = U64.ZERO;
private final static int DEFAULT_PRIORITY = 0x0;
private final static short DEFAULT_REASON = (short) 0x0;
private final static long DEFAULT_DURATION_SEC = 0x0L;
private final static long DEFAULT_DURATION_NSEC = 0x0L;
private final static int DEFAULT_IDLE_TIMEOUT = 0x0;
private final static U64 DEFAULT_PACKET_COUNT = U64.ZERO;
private final static U64 DEFAULT_BYTE_COUNT = U64.ZERO;
// OF message fields
private final long xid;
private final Match match;
private final U64 cookie;
private final int priority;
private final short reason;
private final long durationSec;
private final long durationNsec;
private final int idleTimeout;
private final U64 packetCount;
private final U64 byteCount;
//
// Immutable default instance
final static OFFlowRemovedVer10 DEFAULT = new OFFlowRemovedVer10(
DEFAULT_XID, DEFAULT_MATCH, DEFAULT_COOKIE, DEFAULT_PRIORITY, DEFAULT_REASON, DEFAULT_DURATION_SEC, DEFAULT_DURATION_NSEC, DEFAULT_IDLE_TIMEOUT, DEFAULT_PACKET_COUNT, DEFAULT_BYTE_COUNT
);
// package private constructor - used by readers, builders, and factory
OFFlowRemovedVer10(long xid, Match match, U64 cookie, int priority, short reason, long durationSec, long durationNsec, int idleTimeout, U64 packetCount, U64 byteCount) {
this.xid = xid;
this.match = match;
this.cookie = cookie;
this.priority = priority;
this.reason = reason;
this.durationSec = durationSec;
this.durationNsec = durationNsec;
this.idleTimeout = idleTimeout;
this.packetCount = packetCount;
this.byteCount = byteCount;
}
// Accessors for OF message fields
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
@Override
public OFType getType() {
return OFType.FLOW_REMOVED;
}
@Override
public long getXid() {
return xid;
}
@Override
public U64 getCookie() {
return cookie;
}
@Override
public int getPriority() {
return priority;
}
@Override
public short getReason() {
return reason;
}
@Override
public TableId getTableId()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property tableId not supported in version 1.0");
}
@Override
public long getDurationSec() {
return durationSec;
}
@Override
public long getDurationNsec() {
return durationNsec;
}
@Override
public int getIdleTimeout() {
return idleTimeout;
}
@Override
public int getHardTimeout()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0");
}
@Override
public U64 getPacketCount() {
return packetCount;
}
@Override
public U64 getByteCount() {
return byteCount;
}
@Override
public Match getMatch() {
return match;
}
public OFFlowRemoved.Builder createBuilder() {
return new BuilderWithParent(this);
}
static class BuilderWithParent implements OFFlowRemoved.Builder {
final OFFlowRemovedVer10 parentMessage;
// OF message fields
private boolean xidSet;
private long xid;
private boolean matchSet;
private Match match;
private boolean cookieSet;
private U64 cookie;
private boolean prioritySet;
private int priority;
private boolean reasonSet;
private short reason;
private boolean durationSecSet;
private long durationSec;
private boolean durationNsecSet;
private long durationNsec;
private boolean idleTimeoutSet;
private int idleTimeout;
private boolean packetCountSet;
private U64 packetCount;
private boolean byteCountSet;
private U64 byteCount;
BuilderWithParent(OFFlowRemovedVer10 parentMessage) {
this.parentMessage = parentMessage;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
@Override
public OFType getType() {
return OFType.FLOW_REMOVED;
}
@Override
public long getXid() {
return xid;
}
@Override
public OFFlowRemoved.Builder setXid(long xid) {
this.xid = xid;
this.xidSet = true;
return this;
}
@Override
public U64 getCookie() {
return cookie;
}
@Override
public OFFlowRemoved.Builder setCookie(U64 cookie) {
this.cookie = cookie;
this.cookieSet = true;
return this;
}
@Override
public int getPriority() {
return priority;
}
@Override
public OFFlowRemoved.Builder setPriority(int priority) {
this.priority = priority;
this.prioritySet = true;
return this;
}
@Override
public short getReason() {
return reason;
}
@Override
public OFFlowRemoved.Builder setReason(short reason) {
this.reason = reason;
this.reasonSet = true;
return this;
}
@Override
public TableId getTableId()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property tableId not supported in version 1.0");
}
@Override
public OFFlowRemoved.Builder setTableId(TableId tableId) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property tableId not supported in version 1.0");
}
@Override
public long getDurationSec() {
return durationSec;
}
@Override
public OFFlowRemoved.Builder setDurationSec(long durationSec) {
this.durationSec = durationSec;
this.durationSecSet = true;
return this;
}
@Override
public long getDurationNsec() {
return durationNsec;
}
@Override
public OFFlowRemoved.Builder setDurationNsec(long durationNsec) {
this.durationNsec = durationNsec;
this.durationNsecSet = true;
return this;
}
@Override
public int getIdleTimeout() {
return idleTimeout;
}
@Override
public OFFlowRemoved.Builder setIdleTimeout(int idleTimeout) {
this.idleTimeout = idleTimeout;
this.idleTimeoutSet = true;
return this;
}
@Override
public int getHardTimeout()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0");
}
@Override
public OFFlowRemoved.Builder setHardTimeout(int hardTimeout) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0");
}
@Override
public U64 getPacketCount() {
return packetCount;
}
@Override
public OFFlowRemoved.Builder setPacketCount(U64 packetCount) {
this.packetCount = packetCount;
this.packetCountSet = true;
return this;
}
@Override
public U64 getByteCount() {
return byteCount;
}
@Override
public OFFlowRemoved.Builder setByteCount(U64 byteCount) {
this.byteCount = byteCount;
this.byteCountSet = true;
return this;
}
@Override
public Match getMatch() {
return match;
}
@Override
public OFFlowRemoved.Builder setMatch(Match match) {
this.match = match;
this.matchSet = true;
return this;
}
@Override
public OFFlowRemoved build() {
long xid = this.xidSet ? this.xid : parentMessage.xid;
Match match = this.matchSet ? this.match : parentMessage.match;
if(match == null)
throw new NullPointerException("Property match must not be null");
U64 cookie = this.cookieSet ? this.cookie : parentMessage.cookie;
if(cookie == null)
throw new NullPointerException("Property cookie must not be null");
int priority = this.prioritySet ? this.priority : parentMessage.priority;
short reason = this.reasonSet ? this.reason : parentMessage.reason;
long durationSec = this.durationSecSet ? this.durationSec : parentMessage.durationSec;
long durationNsec = this.durationNsecSet ? this.durationNsec : parentMessage.durationNsec;
int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : parentMessage.idleTimeout;
U64 packetCount = this.packetCountSet ? this.packetCount : parentMessage.packetCount;
if(packetCount == null)
throw new NullPointerException("Property packetCount must not be null");
U64 byteCount = this.byteCountSet ? this.byteCount : parentMessage.byteCount;
if(byteCount == null)
throw new NullPointerException("Property byteCount must not be null");
//
return new OFFlowRemovedVer10(
xid,
match,
cookie,
priority,
reason,
durationSec,
durationNsec,
idleTimeout,
packetCount,
byteCount
);
}
}
static class Builder implements OFFlowRemoved.Builder {
// OF message fields
private boolean xidSet;
private long xid;
private boolean matchSet;
private Match match;
private boolean cookieSet;
private U64 cookie;
private boolean prioritySet;
private int priority;
private boolean reasonSet;
private short reason;
private boolean durationSecSet;
private long durationSec;
private boolean durationNsecSet;
private long durationNsec;
private boolean idleTimeoutSet;
private int idleTimeout;
private boolean packetCountSet;
private U64 packetCount;
private boolean byteCountSet;
private U64 byteCount;
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
@Override
public OFType getType() {
return OFType.FLOW_REMOVED;
}
@Override
public long getXid() {
return xid;
}
@Override
public OFFlowRemoved.Builder setXid(long xid) {
this.xid = xid;
this.xidSet = true;
return this;
}
@Override
public U64 getCookie() {
return cookie;
}
@Override
public OFFlowRemoved.Builder setCookie(U64 cookie) {
this.cookie = cookie;
this.cookieSet = true;
return this;
}
@Override
public int getPriority() {
return priority;
}
@Override
public OFFlowRemoved.Builder setPriority(int priority) {
this.priority = priority;
this.prioritySet = true;
return this;
}
@Override
public short getReason() {
return reason;
}
@Override
public OFFlowRemoved.Builder setReason(short reason) {
this.reason = reason;
this.reasonSet = true;
return this;
}
@Override
public TableId getTableId()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property tableId not supported in version 1.0");
}
@Override
public OFFlowRemoved.Builder setTableId(TableId tableId) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property tableId not supported in version 1.0");
}
@Override
public long getDurationSec() {
return durationSec;
}
@Override
public OFFlowRemoved.Builder setDurationSec(long durationSec) {
this.durationSec = durationSec;
this.durationSecSet = true;
return this;
}
@Override
public long getDurationNsec() {
return durationNsec;
}
@Override
public OFFlowRemoved.Builder setDurationNsec(long durationNsec) {
this.durationNsec = durationNsec;
this.durationNsecSet = true;
return this;
}
@Override
public int getIdleTimeout() {
return idleTimeout;
}
@Override
public OFFlowRemoved.Builder setIdleTimeout(int idleTimeout) {
this.idleTimeout = idleTimeout;
this.idleTimeoutSet = true;
return this;
}
@Override
public int getHardTimeout()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0");
}
@Override
public OFFlowRemoved.Builder setHardTimeout(int hardTimeout) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property hardTimeout not supported in version 1.0");
}
@Override
public U64 getPacketCount() {
return packetCount;
}
@Override
public OFFlowRemoved.Builder setPacketCount(U64 packetCount) {
this.packetCount = packetCount;
this.packetCountSet = true;
return this;
}
@Override
public U64 getByteCount() {
return byteCount;
}
@Override
public OFFlowRemoved.Builder setByteCount(U64 byteCount) {
this.byteCount = byteCount;
this.byteCountSet = true;
return this;
}
@Override
public Match getMatch() {
return match;
}
@Override
public OFFlowRemoved.Builder setMatch(Match match) {
this.match = match;
this.matchSet = true;
return this;
}
//
@Override
public OFFlowRemoved build() {
long xid = this.xidSet ? this.xid : DEFAULT_XID;
Match match = this.matchSet ? this.match : DEFAULT_MATCH;
if(match == null)
throw new NullPointerException("Property match must not be null");
U64 cookie = this.cookieSet ? this.cookie : DEFAULT_COOKIE;
if(cookie == null)
throw new NullPointerException("Property cookie must not be null");
int priority = this.prioritySet ? this.priority : DEFAULT_PRIORITY;
short reason = this.reasonSet ? this.reason : DEFAULT_REASON;
long durationSec = this.durationSecSet ? this.durationSec : DEFAULT_DURATION_SEC;
long durationNsec = this.durationNsecSet ? this.durationNsec : DEFAULT_DURATION_NSEC;
int idleTimeout = this.idleTimeoutSet ? this.idleTimeout : DEFAULT_IDLE_TIMEOUT;
U64 packetCount = this.packetCountSet ? this.packetCount : DEFAULT_PACKET_COUNT;
if(packetCount == null)
throw new NullPointerException("Property packetCount must not be null");
U64 byteCount = this.byteCountSet ? this.byteCount : DEFAULT_BYTE_COUNT;
if(byteCount == null)
throw new NullPointerException("Property byteCount must not be null");
return new OFFlowRemovedVer10(
xid,
match,
cookie,
priority,
reason,
durationSec,
durationNsec,
idleTimeout,
packetCount,
byteCount
);
}
}
final static Reader READER = new Reader();
static class Reader implements OFMessageReader<OFFlowRemoved> {
@Override
public OFFlowRemoved readFrom(ChannelBuffer bb) throws OFParseError {
int start = bb.readerIndex();
// fixed value property version == 1
byte version = bb.readByte();
if(version != (byte) 0x1)
throw new OFParseError("Wrong version: Expected=OFVersion.OF_10(1), got="+version);
// fixed value property type == 11
byte type = bb.readByte();
if(type != (byte) 0xb)
throw new OFParseError("Wrong type: Expected=OFType.FLOW_REMOVED(11), got="+type);
int length = U16.f(bb.readShort());
if(length != 88)
throw new OFParseError("Wrong length: Expected=88(88), got="+length);
if(bb.readableBytes() + (bb.readerIndex() - start) < length) {
// Buffer does not have all data yet
bb.readerIndex(start);
return null;
}
if(logger.isTraceEnabled())
logger.trace("readFrom - length={}", length);
long xid = U32.f(bb.readInt());
Match match = ChannelUtilsVer10.readOFMatch(bb);
U64 cookie = U64.ofRaw(bb.readLong());
int priority = U16.f(bb.readShort());
short reason = U8.f(bb.readByte());
// pad: 1 bytes
bb.skipBytes(1);
long durationSec = U32.f(bb.readInt());
long durationNsec = U32.f(bb.readInt());
int idleTimeout = U16.f(bb.readShort());
// pad: 2 bytes
bb.skipBytes(2);
U64 packetCount = U64.ofRaw(bb.readLong());
U64 byteCount = U64.ofRaw(bb.readLong());
OFFlowRemovedVer10 flowRemovedVer10 = new OFFlowRemovedVer10(
xid,
match,
cookie,
priority,
reason,
durationSec,
durationNsec,
idleTimeout,
packetCount,
byteCount
);
if(logger.isTraceEnabled())
logger.trace("readFrom - read={}", flowRemovedVer10);
return flowRemovedVer10;
}
}
public void putTo(PrimitiveSink sink) {
FUNNEL.funnel(this, sink);
}
final static OFFlowRemovedVer10Funnel FUNNEL = new OFFlowRemovedVer10Funnel();
static class OFFlowRemovedVer10Funnel implements Funnel<OFFlowRemovedVer10> {
private static final long serialVersionUID = 1L;
@Override
public void funnel(OFFlowRemovedVer10 message, PrimitiveSink sink) {
// fixed value property version = 1
sink.putByte((byte) 0x1);
// fixed value property type = 11
sink.putByte((byte) 0xb);
// fixed value property length = 88
sink.putShort((short) 0x58);
sink.putLong(message.xid);
message.match.putTo(sink);
message.cookie.putTo(sink);
sink.putInt(message.priority);
sink.putShort(message.reason);
// skip pad (1 bytes)
sink.putLong(message.durationSec);
sink.putLong(message.durationNsec);
sink.putInt(message.idleTimeout);
// skip pad (2 bytes)
message.packetCount.putTo(sink);
message.byteCount.putTo(sink);
}
}
public void writeTo(ChannelBuffer bb) {
WRITER.write(bb, this);
}
final static Writer WRITER = new Writer();
static class Writer implements OFMessageWriter<OFFlowRemovedVer10> {
@Override
public void write(ChannelBuffer bb, OFFlowRemovedVer10 message) {
// fixed value property version = 1
bb.writeByte((byte) 0x1);
// fixed value property type = 11
bb.writeByte((byte) 0xb);
// fixed value property length = 88
bb.writeShort((short) 0x58);
bb.writeInt(U32.t(message.xid));
message.match.writeTo(bb);
bb.writeLong(message.cookie.getValue());
bb.writeShort(U16.t(message.priority));
bb.writeByte(U8.t(message.reason));
// pad: 1 bytes
bb.writeZero(1);
bb.writeInt(U32.t(message.durationSec));
bb.writeInt(U32.t(message.durationNsec));
bb.writeShort(U16.t(message.idleTimeout));
// pad: 2 bytes
bb.writeZero(2);
bb.writeLong(message.packetCount.getValue());
bb.writeLong(message.byteCount.getValue());
}
}
@Override
public String toString() {
StringBuilder b = new StringBuilder("OFFlowRemovedVer10(");
b.append("xid=").append(xid);
b.append(", ");
b.append("match=").append(match);
b.append(", ");
b.append("cookie=").append(cookie);
b.append(", ");
b.append("priority=").append(priority);
b.append(", ");
b.append("reason=").append(reason);
b.append(", ");
b.append("durationSec=").append(durationSec);
b.append(", ");
b.append("durationNsec=").append(durationNsec);
b.append(", ");
b.append("idleTimeout=").append(idleTimeout);
b.append(", ");
b.append("packetCount=").append(packetCount);
b.append(", ");
b.append("byteCount=").append(byteCount);
b.append(")");
return b.toString();
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
OFFlowRemovedVer10 other = (OFFlowRemovedVer10) obj;
if( xid != other.xid)
return false;
if (match == null) {
if (other.match != null)
return false;
} else if (!match.equals(other.match))
return false;
if (cookie == null) {
if (other.cookie != null)
return false;
} else if (!cookie.equals(other.cookie))
return false;
if( priority != other.priority)
return false;
if( reason != other.reason)
return false;
if( durationSec != other.durationSec)
return false;
if( durationNsec != other.durationNsec)
return false;
if( idleTimeout != other.idleTimeout)
return false;
if (packetCount == null) {
if (other.packetCount != null)
return false;
} else if (!packetCount.equals(other.packetCount))
return false;
if (byteCount == null) {
if (other.byteCount != null)
return false;
} else if (!byteCount.equals(other.byteCount))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * (int) (xid ^ (xid >>> 32));
result = prime * result + ((match == null) ? 0 : match.hashCode());
result = prime * result + ((cookie == null) ? 0 : cookie.hashCode());
result = prime * result + priority;
result = prime * result + reason;
result = prime * (int) (durationSec ^ (durationSec >>> 32));
result = prime * (int) (durationNsec ^ (durationNsec >>> 32));
result = prime * result + idleTimeout;
result = prime * result + ((packetCount == null) ? 0 : packetCount.hashCode());
result = prime * result + ((byteCount == null) ? 0 : byteCount.hashCode());
return result;
}
}