Formatted
This commit is contained in:
parent
5fc01a9bec
commit
7635272fbd
150 changed files with 5055 additions and 4032 deletions
|
|
@ -6,11 +6,13 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_bundle.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
|
||||
bundle =
|
||||
Openflow.Action.NxBundle.new(
|
||||
algorithm: :highest_random_weight,
|
||||
slaves: [4, 8]
|
||||
slaves: [4, 8]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(bundle)
|
||||
assert actions_bin == packet
|
||||
assert actions == [bundle]
|
||||
|
|
@ -20,12 +22,14 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_bundle_load.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
|
||||
bundle_load =
|
||||
Openflow.Action.NxBundleLoad.new(
|
||||
algorithm: :highest_random_weight,
|
||||
slaves: [4, 8],
|
||||
dst_field: :reg0
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(bundle_load)
|
||||
assert actions_bin == packet
|
||||
assert actions == [bundle_load]
|
||||
|
|
@ -35,11 +39,14 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_controller.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
controller = Openflow.Action.NxController.new(
|
||||
max_len: 1234,
|
||||
reason: :invalid_ttl,
|
||||
id: 5678
|
||||
)
|
||||
|
||||
controller =
|
||||
Openflow.Action.NxController.new(
|
||||
max_len: 1234,
|
||||
reason: :invalid_ttl,
|
||||
id: 5678
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(controller)
|
||||
assert actions_bin == packet
|
||||
assert actions == [controller]
|
||||
|
|
@ -49,12 +56,15 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_controller2.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
controller2 = Openflow.Action.NxController2.new(
|
||||
max_len: 1234,
|
||||
reason: :invalid_ttl,
|
||||
userdata: <<1,2,3,4,5>>,
|
||||
pause: true
|
||||
)
|
||||
|
||||
controller2 =
|
||||
Openflow.Action.NxController2.new(
|
||||
max_len: 1234,
|
||||
reason: :invalid_ttl,
|
||||
userdata: <<1, 2, 3, 4, 5>>,
|
||||
pause: true
|
||||
)
|
||||
|
||||
assert actions == [controller2]
|
||||
end
|
||||
|
||||
|
|
@ -102,13 +112,19 @@ defmodule OfpActionTest do
|
|||
test "with ct(commit,exec(load:0->NXM_NX_CT_LABEL[64..127],load:0x1d->NXM_NX_CT_LABEL[0..63]))" do
|
||||
test_file =
|
||||
"test/packet_data/nx_ct(commit,exec(load:0->NXM_NX_CT_LABEL[64..127],load:0x1d->NXM_NX_CT_LABEL[0..63])).raw"
|
||||
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxRegLoad.new(dst_field: :ct_label, value: 0, offset: 64, n_bits: 64),
|
||||
Openflow.Action.NxRegLoad.new(dst_field: :ct_label, value: 0x1d, n_bits: 64)]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxRegLoad.new(dst_field: :ct_label, value: 0, offset: 64, n_bits: 64),
|
||||
Openflow.Action.NxRegLoad.new(dst_field: :ct_label, value: 0x1D, n_bits: 64)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -118,10 +134,13 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[])).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxRegLoad.new(dst_field: :ct_mark, value: 0xf009)]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxRegLoad.new(dst_field: :ct_mark, value: 0xF009)]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -131,10 +150,13 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct(commit,force,exec(load:0xf009->NXM_NX_CT_MARK[])).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit, :force],
|
||||
exec: [Openflow.Action.NxRegLoad.new(dst_field: :ct_mark, value: 0xf009)]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit, :force],
|
||||
exec: [Openflow.Action.NxRegLoad.new(dst_field: :ct_mark, value: 0xF009)]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -144,10 +166,13 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct(commit,nat(dst)).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:dst])]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:dst])]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -159,16 +184,19 @@ defmodule OfpActionTest do
|
|||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv4_min} = :inet.parse_ipv4_address('10.0.0.128')
|
||||
{:ok, ipv4_max} = :inet.parse_ipv4_address('10.0.0.254')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:dst, :protocol_hash],
|
||||
ipv4_min: ipv4_min,
|
||||
ipv4_max: ipv4_max
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:dst, :protocol_hash],
|
||||
ipv4_min: ipv4_min,
|
||||
ipv4_max: ipv4_max
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -178,10 +206,13 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct(commit,nat(src)).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:src])]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:src])]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -192,38 +223,46 @@ defmodule OfpActionTest do
|
|||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv4_min} = :inet.parse_ipv4_address('10.0.0.240')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv4_min: ipv4_min
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv4_min: ipv4_min
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent)).raw"
|
||||
test_file =
|
||||
"test/packet_data/nx_ct(commit,nat(src=10.0.0.240-10.0.0.254:32768-65535,persistent)).raw"
|
||||
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv4_min} = :inet.parse_ipv4_address('10.0.0.240')
|
||||
{:ok, ipv4_max} = :inet.parse_ipv4_address('10.0.0.254')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :persistent],
|
||||
ipv4_min: ipv4_min,
|
||||
ipv4_max: ipv4_max,
|
||||
proto_min: 32_768,
|
||||
proto_max: 65_535
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :persistent],
|
||||
ipv4_min: ipv4_min,
|
||||
ipv4_max: ipv4_max,
|
||||
proto_min: 32_768,
|
||||
proto_max: 65_535
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -234,61 +273,74 @@ defmodule OfpActionTest do
|
|||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv4_min} = :inet.parse_ipv4_address('10.0.0.240')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv4_min: ipv4_min,
|
||||
proto_min: 32_768,
|
||||
proto_max: 65_535
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv4_min: ipv4_min,
|
||||
proto_min: 32_768,
|
||||
proto_max: 65_535
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random)).raw"
|
||||
test_file =
|
||||
"test/packet_data/nx_ct(commit,nat(src=[fe80::20c:29ff:fe88:1]-[fe80::20c:29ff:fe88:a18b]:255-4096,random)).raw"
|
||||
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv6_min} = :inet.parse_ipv6_address('fe80::20c:29ff:fe88:1')
|
||||
{:ok, ipv6_max} = :inet.parse_ipv6_address('fe80::20c:29ff:fe88:a18b')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv6_min: ipv6_min,
|
||||
ipv6_max: ipv6_max,
|
||||
proto_min: 255,
|
||||
proto_max: 4096
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv6_min: ipv6_min,
|
||||
ipv6_max: ipv6_max,
|
||||
proto_min: 255,
|
||||
proto_max: 4096
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random)).raw"
|
||||
test_file =
|
||||
"test/packet_data/nx_ct(commit,nat(src=fe80::20c:29ff:fe88:1-fe80::20c:29ff:fe88:a18b,random)).raw"
|
||||
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv6_min} = :inet.parse_ipv6_address('fe80::20c:29ff:fe88:1')
|
||||
{:ok, ipv6_max} = :inet.parse_ipv6_address('fe80::20c:29ff:fe88:a18b')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv6_min: ipv6_min,
|
||||
ipv6_max: ipv6_max
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [
|
||||
Openflow.Action.NxNat.new(
|
||||
flags: [:src, :protocol_random],
|
||||
ipv6_min: ipv6_min,
|
||||
ipv6_max: ipv6_max
|
||||
)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -299,10 +351,13 @@ defmodule OfpActionTest do
|
|||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
{:ok, ipv6_min} = :inet.parse_ipv6_address('fe80::20c:29ff:fe88:a18b')
|
||||
ct = Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:src, :protocol_random], ipv6_min: ipv6_min)]
|
||||
)
|
||||
|
||||
ct =
|
||||
Openflow.Action.NxConntrack.new(
|
||||
flags: [:commit],
|
||||
exec: [Openflow.Action.NxNat.new(flags: [:src, :protocol_random], ipv6_min: ipv6_min)]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -312,7 +367,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct(nat).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(exec: [Openflow.Action.NxNat.new])
|
||||
ct = Openflow.Action.NxConntrack.new(exec: [Openflow.Action.NxNat.new()])
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -352,7 +407,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new
|
||||
ct = Openflow.Action.NxConntrack.new()
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -362,7 +417,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_ct_clear.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxCtClear.new
|
||||
ct = Openflow.Action.NxCtClear.new()
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
|
|
@ -372,7 +427,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_dec_ttl.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
dec_ttl = Openflow.Action.NxDecTtl.new
|
||||
dec_ttl = Openflow.Action.NxDecTtl.new()
|
||||
actions_bin = Openflow.Action.to_binary(dec_ttl)
|
||||
assert actions_bin == packet
|
||||
assert actions == [dec_ttl]
|
||||
|
|
@ -392,7 +447,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_exit.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
exit = Openflow.Action.NxExit.new
|
||||
exit = Openflow.Action.NxExit.new()
|
||||
actions_bin = Openflow.Action.to_binary(exit)
|
||||
assert actions_bin == packet
|
||||
assert actions == [exit]
|
||||
|
|
@ -412,21 +467,24 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_learn.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
learn = Openflow.Action.NxLearn.new(
|
||||
idle_timeout: 10,
|
||||
hard_timeout: 20,
|
||||
priority: 80,
|
||||
cookie: 0x123456789abcdef0,
|
||||
flags: [],
|
||||
table_id: 2,
|
||||
fin_idle_timeout: 2,
|
||||
fin_hard_timeout: 4,
|
||||
flow_specs: [
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
|
||||
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
|
||||
]
|
||||
)
|
||||
|
||||
learn =
|
||||
Openflow.Action.NxLearn.new(
|
||||
idle_timeout: 10,
|
||||
hard_timeout: 20,
|
||||
priority: 80,
|
||||
cookie: 0x123456789ABCDEF0,
|
||||
flags: [],
|
||||
table_id: 2,
|
||||
fin_idle_timeout: 2,
|
||||
fin_hard_timeout: 4,
|
||||
flow_specs: [
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
|
||||
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(learn)
|
||||
assert actions_bin == packet
|
||||
assert actions == [learn]
|
||||
|
|
@ -436,24 +494,27 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_learn2.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
learn2 = Openflow.Action.NxLearn2.new(
|
||||
idle_timeout: 10,
|
||||
hard_timeout: 20,
|
||||
priority: 80,
|
||||
cookie: 0x123456789abcdef0,
|
||||
flags: [:write_result],
|
||||
table_id: 2,
|
||||
fin_idle_timeout: 2,
|
||||
fin_hard_timeout: 4,
|
||||
limit: 1,
|
||||
result_dst: :reg0,
|
||||
result_dst_offset: 8,
|
||||
flow_specs: [
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
|
||||
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
|
||||
]
|
||||
)
|
||||
|
||||
learn2 =
|
||||
Openflow.Action.NxLearn2.new(
|
||||
idle_timeout: 10,
|
||||
hard_timeout: 20,
|
||||
priority: 80,
|
||||
cookie: 0x123456789ABCDEF0,
|
||||
flags: [:write_result],
|
||||
table_id: 2,
|
||||
fin_idle_timeout: 2,
|
||||
fin_hard_timeout: 4,
|
||||
limit: 1,
|
||||
result_dst: :reg0,
|
||||
result_dst_offset: 8,
|
||||
flow_specs: [
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_vlan_tci, dst: :nx_vlan_tci, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
|
||||
Openflow.Action.NxFlowSpecOutput.new(src: :nx_in_port)
|
||||
]
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(learn2)
|
||||
assert actions_bin == packet
|
||||
assert actions == [learn2]
|
||||
|
|
@ -463,11 +524,14 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_multipath.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
multipath = Openflow.Action.NxMultipath.new(
|
||||
algorithm: :modulo_n,
|
||||
basis: 50,
|
||||
dst_field: :reg0
|
||||
)
|
||||
|
||||
multipath =
|
||||
Openflow.Action.NxMultipath.new(
|
||||
algorithm: :modulo_n,
|
||||
basis: 50,
|
||||
dst_field: :reg0
|
||||
)
|
||||
|
||||
actions_bin = Openflow.Action.to_binary(multipath)
|
||||
assert actions_bin == packet
|
||||
assert actions == [multipath]
|
||||
|
|
@ -477,7 +541,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_note.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
note = Openflow.Action.NxNote.new(<<0x11, 0xe9, 0x9a, 0xad, 0x67, 0xf3>>)
|
||||
note = Openflow.Action.NxNote.new(<<0x11, 0xE9, 0x9A, 0xAD, 0x67, 0xF3>>)
|
||||
actions_bin = Openflow.Action.to_binary(note)
|
||||
assert actions_bin == packet
|
||||
assert actions == [note]
|
||||
|
|
@ -507,7 +571,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_pop_queue.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
pop_queue = Openflow.Action.NxPopQueue.new
|
||||
pop_queue = Openflow.Action.NxPopQueue.new()
|
||||
actions_bin = Openflow.Action.to_binary(pop_queue)
|
||||
assert actions_bin == packet
|
||||
assert actions == [pop_queue]
|
||||
|
|
@ -517,7 +581,7 @@ defmodule OfpActionTest do
|
|||
test_file = "test/packet_data/nx_reg_load.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
reg_load = Openflow.Action.NxRegLoad.new(dst_field: :nx_vlan_tci, value: 0xf009)
|
||||
reg_load = Openflow.Action.NxRegLoad.new(dst_field: :nx_vlan_tci, value: 0xF009)
|
||||
actions_bin = Openflow.Action.to_binary(reg_load)
|
||||
assert actions_bin == packet
|
||||
assert actions == [reg_load]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue