openflow/actions: Add nx_check_pkt_larger (#17)
this action available since post-2.11
This commit is contained in:
parent
ccb420cbce
commit
6ce014ea91
6 changed files with 94 additions and 0 deletions
46
lib/openflow/actions/nx_check_pkt_larger.ex
Normal file
46
lib/openflow/actions/nx_check_pkt_larger.ex
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
defmodule Openflow.Action.NxCheckPktLarger do
|
||||
defstruct(
|
||||
pkt_len: 0,
|
||||
offset: 0,
|
||||
dst_field: nil
|
||||
)
|
||||
|
||||
@experimenter 0x00002320
|
||||
@nxast 49
|
||||
|
||||
alias __MODULE__
|
||||
alias Openflow.Action.Experimenter
|
||||
|
||||
@type t :: %NxCheckPktLarger{dst_field: atom(), pkt_len: 0..0xFFFF, offset: 0..0xFFFF}
|
||||
|
||||
@spec new(dst_field: atom(), pkt_len: 0..0xFFFF, offset: 0..0xFFFF) :: t()
|
||||
def new(options \\ []) do
|
||||
dst_field = options[:dst_field] || raise "dst_field must be specified"
|
||||
pkt_len = options[:pkt_len] || raise "pkt_len must be specified"
|
||||
ofs = Keyword.get(options, :offset, 0)
|
||||
%NxCheckPktLarger{dst_field: dst_field, pkt_len: pkt_len, offset: ofs}
|
||||
end
|
||||
|
||||
@spec to_binary(t()) :: binary()
|
||||
def to_binary(%NxCheckPktLarger{} = pkt_larger) do
|
||||
dst_field_bin = Openflow.Match.codec_header(pkt_larger.dst_field)
|
||||
pkt_len = pkt_larger.pkt_len
|
||||
ofs = pkt_larger.offset
|
||||
|
||||
Experimenter.pack_exp_header(<<
|
||||
@experimenter::32,
|
||||
@nxast::16,
|
||||
pkt_len::16,
|
||||
ofs::16,
|
||||
dst_field_bin::4-bytes,
|
||||
0::size(10)-unit(8)
|
||||
>>)
|
||||
end
|
||||
|
||||
@spec read(binary()) :: t()
|
||||
def read(<<@experimenter::32, @nxast::16, body::bytes>>) do
|
||||
<<pkt_len::16, ofs::16, dst_field_bin::4-bytes, _::bytes>> = body
|
||||
dst_field = Openflow.Match.codec_header(dst_field_bin)
|
||||
%NxCheckPktLarger{dst_field: dst_field, pkt_len: pkt_len, offset: ofs}
|
||||
end
|
||||
end
|
||||
|
|
@ -4417,6 +4417,12 @@ defmodule Openflow.Enums do
|
|||
_class, _reason -> Openflow.Action.NxDecap
|
||||
end
|
||||
|
||||
def to_int(Openflow.Action.NxCheckPktLarger, :nicira_ext_action) do
|
||||
nicira_ext_action_to_int(Openflow.Action.NxCheckPktLarger)
|
||||
catch
|
||||
_class, _reason -> Openflow.Action.NxCheckPktLarger
|
||||
end
|
||||
|
||||
def to_int(Openflow.Action.NxDebugRecirc, :nicira_ext_action) do
|
||||
nicira_ext_action_to_int(Openflow.Action.NxDebugRecirc)
|
||||
catch
|
||||
|
|
@ -9619,6 +9625,12 @@ defmodule Openflow.Enums do
|
|||
_class, _reason -> 47
|
||||
end
|
||||
|
||||
def to_atom(0x31, :nicira_ext_action) do
|
||||
nicira_ext_action_to_atom(0x31)
|
||||
catch
|
||||
_class, _reason -> 49
|
||||
end
|
||||
|
||||
def to_atom(0xFF, :nicira_ext_action) do
|
||||
nicira_ext_action_to_atom(0xFF)
|
||||
catch
|
||||
|
|
@ -11888,6 +11900,7 @@ defmodule Openflow.Enums do
|
|||
def nicira_ext_action_to_int(Openflow.Action.NxLearn2), do: 0x2D
|
||||
def nicira_ext_action_to_int(Openflow.Action.NxEncap), do: 0x2E
|
||||
def nicira_ext_action_to_int(Openflow.Action.NxDecap), do: 0x2F
|
||||
def nicira_ext_action_to_int(Openflow.Action.NxCheckPktLarger), do: 0x31
|
||||
def nicira_ext_action_to_int(Openflow.Action.NxDebugRecirc), do: 0xFF
|
||||
def nicira_ext_action_to_int(_), do: throw(:bad_enum)
|
||||
def nicira_ext_action_to_atom(0x1), do: Openflow.Action.NxResubmit
|
||||
|
|
@ -11927,6 +11940,7 @@ defmodule Openflow.Enums do
|
|||
def nicira_ext_action_to_atom(0x2D), do: Openflow.Action.NxLearn2
|
||||
def nicira_ext_action_to_atom(0x2E), do: Openflow.Action.NxEncap
|
||||
def nicira_ext_action_to_atom(0x2F), do: Openflow.Action.NxDecap
|
||||
def nicira_ext_action_to_atom(0x31), do: Openflow.Action.NxCheckPktLarger
|
||||
def nicira_ext_action_to_atom(0xFF), do: Openflow.Action.NxDebugRecirc
|
||||
def nicira_ext_action_to_atom(_), do: throw(:bad_enum)
|
||||
def nx_mp_algorithm_to_int(:modulo_n), do: 0x0
|
||||
|
|
@ -13742,6 +13756,7 @@ defmodule Openflow.Enums do
|
|||
{Openflow.Action.NxLearn2, 45},
|
||||
{Openflow.Action.NxEncap, 46},
|
||||
{Openflow.Action.NxDecap, 47},
|
||||
{Openflow.Action.NxCheckPktLarger, 49},
|
||||
{Openflow.Action.NxDebugRecirc, 255}
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -117,6 +117,7 @@ defmodule Tres.Messages do
|
|||
alias Openflow.Action.NxEncap
|
||||
alias Openflow.Action.NxDecap
|
||||
alias Openflow.Action.NxDebugRecirc
|
||||
alias Openflow.Action.NxCheckPktLarger
|
||||
|
||||
alias Openflow.Action.NxFlowSpecMatch
|
||||
alias Openflow.Action.NxFlowSpecLoad
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue