Add isEnabled to interface and add tests
diff --git a/java_gen/pre-written/src/test/java/org/projectfloodlight/protocol/OFPortDescTest.java b/java_gen/pre-written/src/test/java/org/projectfloodlight/protocol/OFPortDescTest.java
new file mode 100644
index 0000000..803b9bd
--- /dev/null
+++ b/java_gen/pre-written/src/test/java/org/projectfloodlight/protocol/OFPortDescTest.java
@@ -0,0 +1,42 @@
+package org.projectfloodlight.protocol;
+
+import java.util.Arrays;
+import java.util.HashSet;
+
+import org.junit.Test;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFPortConfig;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+import org.projectfloodlight.openflow.protocol.OFPortState;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+
+import static org.hamcrest.Matchers.is;
+
+import static org.junit.Assert.assertThat;
+
+public class OFPortDescTest {
+
+ OFFactory factory = OFFactories.getFactory(OFVersion.OF_13);
+
+ @Test
+ public void testIsEnabled() {
+ // Default
+ OFPortDesc desc = factory.buildPortDesc()
+ .build();
+ assertThat(desc.isEnabled(), is(true));
+
+ // Partially disabled
+ desc = factory.buildPortDesc()
+ .setConfig(new HashSet<OFPortConfig>(Arrays.asList(OFPortConfig.PORT_DOWN)))
+ .build();
+ assertThat(desc.isEnabled(), is(false));
+
+ // Fully disabled
+ desc = factory.buildPortDesc()
+ .setConfig(new HashSet<OFPortConfig>(Arrays.asList(OFPortConfig.PORT_DOWN)))
+ .setState(new HashSet<OFPortState>(Arrays.asList(OFPortState.LINK_DOWN)))
+ .build();
+ assertThat(desc.isEnabled(), is(false));
+ }
+}
diff --git a/java_gen/templates/custom/interface/OFPortDesc.java b/java_gen/templates/custom/interface/OFPortDesc.java
new file mode 100644
index 0000000..ecf39f3
--- /dev/null
+++ b/java_gen/templates/custom/interface/OFPortDesc.java
@@ -0,0 +1,2 @@
+ // Additional method
+ boolean isEnabled();
\ No newline at end of file