quality: Add test cases for openflow actions

This commit is contained in:
Eishun Kondoh 2019-04-22 19:17:30 +09:00
parent 2c0a283932
commit 84a827eea1
5 changed files with 188 additions and 88 deletions

View file

@ -25,7 +25,31 @@ defmodule Openflow.Action.NxController2 do
alias __MODULE__
alias Openflow.Action.Experimenter
def new(options \\ []) do
@type max_len :: pos_integer() | :max | :no_buffer
@type packet_in_reason ::
:no_match | :action | :invalid_ttl | :action_set | :group | :packet_out
@type meter_id :: pos_integer() | :max | :slowpath | :controller | :all
@type t :: %NxController2{
max_len: max_len(),
id: non_neg_integer(),
reason: packet_in_reason(),
userdata: binary(),
pause: boolean(),
meter_id: meter_id()
}
@spec new(
max_len: max_len(),
id: non_neg_integer(),
reason: packet_in_reason(),
userdata: binary(),
pause: boolean(),
meter_id: meter_id()
) :: t()
def new(options \\ [])
def new(options) when is_list(options) do
%NxController2{
max_len: options[:max_len] || :no_buffer,
id: options[:id] || 0,