test: Add testcases for set_config codec
This commit is contained in:
parent
422ab63dad
commit
289a705fa3
1 changed files with 20 additions and 0 deletions
|
|
@ -14,6 +14,20 @@ defmodule OfpSetConfigTest do
|
|||
assert config.flags == []
|
||||
assert config.miss_send_len == 128
|
||||
end
|
||||
|
||||
test "with a flag option" do
|
||||
binary = <<0x04, 0x09, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x02, 0xff, 0xe5>>
|
||||
|
||||
set_config =
|
||||
binary
|
||||
|> Openflow.read()
|
||||
|> Kernel.elem(1)
|
||||
|
||||
assert set_config.version == 4
|
||||
assert set_config.xid == 13
|
||||
assert set_config.flags == [:fragment_reassemble]
|
||||
assert set_config.miss_send_len == :max
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
|
|
@ -31,5 +45,11 @@ defmodule OfpSetConfigTest do
|
|||
|
||||
assert Openflow.to_binary(config) == expect
|
||||
end
|
||||
|
||||
test "with a flag option" do
|
||||
binary = <<0x04, 0x09, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x02, 0xff, 0xe5>>
|
||||
set_config = Openflow.SetConfig.new(xid: 13, flags: [:fragment_reassemble], miss_send_len: :max)
|
||||
^binary = Openflow.to_binary(set_config)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue