Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
26
test/ofp_hello_test.exs
Normal file
26
test/ofp_hello_test.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
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
|
||||
Loading…
Add table
Add a link
Reference in a new issue