test: Add testcases for set_config codec

This commit is contained in:
Eishun Kondoh 2019-06-04 19:00:20 +09:00
parent 422ab63dad
commit 289a705fa3

View file

@ -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