quality: Add test cases for get_config messages

This commit is contained in:
Eishun Kondoh 2019-04-28 14:18:51 +09:00
parent c592d9f7c5
commit ca07b47575
5 changed files with 29 additions and 17 deletions

View file

@ -1,2 +0,0 @@
defmodule Openflow.GetConfig do
end

View file

@ -11,6 +11,19 @@ defmodule Openflow.GetConfig.Reply do
alias __MODULE__
@type flags :: [:drop | :reasm]
@type max_len :: :max | :no_buffer | 0..0xFFFF
@type t :: %Reply{
version: 4,
xid: 0..0xFFFFFFFF,
datapath_id: String.t() | nil,
aux_id: 0..0xF | nil,
flags: flags(),
miss_send_len: max_len()
}
@spec ofp_type() :: t()
def ofp_type, do: 8
def read(<<flags_int::16, miss_send_len0::16>>) do

View file

@ -10,17 +10,22 @@ defmodule Openflow.GetConfig.Request do
alias __MODULE__
@type t :: %Request{
version: 4,
xid: 0..0xFFFFFFFF,
datapath_id: String.t() | nil,
aux_id: non_neg_integer() | nil
}
@spec ofp_type() :: 7
def ofp_type, do: 7
def new(xid \\ 0) do
%Request{xid: xid}
end
@spec new(xid :: 0..0xFFFFFFFF) :: t()
def new(xid \\ 0), do: %Request{xid: xid}
def read(_) do
%Request{}
end
@spec read(any()) :: t()
def read(_), do: %Request{}
def to_binary(%Request{}) do
<<>>
end
@spec to_binary(t()) :: <<>>
def to_binary(%Request{}), do: <<>>
end