Merge into master from pull request #76:
Update openflow connection port to 6653 [PAN-367] (https://github.com/floodlight/loxigen/pull/76)
diff --git a/java_gen/java_model.py b/java_gen/java_model.py
index b03c224..410a1dd 100644
--- a/java_gen/java_model.py
+++ b/java_gen/java_model.py
@@ -378,14 +378,15 @@
annotated_base_class = base_class + "<?>" if base_class == "OFOxm" else base_class
factories[base_class] = OFFactory(package="%s.%s" % (prefix, package),
- name=base_class + "s", members=[], remove_prefix=remove_prefix, base_class=annotated_base_class, sub_factories={})
+ name=base_class + "s", members=[], remove_prefix=remove_prefix, base_class=annotated_base_class, sub_factories={}, xid_generator=False)
factories[""] = OFFactory(
package=prefix,
name="OFFactory",
remove_prefix="",
members=[], base_class="OFMessage", sub_factories=OrderedDict(
- ("{}{}s".format(n[2].lower(), n[3:]), "{}s".format(n)) for n in sub_factory_classes ))
+ ("{}{}s".format(n[2].lower(), n[3:]), "{}s".format(n)) for n in sub_factory_classes ),
+ xid_generator=True)
for i in self.interfaces:
for n, factory in factories.items():
@@ -421,7 +422,7 @@
return True
-class OFFactory(namedtuple("OFFactory", ("package", "name", "members", "remove_prefix", "base_class", "sub_factories"))):
+class OFFactory(namedtuple("OFFactory", ("package", "name", "members", "remove_prefix", "base_class", "sub_factories", "xid_generator"))):
@property
def factory_classes(self):
return [ OFFactoryClass(
@@ -572,8 +573,10 @@
# FIXME: This duplicates inheritance information that is now available in the loxi_ir
# model (note, that the loxi model is on versioned classes). Should check/infer the
# inheritance information from the versioned lox_ir classes.
- if re.match(r'OF.+StatsRequest$', self.name):
- return ("", "OFStatsRequest", None)
+ if re.match(r'OFStatsRequest$', self.name):
+ return ("", "OFMessage", "T extends OFStatsReply")
+ elif re.match(r'OF.+StatsRequest$', self.name):
+ return ("", "OFStatsRequest<{}>".format(re.sub(r'Request$', 'Reply', self.name)), None)
elif re.match(r'OF.+StatsReply$', self.name):
return ("", "OFStatsReply", None)
elif re.match(r'OFFlow(Add|Modify(Strict)?|Delete(Strict)?)$', self.name):
@@ -622,6 +625,10 @@
def writeable_members(self):
return [ m for m in self.members if m.is_writeable ]
+ @memoize
+ def member_by_name(self, name):
+ return find(lambda m: m.name == name, self.members)
+
@property
@memoize
def members(self):
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 87ce9d6..7da6f6a 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -248,8 +248,8 @@
u64 = JType('U64', 'U64') \
.op(read='U64.ofRaw(bb.readLong())', write='bb.writeLong($name.getValue())', default="U64.ZERO")
of_port = JType("OFPort") \
- .op(version=1, read="OFPort.read2Bytes(bb)", write="$name.write2Bytes(bb)", default="OFPort.NONE") \
- .op(version=ANY, read="OFPort.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFPort.NONE")
+ .op(version=1, read="OFPort.read2Bytes(bb)", write="$name.write2Bytes(bb)", default="OFPort.ANY") \
+ .op(version=ANY, read="OFPort.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFPort.ANY")
actions_list = JType('List<OFAction>') \
.op(read='ChannelUtils.readList(bb, $length, OFActionVer$version.READER)',
write='ChannelUtils.writeList(bb, $name);',
@@ -380,7 +380,10 @@
table_stats_wildcards = JType("int") \
.op(read='bb.readInt()',
write='bb.writeInt($name)')
-
+table_id = JType("TableId") \
+ .op(read='TableId.readByte(bb)',
+ write='$name.writeByte(bb)',
+ default='TableId.ALL')
port_speed = JType("PortSpeed")
error_type = JType("OFErrorType")
@@ -538,6 +541,8 @@
return JType("OFActionType", 'short') \
.op(read='bb.readShort()', write='bb.writeShort($name)', pub_type=False)\
.op(read="OFActionTypeSerializerVer$version.readFrom(bb)", write="OFActionTypeSerializerVer$version.writeTo(bb, $name)", pub_type=True)
+ elif field_name == "table_id" and c_type == "uint8_t":
+ return table_id
elif field_name == "version" and c_type == "uint8_t":
return JType("OFVersion", 'byte') \
.op(read='bb.readByte()', write='bb.writeByte($name)')
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java
index 65976dc..2ee2764 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerator.java
@@ -1,5 +1,5 @@
package org.projectfloodlight.openflow.protocol;
public interface XidGenerator {
- int nextXid();
+ long nextXid();
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java
new file mode 100644
index 0000000..4609afa
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/XidGenerators.java
@@ -0,0 +1,38 @@
+package org.projectfloodlight.openflow.protocol;
+
+import java.util.concurrent.atomic.AtomicLong;
+
+public class XidGenerators {
+ private static final XidGenerator GLOBAL_XID_GENERATOR = new StandardXidGenerator();
+
+ public static XidGenerator create() {
+ return new StandardXidGenerator();
+ }
+
+ public static XidGenerator global() {
+ return GLOBAL_XID_GENERATOR;
+ }
+}
+
+class StandardXidGenerator implements XidGenerator {
+
+ private final AtomicLong xidGen = new AtomicLong();
+ long MAX_XID = 0xFFffFFffL;
+
+ @Override
+ public long nextXid() {
+ long xid;
+ do {
+ xid = xidGen.incrementAndGet();
+ if(xid > MAX_XID) {
+ synchronized(this) {
+ if(xidGen.get() > MAX_XID) {
+ xidGen.set(0);
+ }
+ }
+ }
+ } while(xid > MAX_XID);
+ return xid;
+ }
+
+}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
index 5ab940d..2a33a0e 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ArpOpcode.java
@@ -2,6 +2,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.primitives.UnsignedInts;
+
public class ArpOpcode implements OFValueType<ArpOpcode> {
final static int LENGTH = 2;
@@ -160,4 +162,31 @@
return opcode;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + opcode;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ArpOpcode other = (ArpOpcode) obj;
+ if (opcode != other.opcode)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ArpOpcode o) {
+ return UnsignedInts.compare(opcode, o.opcode);
+ }
+
}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java
index abd4bff..7031a0d 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/EthType.java
@@ -2,6 +2,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.primitives.UnsignedInts;
+
/**
* EtherType field representation.
@@ -214,24 +216,6 @@
}
@Override
- public boolean equals(Object obj) {
- if (!(obj instanceof EthType))
- return false;
- EthType o = (EthType)obj;
- if (o.rawValue != this.rawValue)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 37;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
public String toString() {
return Integer.toHexString(rawValue);
}
@@ -253,5 +237,28 @@
return rawValue;
}
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof EthType))
+ return false;
+ EthType o = (EthType)obj;
+ if (o.rawValue != this.rawValue)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 37;
+ int result = 1;
+ result = prime * result + rawValue;
+ return result;
+ }
+
+ @Override
+ public int compareTo(EthType o) {
+ return UnsignedInts.compare(rawValue, o.rawValue);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
index a6544c9..c66486f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Code.java
@@ -2,6 +2,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.primitives.Shorts;
+
/**
*
* @author Yotam Harchol (yotam.harchol@bigswitch.com)
@@ -56,4 +58,30 @@
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + code;
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ICMPv4Code other = (ICMPv4Code) obj;
+ if (code != other.code)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ICMPv4Code o) {
+ return Shorts.compare(code, o.code);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
index 5190d4e..594aaec 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/ICMPv4Type.java
@@ -2,8 +2,9 @@
import org.jboss.netty.buffer.ChannelBuffer;
-public class ICMPv4Type implements OFValueType<ICMPv4Type> {
+import com.google.common.primitives.Shorts;
+public class ICMPv4Type implements OFValueType<ICMPv4Type> {
final static int LENGTH = 1;
private static final short ICMPV4_TYPE_VAL_ECHO_REPLY = 0;
@@ -166,5 +167,30 @@
return ICMPv4Type.of((short)(this.type & mask.type));
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + type;
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ ICMPv4Type other = (ICMPv4Type) obj;
+ if (type != other.type)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(ICMPv4Type o) {
+ return Shorts.compare(type, o.type);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
index 3b07c17..77b792f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv4Address.java
@@ -1,7 +1,11 @@
package org.projectfloodlight.openflow.types;
+import java.util.Arrays;
+
import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.primitives.UnsignedInts;
+
/**
@@ -106,28 +110,6 @@
return res.toString();
}
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + rawValue;
- return result;
- }
-
- @Override
- public boolean equals(final Object obj) {
- if (this == obj)
- return true;
- if (obj == null)
- return false;
- if (getClass() != obj.getClass())
- return false;
- IPv4Address other = (IPv4Address) obj;
- if (rawValue != other.rawValue)
- return false;
- return true;
- }
-
public void write4Bytes(ChannelBuffer c) {
c.writeInt(rawValue);
}
@@ -141,5 +123,33 @@
return IPv4Address.of(this.rawValue & mask.rawValue);
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + Arrays.hashCode(bytesCache);
+ result = prime * result + rawValue;
+ return result;
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ IPv4Address other = (IPv4Address) obj;
+ if (!Arrays.equals(bytesCache, other.bytesCache))
+ return false;
+ if (rawValue != other.rawValue)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int compareTo(IPv4Address o) {
+ return UnsignedInts.compare(rawValue, o.rawValue);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
index eb52f67..b58de1a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6Address.java
@@ -5,6 +5,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.Longs;
+
/**
* IPv6 address object. Instance controlled, immutable. Internal representation:
* two 64 bit longs (not that you'd have to know).
@@ -297,4 +299,13 @@
public IPv6Address applyMask(IPv6Address mask) {
return IPv6Address.of(this.raw1 & mask.raw1, this.raw2 & mask.raw2);
}
+
+ @Override
+ public int compareTo(IPv6Address o) {
+ int res = Longs.compare(raw1, o.raw1);
+ if(res != 0)
+ return res;
+ else
+ return Longs.compare(raw2, o.raw2);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
index 7dbf9bb..45bbf4b 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IPv6FlowLabel.java
@@ -3,6 +3,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.UnsignedInts;
+
public class IPv6FlowLabel implements OFValueType<IPv6FlowLabel> {
static final int LENGTH = 4;
@@ -69,4 +71,9 @@
public int getIPv6FlowLabelValue() {
return label;
}
+
+ @Override
+ public int compareTo(IPv6FlowLabel o) {
+ return UnsignedInts.compare(label, o.label);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
index 36a76a2..f0f79ec 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/IpProtocol.java
@@ -2,6 +2,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
+import com.google.common.primitives.Shorts;
+
/**
* IP-Protocol field representation
*
@@ -608,24 +610,6 @@
}
@Override
- public boolean equals(Object obj) {
- if (!(obj instanceof IpProtocol))
- return false;
- IpProtocol o = (IpProtocol)obj;
- if (o.proto != this.proto)
- return false;
- return true;
- }
-
- @Override
- public int hashCode() {
- final int prime = 37;
- int result = 1;
- result = prime * result + proto;
- return result;
- }
-
- @Override
public String toString() {
return Integer.toHexString(proto);
}
@@ -647,4 +631,28 @@
return proto;
}
-}
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof IpProtocol))
+ return false;
+ IpProtocol o = (IpProtocol)obj;
+ if (o.proto != this.proto)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 37;
+ int result = 1;
+ result = prime * result + proto;
+ return result;
+ }
+
+
+ @Override
+ public int compareTo(IpProtocol o) {
+ return Shorts.compare(proto, o.proto);
+ }
+
+}
\ No newline at end of file
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
index 713db9a..b7f7f67 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
@@ -1,10 +1,13 @@
package org.projectfloodlight.openflow.types;
-import org.jboss.netty.buffer.ChannelBuffer;
import javax.annotation.concurrent.Immutable;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.primitives.UnsignedInts;
+
@Immutable
-public class LagId {
+public class LagId implements OFValueType<LagId> {
static final int LENGTH = 4;
private final int rawValue;
@@ -20,6 +23,7 @@
return rawValue;
}
+ @Override
public int getLength() {
return LENGTH;
}
@@ -58,4 +62,14 @@
public static LagId read4Bytes(ChannelBuffer c) {
return LagId.of(c.readInt());
}
+
+ @Override
+ public int compareTo(LagId o) {
+ return UnsignedInts.compare(rawValue, o.rawValue);
+ }
+
+ @Override
+ public LagId applyMask(LagId mask) {
+ return LagId.of(rawValue & mask.rawValue);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
index cc047ca..87be7c2 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/MacAddress.java
@@ -4,6 +4,8 @@
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.util.HexString;
+import com.google.common.primitives.Longs;
+
/**
* Wrapper around a 6 byte mac address.
*
@@ -131,6 +133,11 @@
return MacAddress.of(this.rawValue & mask.rawValue);
}
+ @Override
+ public int compareTo(MacAddress o) {
+ return Longs.compare(rawValue, o.rawValue);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java
index ead7d62..4d88793 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Masked.java
@@ -5,20 +5,20 @@
public class Masked<T extends OFValueType<T>> implements OFValueType<Masked<T>> {
protected T value;
protected T mask;
-
+
protected Masked(T value, T mask) {
this.value = value.applyMask(mask);
this.mask = mask;
}
-
+
public T getValue() {
return value;
}
-
+
public T getMask() {
return mask;
}
-
+
public static <T extends OFValueType<T>> Masked<T> of(T value, T mask) {
return new Masked<T>(value, mask);
}
@@ -27,7 +27,20 @@
public int getLength() {
return this.value.getLength() + this.mask.getLength();
}
-
+
+ @Override
+ public String toString() {
+ // General representation: value/mask
+ StringBuilder sb = new StringBuilder();
+ sb.append(value.toString()).append('/').append(mask.toString());
+ return sb.toString();
+ }
+
+ @Override
+ public Masked<T> applyMask(Masked<T> mask) {
+ return this;
+ }
+
@Override
public boolean equals(Object obj) {
if (!(obj instanceof Masked<?>))
@@ -46,16 +59,11 @@
}
@Override
- public String toString() {
- // General representation: value/mask
- StringBuilder sb = new StringBuilder();
- sb.append(value.toString()).append('/').append(mask.toString());
- return sb.toString();
+ public int compareTo(Masked<T> o) {
+ int res = value.compareTo(o.value);
+ if(res != 0)
+ return res;
+ else
+ return mask.compareTo(o.mask);
}
-
- @Override
- public Masked<T> applyMask(Masked<T> mask) {
- return this;
- }
-
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Metadata.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Metadata.java
index e4eed77..4764747 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Metadata.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Metadata.java
@@ -2,8 +2,10 @@
import javax.annotation.concurrent.Immutable;
+import com.google.common.primitives.UnsignedInts;
+
@Immutable
-public class Metadata {
+public class Metadata implements OFValueType<Metadata> {
static final int LENGTH = 4;
private final static int NONE_VAL = 0;
@@ -26,11 +28,21 @@
return rawValue;
}
+ @Override
public int getLength() {
return LENGTH;
}
@Override
+ public String toString() {
+ return Integer.toString(rawValue);
+ }
+
+ @Override
+ public Metadata applyMask(Metadata mask) {
+ return Metadata.of(rawValue & mask.rawValue); }
+
+ @Override
public int hashCode() {
final int prime = 31;
int result = 1;
@@ -53,7 +65,7 @@
}
@Override
- public String toString() {
- return Integer.toString(rawValue);
+ public int compareTo(Metadata o) {
+ return UnsignedInts.compare(rawValue, rawValue);
}
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
index 99f3e7f..856eff0 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFBufferId.java
@@ -4,14 +4,15 @@
import org.projectfloodlight.openflow.annotations.Immutable;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.UnsignedInts;
+
/**
* Abstraction of a buffer id in OpenFlow. Immutable.
*
* @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
*/
@Immutable
-public class OFBufferId {
-
+public class OFBufferId implements Comparable<OFBufferId> {
public static final OFBufferId NO_BUFFER = new OFBufferId(0xFFFFFFFF);
private final int rawValue;
@@ -64,4 +65,9 @@
return false;
return true;
}
+
+ @Override
+ public int compareTo(OFBufferId o) {
+ return UnsignedInts.compare(rawValue, o.rawValue);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
index 766ade1..0844d89 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFMetadata.java
@@ -63,6 +63,8 @@
return "Metadata: " + u64.toString();
}
-
-
+ @Override
+ public int compareTo(OFMetadata o) {
+ return u64.compareTo(o.u64);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
index db7bd5f..cb36d0c 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFPort.java
@@ -4,6 +4,8 @@
import org.projectfloodlight.openflow.annotations.Immutable;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.UnsignedInts;
+
/**
* Abstraction of an logical / OpenFlow switch port (ofp_port_no) in OpenFlow.
* Immutable. Note: Switch port numbers were changed in OpenFlow 1.1 from uint16
@@ -20,7 +22,6 @@
// private int constants (OF1.1+) to avoid duplication in the code
// should not have to use these outside this class
- private static final int OFPP_NONE_INT = 0x0;
private static final int OFPP_ANY_INT = 0xFFffFFff;
private static final int OFPP_LOCAL_INT = 0xFFffFFfe;
private static final int OFPP_CONTROLLER_INT = 0xFFffFFfd;
@@ -87,9 +88,6 @@
*/
public final static OFPort ANY = new NamedPort(OFPP_ANY_INT, "any");
- /** port number 0, read of the wire, e.g, if not set */
- public final static OFPort NONE = new NamedPort(OFPP_NONE_INT, "none");
-
public static final OFPort NO_MASK = OFPort.of(0xFFFFFFFF);
public static final OFPort FULL_MASK = OFPort.of(0x0);
@@ -162,8 +160,6 @@
*/
public static OFPort ofInt(final int portNumber) {
switch (portNumber) {
- case 0:
- return NONE;
case 1:
return PrecachedPort.p1;
case 2:
@@ -306,8 +302,6 @@
*/
public static OFPort ofShort(final short portNumber) {
switch (portNumber) {
- case 0:
- return NONE;
case 1:
return PrecachedPort.p1;
case 2:
@@ -546,4 +540,9 @@
public OFPort applyMask(OFPort mask) {
return OFPort.of(this.portNumber & mask.portNumber);
}
+
+ @Override
+ public int compareTo(OFPort o) {
+ return UnsignedInts.compare(this.portNumber, o.portNumber);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
index 5f41494..3d8d1cd 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFValueType.java
@@ -3,10 +3,8 @@
-public interface OFValueType<T extends OFValueType<T>> {
-
+public interface OFValueType<T extends OFValueType<T>> extends Comparable<T> {
public int getLength();
-
- public T applyMask(T mask);
+ public T applyMask(T mask);
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TableId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TableId.java
new file mode 100644
index 0000000..ebb1966
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TableId.java
@@ -0,0 +1,92 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.primitives.Shorts;
+
+public class TableId implements OFValueType<TableId>, Comparable<TableId> {
+
+ final static int LENGTH = 1;
+
+ private static final short VALIDATION_MASK = 0x00FF;
+
+ private static final short ALL_VAL = 0x00FF;
+ private static final short NONE_VAL = 0x0000;
+ public static final TableId NONE = new TableId(NONE_VAL);
+ public static final TableId ALL = new TableId(ALL_VAL);
+
+ private final short id;
+
+ private TableId(short id) {
+ this.id = id;
+ }
+
+ public static TableId of(short id) {
+ switch(id) {
+ case NONE_VAL:
+ return NONE;
+ case ALL_VAL:
+ return ALL;
+ default:
+ if ((id & VALIDATION_MASK) != id)
+ throw new IllegalArgumentException("Illegal Table id value: " + id);
+ return new TableId(id);
+ }
+ }
+
+ public static TableId of(int id) {
+ if((id & VALIDATION_MASK) != id)
+ throw new IllegalArgumentException("Illegal Table id value: "+id);
+ return of((short) id);
+ }
+
+ @Override
+ public String toString() {
+ return "0x" + Integer.toHexString(id);
+ }
+
+ public short getValue() {
+ return id;
+ }
+
+ @Override
+ public int getLength() {
+ return LENGTH;
+ }
+
+ public void writeByte(ChannelBuffer c) {
+ c.writeByte(this.id);
+ }
+
+ public static TableId readByte(ChannelBuffer c) throws OFParseError {
+ return TableId.of(c.readUnsignedByte());
+ }
+
+ @Override
+ public TableId applyMask(TableId mask) {
+ return TableId.of((short)(this.id & mask.id));
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof TableId))
+ return false;
+ TableId other = (TableId)obj;
+ if (other.id != this.id)
+ return false;
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int prime = 13873;
+ return this.id * prime;
+ }
+
+ @Override
+ public int compareTo(TableId other) {
+ return Shorts.compare(this.id, other.id);
+ }
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
index 6efd813..540ad1a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/TransportPort.java
@@ -3,6 +3,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.Ints;
+
/**
* Represents L4 (Transport Layer) port (TCP, UDP, etc.)
*
@@ -80,4 +82,9 @@
return TransportPort.of(this.port & mask.port);
}
+ @Override
+ public int compareTo(TransportPort o) {
+ return Ints.compare(port, o.port);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
index 43bec7a..c52a74a 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U16.java
@@ -60,7 +60,7 @@
@Override
public String toString() {
- return "" + f(raw);
+ return Integer.toString(f(raw));
}
@Override
@@ -110,4 +110,9 @@
public U16 applyMask(U16 mask) {
return ofRaw( (short) (raw & mask.raw));
}
+
+ @Override
+ public int compareTo(U16 o) {
+ return Integer.compare(f(raw), f(o.raw));
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java
index f56a528..daf5fa6 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U32.java
@@ -22,6 +22,8 @@
import org.projectfloodlight.openflow.protocol.OFMessageReader;
import org.projectfloodlight.openflow.protocol.Writeable;
+import com.google.common.primitives.UnsignedInts;
+
public class U32 implements Writeable, OFValueType<U32> {
private final static int ZERO_VAL = 0;
public final static U32 ZERO = new U32(ZERO_VAL);
@@ -110,4 +112,9 @@
return ofRaw(raw & mask.raw);
}
+ @Override
+ public int compareTo(U32 o) {
+ return UnsignedInts.compare(raw, o.raw);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java
index 3b89e24..8cd577f 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U64.java
@@ -22,6 +22,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.protocol.Writeable;
+import com.google.common.primitives.UnsignedLongs;
+
public class U64 implements Writeable, OFValueType<U64> {
private static final long UNSIGNED_MASK = 0x7fffffffffffffffL;
private final static long ZERO_VAL = 0;
@@ -113,4 +115,9 @@
bb.writeLong(raw);
}
+ @Override
+ public int compareTo(U64 o) {
+ return UnsignedLongs.compare(raw, o.raw);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java
index f85bfae..b85627e 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/U8.java
@@ -22,6 +22,8 @@
import org.projectfloodlight.openflow.protocol.OFMessageReader;
import org.projectfloodlight.openflow.protocol.Writeable;
+import com.google.common.primitives.UnsignedBytes;
+
public class U8 implements Writeable, OFValueType<U8> {
private final static byte ZERO_VAL = 0;
public final static U8 ZERO = new U8(ZERO_VAL);
@@ -112,4 +114,9 @@
return ofRaw( (byte) (raw & mask.raw));
}
+ @Override
+ public int compareTo(U8 o) {
+ return UnsignedBytes.compare(raw, o.raw);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
index cda5699..10e2ebc 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
@@ -1,8 +1,11 @@
package org.projectfloodlight.openflow.types;
-import org.jboss.netty.buffer.ChannelBuffer;
import javax.annotation.concurrent.Immutable;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+import com.google.common.primitives.UnsignedInts;
+
@Immutable
public class VRF implements OFValueType<VRF> {
static final int LENGTH = 4;
@@ -67,4 +70,9 @@
public VRF applyMask(VRF mask) {
return VRF.of(this.rawValue & mask.rawValue);
}
+
+ @Override
+ public int compareTo(VRF o) {
+ return UnsignedInts.compare(rawValue, o.rawValue);
+ }
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
index 7d15fb7..dcc7d60 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanPcp.java
@@ -3,6 +3,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.UnsignedBytes;
+
public class VlanPcp implements OFValueType<VlanPcp> {
private static final byte VALIDATION_MASK = 0x07;
@@ -68,4 +70,9 @@
return VlanPcp.of((byte)(this.pcp & mask.pcp));
}
+ @Override
+ public int compareTo(VlanPcp o) {
+ return UnsignedBytes.compare(pcp, o.pcp);
+ }
+
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
index 5c23779..d6f65d5 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VlanVid.java
@@ -3,6 +3,8 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
+import com.google.common.primitives.Shorts;
+
public class VlanVid implements OFValueType<VlanVid> {
private static final short VALIDATION_MASK = 0x0FFF;
@@ -86,4 +88,9 @@
return VlanVid.of((short)(this.vid & mask.vid));
}
+ @Override
+ public int compareTo(VlanVid o) {
+ return Shorts.compare(vid, o.vid);
+ }
+
}
diff --git a/java_gen/templates/custom/OFMatchV1Ver10.Builder.java b/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
index 769a687..38cc127 100644
--- a/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
+++ b/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
@@ -425,7 +425,7 @@
wildcards |= OFPFW_TP_SRC;
break;
case IN_PORT:
- setInPort(OFPort.NONE);
+ setInPort(OFPort.of(0)); // NOTE: not 'NONE' -- that is 0xFF for ports
wildcards |= OFPFW_IN_PORT;
break;
case IPV4_DST:
diff --git a/java_gen/templates/of_factory_class.java b/java_gen/templates/of_factory_class.java
index 86b092a..5263226 100644
--- a/java_gen/templates/of_factory_class.java
+++ b/java_gen/templates/of_factory_class.java
@@ -40,7 +40,10 @@
public class ${factory.name} implements ${factory.interface.name} {
public final static ${factory.name} INSTANCE = new ${factory.name}();
- private ${factory.name}() {}
+
+ //:: if factory.interface.xid_generator:
+ private final XidGenerator xidGenerator = XidGenerators.global();
+ //:: #endif
//:: for name, clazz in factory.interface.sub_factories.items():
public ${clazz} ${name}() {
@@ -59,7 +62,7 @@
//:: if len(i.writeable_members) > 0:
public ${i.name}.Builder ${factory.interface.method_name(i, builder=True)}() {
//:: if i.has_version(factory.version) and model.generate_class(i.versioned_class(factory.version)):
- return new ${i.versioned_class(factory.version).name}.Builder();
+ return new ${i.versioned_class(factory.version).name}.Builder()${".setXid(nextXid())" if i.member_by_name("xid") else ""};
//:: else:
throw new UnsupportedOperationException("${i.name} not supported in version ${factory.version}");
//:: #endif
@@ -72,12 +75,12 @@
//:: general_get_match_func_written = True
//:: #endif
//:: if len(i.writeable_members) <= 2:
- public ${i.name} ${factory.interface.method_name(i, builder=False)}(${", ".join("%s %s" % (p.java_type.public_type, p.name) for p in i.writeable_members)}) {
+ public ${i.name} ${factory.interface.method_name(i, builder=False)}(${", ".join("%s %s" % (p.java_type.public_type, p.name) for p in i.writeable_members if p.name != "xid" )}) {
//:: if i.has_version(factory.version) and model.generate_class(i.versioned_class(factory.version)):
//:: if len(i.writeable_members) > 0:
return new ${i.versioned_class(factory.version).name}(
${",\n ".join(
- [ prop.name for prop in i.versioned_class(factory.version).data_members])}
+ [ prop.name if prop.name != "xid" else "nextXid()" for prop in i.versioned_class(factory.version).data_members])}
);
//:: else:
return ${i.versioned_class(factory.version).name}.INSTANCE;
@@ -155,5 +158,10 @@
}
}
//:: #endif
+//:: if factory.interface.xid_generator:
+ public long nextXid() {
+ return xidGenerator.nextXid();
+ }
+//:: #endif
}
diff --git a/java_gen/templates/of_factory_interface.java b/java_gen/templates/of_factory_interface.java
index 634362d..48ea34a 100644
--- a/java_gen/templates/of_factory_interface.java
+++ b/java_gen/templates/of_factory_interface.java
@@ -36,7 +36,7 @@
//:: include("_imports.java")
-public interface ${factory.name} {
+public interface ${factory.name}${" extends XidGenerator" if factory.xid_generator else ""} {
// Subfactories
//:: for name, clazz in factory.sub_factories.items():
${clazz} ${name}();
@@ -50,7 +50,7 @@
${i.name}.Builder ${factory.method_name(i, builder=True)}()${ "" if i.is_universal else " throws UnsupportedOperationException"};
//:: #endif
//:: if len(i.writeable_members) <= 2:
- ${i.name} ${factory.method_name(i, builder=False )}(${", ".join("%s %s" % (p.java_type.public_type, p.name) for p in i.writeable_members)});
+ ${i.name} ${factory.method_name(i, builder=False )}(${", ".join("%s %s" % (p.java_type.public_type, p.name) for p in i.writeable_members if p.name != "xid" )});
//:: #endif
//:: #endfor
//:: if factory.name == 'OFFactory':
diff --git a/java_gen/templates/of_interface.java b/java_gen/templates/of_interface.java
index 8c9bf25..98d7b9e 100644
--- a/java_gen/templates/of_interface.java
+++ b/java_gen/templates/of_interface.java
@@ -50,7 +50,7 @@
//:: for prop in msg.members:
${prop.java_type.public_type} ${prop.getter_name}()${ "" if prop.is_universal else " throws UnsupportedOperationException"};
//:: if prop.is_writeable:
- Builder ${prop.setter_name}(${prop.java_type.public_type} ${prop.name})${ "" if prop.is_universal else " throws UnsupportedOperationException"};
+ Builder${msg.type_variable} ${prop.setter_name}(${prop.java_type.public_type} ${prop.name})${ "" if prop.is_universal else " throws UnsupportedOperationException"};
//:: #endif
//:: #endfor
}
diff --git a/test_data/of10/flow_add.data b/test_data/of10/flow_add.data
index 127e1fc..60fd780 100644
--- a/test_data/of10/flow_add.data
+++ b/test_data/of10/flow_add.data
@@ -148,6 +148,7 @@
.setIdleTimeout(5)
.setFlags(Sets.immutableEnumSet(OFFlowModFlags.CHECK_OVERLAP))
.setBufferId(OFBufferId.of(0))
+ .setOutPort(OFPort.of(0)) // doesn't make that much sense, but is in the example
.setActions(
ImmutableList.of(
factory.actions().output(OFPort.FLOOD, 0),
diff --git a/test_data/of10/flow_stats_entry.data b/test_data/of10/flow_stats_entry.data
index 3422064..b9a8dc1 100644
--- a/test_data/of10/flow_stats_entry.data
+++ b/test_data/of10/flow_stats_entry.data
@@ -110,7 +110,7 @@
of_flow_stats_entry_table_id_set(obj, 3);
-- java
builder
- .setTableId((short) 3)
+ .setTableId(TableId.of(3))
.setMatch(
factory.buildMatch()
.setExact(MatchField.IN_PORT, OFPort.of(3))
diff --git a/test_data/of13/flow_add.data b/test_data/of13/flow_add.data
index f86f4ae..854c908 100644
--- a/test_data/of13/flow_add.data
+++ b/test_data/of13/flow_add.data
@@ -76,7 +76,7 @@
builder.setXid(0x12345678)
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
- .setTableId((byte) 3)
+ .setTableId(TableId.of(3))
.setIdleTimeout(5)
.setHardTimeout(10)
.setPriority(6000)
@@ -96,7 +96,7 @@
)
.setInstructions(
ImmutableList.<OFInstruction>of(
- factory.instructions().gotoTable((short)4),
- factory.instructions().gotoTable((short)7)
+ factory.instructions().gotoTable(TableId.of(4)),
+ factory.instructions().gotoTable(TableId.of(7))
)
);
diff --git a/test_data/of13/flow_delete.data b/test_data/of13/flow_delete.data
index 6dee43b..497103f 100644
--- a/test_data/of13/flow_delete.data
+++ b/test_data/of13/flow_delete.data
@@ -76,7 +76,7 @@
builder.setXid(0x12345678)
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
- .setTableId((byte) 3)
+ .setTableId(TableId.of(3))
.setIdleTimeout(5)
.setHardTimeout(10)
.setPriority(6000)
@@ -96,7 +96,7 @@
)
.setInstructions(
ImmutableList.<OFInstruction>of(
- factory.instructions().gotoTable((short)4),
- factory.instructions().gotoTable((short)7)
+ factory.instructions().gotoTable(TableId.of(4)),
+ factory.instructions().gotoTable(TableId.of(7))
)
);
diff --git a/test_data/of13/flow_delete_strict.data b/test_data/of13/flow_delete_strict.data
index 5da11a2..83d212c 100644
--- a/test_data/of13/flow_delete_strict.data
+++ b/test_data/of13/flow_delete_strict.data
@@ -76,7 +76,7 @@
builder.setXid(0x12345678)
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
- .setTableId((byte) 3)
+ .setTableId(TableId.of(3))
.setIdleTimeout(5)
.setHardTimeout(10)
.setPriority(6000)
@@ -96,7 +96,7 @@
)
.setInstructions(
ImmutableList.<OFInstruction>of(
- factory.instructions().gotoTable((short)4),
- factory.instructions().gotoTable((short)7)
+ factory.instructions().gotoTable(TableId.of(4)),
+ factory.instructions().gotoTable(TableId.of(7))
)
);
diff --git a/test_data/of13/flow_modify.data b/test_data/of13/flow_modify.data
index 7f7f7a6..9b8834d 100644
--- a/test_data/of13/flow_modify.data
+++ b/test_data/of13/flow_modify.data
@@ -76,7 +76,7 @@
builder.setXid(0x12345678)
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
- .setTableId((byte) 3)
+ .setTableId(TableId.of(3))
.setIdleTimeout(5)
.setHardTimeout(10)
.setPriority(6000)
@@ -96,7 +96,7 @@
)
.setInstructions(
ImmutableList.<OFInstruction>of(
- factory.instructions().gotoTable((short)4),
- factory.instructions().gotoTable((short)7)
+ factory.instructions().gotoTable(TableId.of(4)),
+ factory.instructions().gotoTable(TableId.of(7))
)
);
diff --git a/test_data/of13/flow_modify_strict.data b/test_data/of13/flow_modify_strict.data
index f288d5f..250adb9 100644
--- a/test_data/of13/flow_modify_strict.data
+++ b/test_data/of13/flow_modify_strict.data
@@ -76,7 +76,7 @@
builder.setXid(0x12345678)
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setCookieMask(U64.parseHex("FF00FF00FF00FF00"))
- .setTableId((byte) 3)
+ .setTableId(TableId.of(3))
.setIdleTimeout(5)
.setHardTimeout(10)
.setPriority(6000)
@@ -96,7 +96,7 @@
)
.setInstructions(
ImmutableList.<OFInstruction>of(
- factory.instructions().gotoTable((short)4),
- factory.instructions().gotoTable((short)7)
+ factory.instructions().gotoTable(TableId.of(4)),
+ factory.instructions().gotoTable(TableId.of(7))
)
);
diff --git a/test_data/of13/packet_in.data b/test_data/of13/packet_in.data
index b32bbee..ca7006f 100644
--- a/test_data/of13/packet_in.data
+++ b/test_data/of13/packet_in.data
@@ -36,7 +36,7 @@
.setBufferId(OFBufferId.of(100))
.setTotalLen(17000)
.setReason(OFPacketInReason.ACTION)
- .setTableId((byte) 20)
+ .setTableId(TableId.of(20))
.setCookie(U64.parseHex("FEDCBA9876543210"))
.setMatch(
factory.buildMatchV3()