Refactored nicira extended actions

This commit is contained in:
Eishun Kondoh 2019-03-18 13:31:36 +09:00
parent efd08cf6dd
commit ffcba91395
51 changed files with 1015 additions and 819 deletions

View file

@ -16,6 +16,23 @@ defmodule Openflow.Action.Experimenter do
<<0xFFFF::16, length::16, exp_id::32, data::bytes>>
end
@spec pack_exp_header(binary()) :: binary()
def pack_exp_header(exp_body) do
pad_length =
exp_body
|> Kernel.byte_size()
|> Kernel.+(4)
|> Openflow.Utils.padding(8)
length =
exp_body
|> byte_size()
|> Kernel.+(4)
|> Kernel.+(pad_length)
<<0xFFFF::16, length::16, exp_body::bytes, 0::size(pad_length)-unit(8)>>
end
def read(<<0xFFFF::16, _length::16, exp_id::32, exp_type::16, data::bytes>>) do
case Openflow.Utils.get_enum(exp_id, :action_vendor) do
vendor_id when is_integer(vendor_id) ->