Merge into master from pull request #187:
OF Aux Id class (https://github.com/floodlight/loxigen/pull/187)
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 3d97267..e57000f 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -441,6 +441,10 @@
.op(read='TableId.readByte(bb)',
write='$name.writeByte(bb)',
default='TableId.ZERO')
+of_aux_id = JType("OFAuxId") \
+ .op(read='OFAuxId.readByte(bb)',
+ write='$name.writeByte(bb)',
+ default='OFAuxId.MAIN')
of_version = JType("OFVersion", 'byte') \
.op(read='bb.readByte()', write='bb.writeByte($name)')
@@ -638,6 +642,8 @@
'of_bsn_tlv_vlan_vid' : { 'value' : vlan_vid },
'of_bsn_gentable_entry_add' : { 'table_id' : gen_table_id },
+
+ 'of_features_reply' : { 'auxiliary_id' : of_aux_id},
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java
new file mode 100644
index 0000000..7b124f2
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/OFAuxId.java
@@ -0,0 +1,83 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+
+import com.google.common.hash.PrimitiveSink;
+import com.google.common.primitives.Shorts;
+
+public class OFAuxId implements Comparable<OFAuxId>, PrimitiveSinkable {
+
+ private static final short VALIDATION_MASK = 0xFF;
+
+ private static final short MAIN_VAL = 0x0000;
+
+ public static final OFAuxId MAIN = new OFAuxId(MAIN_VAL);
+
+ private final short id;
+
+ private OFAuxId(short id) {
+ this.id = id;
+ }
+
+ public static OFAuxId of(short id) {
+ switch(id) {
+ case MAIN_VAL:
+ return MAIN;
+ default:
+ if ((id & VALIDATION_MASK) != id)
+ throw new IllegalArgumentException("Illegal Aux id value: " + id);
+ return new OFAuxId(id);
+ }
+ }
+
+ public static OFAuxId of(int id) {
+ if((id & VALIDATION_MASK) != id)
+ throw new IllegalArgumentException("Illegal Aux id value: "+id);
+ return of((short) id);
+ }
+
+ @Override
+ public String toString() {
+ return "0x" + Integer.toHexString(id);
+ }
+
+ public short getValue() {
+ return id;
+ }
+
+ public void writeByte(ChannelBuffer c) {
+ c.writeByte(this.id);
+ }
+
+ public static OFAuxId readByte(ChannelBuffer c) throws OFParseError {
+ return OFAuxId.of(c.readUnsignedByte());
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof TableId))
+ return false;
+ OFAuxId other = (OFAuxId)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(OFAuxId other) {
+ return Shorts.compare(this.id, other.id);
+ }
+
+ @Override
+ public void putTo(PrimitiveSink sink) {
+ sink.putByte((byte) id);
+ }
+
+}