Merge into master from pull request #110:
Reading buckets and single oxm matches (https://github.com/floodlight/loxigen/pull/110)
diff --git a/wireshark_gen/field_info.py b/wireshark_gen/field_info.py
index 28f4cdb..4a80a8e 100644
--- a/wireshark_gen/field_info.py
+++ b/wireshark_gen/field_info.py
@@ -111,6 +111,11 @@
('of_action_id', 'type'): 'ofp_action_type',
('of_instruction_apply_actions', 'type'): 'ofp_instruction_type',
('of_instruction_write_actions', 'type'): 'ofp_instruction_type',
+ ('of_group_mod', 'group_type'): 'ofp_group_type',
+ ('of_group_mod', 'type'): 'ofp_type',
+ ('of_group_mod', 'command'): 'ofp_group_mod_commane',
+ ('of_group_mod', 'group_id'): 'ofp_group',
+
}
# Override oftype_to_base for certain field names
diff --git a/wireshark_gen/templates/_oftype_readers.lua b/wireshark_gen/templates/_oftype_readers.lua
index c258953..4f5d7f9 100644
--- a/wireshark_gen/templates/_oftype_readers.lua
+++ b/wireshark_gen/templates/_oftype_readers.lua
@@ -134,6 +134,7 @@
local list = nil
if not reader2.is_empty() then
list = subtree:add(fields[field_name], reader2.peek_all(0))
+ list:set_text("List of matches")
end
while not reader2.is_empty() do
local match_len = 4 + reader2.peek(3,1):uint()
@@ -143,7 +144,6 @@
child_subtree:set_text(info)
end
subtree:set_text("OXM")
- list:set_text("List of matches")
reader.skip_align()
end
@@ -155,3 +155,27 @@
local info = dissect_of_instruction(reader, child_subtree, version)
child_subtree:set_text("Instructions")
end
+
+function read_list_of_bucket_t(reader, version, subtree, field_name)
+ if reader.is_empty() then
+ return
+ end
+ local bucket_list_subtree = subtree:add(fields[field_name], reader.peek_all(0))
+ bucket_list_subtree:set_text("List of buckets")
+ while not reader.is_empty() do
+ local bucket_len = reader.peek(0,2):uint()
+ local child_reader = reader.slice(bucket_len)
+ local child_subtree = bucket_list_subtree:add(fields[field_name], child_reader.peek_all(0))
+ local info = dissect_of_bucket(child_reader, child_subtree, version)
+ child_subtree:set_text(info)
+ end
+end
+
+function read_of_oxm_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 = dissect_of_oxm(reader, child_subtree, version)
+ child_subtree:set_text(info)
+end
diff --git a/wireshark_gen/templates/openflow.lua b/wireshark_gen/templates/openflow.lua
index 067dbdd..f2791d1 100644
--- a/wireshark_gen/templates/openflow.lua
+++ b/wireshark_gen/templates/openflow.lua
@@ -119,6 +119,12 @@
:: #endfor
}
+local of_bucket_dissectors = {
+:: for version in ir:
+ [${version}] = dissect_of_bucket_v${version},
+:: #endfor
+}
+
function dissect_of_message(buf, root)
local reader = OFReader.new(buf)
local subtree = root:add(p_of, buf(0))
@@ -168,6 +174,15 @@
return info
end
+function dissect_of_bucket(reader, subtree, version_val)
+ local info = "unknown"
+ if of_bucket_dissectors[version_val] then
+ info = of_bucket_dissectors[version_val](reader, subtree)
+ end
+
+ return info
+end
+
-- of dissector function
function p_of.dissector (buf, pkt, root)
local offset = 0