Merge into master from pull request #96:
locitest: add module magic string to makefile (https://github.com/floodlight/loxigen/pull/96)
diff --git a/java_gen/codegen.py b/java_gen/codegen.py
index 776b8c5..4369b30 100644
--- a/java_gen/codegen.py
+++ b/java_gen/codegen.py
@@ -44,6 +44,8 @@
import java_gen.java_model as java_model
def gen_all_java(out, name):
+ # close the virtual file - we don't need it
+ out.close()
basedir= '%s/openflowj' % of_g.options.install_dir
print "Outputting to %s" % basedir
if os.path.exists(basedir):
@@ -56,7 +58,6 @@
gen.create_of_const_enums()
gen.create_of_factories()
- out.close()
class JavaGenerator(object):
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 6de71ba..02db1a6 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -509,6 +509,7 @@
},
'of_bsn_set_l2_table_request': { 'l2_table_enable': boolean },
'of_bsn_set_l2_table_reply': { 'l2_table_enable': boolean },
+ 'of_bsn_set_pktin_suppression_request': { 'enabled': boolean },
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
index aa7191a..f58d658 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/DatapathId.java
@@ -2,13 +2,16 @@
import org.projectfloodlight.openflow.util.HexString;
+import com.google.common.primitives.Longs;
+import com.google.common.primitives.UnsignedLongs;
+
/**
* Abstraction of a datapath ID that can be set and/or accessed as either a
* long value or a colon-separated string.
- *
+ *
* @author Rob Vaterlaus <rob.vaterlaus@bigswitch.com>
*/
-public class DatapathId {
+public class DatapathId implements Comparable<DatapathId> {
public static final DatapathId NONE = new DatapathId(0);
@@ -26,6 +29,10 @@
return new DatapathId(HexString.toLong(s));
}
+ public static DatapathId of(byte[] bytes) {
+ return new DatapathId(Longs.fromByteArray(bytes));
+ }
+
public long getLong() {
return rawValue;
}
@@ -34,6 +41,10 @@
return U64.of(rawValue);
}
+ public byte[] getBytes() {
+ return Longs.toByteArray(rawValue);
+ }
+
@Override
public String toString() {
return HexString.toHexString(rawValue);
@@ -60,4 +71,9 @@
return false;
return true;
}
+
+ @Override
+ public int compareTo(DatapathId o) {
+ return UnsignedLongs.compare(rawValue, o.rawValue);
+ }
}
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/MacAddressTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/MacAddressTest.java
index ed380ee..3ccceb3 100644
--- a/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/MacAddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/openflow/types/MacAddressTest.java
@@ -84,7 +84,7 @@
for(String invalid : invalidMacStrings) {
try {
MacAddress.of(invalid);
- fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
+ fail("Invalid MAC address "+invalid+ " should have raised IllegalArgumentException");
} catch(IllegalArgumentException e) {
// ok
}
@@ -96,7 +96,7 @@
for(byte[] invalid : invalidMacBytes) {
try {
MacAddress.of(invalid);
- fail("Invalid IP "+invalid+ " should have raised IllegalArgumentException");
+ fail("Invalid MAC address bytes "+ Arrays.toString(invalid) + " should have raised IllegalArgumentException");
} catch(IllegalArgumentException e) {
// ok
}
diff --git a/java_gen/templates/of_factories.java b/java_gen/templates/of_factories.java
index 0a27c59..f8c9a80 100644
--- a/java_gen/templates/of_factories.java
+++ b/java_gen/templates/of_factories.java
@@ -37,7 +37,7 @@
public final class OFFactories {
- private final static GenericReader GENERIC_READER = new GenericReader();
+ private static final GenericReader GENERIC_READER = new GenericReader();
public static OFFactory getFactory(OFVersion version) {
switch(version) {