Add testcases for Openflow13 standard actions

This commit is contained in:
Eishun Kondoh 2019-03-18 22:22:37 +09:00
parent ffcba91395
commit 44670cfbce
4 changed files with 177 additions and 4 deletions

View file

@ -8,13 +8,15 @@ defmodule Openflow.Action.Output do
def ofpat, do: 0
def new(options \\ [])
def new(port) when not is_list(port) do
new(port_number: port)
end
def new(options) when is_list(options) do
port_no = Keyword.get(options, :port_number)
max_len = Keyword.get(options, :max_len, :no_buffer)
port_no = options[:port_number] || raise "port_number must be specified"
max_len = options[:max_len] || :no_buffer
%Output{port_number: port_no, max_len: max_len}
end

View file

@ -3,9 +3,11 @@ defmodule Openflow.Action.PopMpls do
alias __MODULE__
@eth_p_mpls_uc 0x8847
def ofpat, do: 20
def new(ethertype) do
def new(ethertype \\ @eth_p_mpls_uc) do
%PopMpls{ethertype: ethertype}
end

View file

@ -1,11 +1,13 @@
defmodule Openflow.Action.PushMpls do
defstruct(ethertype: 0x8847)
@eth_p_mpls_uc 0x8847
alias __MODULE__
def ofpat, do: 19
def new(ethertype) do
def new(ethertype \\ @eth_p_mpls_uc) do
%PushMpls{ethertype: ethertype}
end