openflow/learn_flow_spec: Fix to use src field if dst field is omitted, as dst field.

This commit is contained in:
Eishun Kondoh 2019-07-24 02:05:39 +09:00
parent 6ce014ea91
commit 6dc3cfd500
3 changed files with 34 additions and 33 deletions

View file

@ -56,29 +56,7 @@ defmodule NxLearningSwitch do
send_flow_mod_add(
datapath_id,
table_id: 0,
instructions: ApplyActions.new([
NxLearn.new(
table_id: 1,
priority: 2,
hard_timeout: 10,
flow_specs: [
NxFlowSpecMatch.new(
src: :eth_src,
dst: :eth_dst
),
NxFlowSpecMatch.new(
src: :vlan_vid,
dst: :vlan_vid,
offset: 0,
n_bits: 12
),
NxFlowSpecOutput.new(
src: :nx_in_port
)
]
),
NxResubmitTable.new(1)
])
instructions: l2_learning_instr()
)
end
@ -90,4 +68,28 @@ defmodule NxLearningSwitch do
instructions: ApplyActions.new(Output.new(:flood))
)
end
defp l2_learning_instr do
ApplyActions.new([
l2_learning_action(),
NxResubmitTable.new(1)
])
end
defp l2_learning_action do
NxLearn.new(
table_id: 1,
priority: 2,
hard_timeout: 10,
flow_specs: l2_learning_flow_specs()
)
end
defp l2_learning_flow_specs do
[
NxFlowSpecMatch.new(src: :eth_src, dst: :eth_dst),
NxFlowSpecMatch.new(src: :vlan_vid, n_bits: 12),
NxFlowSpecOutput.new(src: :nx_in_port)
]
end
end