openflow/field: Fix broken NXOXM/ONFOXM fields

This commit is contained in:
Eishun Kondoh 2019-07-31 20:34:00 +09:00
parent c81cf9e8ba
commit d8a17d2d94
6 changed files with 227 additions and 384 deletions

View file

@ -20,122 +20,4 @@ defmodule OfpFlowStatsTest do
assert flow_stats.match == []
end
end
describe "Openflow.Multipart.Flow.Reply" do
test "with test packet_data" do
flow_stats =
"test/packet_data/4-12-ofp_flow_stats_reply.packet"
|> File.read!()
|> Openflow.read()
|> Kernel.elem(1)
%Openflow.Multipart.Flow.Reply{
aux_id: nil,
datapath_id: nil,
flags: [],
flows: [
%Openflow.Multipart.FlowStats{
byte_count: 0,
cookie: 0,
duration_nsec: 115_277_000,
duration_sec: 358,
flags: [],
hard_timeout: 0,
idle_timeout: 0,
instructions: [],
match: [],
packet_count: 0,
priority: 65535,
table_id: 0
},
%Openflow.Multipart.FlowStats{
byte_count: 0,
cookie: 0,
duration_nsec: 115_055_000,
duration_sec: 358,
flags: [],
hard_timeout: 0,
idle_timeout: 0,
instructions: [
%Openflow.Instruction.ApplyActions{
actions: [%Openflow.Action.Output{max_len: 0, port_number: :normal}]
}
],
match: [eth_type: 2054],
packet_count: 0,
priority: 65534,
table_id: 0
},
%Openflow.Multipart.FlowStats{
byte_count: 238,
cookie: 0,
duration_nsec: 511_582_000,
duration_sec: 316_220,
flags: [],
hard_timeout: 0,
idle_timeout: 0,
instructions: [%Openflow.Instruction.GotoTable{table_id: 1}],
match: [in_port: 6, eth_src: <<0xF20BA47DF8EA::48>>],
packet_count: 3,
priority: 123,
table_id: 0
},
%Openflow.Multipart.FlowStats{
byte_count: 98,
cookie: 0,
duration_nsec: 980_901_000,
duration_sec: 313_499,
flags: [],
hard_timeout: 0,
idle_timeout: 0,
instructions: [
%Openflow.Instruction.WriteActions{
actions: [
%Openflow.Action.SetField{field: [vlan_vid: 258]},
%Openflow.Action.CopyTtlOut{},
%Openflow.Action.CopyTtlIn{},
%Openflow.Action.CopyTtlIn{},
%Openflow.Action.PopPbb{},
%Openflow.Action.PushPbb{ethertype: 4660},
%Openflow.Action.PopMpls{ethertype: 39030},
%Openflow.Action.PushMpls{ethertype: 34887},
%Openflow.Action.PopVlan{},
%Openflow.Action.PushVlan{ethertype: 33024},
%Openflow.Action.DecMplsTtl{},
%Openflow.Action.SetMplsTtl{ttl: 10},
%Openflow.Action.DecNwTtl{},
%Openflow.Action.SetNwTtl{ttl: 10},
%Openflow.Action.SetQueue{id: 3},
%Openflow.Action.Group{id: 99},
%Openflow.Action.Output{max_len: :no_buffer, port_number: 6},
%Openflow.Action.Experimenter{data: "exp_data", exp_id: 98_765_432},
%Openflow.Action.Experimenter{data: "exp_data", exp_id: 8992}
]
},
%Openflow.Instruction.ApplyActions{
actions: [
%Openflow.Action.SetField{field: [eth_src: <<0x010203040506::48>>]},
%Openflow.Action.SetField{field: [onf_pbb_uca: 1]}
]
},
%Openflow.Instruction.WriteActions{
actions: [
%Openflow.Action.Output{
max_len: :no_buffer,
port_number: :controller
}
]
}
],
match: [],
packet_count: 1,
priority: 0,
table_id: 0
}
],
version: 4,
xid: 0
} = flow_stats
end
end
end