Merge into master from pull request #51:
openflow_input: add discriminators to experimenter superclasses (https://github.com/floodlight/loxigen/pull/51)
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java
index cdb34e5..3fc5527 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/Match.java
@@ -142,7 +142,21 @@
*
* @author Yotam Harchol (yotam.harchol@bigswitch.com)
*/
- interface Builder extends Match {
+ interface Builder {
+ public <F extends OFValueType<F>> F get(MatchField<F> field) throws UnsupportedOperationException;
+
+ public <F extends OFValueType<F>> Masked<F> getMasked(MatchField<F> field) throws UnsupportedOperationException;
+
+ public boolean supports(MatchField<?> field);
+
+ public boolean supportsMasked(MatchField<?> field) throws UnsupportedOperationException;
+
+ public boolean isExact(MatchField<?> field) throws UnsupportedOperationException;
+
+ public boolean isFullyWildcarded(MatchField<?> field) throws UnsupportedOperationException;
+
+ public boolean isPartiallyMasked(MatchField<?> field) throws UnsupportedOperationException;
+
/**
* Sets a specific exact value for a field.
*
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java b/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java
index a5ac1be..8125b04 100644
--- a/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java
+++ b/java_gen/pre-written/src/test/java/org/openflow/types/IPv4Test.java
@@ -7,7 +7,6 @@
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.openflow.exceptions.OFParseError;
-import org.openflow.exceptions.OFShortRead;
public class IPv4Test {
byte[][] testAddresses = new byte[][] {
@@ -42,21 +41,21 @@
"1.x.3.4",
"1.2x.3.4"
};
-
+
String[] ipsWithMask = {
"1.2.3.4/24",
"192.168.130.140/255.255.192.0",
"127.0.0.1/8",
"8.8.8.8",
};
-
+
boolean[] hasMask = {
true,
true,
true,
false
};
-
+
byte[][][] ipsWithMaskValues = {
new byte[][] { new byte[] { (byte)0x01, (byte)0x02, (byte)0x03, (byte)0x04 }, new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xFF, (byte)0x00 } },
new byte[][] { new byte[] { (byte)0xC0, (byte)0xA8, (byte)0x82, (byte)0x8C }, new byte[] { (byte)0xFF, (byte)0xFF, (byte)0xC0, (byte)0x00 } },
@@ -86,7 +85,7 @@
}
@Test
- public void testReadFrom() throws OFParseError, OFShortRead {
+ public void testReadFrom() throws OFParseError {
for(int i=0; i < testAddresses.length; i++ ) {
IPv4 ip = IPv4.read4Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
assertEquals(testInts[i], ip.getInt());
@@ -97,7 +96,7 @@
@Test
- public void testInvalidIPs() throws OFParseError, OFShortRead {
+ public void testInvalidIPs() throws OFParseError {
for(String invalid : invalidIPs) {
try {
IPv4.of(invalid);
@@ -107,9 +106,9 @@
}
}
}
-
+
@Test
- public void testOfMasked() throws OFParseError, OFShortRead {
+ public void testOfMasked() throws OFParseError {
for (int i = 0; i < ipsWithMask.length; i++) {
IPv4WithMask value = IPv4WithMask.of(ipsWithMask[i]);
if (!hasMask[i]) {
@@ -122,7 +121,7 @@
for (int j = 0; j < ipBytes.length; j++) {
ipBytes[j] &= ipsWithMaskValues[i][1][j];
}
-
+
assertArrayEquals(ipBytes, value.getValue().getBytes());
assertArrayEquals(ipsWithMaskValues[i][1], value.getMask().getBytes());
}
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java b/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java
index 71ab28e..352b8bc 100644
--- a/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java
+++ b/java_gen/pre-written/src/test/java/org/openflow/types/IPv6Test.java
@@ -11,7 +11,6 @@
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.openflow.exceptions.OFParseError;
-import org.openflow.exceptions.OFShortRead;
public class IPv6Test {
@@ -21,33 +20,33 @@
"ffe0::",
"1:2:3:4:5:6:7:8"
};
-
+
String[] ipsWithMask = {
"1::1/80",
"1:2:3:4::/ffff:ffff:ffff:ff00::",
"ffff:ffee:1::/ff00:ff00:ff00:ff00::",
"8:8:8:8:8:8:8:8",
};
-
+
byte[][] masks = {
- new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00,
+ new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
- (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ new byte[] { (byte)0xff, (byte)0xff, (byte)0xff, (byte)0xff,
+ (byte)0xff, (byte)0xff, (byte)0xff, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
- (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ new byte[] { (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
+ (byte)0xff, (byte)0x00, (byte)0xff, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 },
- new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
- (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ new byte[] { (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
+ (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00,
(byte)0x00, (byte)0x00, (byte)0x00, (byte)0x00 }
};
-
+
boolean[] hasMask = {
true,
true,
@@ -70,11 +69,11 @@
byte[] address = inetAddress.getAddress();
assertEquals(address.length, value.getValue().getBytes().length);
-
+
for (int j = 0; j < address.length; j++) {
address[j] &= masks[i][j];
}
-
+
assertArrayEquals(value.getValue().getBytes(), address);
assertArrayEquals(masks[i], value.getMask().getBytes());
}
@@ -104,7 +103,7 @@
}
@Test
- public void testReadFrom() throws OFParseError, OFShortRead, UnknownHostException {
+ public void testReadFrom() throws OFParseError, UnknownHostException {
for(int i=0; i < testStrings.length; i++ ) {
byte[] bytes = Inet6Address.getByName(testStrings[i]).getAddress();
IPv6 ip = IPv6.read16Bytes(ChannelBuffers.copiedBuffer(bytes));
@@ -126,7 +125,7 @@
};
@Test
- public void testInvalidIPs() throws OFParseError, OFShortRead {
+ public void testInvalidIPs() throws OFParseError {
for(String invalid : invalidIPs) {
try {
IPv6.of(invalid);
@@ -138,7 +137,7 @@
}
@Test
- public void testZeroCompression() throws OFParseError, OFShortRead {
+ public void testZeroCompression() throws OFParseError {
assertEquals("::", IPv6.of("::").toString(true, false));
assertEquals("0:0:0:0:0:0:0:0", IPv6.of("::").toString(false, false));
assertEquals("0000:0000:0000:0000:0000:0000:0000:0000", IPv6.of("::").toString(false, true));
diff --git a/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java b/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java
index 78728e1..2be3046 100644
--- a/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java
+++ b/java_gen/pre-written/src/test/java/org/openflow/types/MacAddressTest.java
@@ -9,7 +9,6 @@
import org.jboss.netty.buffer.ChannelBuffers;
import org.junit.Test;
import org.openflow.exceptions.OFParseError;
-import org.openflow.exceptions.OFShortRead;
public class MacAddressTest {
byte[][] testAddresses = new byte[][] {
@@ -62,7 +61,7 @@
}
@Test
- public void testReadFrom() throws OFParseError, OFShortRead {
+ public void testReadFrom() throws OFParseError {
for(int i=0; i < testAddresses.length; i++ ) {
MacAddress ip = MacAddress.read6Bytes(ChannelBuffers.copiedBuffer(testAddresses[i]));
assertEquals(testInts[i], ip.getLong());
@@ -73,7 +72,7 @@
@Test
- public void testInvalidMacss() throws OFParseError, OFShortRead {
+ public void testInvalidMacss() throws OFParseError {
for(String invalid : invalidMacs) {
try {
MacAddress.of(invalid);
diff --git a/java_gen/templates/custom/OFMatchV1Ver10.Builder.java b/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
index ba739bc..6570df8 100644
--- a/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
+++ b/java_gen/templates/custom/OFMatchV1Ver10.Builder.java
@@ -69,13 +69,3 @@
// FIXME yotam - please replace with real implementation
return null;
}
-
- @Override
- public Builder createBuilder() {
- return this;
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- // FIXME yotam - please replace with real implementation
- }
diff --git a/java_gen/templates/custom/OFMatchV2Ver11.Builder.java b/java_gen/templates/custom/OFMatchV2Ver11.Builder.java
index ba739bc..6570df8 100644
--- a/java_gen/templates/custom/OFMatchV2Ver11.Builder.java
+++ b/java_gen/templates/custom/OFMatchV2Ver11.Builder.java
@@ -69,13 +69,3 @@
// FIXME yotam - please replace with real implementation
return null;
}
-
- @Override
- public Builder createBuilder() {
- return this;
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- // FIXME yotam - please replace with real implementation
- }
diff --git a/java_gen/templates/custom/OFMatchV3Ver12.Builder.java b/java_gen/templates/custom/OFMatchV3Ver12.Builder.java
index b5fa630..3fae367 100644
--- a/java_gen/templates/custom/OFMatchV3Ver12.Builder.java
+++ b/java_gen/templates/custom/OFMatchV3Ver12.Builder.java
@@ -104,14 +104,3 @@
updateOxmList();
return this;
}
-
- @Override
- public Builder createBuilder() {
- return this;
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- // TODO: What should this write?
- throw new UnsupportedOperationException("Builder cannot be written");
- }
\ No newline at end of file
diff --git a/java_gen/templates/custom/OFMatchV3Ver13.Builder.java b/java_gen/templates/custom/OFMatchV3Ver13.Builder.java
index b5fa630..48f8b70 100644
--- a/java_gen/templates/custom/OFMatchV3Ver13.Builder.java
+++ b/java_gen/templates/custom/OFMatchV3Ver13.Builder.java
@@ -105,13 +105,3 @@
return this;
}
- @Override
- public Builder createBuilder() {
- return this;
- }
-
- @Override
- public void writeTo(ChannelBuffer bb) {
- // TODO: What should this write?
- throw new UnsupportedOperationException("Builder cannot be written");
- }
\ No newline at end of file
diff --git a/openflow_input/standard-1.3 b/openflow_input/standard-1.3
index 3e85338..119e7a4 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -1177,7 +1177,8 @@
uint16_t priority;
uint16_t idle_timeout;
uint16_t hard_timeout;
- pad(6);
+ uint16_t flags;
+ pad(4);
uint64_t cookie;
uint64_t packet_count;
uint64_t byte_count;