Work on test case for secure channel

This commit is contained in:
Eishun Kondoh 2017-11-20 16:57:37 +09:00
parent e52fe31b79
commit 2c0b0024a1
11 changed files with 603 additions and 16 deletions

View file

@ -5,7 +5,7 @@ defmodule Openflow.Action.PushVlan do
def ofpat, do: 17
def new(ethertype) do
def new(ethertype \\ 0x8100) do
%PushVlan{ethertype: ethertype}
end

View file

@ -20,7 +20,7 @@ defmodule Tres.MessageHelper do
end
defp send_flow_mod_modify(datapath_id, options) do
command = Tres.Utils.flow_command(options, :modify)
command = Tres.Utils.flow_command(:modify, options)
flow_mod = %Openflow.FlowMod{
cookie: options[:cookie] || 0,
table_id: options[:table_id] || 0,
@ -36,7 +36,7 @@ defmodule Tres.MessageHelper do
end
defp send_flow_mod_delete(datapath_id, options) do
command = Tres.Utils.flow_command(options, :delete)
command = Tres.Utils.flow_command(:delete, options)
flow_mod = %Openflow.FlowMod{
cookie: options[:cookie] || 0,
cookie_mask: options[:cookie_mask] || 0,

View file

@ -18,7 +18,7 @@ defmodule Tres.SecureChannel do
@hello_handshake_timeout 1000
@features_handshake_timeout 1000
@ping_timeout 5000
@transaction_timeout 5000
# @transaction_timeout 5000
@ping_interval 5000
@ping_fail_max_count 10
@ -193,12 +193,16 @@ defmodule Tres.SecureChannel do
end
defp handle_message(_in_xact = true, message, state_data) do
[{:xact_entry, _xid, prev_message, _orig}|_] = XACT_KV.get(state_data.xact_kv_ref, message.xid)
new_message = Openflow.append_body(prev_message, message)
XACT_KV.update(state_data.xact_kv_ref, message.xid, new_message)
case XACT_KV.get(state_data.xact_kv_ref, message.xid) do
[{:xact_entry, _xid, prev_message, _orig}|_] ->
new_message = Openflow.append_body(prev_message, message)
XACT_KV.update(state_data.xact_kv_ref, message.xid, new_message)
_ ->
XACT_KV.delete(state_data.xact_kv_ref, message.xid)
end
end
defp handle_message(_in_xact = false, message, %SecureChannelState{handler_pid: handler_pid}) do
send(handler_pid, message)
defp handle_message(_in_xact = false, message, state_data) do
send(state_data.handler_pid, message)
end
# WATING state