Formatted

This commit is contained in:
Eishun Kondoh 2018-01-30 22:47:31 +09:00
parent 5fc01a9bec
commit 7635272fbd
150 changed files with 5055 additions and 4032 deletions

View file

@ -3,27 +3,112 @@ defmodule OfpPacketOutTest do
doctest Openflow
@packet <<
0xf2, 0x0b, 0xa4, 0xd0, 0x3f, 0x70, 0xf2, 0x0b,
0xa4, 0x7d, 0xf8, 0xea, 0x08, 0x00, 0x45, 0x00,
0x00, 0x54, 0xf8, 0x1a, 0x00, 0x00, 0xff, 0x01,
0xaf, 0x8b, 0x0a, 0x00, 0x00, 0x01, 0x0a, 0x00,
0x00, 0x02, 0x08, 0x00, 0x02, 0x08, 0xf7, 0x60,
0x00, 0x00, 0x31, 0xd6, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0xab, 0x8d, 0x2d, 0x31, 0x00, 0x00,
0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
0x2e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00
0xF2,
0x0B,
0xA4,
0xD0,
0x3F,
0x70,
0xF2,
0x0B,
0xA4,
0x7D,
0xF8,
0xEA,
0x08,
0x00,
0x45,
0x00,
0x00,
0x54,
0xF8,
0x1A,
0x00,
0x00,
0xFF,
0x01,
0xAF,
0x8B,
0x0A,
0x00,
0x00,
0x01,
0x0A,
0x00,
0x00,
0x02,
0x08,
0x00,
0x02,
0x08,
0xF7,
0x60,
0x00,
0x00,
0x31,
0xD6,
0x02,
0x00,
0x00,
0x00,
0x00,
0x00,
0xAB,
0x8D,
0x2D,
0x31,
0x00,
0x00,
0x00,
0x00,
0x10,
0x11,
0x12,
0x13,
0x14,
0x15,
0x16,
0x17,
0x18,
0x19,
0x1A,
0x1B,
0x1C,
0x1D,
0x1E,
0x1F,
0x20,
0x21,
0x22,
0x23,
0x24,
0x25,
0x26,
0x27,
0x28,
0x29,
0x2A,
0x2B,
0x2C,
0x2D,
0x2E,
0x2F,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00,
0x00
>>
describe "Openflow.read/1" do
test "with OFP_PACKET_OUT packet" do
{:ok, pktout, ""} =
"test/packet_data/libofproto-OFP13-ofp_packet_out_packet_library.packet"
|> File.read!
|> Openflow.read
|> File.read!()
|> Openflow.read()
assert pktout.version == 4
assert pktout.xid == 0
@ -37,12 +122,12 @@ defmodule OfpPacketOutTest do
describe "Openflow.to_binary/1" do
pktout = %Openflow.PacketOut{
actions: [Openflow.Action.Output.new(port_number: :all)],
data: @packet
data: @packet
}
expect =
"test/packet_data/libofproto-OFP13-ofp_packet_out_packet_library.packet"
|> File.read!
|> File.read!()
assert Openflow.to_binary(pktout) == expect
end