Merge into master from pull request #65:
add more types in org.projectfloodlight.openflow.types (https://github.com/floodlight/loxigen/pull/65)
diff --git a/.gitignore b/.gitignore
index 9712e8f..c0b10be 100644
--- a/.gitignore
+++ b/.gitignore
@@ -11,3 +11,4 @@
.*.swo
*.cache
openflowj-loxi
+/bin
diff --git a/java_gen/pre-written/pom.xml b/java_gen/pre-written/pom.xml
index d50fce4..dbd04a5 100644
--- a/java_gen/pre-written/pom.xml
+++ b/java_gen/pre-written/pom.xml
@@ -35,6 +35,11 @@
<dependencies>
<dependency>
+ <groupId>com.google.code.findbugs</groupId>
+ <artifactId>annotations</artifactId>
+ <version>2.0.1</version>
+ </dependency>
+ <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.2</version>
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
new file mode 100644
index 0000000..713db9a
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/LagId.java
@@ -0,0 +1,61 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import javax.annotation.concurrent.Immutable;
+
+@Immutable
+public class LagId {
+ static final int LENGTH = 4;
+ private final int rawValue;
+
+ private LagId(final int rawValue) {
+ this.rawValue = rawValue;
+ }
+
+ public static LagId of(final int raw) {
+ return new LagId(raw);
+ }
+
+ public int getInt() {
+ return rawValue;
+ }
+
+ public int getLength() {
+ return LENGTH;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + rawValue;
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return Integer.toString(rawValue);
+ }
+
+ @Override
+ public boolean equals(final Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ LagId other = (LagId) obj;
+ if (rawValue != other.rawValue)
+ return false;
+ return true;
+ }
+
+ public void write4Bytes(ChannelBuffer c) {
+ c.writeInt(rawValue);
+ }
+
+ public static LagId read4Bytes(ChannelBuffer c) {
+ return LagId.of(c.readInt());
+ }
+}
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
new file mode 100644
index 0000000..1d0aea7
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/Metadata.java
@@ -0,0 +1,52 @@
+package org.projectfloodlight.openflow.types;
+
+import javax.annotation.concurrent.Immutable;
+
+@Immutable
+public class Metadata {
+ static final int LENGTH = 4;
+ private final int rawValue;
+
+ private Metadata(final int rawValue) {
+ this.rawValue = rawValue;
+ }
+
+ public static Metadata of(final int raw) {
+ return new Metadata(raw);
+ }
+
+ public int getInt() {
+ return rawValue;
+ }
+
+ public int getLength() {
+ return LENGTH;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ 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;
+ Metadata other = (Metadata) obj;
+ if (rawValue != other.rawValue)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return Integer.toString(rawValue);
+ }
+}
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
new file mode 100644
index 0000000..cda5699
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/types/VRF.java
@@ -0,0 +1,70 @@
+package org.projectfloodlight.openflow.types;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import javax.annotation.concurrent.Immutable;
+
+@Immutable
+public class VRF implements OFValueType<VRF> {
+ static final int LENGTH = 4;
+ private final int rawValue;
+
+ public static final VRF NO_MASK = VRF.of(0xFFFFFFFF);
+ public static final VRF FULL_MASK = VRF.of(0x00000000);
+
+ private VRF(final int rawValue) {
+ this.rawValue = rawValue;
+ }
+
+ public static VRF of(final int raw) {
+ return new VRF(raw);
+ }
+
+ public int getInt() {
+ return rawValue;
+ }
+
+ @Override
+ public int getLength() {
+ return LENGTH;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ 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;
+ VRF other = (VRF) obj;
+ if (rawValue != other.rawValue)
+ return false;
+ return true;
+ }
+
+ @Override
+ public String toString() {
+ return Integer.toString(rawValue);
+ }
+
+ public void write4Bytes(ChannelBuffer c) {
+ c.writeInt(rawValue);
+ }
+
+ public static VRF read4Bytes(ChannelBuffer c) {
+ return VRF.of(c.readInt());
+ }
+
+ @Override
+ public VRF applyMask(VRF mask) {
+ return VRF.of(this.rawValue & mask.rawValue);
+ }
+}