quality: Add test cases for barrier messages

This commit is contained in:
Eishun Kondoh 2019-04-26 23:59:45 +09:00
parent 211d703366
commit 578c0d1bdc
4 changed files with 99 additions and 18 deletions

View file

@ -1158,6 +1158,36 @@ defmodule OfpActionTest do
end
end
describe "Openflow.Action.NxStackPush" do
test "with push:NXM_NX_REG0[]" do
push = Openflow.Action.NxStackPush.new(field: :reg0)
assert push.n_bits == 32
assert push.offset == 0
push
|> Openflow.Action.to_binary()
|> Openflow.Action.read()
|> Enum.at(0)
|> Kernel.==(push)
|> assert()
end
test "with push:NXM_NX_REG0[1..31]" do
push = Openflow.Action.NxStackPush.new(field: :reg0, offset: 1, n_bits: 31)
assert push.n_bits == 31
assert push.offset == 1
push
|> Openflow.Action.to_binary()
|> Openflow.Action.read()
|> Enum.at(0)
|> Kernel.==(push)
|> assert()
end
end
describe "Openflow.Action.NxSetTunnel" do
test "with set_tunnel:0x1" do
set_tunnel = Openflow.Action.NxSetTunnel.new(1)