quality: Add testcases for table_mod, set_controller_id and resume message handlers

This commit is contained in:
Eishun Kondoh 2019-05-08 22:29:44 +09:00
parent 27cfce26b3
commit db8aa3561b
4 changed files with 40 additions and 14 deletions

View file

@ -16,10 +16,6 @@ defmodule Openflow.NxSetControllerId do
%NxSetControllerId{id: controller_id}
end
def read(<<@experimenter::32, @nx_type::32, _::size(6)-unit(8), controller_id::16>>) do
%NxSetControllerId{id: controller_id}
end
def to_binary(%NxSetControllerId{id: controller_id}) do
<<@experimenter::32, @nx_type::32, 0::size(6)-unit(8), controller_id::16>>
end

View file

@ -14,15 +14,11 @@ defmodule Openflow.TableMod do
def new(options) when is_list(options) do
%TableMod{
xid: options[:xid] || 0,
table_id: options[:table_id] || 0
xid: Keyword.get(options, :xid, 0),
table_id: Keyword.get(options, :table_id, 0)
}
end
def new(table_id) when is_integer(table_id) or is_atom(table_id) do
%TableMod{table_id: table_id}
end
def read(<<table_id_int::8, _::size(3)-unit(8), config::32>>) do
table_id = Openflow.Utils.get_enum(table_id_int, :table_id)
%TableMod{table_id: table_id, config: config}