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 ee9886a..e57000f 100644
--- a/java_gen/java_type.py
+++ b/java_gen/java_type.py
@@ -419,6 +419,9 @@
meter_features = JType("OFMeterFeatures")\
.op(read="OFMeterFeaturesVer$version.READER.readFrom(bb)",
write="$name.writeTo(bb)")
+bsn_vport_q_in_q = JType("OFBsnVportQInQ")\
+ .op(read="OFBsnVportQInQVer$version.READER.readFrom(bb)",
+ write="$name.writeTo(bb)")
flow_wildcards = JType("int") \
.op(read='bb.readInt()',
write='bb.writeInt($name)',
@@ -472,6 +475,8 @@
funnel='ChannelUtilsVer10.putSupportedActionsTo($name, sink)')
of_group = JType("OFGroup") \
.op(version=ANY, read="OFGroup.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFGroup.ALL")
+of_group_default_any = JType("OFGroup") \
+ .op(version=ANY, read="OFGroup.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFGroup.ANY")
# the outgroup field of of_flow_stats_request has a special default value
of_group_default_any = JType("OFGroup") \
.op(version=ANY, read="OFGroup.read4Bytes(bb)", write="$name.write4Bytes(bb)", default="OFGroup.ANY")
@@ -528,6 +533,7 @@
'of_meter_features_t': meter_features,
'of_bitmap_128_t': port_bitmap,
'of_checksum_128_t': checksum,
+ 'of_bsn_vport_q_in_q_t': bsn_vport_q_in_q,
}
## Map that defines exceptions from the standard loxi->java mapping scheme
@@ -682,8 +688,10 @@
.op(read='bb.readShort()', write='bb.writeShort($name)')
elif field_name == "type" and re.match(r'of_instruction.*', obj_name):
return instruction_type
- elif obj_name in ("of_flow_add", "of_flow_modify", "of_flow_modify_strict", "of_delete_strict") and field_name == "table_id" and c_type == "uint8_t":
+ elif loxi_utils.class_is(obj_name, "of_flow_mod") and field_name == "table_id" and c_type == "uint8_t":
return table_id_default_zero
+ elif loxi_utils.class_is(obj_name, "of_flow_mod") and field_name == "out_group" and c_type == "uint32_t":
+ return of_group_default_any
elif field_name == "table_id" and c_type == "uint8_t":
return table_id
elif field_name == "version" and c_type == "uint8_t":
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
index ed7c0c8..b4937ba 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver10/ChannelUtilsVer10.java
@@ -6,7 +6,6 @@
import org.jboss.netty.buffer.ChannelBuffer;
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.protocol.OFActionType;
-import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
import org.projectfloodlight.openflow.protocol.match.Match;
import com.google.common.hash.PrimitiveSink;
@@ -22,17 +21,6 @@
return OFMatchV1Ver10.READER.readFrom(bb);
}
- // TODO these need to be figured out / removed
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
-
- }
-
public static Set<OFActionType> readSupportedActions(ChannelBuffer bb) {
int actions = bb.readInt();
EnumSet<OFActionType> supportedActions = EnumSet.noneOf(OFActionType.class);
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
index 735fe3b..b090e47 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver11/ChannelUtilsVer11.java
@@ -4,8 +4,6 @@
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.protocol.OFMatchBmap;
import org.projectfloodlight.openflow.protocol.match.Match;
-import org.projectfloodlight.openflow.protocol.ver11.OFMatchV2Ver11;
-import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
/**
* Collection of helper functions for reading and writing into ChannelBuffers
@@ -18,17 +16,6 @@
return OFMatchV2Ver11.READER.readFrom(bb);
}
- // TODO these need to be figured out / removed
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
- }
-
-
public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
throw new UnsupportedOperationException("not implemented");
}
diff --git a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
index 0be26ae..8216bb0 100644
--- a/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
+++ b/java_gen/pre-written/src/main/java/org/projectfloodlight/openflow/protocol/ver13/ChannelUtilsVer13.java
@@ -4,8 +4,6 @@
import org.projectfloodlight.openflow.exceptions.OFParseError;
import org.projectfloodlight.openflow.protocol.OFMatchBmap;
import org.projectfloodlight.openflow.protocol.match.Match;
-import org.projectfloodlight.openflow.protocol.ver13.OFMatchV3Ver13;
-import org.projectfloodlight.openflow.protocol.OFBsnVportQInQ;
/**
* Collection of helper functions for reading and writing into ChannelBuffers
@@ -18,17 +16,6 @@
return OFMatchV3Ver13.READER.readFrom(bb);
}
- // TODO these need to be figured out / removed
-
- public static OFBsnVportQInQ readOFBsnVportQInQ(ChannelBuffer bb) {
- throw new UnsupportedOperationException("not implemented");
- }
-
- public static void writeOFBsnVportQInQ(ChannelBuffer bb,
- OFBsnVportQInQ vport) {
- throw new UnsupportedOperationException("not implemented");
- }
-
public static OFMatchBmap readOFMatchBmap(ChannelBuffer bb) {
throw new UnsupportedOperationException("not implemented");
}
diff --git a/java_gen/templates/custom/OFMatchV1Ver10.java b/java_gen/templates/custom/OFMatchV1Ver10.java
index 93c2ad0..8a24b2f 100644
--- a/java_gen/templates/custom/OFMatchV1Ver10.java
+++ b/java_gen/templates/custom/OFMatchV1Ver10.java
@@ -331,7 +331,7 @@
int dstCidrLen = getIpv4DstCidrMaskLen();
return dstCidrLen > 0 && dstCidrLen < 32;
default:
- throw new UnsupportedOperationException("OFMatch does not support masked matching on field " + field.getName());
+ return false;
}
}
diff --git a/java_gen/templates/custom/OFMatchV1Ver10_toString.java b/java_gen/templates/custom/OFMatchV1Ver10_toString.java
new file mode 100644
index 0000000..3b2783b
--- /dev/null
+++ b/java_gen/templates/custom/OFMatchV1Ver10_toString.java
@@ -0,0 +1 @@
+//:: include("custom/OFMatch_toString.java", msg=msg, has_parent=False)
diff --git a/java_gen/templates/custom/OFMatchV3Ver13_toString.java b/java_gen/templates/custom/OFMatchV3Ver13_toString.java
new file mode 100644
index 0000000..3b2783b
--- /dev/null
+++ b/java_gen/templates/custom/OFMatchV3Ver13_toString.java
@@ -0,0 +1 @@
+//:: include("custom/OFMatch_toString.java", msg=msg, has_parent=False)
diff --git a/java_gen/templates/custom/OFMatch_toString.java b/java_gen/templates/custom/OFMatch_toString.java
new file mode 100644
index 0000000..1eaf8a5
--- /dev/null
+++ b/java_gen/templates/custom/OFMatch_toString.java
@@ -0,0 +1,18 @@
+ @Override
+ public String toString() {
+ StringBuilder b = new StringBuilder("${msg.name}(");
+ boolean first = true;
+ for(MatchField<?> field : getMatchFields()) {
+ if(first)
+ first = false;
+ else
+ b.append(", ");
+ String name = field.getName();
+ b.append(name).append('=').append(this.get(field));
+ if(isPartiallyMasked(field)) {
+ b.append('/').append(this.getMasked(field).getMask());
+ }
+ }
+ b.append(")");
+ return b.toString();
+ }
diff --git a/java_gen/templates/of_class.java b/java_gen/templates/of_class.java
index b35df1c..f1d72b2 100644
--- a/java_gen/templates/of_class.java
+++ b/java_gen/templates/of_class.java
@@ -363,6 +363,9 @@
}
}
+ //:: if os.path.exists("%s/custom/%s_toString.java" % (template_dir, msg.name)):
+ //:: include("custom/%s_toString.java" % msg.name, msg=msg, has_parent=False)
+ //:: else:
@Override
public String toString() {
StringBuilder b = new StringBuilder("${msg.name}(");
@@ -375,7 +378,7 @@
b.append(")");
return b.toString();
}
-
+ //:: #endif
@Override
public boolean equals(Object obj) {
diff --git a/openflow_input/bsn_tlv b/openflow_input/bsn_tlv
index 5086217..ec91065 100644
--- a/openflow_input/bsn_tlv
+++ b/openflow_input/bsn_tlv
@@ -76,3 +76,39 @@
uint16_t type == 7;
uint16_t length;
};
+
+struct of_bsn_tlv_idle_timeout : of_bsn_tlv {
+ uint16_t type == 8;
+ uint16_t length;
+ uint32_t value; /* Milliseconds */
+};
+
+struct of_bsn_tlv_unicast_query_timeout : of_bsn_tlv {
+ uint16_t type == 9;
+ uint16_t length;
+ uint32_t value; /* Milliseconds */
+};
+
+struct of_bsn_tlv_broadcast_query_timeout : of_bsn_tlv {
+ uint16_t type == 10;
+ uint16_t length;
+ uint32_t value; /* Milliseconds */
+};
+
+struct of_bsn_tlv_request_packets : of_bsn_tlv {
+ uint16_t type == 11;
+ uint16_t length;
+ uint64_t value;
+};
+
+struct of_bsn_tlv_reply_packets : of_bsn_tlv {
+ uint16_t type == 12;
+ uint16_t length;
+ uint64_t value;
+};
+
+struct of_bsn_tlv_miss_packets : of_bsn_tlv {
+ uint16_t type == 13;
+ uint16_t length;
+ uint64_t value;
+};
diff --git a/openflow_input/standard-1.3 b/openflow_input/standard-1.3
index f697c42..bb85231 100644
--- a/openflow_input/standard-1.3
+++ b/openflow_input/standard-1.3
@@ -290,6 +290,7 @@
OFPR_BSN_DEST_HOST_UNREACHABLE = 135,
OFPR_BSN_DEST_PORT_UNREACHABLE = 136,
OFPR_BSN_FRAGMENTATION_REQUIRED = 137,
+ OFPR_BSN_ARP = 139,
};
enum ofp_flow_removed_reason(wire_type=uint8_t) {
diff --git a/py_gen/oftype.py b/py_gen/oftype.py
index 7e28a0c..3b56308 100644
--- a/py_gen/oftype.py
+++ b/py_gen/oftype.py
@@ -150,12 +150,6 @@
pack='%s.pack()',
unpack='%s.unpack(%%s)' % pyclass)
-# Special case for lists of hello_elem, which must ignore unknown types
-type_data_map['list(of_hello_elem_t)'] = OFTypeData(
- init='[]',
- pack='loxi.generic_util.pack_list(%s)',
- unpack='util.unpack_list_hello_elem(%s)')
-
## Public interface
def lookup_type_data(oftype, version):
diff --git a/py_gen/templates/_ofclass.py b/py_gen/templates/_ofclass.py
index f902ae8..dfcd1fc 100644
--- a/py_gen/templates/_ofclass.py
+++ b/py_gen/templates/_ofclass.py
@@ -1,9 +1,19 @@
:: superclass_pyname = ofclass.superclass.pyname if ofclass.superclass else "loxi.OFObject"
:: from loxi_ir import *
:: import py_gen.oftype
+:: import py_gen.util as util
:: type_members = [m for m in ofclass.members if type(m) == OFTypeMember]
-:: normal_members = [m for m in ofclass.members if type(m) == OFDataMember]
+:: normal_members = [m for m in ofclass.members if type(m) == OFDataMember or
+:: type(m) == OFDiscriminatorMember]
+:: if ofclass.virtual:
+:: discriminator_fmts = { 1: "B", 2: "!H", 4: "!L" }
+:: discriminator_fmt = discriminator_fmts[ofclass.discriminator.length]
+:: #endif
class ${ofclass.pyname}(${superclass_pyname}):
+:: if ofclass.virtual:
+ subtypes = {}
+
+:: #endif
:: for m in type_members:
${m.name} = ${m.value}
:: #endfor
@@ -29,6 +39,13 @@
@staticmethod
def unpack(reader):
+:: if ofclass.virtual:
+ subtype, = reader.peek(${repr(discriminator_fmt)}, ${ofclass.discriminator.offset})
+ subclass = ${ofclass.pyname}.subtypes.get(subtype)
+ if subclass:
+ return subclass.unpack(reader)
+
+:: #endif
obj = ${ofclass.pyname}()
:: include("_unpack.py", ofclass=ofclass)
return obj
diff --git a/py_gen/templates/_unpack.py b/py_gen/templates/_unpack.py
index 81f74c7..cce9de3 100644
--- a/py_gen/templates/_unpack.py
+++ b/py_gen/templates/_unpack.py
@@ -42,7 +42,7 @@
:: elif type(m) == OFTypeMember:
_${m.name} = ${gen_unpack_expr(m.oftype, 'reader', version=version)}
assert(_${m.name} == ${m.value})
-:: elif type(m) == OFDataMember:
+:: elif type(m) == OFDataMember or type(m) == OFDiscriminatorMember:
:: if m.name in field_length_members:
:: reader_expr = 'reader.slice(_%s)' % field_length_members[m.name].name
:: else:
diff --git a/py_gen/templates/_virtual_ofclass.py b/py_gen/templates/_virtual_ofclass.py
deleted file mode 100644
index 1e5dcc2..0000000
--- a/py_gen/templates/_virtual_ofclass.py
+++ /dev/null
@@ -1,23 +0,0 @@
-:: import py_gen.util as util
-:: superclass_pyname = ofclass.superclass.pyname if ofclass.superclass else "loxi.OFObject"
-:: fmts = { 1: "B", 2: "!H", 4: "!L" }
-:: fmt = fmts[ofclass.discriminator.length]
-:: trail = ' '.join([x.pyname for x in util.ancestors(ofclass)])
-class ${ofclass.pyname}(${superclass_pyname}):
- subtypes = {}
-
- @staticmethod
- def unpack(reader):
- subtype, = reader.peek(${repr(fmt)}, ${ofclass.discriminator.offset})
- try:
- subclass = ${ofclass.pyname}.subtypes[subtype]
- except KeyError:
- raise loxi.ProtocolError("unknown ${trail} subtype %#x" % subtype)
- return subclass.unpack(reader)
-
-:: # Register with our superclass
-:: if ofclass.superclass:
-:: type_field_name = ofclass.superclass.discriminator.name
-:: type_value = ofclass.member_by_name(type_field_name).value
-${superclass_pyname}.subtypes[${type_value}] = ${ofclass.pyname}
-:: #endif
diff --git a/py_gen/templates/module.py b/py_gen/templates/module.py
index 02f0002..dfe23e8 100644
--- a/py_gen/templates/module.py
+++ b/py_gen/templates/module.py
@@ -52,11 +52,7 @@
import loxi.generic_util
:: for ofclass in ofclasses:
-:: if ofclass.virtual:
-:: include('_virtual_ofclass.py', ofclass=ofclass)
-:: else:
:: include('_ofclass.py', ofclass=ofclass)
-:: #endif
:: #endfor
diff --git a/py_gen/templates/util.py b/py_gen/templates/util.py
index d690939..85181dc 100644
--- a/py_gen/templates/util.py
+++ b/py_gen/templates/util.py
@@ -173,16 +173,6 @@
x >>= 1
return value
-def unpack_list_hello_elem(reader):
- def deserializer(reader):
- typ, length, = reader.peek('!HH')
- reader = reader.slice(length)
- try:
- return common.hello_elem.unpack(reader)
- except loxi.ProtocolError:
- return None
- return [x for x in loxi.generic_util.unpack_list(reader, deserializer) if x != None]
-
def pack_checksum_128(value):
return struct.pack("!QQ", (value >> 64) & MASK64, value & MASK64)
diff --git a/py_gen/tests/of10.py b/py_gen/tests/of10.py
index 250000f..7e10335 100644
--- a/py_gen/tests/of10.py
+++ b/py_gen/tests/of10.py
@@ -112,10 +112,10 @@
with self.assertRaisesRegexp(ofp.ProtocolError, 'Buffer too short'):
loxi.generic_util.unpack_list(OFReader(buf), ofp.action.action.unpack)
- def test_invalid_action_type(self):
+ def test_unknown_action_type(self):
buf = '\xff\xfe\x00\x08\x00\x00\x00\x00'
- with self.assertRaisesRegexp(ofp.ProtocolError, 'unknown action subtype'):
- loxi.generic_util.unpack_list(OFReader(buf), ofp.action.action.unpack)
+ result = loxi.generic_util.unpack_list(OFReader(buf), ofp.action.action.unpack)
+ self.assertEquals(result, [ofp.action.action(type=0xfffe)])
class TestConstants(unittest.TestCase):
def test_ports(self):
@@ -200,11 +200,19 @@
test_klasses = [x for x in ofp.message.__dict__.values()
if type(x) == type
and issubclass(x, ofp.message.message)
- and hasattr(x, 'pack')]
+ and not hasattr(x, 'subtypes')]
for klass in test_klasses:
self.assertIsInstance(ofp.message.parse_message(klass(xid=1).pack()), klass)
+ def test_parse_unknown_message(self):
+ import loxi
+ import loxi.of10 as ofp
+
+ buf = "\x01\xfe\x00\x08\x12\x34\x56\x78"
+ msg = ofp.message.parse_message(buf)
+ self.assertIsInstance(msg, ofp.message.message)
+
class TestUtils(unittest.TestCase):
def test_pretty_wildcards(self):
self.assertEquals("OFPFW_ALL", ofp.util.pretty_wildcards(ofp.OFPFW_ALL))
@@ -231,7 +239,7 @@
for klass in mod.__dict__.values()
if isinstance(klass, type) and
issubclass(klass, loxi.OFObject) and
- hasattr(klass, 'pack')]
+ not hasattr(klass, 'subtypes')]
self.klasses.sort(key=lambda x: str(x))
def test_serialization(self):
diff --git a/py_gen/tests/of11.py b/py_gen/tests/of11.py
index d620509..7ae6d8a 100644
--- a/py_gen/tests/of11.py
+++ b/py_gen/tests/of11.py
@@ -69,7 +69,7 @@
for klass in mod.__dict__.values()
if isinstance(klass, type) and
issubclass(klass, loxi.OFObject) and
- hasattr(klass, 'pack')]
+ not hasattr(klass, 'subtypes')]
self.klasses.sort(key=lambda x: str(x))
def test_serialization(self):
diff --git a/py_gen/tests/of12.py b/py_gen/tests/of12.py
index 4774672..c463c50 100644
--- a/py_gen/tests/of12.py
+++ b/py_gen/tests/of12.py
@@ -78,7 +78,7 @@
for klass in mod.__dict__.values()
if isinstance(klass, type) and
issubclass(klass, loxi.OFObject) and
- hasattr(klass, 'pack')]
+ not hasattr(klass, 'subtypes')]
self.klasses.sort(key=lambda x: str(x))
def test_serialization(self):
diff --git a/py_gen/tests/of13.py b/py_gen/tests/of13.py
index 8e258df..c5a16b2 100644
--- a/py_gen/tests/of13.py
+++ b/py_gen/tests/of13.py
@@ -60,18 +60,6 @@
self.assertTrue(hasattr(loxi.of13, "message"))
self.assertTrue(hasattr(loxi.of13, "oxm"))
-class TestCommon(unittest.TestCase):
- def test_list_hello_elem_unpack(self):
- buf = ''.join([
- '\x00\x01\x00\x04', # versionbitmap
- '\x00\x00\x00\x04', # unknown type
- '\x00\x01\x00\x04', # versionbitmap
- ])
- l = ofp.util.unpack_list_hello_elem(OFReader(buf))
- self.assertEquals(len(l), 2)
- self.assertTrue(isinstance(l[0], ofp.hello_elem_versionbitmap))
- self.assertTrue(isinstance(l[1], ofp.hello_elem_versionbitmap))
-
# The majority of the serialization tests are created here using the files in
# the test_data directory.
class TestDataFiles(unittest.TestCase):
@@ -91,7 +79,7 @@
for klass in mod.__dict__.values()
if isinstance(klass, type) and
issubclass(klass, loxi.OFObject) and
- hasattr(klass, 'pack')]
+ not hasattr(klass, 'subtypes')]
self.klasses.sort(key=lambda x: str(x))
def test_serialization(self):
diff --git a/test_data/of13/flow_add.data b/test_data/of13/flow_add.data
index 0766375..d566096 100644
--- a/test_data/of13/flow_add.data
+++ b/test_data/of13/flow_add.data
@@ -82,7 +82,7 @@
.setPriority(6000)
.setBufferId(OFBufferId.of(50))
.setOutPort(OFPort.of(6))
- .setOutGroup(8)
+ .setOutGroup(OFGroup.of(8))
.setFlags(ImmutableSet.<OFFlowModFlags>of())
.setMatch(
factory.buildMatch()
diff --git a/test_data/of13/flow_delete.data b/test_data/of13/flow_delete.data
index 6148d21..bf9c453 100644
--- a/test_data/of13/flow_delete.data
+++ b/test_data/of13/flow_delete.data
@@ -82,7 +82,7 @@
.setPriority(6000)
.setBufferId(OFBufferId.of(50))
.setOutPort(OFPort.of(6))
- .setOutGroup(8)
+ .setOutGroup(OFGroup.of(8))
.setFlags(ImmutableSet.<OFFlowModFlags>of())
.setMatch(
factory.buildMatch()
diff --git a/test_data/of13/flow_delete_strict.data b/test_data/of13/flow_delete_strict.data
index 7e4d233..c33e4f8 100644
--- a/test_data/of13/flow_delete_strict.data
+++ b/test_data/of13/flow_delete_strict.data
@@ -82,7 +82,7 @@
.setPriority(6000)
.setBufferId(OFBufferId.of(50))
.setOutPort(OFPort.of(6))
- .setOutGroup(8)
+ .setOutGroup(OFGroup.of(8))
.setFlags(ImmutableSet.<OFFlowModFlags>of())
.setMatch(
factory.buildMatch()
diff --git a/test_data/of13/flow_modify.data b/test_data/of13/flow_modify.data
index 83234f5..6f3ebee 100644
--- a/test_data/of13/flow_modify.data
+++ b/test_data/of13/flow_modify.data
@@ -82,7 +82,7 @@
.setPriority(6000)
.setBufferId(OFBufferId.of(50))
.setOutPort(OFPort.of(6))
- .setOutGroup(8)
+ .setOutGroup(OFGroup.of(8))
.setFlags(ImmutableSet.<OFFlowModFlags>of())
.setMatch(
factory.buildMatch()
diff --git a/test_data/of13/flow_modify_strict.data b/test_data/of13/flow_modify_strict.data
index 1d6f4c3..26e55a4 100644
--- a/test_data/of13/flow_modify_strict.data
+++ b/test_data/of13/flow_modify_strict.data
@@ -82,7 +82,7 @@
.setPriority(6000)
.setBufferId(OFBufferId.of(50))
.setOutPort(OFPort.of(6))
- .setOutGroup(8)
+ .setOutGroup(OFGroup.of(8))
.setFlags(ImmutableSet.<OFFlowModFlags>of())
.setMatch(
factory.buildMatch()
diff --git a/wireshark_gen/__init__.py b/wireshark_gen/__init__.py
index 5c02e06..a610f3f 100644
--- a/wireshark_gen/__init__.py
+++ b/wireshark_gen/__init__.py
@@ -52,6 +52,8 @@
enum = ofproto.enum_by_name(m.oftype)
if enum and 'wire_type' in enum.params:
return "read_" + enum.params['wire_type']
+ elif (cls.name, m.name) in field_info.reader_overrides:
+ return field_info.reader_overrides[(cls.name, m.name)]
else:
return "read_" + m.oftype.replace(')', '').replace('(', '_')
diff --git a/wireshark_gen/field_info.py b/wireshark_gen/field_info.py
index 94e5243..3b76937 100644
--- a/wireshark_gen/field_info.py
+++ b/wireshark_gen/field_info.py
@@ -171,3 +171,7 @@
"cookie": "HEX",
"datapath_id": "HEX",
}
+
+reader_overrides = {
+ ("of_packet_in", "data"): "read_ethernet",
+}
diff --git a/wireshark_gen/templates/_oftype_readers.lua b/wireshark_gen/templates/_oftype_readers.lua
index d80323c..f1de7ec 100644
--- a/wireshark_gen/templates/_oftype_readers.lua
+++ b/wireshark_gen/templates/_oftype_readers.lua
@@ -121,6 +121,10 @@
read_scalar(reader, subtree, field_name, 32)
end
+function read_of_table_name_t(reader, version, subtree, field_name)
+ read_scalar(reader, subtree, field_name, 32)
+end
+
function read_of_port_desc_t(reader, version, subtree, field_name)
if reader.is_empty() then
return
@@ -151,3 +155,21 @@
return
end
end
+
+function read_ethernet(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local child_subtree = subtree:add(fields[field_name], reader.peek_all(0))
+ child_subtree:set_text("Ethernet packet")
+ ethernet_dissector:call(reader.read_all():tvb(), current_pkt, child_subtree)
+end
+
+function read_of_bsn_vport_q_in_q_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local child_subtree = subtree:add(fields[field_name], reader.peek_all(0))
+ local info = of_bsn_vport_q_in_q_dissectors[version](reader, child_subtree)
+ child_subtree:set_text(info)
+end
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index cad61a5..3f86684 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -40,6 +40,9 @@
:: include('_ofreader.lua')
p_of = Proto ("of", "OpenFlow")
+ethernet_dissector = Dissector.get("eth")
+
+current_pkt = nil
local openflow_versions = {
:: for version in loxi_globals.OFVersions.all_supported:
@@ -118,6 +121,12 @@
:: #endfor
}
+local of_bsn_vport_q_in_q_dissectors = {
+:: for version in ir:
+ [${version.wire_version}] = dissect_of_bsn_vport_q_in_q_v${version.wire_version},
+:: #endfor
+}
+
:: include('_oftype_readers.lua')
function dissect_of_message(buf, root)
@@ -140,6 +149,7 @@
-- of dissector function
function p_of.dissector (buf, pkt, root)
local offset = 0
+ current_pkt = pkt
repeat
if buf:len() - offset >= 4 then
msg_len = buf(offset+2,2):uint()