Openflow parser
This commit is contained in:
parent
70b0d8919e
commit
fc02a678de
338 changed files with 9081 additions and 0 deletions
566
test/ofp_action_test.exs
Normal file
566
test/ofp_action_test.exs
Normal file
|
|
@ -0,0 +1,566 @@
|
|||
defmodule OfpActionTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
test "Openflow.Action.NxBundle" 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]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(bundle)
|
||||
assert actions_bin == packet
|
||||
assert actions == [bundle]
|
||||
end
|
||||
|
||||
test "Openflow.Action.NxBundleLoad" 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]
|
||||
end
|
||||
|
||||
test "Openflow.Action.NxController" 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
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(controller)
|
||||
assert actions_bin == packet
|
||||
assert actions == [controller]
|
||||
end
|
||||
|
||||
test "Openflow.Action.NxController2" 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
|
||||
)
|
||||
assert actions == [controller2]
|
||||
end
|
||||
|
||||
describe "Openflow.Action.NxConntrack" do
|
||||
test "with ct(alg=ftp)" do
|
||||
test_file = "test/packet_data/nx_ct(alg=ftp).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(alg: 21)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(alg=tftp)" do
|
||||
test_file = "test/packet_data/nx_ct(alg=tftp).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(alg: 69)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit)" do
|
||||
test_file = "test/packet_data/nx_ct(commit).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(flags: [:commit])
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,force)" do
|
||||
test_file = "test/packet_data/nx_ct(commit, force).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(flags: [:commit, :force])
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
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)]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,exec(load:0xf009->NXM_NX_CT_MARK[]))" 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)]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,force,exec(load:0xf009->NXM_NX_CT_MARK[]))" 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)]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(dst))" 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])]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(dst=10.0.0.128-10.0.0.254,hash)).raw"
|
||||
packet = File.read!(test_file)
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(commit,nat(src))" 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])]
|
||||
)
|
||||
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,random))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=10.0.0.240,random)).raw"
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
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"
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
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:32768-65535,random))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=10.0.0.240:32768-65535,random)).raw"
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
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"
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
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"
|
||||
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
|
||||
)
|
||||
]
|
||||
)
|
||||
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:a18b,random))" do
|
||||
test_file = "test/packet_data/nx_ct(commit,nat(src=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:a18b')
|
||||
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]
|
||||
end
|
||||
|
||||
test "with ct(nat)" 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])
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(table=10)" do
|
||||
test_file = "test/packet_data/nx_ct(table=10).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(recirc_table: 10)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(zone=10)" do
|
||||
test_file = "test/packet_data/nx_ct(zone=10).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(zone_imm: 10)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct(zone=NXM_NX_REG0[0..15])" do
|
||||
test_file = "test/packet_data/nx_ct(zone=NXM_NX_REG0[0..15]).raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new(zone_src: :reg0, zone_offset: 0, zone_n_bits: 16)
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct" do
|
||||
test_file = "test/packet_data/nx_ct.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
ct = Openflow.Action.NxConntrack.new
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with ct_clear" 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
|
||||
actions_bin = Openflow.Action.to_binary(ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [ct]
|
||||
end
|
||||
|
||||
test "with dec_ttl" 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
|
||||
actions_bin = Openflow.Action.to_binary(dec_ttl)
|
||||
assert actions_bin == packet
|
||||
assert actions == [dec_ttl]
|
||||
end
|
||||
|
||||
test "with dec_ttl_cnt_ids" do
|
||||
test_file = "test/packet_data/nx_dec_ttl_cnt_ids.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
dec_ttl = Openflow.Action.NxDecTtlCntIds.new([32_768, 12_345, 90, 765, 1024])
|
||||
actions_bin = Openflow.Action.to_binary(dec_ttl)
|
||||
assert actions_bin == packet
|
||||
assert actions == [dec_ttl]
|
||||
end
|
||||
|
||||
test "with exit" do
|
||||
test_file = "test/packet_data/nx_exit.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
exit = Openflow.Action.NxExit.new
|
||||
actions_bin = Openflow.Action.to_binary(exit)
|
||||
assert actions_bin == packet
|
||||
assert actions == [exit]
|
||||
end
|
||||
|
||||
test "with fin_timeout" do
|
||||
test_file = "test/packet_data/nx_fin_timeout.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
fin_timeout = Openflow.Action.NxFinTimeout.new(idle_timeout: 10, hard_timeout: 20)
|
||||
actions_bin = Openflow.Action.to_binary(fin_timeout)
|
||||
assert actions_bin == packet
|
||||
assert actions == [fin_timeout]
|
||||
end
|
||||
|
||||
test "with learn" 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)
|
||||
]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(learn)
|
||||
assert actions_bin == packet
|
||||
assert actions == [learn]
|
||||
end
|
||||
|
||||
test "with learn2" 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)
|
||||
]
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(learn2)
|
||||
assert actions_bin == packet
|
||||
assert actions == [learn2]
|
||||
end
|
||||
|
||||
test "with multipath" 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
|
||||
)
|
||||
actions_bin = Openflow.Action.to_binary(multipath)
|
||||
assert actions_bin == packet
|
||||
assert actions == [multipath]
|
||||
end
|
||||
|
||||
test "with note" 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>>)
|
||||
actions_bin = Openflow.Action.to_binary(note)
|
||||
assert actions_bin == packet
|
||||
assert actions == [note]
|
||||
end
|
||||
|
||||
test "with output_reg" do
|
||||
test_file = "test/packet_data/nx_output_reg.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
output_reg = Openflow.Action.NxOutputReg.new(src_field: :reg1, n_bits: 6, offset: 5)
|
||||
actions_bin = Openflow.Action.to_binary(output_reg)
|
||||
assert actions_bin == packet
|
||||
assert actions == [output_reg]
|
||||
end
|
||||
|
||||
test "with output_trunc" do
|
||||
test_file = "test/packet_data/nx_output_trunc.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
output_trunc = Openflow.Action.NxOutputTrunc.new(port_number: 1, max_len: 100)
|
||||
actions_bin = Openflow.Action.to_binary(output_trunc)
|
||||
assert actions_bin == packet
|
||||
assert actions == [output_trunc]
|
||||
end
|
||||
|
||||
test "with pop_queue" 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
|
||||
actions_bin = Openflow.Action.to_binary(pop_queue)
|
||||
assert actions_bin == packet
|
||||
assert actions == [pop_queue]
|
||||
end
|
||||
|
||||
test "with reg_load" 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)
|
||||
actions_bin = Openflow.Action.to_binary(reg_load)
|
||||
assert actions_bin == packet
|
||||
assert actions == [reg_load]
|
||||
end
|
||||
|
||||
test "with reg_move" do
|
||||
test_file = "test/packet_data/nx_reg_move.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
reg_move = Openflow.Action.NxRegMove.new(src_field: :nx_in_port, dst_field: :nx_vlan_tci)
|
||||
actions_bin = Openflow.Action.to_binary(reg_move)
|
||||
assert actions_bin == packet
|
||||
assert actions == [reg_move]
|
||||
end
|
||||
|
||||
test "with resubmit" do
|
||||
test_file = "test/packet_data/nx_resubmit.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
resubmit = Openflow.Action.NxResubmit.new(5)
|
||||
actions_bin = Openflow.Action.to_binary(resubmit)
|
||||
assert actions_bin == packet
|
||||
assert actions == [resubmit]
|
||||
end
|
||||
|
||||
test "with resubmit_table" do
|
||||
test_file = "test/packet_data/nx_resubmit_table.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
resubmit_table = Openflow.Action.NxResubmitTable.new(in_port: 10, table_id: 5)
|
||||
actions_bin = Openflow.Action.to_binary(resubmit_table)
|
||||
assert actions_bin == packet
|
||||
assert actions == [resubmit_table]
|
||||
end
|
||||
|
||||
test "with resubmit_table_ct" do
|
||||
test_file = "test/packet_data/nx_resubmit_table_ct.raw"
|
||||
packet = File.read!(test_file)
|
||||
actions = Openflow.Action.read(packet)
|
||||
resubmit_table_ct = Openflow.Action.NxResubmitTableCt.new(in_port: 10, table_id: 5)
|
||||
actions_bin = Openflow.Action.to_binary(resubmit_table_ct)
|
||||
assert actions_bin == packet
|
||||
assert actions == [resubmit_table_ct]
|
||||
end
|
||||
end
|
||||
end
|
||||
52
test/ofp_echo_test.exs
Normal file
52
test/ofp_echo_test.exs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
defmodule OfpEchoTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_ECHO_REQUEST packet" do
|
||||
{:ok, %Openflow.Echo.Request{} = echo, ""} =
|
||||
"test/packet_data/ofp_echo_request.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert echo.version == 4
|
||||
assert echo.xid == 0
|
||||
assert echo.data == ""
|
||||
end
|
||||
|
||||
test "with OFP_ECHO_REPLY packet" do
|
||||
{:ok, %Openflow.Echo.Reply{} = echo, ""} =
|
||||
"test/packet_data/ofp_echo_reply.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert echo.version == 4
|
||||
assert echo.xid == 0
|
||||
assert echo.data == ""
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.Echo.Request{}" do
|
||||
echo = %Openflow.Echo.Request{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
data: ""
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_echo_request.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(echo) == expect
|
||||
end
|
||||
|
||||
test "with %Openflow.Echo.Reply{}" do
|
||||
echo = %Openflow.Echo.Reply{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
data: ""
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_echo_reply.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(echo) == expect
|
||||
end
|
||||
end
|
||||
end
|
||||
56
test/ofp_error_test.exs
Normal file
56
test/ofp_error_test.exs
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
defmodule OfpErrorTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_ERROR packet" do
|
||||
{:ok, error, ""} =
|
||||
"test/packet_data/ofp_error.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert error.version == 4
|
||||
assert error.xid == 0
|
||||
assert error.type == :bad_action
|
||||
assert error.code == :unsupported_order
|
||||
assert error.data == "fugafuga"
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.Error{}" do
|
||||
error = %Openflow.ErrorMsg{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
type: :bad_action,
|
||||
code: :unsupported_order,
|
||||
data: "fugafuga",
|
||||
}
|
||||
|
||||
expect =
|
||||
"test/packet_data/ofp_error.raw"
|
||||
|> File.read!
|
||||
|
||||
assert Openflow.to_binary(error) == expect
|
||||
end
|
||||
|
||||
test "with experimenter %Openflow.Error{}" do
|
||||
error = %Openflow.ErrorMsg{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
type: :experimenter,
|
||||
exp_type: 1,
|
||||
experimenter: 0xdeadbeef,
|
||||
data: "hogehoge",
|
||||
}
|
||||
|
||||
expect = <<
|
||||
4, 1, 0, 24, 0, 0, 0,
|
||||
0, 255, 255, 0, 1, 222,
|
||||
173, 190, 239, 104, 111, 103,
|
||||
101, 104, 111, 103, 101
|
||||
>>
|
||||
|
||||
assert Openflow.to_binary(error) == expect
|
||||
end
|
||||
end
|
||||
end
|
||||
58
test/ofp_features_test.exs
Normal file
58
test/ofp_features_test.exs
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
defmodule OfpFeaturesTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_FEATURES_REQUEST packet" do
|
||||
{:ok, %Openflow.Features.Request{} = features, ""} =
|
||||
"test/packet_data/ofp_features_request.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert features.version == 4
|
||||
assert features.xid == 0
|
||||
end
|
||||
|
||||
test "with OFP_FEATURES_REPLY packet" do
|
||||
{:ok, %Openflow.Features.Reply{} = features, ""} =
|
||||
"test/packet_data/ofp_features_reply.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert features.version == 4
|
||||
assert features.xid == 0
|
||||
assert features.datapath_id == "0000000000000001"
|
||||
assert features.n_buffers == 255
|
||||
assert features.n_tables == 255
|
||||
assert features.aux_id == 0
|
||||
assert features.capabilities == [:flow_stats, :table_stats, :port_stats, :group_stats, :queue_stats]
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.Features.Request{}" do
|
||||
features = %Openflow.Features.Request{
|
||||
version: 4,
|
||||
xid: 0
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_features_request.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(features) == expect
|
||||
end
|
||||
end
|
||||
|
||||
test "with %Openflow.Features.Reply{}" do
|
||||
features = %Openflow.Features.Reply{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
datapath_id: "0000000000000001",
|
||||
n_buffers: 255,
|
||||
n_tables: 255,
|
||||
aux_id: 0,
|
||||
capabilities: [:flow_stats, :table_stats, :port_stats, :group_stats, :queue_stats],
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_features_reply.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(features) == expect
|
||||
end
|
||||
end
|
||||
280
test/ofp_flow_mod_test.exs
Normal file
280
test/ofp_flow_mod_test.exs
Normal file
|
|
@ -0,0 +1,280 @@
|
|||
defmodule OfpFlowModTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
@flow_mod1 "test/packet_data/4-2-ofp_flow_mod.packet"
|
||||
@flow_mod2 "test/packet_data/4-3-ofp_flow_mod.packet"
|
||||
@flow_mod3 "test/packet_data/4-46-ofp_flow_mod.packet"
|
||||
@flow_mod4 "test/packet_data/4-60-ofp_flow_mod.packet"
|
||||
@flow_mod5 "test/packet_data/libofproto-OFP13-flow_mod.packet"
|
||||
@flow_mod6 "test/packet_data/libofproto-OFP13-flow_mod.truncated64"
|
||||
@flow_mod7 "test/packet_data/libofproto-OFP13-flow_mod_conjunction.packet"
|
||||
@flow_mod8 "test/packet_data/libofproto-OFP13-flow_mod_match_conj.packet"
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_FLOW_MOD packet(1)" do
|
||||
binary = File.read!(@flow_mod1)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0
|
||||
assert fm.cookie_mask == 0
|
||||
assert fm.table_id == 1
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 123
|
||||
assert fm.buffer_id == 0xffff
|
||||
assert fm.out_port == :any
|
||||
assert fm.out_group == :any
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(eth_dst: "f20ba47df8ea")
|
||||
assert fm.instructions == [
|
||||
Openflow.Instruction.WriteActions.new([
|
||||
Openflow.Action.SetField.new({:vlan_vid, 258}),
|
||||
Openflow.Action.CopyTtlOut.new,
|
||||
Openflow.Action.CopyTtlIn.new,
|
||||
Openflow.Action.CopyTtlIn.new,
|
||||
Openflow.Action.PopPbb.new,
|
||||
Openflow.Action.PushPbb.new(4660),
|
||||
Openflow.Action.PopMpls.new(39030),
|
||||
Openflow.Action.PushMpls.new(34887),
|
||||
Openflow.Action.PopVlan.new,
|
||||
Openflow.Action.PushVlan.new(33024),
|
||||
Openflow.Action.DecMplsTtl.new,
|
||||
Openflow.Action.SetMplsTtl.new(10),
|
||||
Openflow.Action.DecNwTtl.new,
|
||||
Openflow.Action.SetNwTtl.new(10),
|
||||
Openflow.Action.Experimenter.new(101, <<0, 1, 2, 3, 4, 5, 6, 7>>),
|
||||
Openflow.Action.SetQueue.new(3),
|
||||
Openflow.Action.Group.new(99),
|
||||
Openflow.Action.Output.new(6)
|
||||
]),
|
||||
Openflow.Instruction.ApplyActions.new([
|
||||
Openflow.Action.SetField.new({:eth_src, "010203040506"}),
|
||||
Openflow.Action.SetField.new({:onf_pbb_uca, 1})
|
||||
])
|
||||
]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(2)" do
|
||||
binary = File.read!(@flow_mod2)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0
|
||||
assert fm.cookie_mask == 0
|
||||
assert fm.table_id == 0
|
||||
assert fm.cookie == 0
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 123
|
||||
assert fm.buffer_id == 0xffff
|
||||
assert fm.out_port == :any
|
||||
assert fm.out_group == :any
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(in_port: 6, eth_src: "f20ba47df8ea")
|
||||
assert fm.instructions == [Openflow.Instruction.GotoTable.new(1)]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(3)" do
|
||||
binary = File.read!(@flow_mod3)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0
|
||||
assert fm.cookie_mask == 0
|
||||
assert fm.table_id == 1
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 123
|
||||
assert fm.buffer_id == 0xffff
|
||||
assert fm.out_port == :any
|
||||
assert fm.out_group == :any
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(eth_dst: "f20ba47df8ea")
|
||||
assert fm.instructions == [
|
||||
Openflow.Instruction.Meter.new(1),
|
||||
Openflow.Instruction.WriteActions.new([Openflow.Action.Output.new(6)])
|
||||
]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(4)" do
|
||||
binary = File.read!(@flow_mod4)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0
|
||||
assert fm.cookie_mask == 0
|
||||
assert fm.table_id == 1
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 123
|
||||
assert fm.buffer_id == 0xffff
|
||||
assert fm.out_port == :any
|
||||
assert fm.out_group == :any
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(
|
||||
in_port: 84_281_096,
|
||||
in_phy_port: 16_909_060,
|
||||
metadata: 283_686_952_306_183,
|
||||
eth_type: 2054,
|
||||
eth_dst: "ffffffffffff",
|
||||
eth_src: "f20ba47df8ea",
|
||||
vlan_vid: 999,
|
||||
ip_dscp: 9,
|
||||
ip_ecn: 3,
|
||||
ip_proto: 99,
|
||||
ipv4_src: {1, 2, 3, 4},
|
||||
ipv4_dst: {1, 2, 3, 4},
|
||||
tcp_src: 8080,
|
||||
tcp_dst: 18_080,
|
||||
udp_src: 28_080,
|
||||
udp_dst: 55_936,
|
||||
sctp_src: 48_080,
|
||||
sctp_dst: 59_328,
|
||||
icmpv4_type: 100,
|
||||
icmpv4_code: 101,
|
||||
arp_op: 1,
|
||||
arp_spa: {10, 0, 0, 1},
|
||||
arp_tpa: {10, 0, 0, 3},
|
||||
arp_sha: "f20ba47df8ea",
|
||||
arp_tha: "000000000000",
|
||||
ipv6_src: {65152, 0, 0, 0, 61451, 42239, 65096, 10405},
|
||||
ipv6_dst: {65152, 0, 0, 0, 61451, 42239, 65029, 47068},
|
||||
ipv6_flabel: 541_473,
|
||||
icmpv6_type: 200,
|
||||
icmpv6_code: 201,
|
||||
ipv6_nd_target: {65152, 0, 0, 0, 2656, 28415, 65151, 29927},
|
||||
ipv6_nd_sll: "00000000029a",
|
||||
ipv6_nd_tll: "00000000022b",
|
||||
mpls_label: 624_485,
|
||||
mpls_tc: 5,
|
||||
mpls_bos: 1,
|
||||
pbb_isid: 11_259_375,
|
||||
tunnel_id: 651061555542690057,
|
||||
ipv6_exthdr: [:auth, :frag, :router, :hop, :unrep, :unseq],
|
||||
onf_pbb_uca: 1,
|
||||
tun_src: {1, 2, 3, 4},
|
||||
tun_dst: {1, 2, 3, 4}
|
||||
)
|
||||
assert fm.instructions == []
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(5)" do
|
||||
binary = File.read!(@flow_mod5)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0x123456789abcdef0
|
||||
assert fm.cookie_mask == 0xffffffffffffffff
|
||||
assert fm.table_id == 2
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 0
|
||||
assert fm.buffer_id == 0
|
||||
assert fm.out_port == 0
|
||||
assert fm.out_group == 0
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(
|
||||
in_port: 43981,
|
||||
eth_dst: "aabbcc998877",
|
||||
eth_type: 2048,
|
||||
vlan_vid: 5095,
|
||||
ipv4_dst: {192, 168, 2, 1},
|
||||
tunnel_id: 50_000,
|
||||
tun_src: {192, 168, 2, 3},
|
||||
tun_dst: {192, 168, 2, 4}
|
||||
)
|
||||
assert fm.instructions == [
|
||||
Openflow.Instruction.ApplyActions.new([
|
||||
Openflow.Action.PopVlan.new,
|
||||
Openflow.Action.SetField.new({:ipv4_dst, {192, 168, 2, 9}}),
|
||||
Openflow.Action.NxLearn.new(
|
||||
hard_timeout: 300,
|
||||
priority: 1,
|
||||
table_id: 99,
|
||||
flow_specs: [
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :vlan_vid, dst: :vlan_vid, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecMatch.new(src: :nx_eth_src, dst: :nx_eth_dst),
|
||||
Openflow.Action.NxFlowSpecLoad.new(src: 0, dst: :vlan_vid, n_bits: 12),
|
||||
Openflow.Action.NxFlowSpecLoad.new(src: :tun_id, dst: :tun_id),
|
||||
Openflow.Action.NxFlowSpecOutput.new(src: :in_port)
|
||||
]
|
||||
)
|
||||
]),
|
||||
Openflow.Instruction.GotoTable.new(100)
|
||||
]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(6)" do\
|
||||
{:error, :binary_too_small} =
|
||||
@flow_mod6
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(7)" do
|
||||
binary = File.read!(@flow_mod7)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0x123456789abcdef0
|
||||
assert fm.cookie_mask == 0xffffffffffffffff
|
||||
assert fm.table_id == 4
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 0
|
||||
assert fm.buffer_id == 0
|
||||
assert fm.out_port == 0
|
||||
assert fm.out_group == 0
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(
|
||||
in_port: 43981,
|
||||
eth_dst: "aabbcc998877",
|
||||
eth_type: 2048,
|
||||
vlan_vid: 5095,
|
||||
ipv4_dst: {192, 168, 2, 1},
|
||||
tunnel_id: 50_000,
|
||||
tun_src: {192, 168, 2, 3},
|
||||
tun_dst: {192, 168, 2, 4}
|
||||
)
|
||||
assert fm.instructions == [
|
||||
Openflow.Instruction.ApplyActions.new([
|
||||
Openflow.Action.NxConjunction.new(clause: 1, id: 0xabcdef, n_clauses: 2)
|
||||
])
|
||||
]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_MOD packet(8)" do
|
||||
binary = File.read!(@flow_mod8)
|
||||
{:ok, fm, ""} = Openflow.read(binary)
|
||||
|
||||
assert fm.cookie == 0x123456789abcdef0
|
||||
assert fm.cookie_mask == 0xffffffffffffffff
|
||||
assert fm.table_id == 3
|
||||
assert fm.command == :add
|
||||
assert fm.idle_timeout == 0
|
||||
assert fm.hard_timeout == 0
|
||||
assert fm.priority == 0
|
||||
assert fm.buffer_id == 0
|
||||
assert fm.out_port == 0
|
||||
assert fm.out_group == 0
|
||||
assert fm.flags == []
|
||||
assert fm.match == Openflow.Match.new(conj_id: 0xabcdef)
|
||||
assert fm.instructions == [
|
||||
Openflow.Instruction.ApplyActions.new([
|
||||
Openflow.Action.PopVlan.new,
|
||||
Openflow.Action.SetField.new({:ipv4_dst, {192, 168, 2, 9}})
|
||||
]),
|
||||
Openflow.Instruction.GotoTable.new(100)
|
||||
]
|
||||
assert Openflow.to_binary(fm) == binary
|
||||
end
|
||||
end
|
||||
end
|
||||
57
test/ofp_flow_removed_test.exs
Normal file
57
test/ofp_flow_removed_test.exs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
defmodule OfpFlowRemovedTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_FLOW_REMOVED packet(with a match field)" do
|
||||
{:ok, flow_removed, ""} =
|
||||
"test/packet_data/4-40-ofp_flow_removed.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert flow_removed.version == 4
|
||||
assert flow_removed.xid == 0
|
||||
assert flow_removed.cookie == 0
|
||||
assert flow_removed.priority == 0xffff
|
||||
assert flow_removed.reason == :idle_timeout
|
||||
assert flow_removed.table_id == 0
|
||||
assert flow_removed.duration_sec == 3
|
||||
assert flow_removed.duration_nsec == 48_825_000
|
||||
assert flow_removed.idle_timeout == 3
|
||||
assert flow_removed.hard_timeout == 0
|
||||
assert flow_removed.packet_count == 1
|
||||
assert flow_removed.byte_count == 86
|
||||
assert flow_removed.match == [eth_dst: "f20ba47df8ea"]
|
||||
end
|
||||
|
||||
test "with OFP_FLOW_REMOVED packet(with match fields)" do
|
||||
{:ok, flow_removed, ""} =
|
||||
"test/packet_data/libofproto-OFP13-flow_removed.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert flow_removed.version == 4
|
||||
assert flow_removed.xid == 0
|
||||
assert flow_removed.cookie == 0x123456789abcdef0
|
||||
assert flow_removed.priority == 100
|
||||
assert flow_removed.reason == :idle_timeout
|
||||
assert flow_removed.table_id == 1
|
||||
assert flow_removed.duration_sec == 600
|
||||
assert flow_removed.duration_nsec == 500
|
||||
assert flow_removed.idle_timeout == 400
|
||||
assert flow_removed.hard_timeout == 300
|
||||
assert flow_removed.packet_count == 200
|
||||
assert flow_removed.byte_count == 100
|
||||
assert flow_removed.match == [
|
||||
in_port: 43_981,
|
||||
eth_dst: "aabbcc998877",
|
||||
eth_type: 2048,
|
||||
vlan_vid: 5095,
|
||||
ipv4_dst: {192, 168, 2, 1},
|
||||
tunnel_id: 50_000,
|
||||
tun_src: {192, 168, 2, 3},
|
||||
tun_dst: {192, 168, 2, 4}
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
52
test/ofp_get_config_test.exs
Normal file
52
test/ofp_get_config_test.exs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
defmodule OfpGetConfigTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_GET_CONFIG_REQUEST packet" do
|
||||
{:ok, %Openflow.GetConfig.Request{} = config, ""} =
|
||||
"test/packet_data/ofp_get_config_request.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert config.version == 4
|
||||
assert config.xid == 0
|
||||
end
|
||||
|
||||
test "with OFP_GET_CONFIG_REPLY packet" do
|
||||
{:ok, %Openflow.GetConfig.Reply{} = config, ""} =
|
||||
"test/packet_data/ofp_get_config_reply.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert config.version == 4
|
||||
assert config.xid == 0
|
||||
assert config.flags == []
|
||||
assert config.miss_send_len == 128
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.GetConfig.Request{}" do
|
||||
config = %Openflow.GetConfig.Request{
|
||||
version: 4,
|
||||
xid: 0
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_get_config_request.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(config) == expect
|
||||
end
|
||||
|
||||
test "with %Openflow.GetConfig.Reply{}" do
|
||||
config = %Openflow.GetConfig.Reply{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
flags: [],
|
||||
miss_send_len: 128
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_get_config_reply.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(config) == expect
|
||||
end
|
||||
end
|
||||
end
|
||||
26
test/ofp_group_mod_test.exs
Normal file
26
test/ofp_group_mod_test.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule OfpGroupModTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_GROUP_MOD packet" do
|
||||
binary = File.read!("test/packet_data/4-21-ofp_group_mod.packet")
|
||||
{:ok, group_mod, ""} = Openflow.read(binary)
|
||||
|
||||
assert group_mod.version == 4
|
||||
assert group_mod.xid == 0
|
||||
assert group_mod.command == :add
|
||||
assert group_mod.type == :all
|
||||
assert group_mod.group_id == 1
|
||||
assert group_mod.buckets == [
|
||||
Openflow.Bucket.new(
|
||||
weight: 1,
|
||||
watch_port: 1,
|
||||
watch_group: 1,
|
||||
actions: [Openflow.Action.Output.new(2)]
|
||||
)
|
||||
]
|
||||
assert Openflow.to_binary(group_mod) == binary
|
||||
end
|
||||
end
|
||||
end
|
||||
26
test/ofp_hello_test.exs
Normal file
26
test/ofp_hello_test.exs
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
defmodule OfpHelloTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_HELLO packet" do
|
||||
{:ok, hello, ""} =
|
||||
"test/packet_data/ofp_hello.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert hello.version == 4
|
||||
assert hello.xid == 0
|
||||
assert hello.elements == [versionbitmap: [30, 10, 9, 3, 2, 1]]
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.Hello{}" do
|
||||
hello = Openflow.Hello.new([30, 10, 9, 3, 2, 1])
|
||||
expect =
|
||||
"test/packet_data/ofp_hello.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(hello) == expect
|
||||
end
|
||||
end
|
||||
end
|
||||
87
test/ofp_packet_in_test.exs
Normal file
87
test/ofp_packet_in_test.exs
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
defmodule OfpPacketInTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_PACKET_IN packet(with simple matches)" do
|
||||
{:ok, pktin, ""} =
|
||||
"test/packet_data/4-4-ofp_packet_in.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert pktin.version == 4
|
||||
assert pktin.xid == 0
|
||||
assert pktin.total_len == 42
|
||||
assert pktin.table_id == 1
|
||||
assert pktin.reason == :action
|
||||
assert pktin.in_port == 6
|
||||
assert pktin.match == [
|
||||
eth_type: 2054,
|
||||
eth_dst: "ffffffffffff",
|
||||
eth_src: "f20ba47df8ea",
|
||||
arp_op: 1,
|
||||
arp_spa: {10, 0, 0, 1},
|
||||
arp_tpa: {10, 0, 0, 3},
|
||||
arp_sha: "f20ba47df8ea",
|
||||
arp_tha: "000000000000"
|
||||
]
|
||||
end
|
||||
|
||||
test "with OFP_PACKET_IN packet(with complex matches)" do
|
||||
{:ok, pktin, ""} =
|
||||
"test/packet_data/4-59-ofp_packet_in.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert pktin.version == 4
|
||||
assert pktin.xid == 0
|
||||
assert pktin.total_len == 0
|
||||
assert pktin.table_id == 200
|
||||
assert pktin.reason == :no_match
|
||||
assert pktin.in_port == 84281096
|
||||
assert pktin.match == [
|
||||
in_phy_port: 16909060,
|
||||
metadata: 283686952306183,
|
||||
eth_type: 2054,
|
||||
eth_dst: "ffffffffffff",
|
||||
eth_src: "f20ba47df8ea",
|
||||
vlan_vid: 999,
|
||||
ip_dscp: 9,
|
||||
ip_ecn: 3,
|
||||
ip_proto: 99,
|
||||
ipv4_src: {1, 2, 3, 4},
|
||||
ipv4_dst: {1, 2, 3, 4},
|
||||
tcp_src: 8080,
|
||||
tcp_dst: 18080,
|
||||
udp_src: 28080,
|
||||
udp_dst: 55936,
|
||||
sctp_src: 48080,
|
||||
sctp_dst: 59328,
|
||||
icmpv4_type: 100,
|
||||
icmpv4_code: 101,
|
||||
arp_op: 1,
|
||||
arp_spa: {10, 0, 0, 1},
|
||||
arp_tpa: {10, 0, 0, 3},
|
||||
arp_sha: "f20ba47df8ea",
|
||||
arp_tha: "000000000000",
|
||||
ipv6_src: {65152, 0, 0, 0, 61451, 42239, 65096, 10405},
|
||||
ipv6_dst: {65152, 0, 0, 0, 61451, 42239, 65029, 47068},
|
||||
ipv6_flabel: 541473,
|
||||
icmpv6_type: 200,
|
||||
icmpv6_code: 201,
|
||||
ipv6_nd_target: {65152, 0, 0, 0, 2656, 28415, 65151, 29927},
|
||||
ipv6_nd_sll: "00000000029a",
|
||||
ipv6_nd_tll: "00000000022b",
|
||||
mpls_label: 624485,
|
||||
mpls_tc: 5,
|
||||
mpls_bos: 1,
|
||||
pbb_isid: 11259375,
|
||||
tunnel_id: 651061555542690057,
|
||||
ipv6_exthdr: [:auth, :frag, :router, :hop, :unrep, :unseq],
|
||||
onf_pbb_uca: 1,
|
||||
tun_src: {1, 2, 3, 4},
|
||||
tun_dst: {1, 2, 3, 4}
|
||||
]
|
||||
end
|
||||
end
|
||||
end
|
||||
49
test/ofp_packet_out_test.exs
Normal file
49
test/ofp_packet_out_test.exs
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
defmodule OfpPacketOutTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
@packet <<
|
||||
0xf2, 0x0b, 0xa4, 0xd0, 0x3f, 0x70, 0xf2, 0x0b,
|
||||
0xa4, 0x7d, 0xf8, 0xea, 0x08, 0x00, 0x45, 0x00,
|
||||
0x00, 0x54, 0xf8, 0x1a, 0x00, 0x00, 0xff, 0x01,
|
||||
0xaf, 0x8b, 0x0a, 0x00, 0x00, 0x01, 0x0a, 0x00,
|
||||
0x00, 0x02, 0x08, 0x00, 0x02, 0x08, 0xf7, 0x60,
|
||||
0x00, 0x00, 0x31, 0xd6, 0x02, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00, 0xab, 0x8d, 0x2d, 0x31, 0x00, 0x00,
|
||||
0x00, 0x00, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15,
|
||||
0x16, 0x17, 0x18, 0x19, 0x1a, 0x1b, 0x1c, 0x1d,
|
||||
0x1e, 0x1f, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
|
||||
0x26, 0x27, 0x28, 0x29, 0x2a, 0x2b, 0x2c, 0x2d,
|
||||
0x2e, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
|
||||
0x00, 0x00
|
||||
>>
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_PACKET_OUT packet" do
|
||||
{:ok, pktout, ""} =
|
||||
"test/packet_data/libofproto-OFP13-ofp_packet_out_packet_library.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert pktout.version == 4
|
||||
assert pktout.xid == 0
|
||||
assert pktout.buffer_id == :no_buffer
|
||||
assert pktout.in_port == :controller
|
||||
assert pktout.actions == [%Openflow.Action.Output{max_len: :no_buffer, port_number: :all}]
|
||||
assert pktout.data == @packet
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
pktout = %Openflow.PacketOut{
|
||||
actions: [Openflow.Action.Output.new(port_number: :all)],
|
||||
data: @packet
|
||||
}
|
||||
|
||||
expect =
|
||||
"test/packet_data/libofproto-OFP13-ofp_packet_out_packet_library.packet"
|
||||
|> File.read!
|
||||
|
||||
assert Openflow.to_binary(pktout) == expect
|
||||
end
|
||||
end
|
||||
34
test/ofp_port_mod_test.exs
Normal file
34
test/ofp_port_mod_test.exs
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
defmodule OfpPortModTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_PORT_MOD packet(1)" do
|
||||
binary = File.read!("test/packet_data/4-22-ofp_port_mod.packet")
|
||||
{:ok, port_mod, ""} = Openflow.read(binary)
|
||||
|
||||
assert port_mod.version == 4
|
||||
assert port_mod.xid == 0
|
||||
assert port_mod.number == 1
|
||||
assert port_mod.hw_addr == "001100001111"
|
||||
assert port_mod.config == []
|
||||
assert port_mod.mask == []
|
||||
assert port_mod.advertise == [:fiber]
|
||||
assert Openflow.to_binary(port_mod) == binary
|
||||
end
|
||||
end
|
||||
|
||||
test "with OFP_PORT_MOD packet(2)" do
|
||||
binary = File.read!("test/packet_data/libofproto-OFP13-port_mod.packet")
|
||||
{:ok, port_mod, ""} = Openflow.read(binary)
|
||||
|
||||
assert port_mod.version == 4
|
||||
assert port_mod.xid == 0
|
||||
assert port_mod.number == 1
|
||||
assert port_mod.hw_addr == "aabbcc998877"
|
||||
assert port_mod.config == [:port_down]
|
||||
assert port_mod.mask == [:port_down]
|
||||
assert port_mod.advertise == [:"100mb_fd", :copper, :autoneg]
|
||||
assert Openflow.to_binary(port_mod) == binary
|
||||
end
|
||||
end
|
||||
48
test/ofp_port_status_test.exs
Normal file
48
test/ofp_port_status_test.exs
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
defmodule OfpPortStatusTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_PORT_STATUS packet" do
|
||||
{:ok, port_status, ""} =
|
||||
"test/packet_data/libofproto-OFP13-port_status.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert port_status.version == 4
|
||||
assert port_status.xid == 0
|
||||
assert port_status.reason == :modify
|
||||
assert port_status.port.number == 1
|
||||
assert port_status.port.hw_addr == "ffffffffffff"
|
||||
assert port_status.port.name == "eth0"
|
||||
assert port_status.port.config == []
|
||||
assert port_status.port.state == [:live]
|
||||
assert port_status.port.current_features == [:"100mb_fd", :copper, :autoneg]
|
||||
assert port_status.port.advertised_features == [:"100mb_fd", :copper, :autoneg]
|
||||
assert port_status.port.peer_features == [:"100mb_fd", :copper, :autoneg]
|
||||
assert port_status.port.current_speed == 50_000
|
||||
assert port_status.port.max_speed == 100_000
|
||||
end
|
||||
|
||||
test "with OFP_PORT_STATUS packet(with kanji port name)" do
|
||||
{:ok, port_status, ""} =
|
||||
"test/packet_data/4-39-ofp_port_status.packet"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
|
||||
assert port_status.version == 4
|
||||
assert port_status.xid == 0
|
||||
assert port_status.reason == :add
|
||||
assert port_status.port.number == 7
|
||||
assert port_status.port.hw_addr == "f20ba4d03f70"
|
||||
assert port_status.port.name == "私のポート"
|
||||
assert port_status.port.config == []
|
||||
assert port_status.port.state == [:live]
|
||||
assert port_status.port.current_features == [:"100mb_fd", :copper, :autoneg]
|
||||
assert port_status.port.advertised_features == [:copper, :autoneg]
|
||||
assert port_status.port.peer_features == [:"100mb_fd", :copper, :autoneg]
|
||||
assert port_status.port.current_speed == 5_000
|
||||
assert port_status.port.max_speed == 5_000
|
||||
end
|
||||
end
|
||||
end
|
||||
32
test/ofp_set_config_test.exs
Normal file
32
test/ofp_set_config_test.exs
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
defmodule OfpSetConfigTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_SET_CONFIG packet" do
|
||||
{:ok, %Openflow.SetConfig{} = config, ""} =
|
||||
"test/packet_data/ofp_set_config.raw"
|
||||
|> File.read!
|
||||
|> Openflow.read
|
||||
assert config.version == 4
|
||||
assert config.xid == 0
|
||||
assert config.flags == []
|
||||
assert config.miss_send_len == 128
|
||||
end
|
||||
end
|
||||
|
||||
describe "Openflow.to_binary/1" do
|
||||
test "with %Openflow.SetConfig{}" do
|
||||
config = %Openflow.SetConfig{
|
||||
version: 4,
|
||||
xid: 0,
|
||||
flags: [],
|
||||
miss_send_len: 128
|
||||
}
|
||||
expect =
|
||||
"test/packet_data/ofp_set_config.raw"
|
||||
|> File.read!
|
||||
assert Openflow.to_binary(config) == expect
|
||||
end
|
||||
end
|
||||
end
|
||||
28
test/ofp_table_mod_test.exs
Normal file
28
test/ofp_table_mod_test.exs
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
defmodule OfpTableModTest do
|
||||
use ExUnit.Case
|
||||
doctest Openflow
|
||||
|
||||
describe "Openflow.read/1" do
|
||||
test "with OFP_TABLE_MOD packet(1)" do
|
||||
binary = File.read!("test/packet_data/libofproto-OFP13-table_mod.packet")
|
||||
{:ok, table_mod, ""} = Openflow.read(binary)
|
||||
|
||||
assert table_mod.version == 4
|
||||
assert table_mod.xid == 0
|
||||
assert table_mod.table_id == :all
|
||||
assert table_mod.config == 0
|
||||
assert Openflow.to_binary(table_mod) == binary
|
||||
end
|
||||
end
|
||||
|
||||
test "with OFP_TABLE_MOD packet(2)" do
|
||||
binary = File.read!("test/packet_data/4-23-ofp_table_mod.packet")
|
||||
{:ok, table_mod, ""} = Openflow.read(binary)
|
||||
|
||||
assert table_mod.version == 4
|
||||
assert table_mod.xid == 0
|
||||
assert table_mod.table_id == :all
|
||||
assert table_mod.config == 0
|
||||
assert Openflow.to_binary(table_mod) == binary
|
||||
end
|
||||
end
|
||||
|
|
@ -0,0 +1 @@
|
|||
shun159@shun159.19402:1510242034
|
||||
BIN
test/packet_data/4-0-ofp_desc_reply.packet
Normal file
BIN
test/packet_data/4-0-ofp_desc_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-1-ofp_packet_out.packet
Normal file
BIN
test/packet_data/4-1-ofp_packet_out.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-10-ofp_hello.packet
Normal file
BIN
test/packet_data/4-10-ofp_hello.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-11-ofp_flow_stats_request.packet
Normal file
BIN
test/packet_data/4-11-ofp_flow_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-12-ofp_flow_stats_reply.packet
Normal file
BIN
test/packet_data/4-12-ofp_flow_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-13-ofp_echo_request.packet
Normal file
BIN
test/packet_data/4-13-ofp_echo_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-14-ofp_echo_reply.packet
Normal file
BIN
test/packet_data/4-14-ofp_echo_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-15-ofp_error_msg.packet
Normal file
BIN
test/packet_data/4-15-ofp_error_msg.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-16-ofp_experimenter.packet
Normal file
BIN
test/packet_data/4-16-ofp_experimenter.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-17-ofp_barrier_request.packet
Normal file
BIN
test/packet_data/4-17-ofp_barrier_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-18-ofp_barrier_reply.packet
Normal file
BIN
test/packet_data/4-18-ofp_barrier_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-19-ofp_role_request.packet
Normal file
BIN
test/packet_data/4-19-ofp_role_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-2-ofp_flow_mod.packet
Normal file
BIN
test/packet_data/4-2-ofp_flow_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-20-ofp_role_reply.packet
Normal file
BIN
test/packet_data/4-20-ofp_role_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-21-ofp_group_mod.packet
Normal file
BIN
test/packet_data/4-21-ofp_group_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-22-ofp_port_mod.packet
Normal file
BIN
test/packet_data/4-22-ofp_port_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-23-ofp_table_mod.packet
Normal file
BIN
test/packet_data/4-23-ofp_table_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-24-ofp_desc_request.packet
Normal file
BIN
test/packet_data/4-24-ofp_desc_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-25-ofp_aggregate_stats_request.packet
Normal file
BIN
test/packet_data/4-25-ofp_aggregate_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-26-ofp_aggregate_stats_reply.packet
Normal file
BIN
test/packet_data/4-26-ofp_aggregate_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-27-ofp_table_stats_request.packet
Normal file
BIN
test/packet_data/4-27-ofp_table_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-28-ofp_table_stats_reply.packet
Normal file
BIN
test/packet_data/4-28-ofp_table_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-29-ofp_port_stats_request.packet
Normal file
BIN
test/packet_data/4-29-ofp_port_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-3-ofp_flow_mod.packet
Normal file
BIN
test/packet_data/4-3-ofp_flow_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-30-ofp_port_stats_reply.packet
Normal file
BIN
test/packet_data/4-30-ofp_port_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-31-ofp_group_features_request.packet
Normal file
BIN
test/packet_data/4-31-ofp_group_features_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-32-ofp_group_features_reply.packet
Normal file
BIN
test/packet_data/4-32-ofp_group_features_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-33-ofp_group_desc_request.packet
Normal file
BIN
test/packet_data/4-33-ofp_group_desc_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-34-ofp_group_desc_reply.packet
Normal file
BIN
test/packet_data/4-34-ofp_group_desc_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-35-ofp_queue_get_config_request.packet
Normal file
BIN
test/packet_data/4-35-ofp_queue_get_config_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-36-ofp_queue_get_config_reply.packet
Normal file
BIN
test/packet_data/4-36-ofp_queue_get_config_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-37-ofp_queue_stats_request.packet
Normal file
BIN
test/packet_data/4-37-ofp_queue_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-38-ofp_queue_stats_reply.packet
Normal file
BIN
test/packet_data/4-38-ofp_queue_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-39-ofp_port_status.packet
Normal file
BIN
test/packet_data/4-39-ofp_port_status.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-4-ofp_packet_in.packet
Normal file
BIN
test/packet_data/4-4-ofp_packet_in.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-40-ofp_flow_removed.packet
Normal file
BIN
test/packet_data/4-40-ofp_flow_removed.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-41-ofp_error_msg_experimenter.packet
Normal file
BIN
test/packet_data/4-41-ofp_error_msg_experimenter.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-42-ofp_get_async_request.packet
Normal file
BIN
test/packet_data/4-42-ofp_get_async_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-43-ofp_get_async_reply.packet
Normal file
BIN
test/packet_data/4-43-ofp_get_async_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-44-ofp_set_async.packet
Normal file
BIN
test/packet_data/4-44-ofp_set_async.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-45-ofp_meter_mod.packet
Normal file
BIN
test/packet_data/4-45-ofp_meter_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-46-ofp_flow_mod.packet
Normal file
BIN
test/packet_data/4-46-ofp_flow_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-47-ofp_meter_config_request.packet
Normal file
BIN
test/packet_data/4-47-ofp_meter_config_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-48-ofp_meter_config_reply.packet
Normal file
BIN
test/packet_data/4-48-ofp_meter_config_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-49-ofp_meter_stats_request.packet
Normal file
BIN
test/packet_data/4-49-ofp_meter_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-5-ofp_features_request.packet
Normal file
BIN
test/packet_data/4-5-ofp_features_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-50-ofp_meter_stats_reply.packet
Normal file
BIN
test/packet_data/4-50-ofp_meter_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-51-ofp_meter_features_request.packet
Normal file
BIN
test/packet_data/4-51-ofp_meter_features_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-52-ofp_meter_features_reply.packet
Normal file
BIN
test/packet_data/4-52-ofp_meter_features_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-53-ofp_port_desc_request.packet
Normal file
BIN
test/packet_data/4-53-ofp_port_desc_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-54-ofp_port_desc_reply.packet
Normal file
BIN
test/packet_data/4-54-ofp_port_desc_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-55-ofp_table_features_request.packet
Normal file
BIN
test/packet_data/4-55-ofp_table_features_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-56-ofp_table_features_reply.packet
Normal file
BIN
test/packet_data/4-56-ofp_table_features_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-57-ofp_group_stats_request.packet
Normal file
BIN
test/packet_data/4-57-ofp_group_stats_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-58-ofp_group_stats_reply.packet
Normal file
BIN
test/packet_data/4-58-ofp_group_stats_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-59-ofp_packet_in.packet
Normal file
BIN
test/packet_data/4-59-ofp_packet_in.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-6-ofp_features_reply.packet
Normal file
BIN
test/packet_data/4-6-ofp_features_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-60-ofp_flow_mod.packet
Normal file
BIN
test/packet_data/4-60-ofp_flow_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-61-ofp_experimenter_request.packet
Normal file
BIN
test/packet_data/4-61-ofp_experimenter_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-62-ofp_experimenter_reply.packet
Normal file
BIN
test/packet_data/4-62-ofp_experimenter_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-63-onf_flow_monitor_request.packet
Normal file
BIN
test/packet_data/4-63-onf_flow_monitor_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-7-ofp_set_config.packet
Normal file
BIN
test/packet_data/4-7-ofp_set_config.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-8-ofp_get_config_request.packet
Normal file
BIN
test/packet_data/4-8-ofp_get_config_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/4-9-ofp_get_config_reply.packet
Normal file
BIN
test/packet_data/4-9-ofp_get_config_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-echo_reply.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-echo_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-echo_request.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-echo_request.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-error_msg.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-error_msg.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-features_reply.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-features_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-flow_mod.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-flow_mod.packet
Normal file
Binary file not shown.
0
test/packet_data/libofproto-OFP13-flow_mod.truncated64
Normal file
0
test/packet_data/libofproto-OFP13-flow_mod.truncated64
Normal file
BIN
test/packet_data/libofproto-OFP13-flow_mod_conjunction.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-flow_mod_conjunction.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-flow_mod_match_conj.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-flow_mod_match_conj.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-flow_removed.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-flow_removed.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-get_config_reply.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-get_config_reply.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-hello.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-hello.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-meter_mod.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-meter_mod.packet
Normal file
Binary file not shown.
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-packet_in.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-packet_in.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-port_mod.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-port_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-port_status.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-port_status.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-set_config.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-set_config.packet
Normal file
Binary file not shown.
BIN
test/packet_data/libofproto-OFP13-table_mod.packet
Normal file
BIN
test/packet_data/libofproto-OFP13-table_mod.packet
Normal file
Binary file not shown.
BIN
test/packet_data/nx_bundle.raw
Normal file
BIN
test/packet_data/nx_bundle.raw
Normal file
Binary file not shown.
BIN
test/packet_data/nx_bundle_load.raw
Normal file
BIN
test/packet_data/nx_bundle_load.raw
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue