Merge into master from pull request #180:
OF Aux (https://github.com/floodlight/loxigen/pull/180)
diff --git a/java_gen/java_type.py b/java_gen/java_type.py
index 4e1306b..3d97267 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)',
@@ -468,6 +471,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")
@@ -524,6 +529,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
@@ -676,8 +682,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/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()