openflow/match: Refactored

This commit is contained in:
Eishun Kondoh 2019-07-09 11:58:23 +09:00
parent e65bf77a3c
commit 9ddd82fcab
27 changed files with 1201 additions and 1584 deletions

View file

@ -31,7 +31,7 @@ defmodule Openflow.Action.NxFlowSpecLoad do
def new(options) do
dst = options[:dst] || raise(":dst must be specified")
src = options[:src] || raise(":src must be specified")
n_bits = options[:n_bits] || Openflow.Match.Field.n_bits_of(dst)
n_bits = options[:n_bits] || Openflow.Match.n_bits_of(dst)
%NxFlowSpecLoad{
src: src,
@ -90,7 +90,7 @@ defmodule Openflow.Action.NxFlowSpecLoad do
binary
dst = Openflow.Match.codec_header(dst_bin)
src = Openflow.Match.Field.codec(src_bin, dst)
src = Openflow.Match.decode_value(src_bin, dst)
flow_spec = %NxFlowSpecLoad{src: src, dst: dst, n_bits: n_bits, dst_offset: dst_ofs}
{flow_spec, rest}
end
@ -103,7 +103,7 @@ defmodule Openflow.Action.NxFlowSpecLoad do
end
defp codec_src(%NxFlowSpecLoad{src: src, dst: dst_field}) do
src_bin = Openflow.Match.Field.codec(src, dst_field)
src_bin = Openflow.Match.encode_value(src, dst_field)
{@learn_src_immediate, src_bin}
end
end