quality: Add testcases for table_mod, set_controller_id and resume message handlers
This commit is contained in:
parent
27cfce26b3
commit
db8aa3561b
4 changed files with 40 additions and 14 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue