openflow: Fix aggregate request

This commit is contained in:
Eishun Kondoh 2019-05-01 23:54:40 +09:00
parent c5e38155e1
commit b32cfff395
22 changed files with 71 additions and 44 deletions

View file

@ -0,0 +1,29 @@
defmodule OfpHelloTest do
use ExUnit.Case
doctest Openflow
describe "Openflow.read/1" do
test "with OFP_HELLO packet" do
{:ok, hello, ""} =
"test/packet_data/ofp_hello.raw"
|> File.read!()
|> Openflow.read()
assert hello.version == 4
assert hello.xid == 0
assert hello.elements == [versionbitmap: [30, 10, 9, 3, 2, 1]]
end
end
describe "Openflow.to_binary/1" do
test "with %Openflow.Hello{}" do
hello = Openflow.Hello.new([30, 10, 9, 3, 2, 1])
expect =
"test/packet_data/ofp_hello.raw"
|> File.read!()
assert Openflow.to_binary(hello) == expect
end
end
end