blob: 78a7da385598f9f4482cdac3b8c172d967a46d89 [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 OFTableStatsEntryVer10 implements OFTableStatsEntry {
private static final Logger logger = LoggerFactory.getLogger(OFTableStatsEntryVer10.class);
// version: 1.0
final static byte WIRE_VERSION = 1;
final static int LENGTH = 64;
private final static TableId DEFAULT_TABLE_ID = TableId.ALL;
private final static String DEFAULT_NAME = "";
private final static int DEFAULT_WILDCARDS = 0x0;
private final static long DEFAULT_MAX_ENTRIES = 0x0L;
private final static long DEFAULT_ACTIVE_COUNT = 0x0L;
private final static U64 DEFAULT_LOOKUP_COUNT = U64.ZERO;
private final static U64 DEFAULT_MATCHED_COUNT = U64.ZERO;
// OF message fields
private final TableId tableId;
private final String name;
private final int wildcards;
private final long maxEntries;
private final long activeCount;
private final U64 lookupCount;
private final U64 matchedCount;
//
// Immutable default instance
final static OFTableStatsEntryVer10 DEFAULT = new OFTableStatsEntryVer10(
DEFAULT_TABLE_ID, DEFAULT_NAME, DEFAULT_WILDCARDS, DEFAULT_MAX_ENTRIES, DEFAULT_ACTIVE_COUNT, DEFAULT_LOOKUP_COUNT, DEFAULT_MATCHED_COUNT
);
// package private constructor - used by readers, builders, and factory
OFTableStatsEntryVer10(TableId tableId, String name, int wildcards, long maxEntries, long activeCount, U64 lookupCount, U64 matchedCount) {
this.tableId = tableId;
this.name = name;
this.wildcards = wildcards;
this.maxEntries = maxEntries;
this.activeCount = activeCount;
this.lookupCount = lookupCount;
this.matchedCount = matchedCount;
}
// Accessors for OF message fields
@Override
public TableId getTableId() {
return tableId;
}
@Override
public String getName() {
return name;
}
@Override
public OFMatchBmap getMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property match not supported in version 1.0");
}
@Override
public int getWildcards() {
return wildcards;
}
@Override
public long getWriteActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeActions not supported in version 1.0");
}
@Override
public long getApplyActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applyActions not supported in version 1.0");
}
@Override
public U64 getWriteSetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.0");
}
@Override
public U64 getApplySetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applySetfields not supported in version 1.0");
}
@Override
public U64 getMetadataMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.0");
}
@Override
public U64 getMetadataWrite()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.0");
}
@Override
public long getInstructions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property instructions not supported in version 1.0");
}
@Override
public long getConfig()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property config not supported in version 1.0");
}
@Override
public long getMaxEntries() {
return maxEntries;
}
@Override
public long getActiveCount() {
return activeCount;
}
@Override
public U64 getLookupCount() {
return lookupCount;
}
@Override
public U64 getMatchedCount() {
return matchedCount;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
public OFTableStatsEntry.Builder createBuilder() {
return new BuilderWithParent(this);
}
static class BuilderWithParent implements OFTableStatsEntry.Builder {
final OFTableStatsEntryVer10 parentMessage;
// OF message fields
private boolean tableIdSet;
private TableId tableId;
private boolean nameSet;
private String name;
private boolean wildcardsSet;
private int wildcards;
private boolean maxEntriesSet;
private long maxEntries;
private boolean activeCountSet;
private long activeCount;
private boolean lookupCountSet;
private U64 lookupCount;
private boolean matchedCountSet;
private U64 matchedCount;
BuilderWithParent(OFTableStatsEntryVer10 parentMessage) {
this.parentMessage = parentMessage;
}
@Override
public TableId getTableId() {
return tableId;
}
@Override
public OFTableStatsEntry.Builder setTableId(TableId tableId) {
this.tableId = tableId;
this.tableIdSet = true;
return this;
}
@Override
public String getName() {
return name;
}
@Override
public OFTableStatsEntry.Builder setName(String name) {
this.name = name;
this.nameSet = true;
return this;
}
@Override
public OFMatchBmap getMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property match not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMatch(OFMatchBmap match) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property match not supported in version 1.0");
}
@Override
public int getWildcards() {
return wildcards;
}
@Override
public OFTableStatsEntry.Builder setWildcards(int wildcards) {
this.wildcards = wildcards;
this.wildcardsSet = true;
return this;
}
@Override
public long getWriteActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeActions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setWriteActions(long writeActions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeActions not supported in version 1.0");
}
@Override
public long getApplyActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applyActions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setApplyActions(long applyActions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applyActions not supported in version 1.0");
}
@Override
public U64 getWriteSetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setWriteSetfields(U64 writeSetfields) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.0");
}
@Override
public U64 getApplySetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applySetfields not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setApplySetfields(U64 applySetfields) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applySetfields not supported in version 1.0");
}
@Override
public U64 getMetadataMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMetadataMatch(U64 metadataMatch) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.0");
}
@Override
public U64 getMetadataWrite()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMetadataWrite(U64 metadataWrite) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.0");
}
@Override
public long getInstructions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property instructions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setInstructions(long instructions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property instructions not supported in version 1.0");
}
@Override
public long getConfig()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property config not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setConfig(long config) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property config not supported in version 1.0");
}
@Override
public long getMaxEntries() {
return maxEntries;
}
@Override
public OFTableStatsEntry.Builder setMaxEntries(long maxEntries) {
this.maxEntries = maxEntries;
this.maxEntriesSet = true;
return this;
}
@Override
public long getActiveCount() {
return activeCount;
}
@Override
public OFTableStatsEntry.Builder setActiveCount(long activeCount) {
this.activeCount = activeCount;
this.activeCountSet = true;
return this;
}
@Override
public U64 getLookupCount() {
return lookupCount;
}
@Override
public OFTableStatsEntry.Builder setLookupCount(U64 lookupCount) {
this.lookupCount = lookupCount;
this.lookupCountSet = true;
return this;
}
@Override
public U64 getMatchedCount() {
return matchedCount;
}
@Override
public OFTableStatsEntry.Builder setMatchedCount(U64 matchedCount) {
this.matchedCount = matchedCount;
this.matchedCountSet = true;
return this;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
@Override
public OFTableStatsEntry build() {
TableId tableId = this.tableIdSet ? this.tableId : parentMessage.tableId;
if(tableId == null)
throw new NullPointerException("Property tableId must not be null");
String name = this.nameSet ? this.name : parentMessage.name;
if(name == null)
throw new NullPointerException("Property name must not be null");
int wildcards = this.wildcardsSet ? this.wildcards : parentMessage.wildcards;
long maxEntries = this.maxEntriesSet ? this.maxEntries : parentMessage.maxEntries;
long activeCount = this.activeCountSet ? this.activeCount : parentMessage.activeCount;
U64 lookupCount = this.lookupCountSet ? this.lookupCount : parentMessage.lookupCount;
if(lookupCount == null)
throw new NullPointerException("Property lookupCount must not be null");
U64 matchedCount = this.matchedCountSet ? this.matchedCount : parentMessage.matchedCount;
if(matchedCount == null)
throw new NullPointerException("Property matchedCount must not be null");
//
return new OFTableStatsEntryVer10(
tableId,
name,
wildcards,
maxEntries,
activeCount,
lookupCount,
matchedCount
);
}
}
static class Builder implements OFTableStatsEntry.Builder {
// OF message fields
private boolean tableIdSet;
private TableId tableId;
private boolean nameSet;
private String name;
private boolean wildcardsSet;
private int wildcards;
private boolean maxEntriesSet;
private long maxEntries;
private boolean activeCountSet;
private long activeCount;
private boolean lookupCountSet;
private U64 lookupCount;
private boolean matchedCountSet;
private U64 matchedCount;
@Override
public TableId getTableId() {
return tableId;
}
@Override
public OFTableStatsEntry.Builder setTableId(TableId tableId) {
this.tableId = tableId;
this.tableIdSet = true;
return this;
}
@Override
public String getName() {
return name;
}
@Override
public OFTableStatsEntry.Builder setName(String name) {
this.name = name;
this.nameSet = true;
return this;
}
@Override
public OFMatchBmap getMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property match not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMatch(OFMatchBmap match) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property match not supported in version 1.0");
}
@Override
public int getWildcards() {
return wildcards;
}
@Override
public OFTableStatsEntry.Builder setWildcards(int wildcards) {
this.wildcards = wildcards;
this.wildcardsSet = true;
return this;
}
@Override
public long getWriteActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeActions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setWriteActions(long writeActions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeActions not supported in version 1.0");
}
@Override
public long getApplyActions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applyActions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setApplyActions(long applyActions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applyActions not supported in version 1.0");
}
@Override
public U64 getWriteSetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setWriteSetfields(U64 writeSetfields) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property writeSetfields not supported in version 1.0");
}
@Override
public U64 getApplySetfields()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applySetfields not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setApplySetfields(U64 applySetfields) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property applySetfields not supported in version 1.0");
}
@Override
public U64 getMetadataMatch()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMetadataMatch(U64 metadataMatch) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataMatch not supported in version 1.0");
}
@Override
public U64 getMetadataWrite()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setMetadataWrite(U64 metadataWrite) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property metadataWrite not supported in version 1.0");
}
@Override
public long getInstructions()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property instructions not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setInstructions(long instructions) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property instructions not supported in version 1.0");
}
@Override
public long getConfig()throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property config not supported in version 1.0");
}
@Override
public OFTableStatsEntry.Builder setConfig(long config) throws UnsupportedOperationException {
throw new UnsupportedOperationException("Property config not supported in version 1.0");
}
@Override
public long getMaxEntries() {
return maxEntries;
}
@Override
public OFTableStatsEntry.Builder setMaxEntries(long maxEntries) {
this.maxEntries = maxEntries;
this.maxEntriesSet = true;
return this;
}
@Override
public long getActiveCount() {
return activeCount;
}
@Override
public OFTableStatsEntry.Builder setActiveCount(long activeCount) {
this.activeCount = activeCount;
this.activeCountSet = true;
return this;
}
@Override
public U64 getLookupCount() {
return lookupCount;
}
@Override
public OFTableStatsEntry.Builder setLookupCount(U64 lookupCount) {
this.lookupCount = lookupCount;
this.lookupCountSet = true;
return this;
}
@Override
public U64 getMatchedCount() {
return matchedCount;
}
@Override
public OFTableStatsEntry.Builder setMatchedCount(U64 matchedCount) {
this.matchedCount = matchedCount;
this.matchedCountSet = true;
return this;
}
@Override
public OFVersion getVersion() {
return OFVersion.OF_10;
}
//
@Override
public OFTableStatsEntry build() {
TableId tableId = this.tableIdSet ? this.tableId : DEFAULT_TABLE_ID;
if(tableId == null)
throw new NullPointerException("Property tableId must not be null");
String name = this.nameSet ? this.name : DEFAULT_NAME;
if(name == null)
throw new NullPointerException("Property name must not be null");
int wildcards = this.wildcardsSet ? this.wildcards : DEFAULT_WILDCARDS;
long maxEntries = this.maxEntriesSet ? this.maxEntries : DEFAULT_MAX_ENTRIES;
long activeCount = this.activeCountSet ? this.activeCount : DEFAULT_ACTIVE_COUNT;
U64 lookupCount = this.lookupCountSet ? this.lookupCount : DEFAULT_LOOKUP_COUNT;
if(lookupCount == null)
throw new NullPointerException("Property lookupCount must not be null");
U64 matchedCount = this.matchedCountSet ? this.matchedCount : DEFAULT_MATCHED_COUNT;
if(matchedCount == null)
throw new NullPointerException("Property matchedCount must not be null");
return new OFTableStatsEntryVer10(
tableId,
name,
wildcards,
maxEntries,
activeCount,
lookupCount,
matchedCount
);
}
}
final static Reader READER = new Reader();
static class Reader implements OFMessageReader<OFTableStatsEntry> {
@Override
public OFTableStatsEntry readFrom(ChannelBuffer bb) throws OFParseError {
TableId tableId = TableId.readByte(bb);
// pad: 3 bytes
bb.skipBytes(3);
String name = ChannelUtils.readFixedLengthString(bb, 32);
int wildcards = bb.readInt();
long maxEntries = U32.f(bb.readInt());
long activeCount = U32.f(bb.readInt());
U64 lookupCount = U64.ofRaw(bb.readLong());
U64 matchedCount = U64.ofRaw(bb.readLong());
OFTableStatsEntryVer10 tableStatsEntryVer10 = new OFTableStatsEntryVer10(
tableId,
name,
wildcards,
maxEntries,
activeCount,
lookupCount,
matchedCount
);
if(logger.isTraceEnabled())
logger.trace("readFrom - read={}", tableStatsEntryVer10);
return tableStatsEntryVer10;
}
}
public void putTo(PrimitiveSink sink) {
FUNNEL.funnel(this, sink);
}
final static OFTableStatsEntryVer10Funnel FUNNEL = new OFTableStatsEntryVer10Funnel();
static class OFTableStatsEntryVer10Funnel implements Funnel<OFTableStatsEntryVer10> {
private static final long serialVersionUID = 1L;
@Override
public void funnel(OFTableStatsEntryVer10 message, PrimitiveSink sink) {
message.tableId.putTo(sink);
// skip pad (3 bytes)
sink.putUnencodedChars(message.name);
sink.putInt(message.wildcards);
sink.putLong(message.maxEntries);
sink.putLong(message.activeCount);
message.lookupCount.putTo(sink);
message.matchedCount.putTo(sink);
}
}
public void writeTo(ChannelBuffer bb) {
WRITER.write(bb, this);
}
final static Writer WRITER = new Writer();
static class Writer implements OFMessageWriter<OFTableStatsEntryVer10> {
@Override
public void write(ChannelBuffer bb, OFTableStatsEntryVer10 message) {
message.tableId.writeByte(bb);
// pad: 3 bytes
bb.writeZero(3);
ChannelUtils.writeFixedLengthString(bb, message.name, 32);
bb.writeInt(message.wildcards);
bb.writeInt(U32.t(message.maxEntries));
bb.writeInt(U32.t(message.activeCount));
bb.writeLong(message.lookupCount.getValue());
bb.writeLong(message.matchedCount.getValue());
}
}
@Override
public String toString() {
StringBuilder b = new StringBuilder("OFTableStatsEntryVer10(");
b.append("tableId=").append(tableId);
b.append(", ");
b.append("name=").append(name);
b.append(", ");
b.append("wildcards=").append(wildcards);
b.append(", ");
b.append("maxEntries=").append(maxEntries);
b.append(", ");
b.append("activeCount=").append(activeCount);
b.append(", ");
b.append("lookupCount=").append(lookupCount);
b.append(", ");
b.append("matchedCount=").append(matchedCount);
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;
OFTableStatsEntryVer10 other = (OFTableStatsEntryVer10) obj;
if (tableId == null) {
if (other.tableId != null)
return false;
} else if (!tableId.equals(other.tableId))
return false;
if (name == null) {
if (other.name != null)
return false;
} else if (!name.equals(other.name))
return false;
if( wildcards != other.wildcards)
return false;
if( maxEntries != other.maxEntries)
return false;
if( activeCount != other.activeCount)
return false;
if (lookupCount == null) {
if (other.lookupCount != null)
return false;
} else if (!lookupCount.equals(other.lookupCount))
return false;
if (matchedCount == null) {
if (other.matchedCount != null)
return false;
} else if (!matchedCount.equals(other.matchedCount))
return false;
return true;
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((tableId == null) ? 0 : tableId.hashCode());
result = prime * result + ((name == null) ? 0 : name.hashCode());
result = prime * result + wildcards;
result = prime * (int) (maxEntries ^ (maxEntries >>> 32));
result = prime * (int) (activeCount ^ (activeCount >>> 32));
result = prime * result + ((lookupCount == null) ? 0 : lookupCount.hashCode());
result = prime * result + ((matchedCount == null) ? 0 : matchedCount.hashCode());
return result;
}
}