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

@ -741,7 +741,7 @@ defmodule OfpActionTest do
fin_idle_timeout: 2,
fin_hard_timeout: 4,
flow_specs: [
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, n_bits: 12),
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
]
@ -773,7 +773,7 @@ defmodule OfpActionTest do
result_dst: :reg0,
result_dst_offset: 8,
flow_specs: [
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, n_bits: 12),
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
]
@ -846,22 +846,21 @@ defmodule OfpActionTest do
end
test "with no option" do
assert_raise RuntimeError, ":dst must be specified", fn ->
assert_raise RuntimeError, ":src must be specified", fn ->
Openflow.Action.NxFlowSpecMatch.new()
end
end
test "with no dst option" do
assert_raise RuntimeError, ":dst must be specified", fn ->
Openflow.Action.NxFlowSpecMatch.new(src: :in_port)
end
end
test "with no src option" do
assert_raise RuntimeError, ":src must be specified", fn ->
Openflow.Action.NxFlowSpecMatch.new(dst: :reg0)
end
end
test "with no dst option" do
learn = Openflow.Action.NxFlowSpecMatch.new(src: :in_port)
assert learn.dst == :in_port
end
end
describe "Openflow.Action.NxFlowSpecLoad" do