Refactored nicira extended actions
This commit is contained in:
parent
efd08cf6dd
commit
ffcba91395
51 changed files with 1015 additions and 819 deletions
|
|
@ -9,8 +9,9 @@ defmodule Openflow.Action.NxController do
|
|||
@nxast 20
|
||||
|
||||
alias __MODULE__
|
||||
alias Openflow.Action.Experimenter
|
||||
|
||||
def new(options) do
|
||||
def new(options \\ []) do
|
||||
%NxController{
|
||||
max_len: options[:max_len] || :no_buffer,
|
||||
id: options[:id] || 0,
|
||||
|
|
@ -18,14 +19,18 @@ defmodule Openflow.Action.NxController do
|
|||
}
|
||||
end
|
||||
|
||||
def to_binary(%NxController{max_len: max_len, id: controller_id, reason: reason}) do
|
||||
max_len_int = Openflow.Utils.get_enum(max_len, :controller_max_len)
|
||||
reason_int = Openflow.Enums.to_int(reason, :packet_in_reason)
|
||||
def to_binary(%NxController{} = controller) do
|
||||
max_len_int = Openflow.Utils.get_enum(controller.max_len, :controller_max_len)
|
||||
reason_int = Openflow.Enums.to_int(controller.reason, :packet_in_reason)
|
||||
|
||||
exp_body =
|
||||
<<@experimenter::32, @nxast::16, max_len_int::16, controller_id::16, reason_int::8, 0::8>>
|
||||
|
||||
<<0xFFFF::16, 16::16, exp_body::bytes>>
|
||||
Experimenter.pack_exp_header(<<
|
||||
@experimenter::32,
|
||||
@nxast::16,
|
||||
max_len_int::16,
|
||||
controller.id::16,
|
||||
reason_int::8,
|
||||
0::8
|
||||
>>)
|
||||
end
|
||||
|
||||
def read(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue