From ce878e765186ae6641e2fe2d3f3bfaa4c78e0f62 Mon Sep 17 00:00:00 2001 From: Tarrade Nicolas Date: Wed, 22 Nov 2017 10:17:25 +0100 Subject: [PATCH] tests: Add function to test Butterfly on IPv4 Signed-off-by: Tarrade Nicolas --- tests/functions.sh | 20 +++++++++++ tests/network/bypass/icmp/scenario_05/test.sh | 34 +++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100755 tests/network/bypass/icmp/scenario_05/test.sh diff --git a/tests/functions.sh b/tests/functions.sh index b8366a34b..4d017802f 100755 --- a/tests/functions.sh +++ b/tests/functions.sh @@ -620,6 +620,26 @@ function server_stop { done } +function server_start_ipv4 { + id=$1 + server_start_options_ipv4 $id -t +} + +function server_start_options_ipv4 { + id=$1 + options=${@:2} + echo "[butterfly-$id] starting" + + exec sudo $BUTTERFLY_BUILD_ROOT/api/server/butterflyd --dpdk-args "--no-shconf -c1 -n1 --vdev=eth_pcap$id,iface=but$id --no-huge" -l debug -i 10.0.0.$id -s /tmp --endpoint=tcp://0.0.0.0:876$id $options -t &> $BUTTERFLY_BUILD_ROOT/butterflyd_${id}_output & + pid=$! + sleep 1 + sudo kill -s 0 $pid + if [ $? -ne 0 ]; then + fail "failed to start butterfly, check butterflyd_${id}_output file" + fi + + server_pids["$id"]=$pid +} function network_connect { id1=$1 id2=$2 diff --git a/tests/network/bypass/icmp/scenario_05/test.sh b/tests/network/bypass/icmp/scenario_05/test.sh new file mode 100755 index 000000000..abd9a0314 --- /dev/null +++ b/tests/network/bypass/icmp/scenario_05/test.sh @@ -0,0 +1,34 @@ +#!/bin/bash + +BUTTERFLY_BUILD_ROOT=$1 +BUTTERFLY_SRC_ROOT=$(cd "$(dirname $0)/../../../../.." && pwd) +source $BUTTERFLY_SRC_ROOT/tests/functions.sh + +network_connect 0 1 +server_start_ipv4 0 +server_start_ipv4 1 +nic_add 0 1 42 sg-1 +nic_add 0 2 42 sg-1 +nic_add 1 3 42 sg-1 +nic_add 1 4 42 sg-1 +sg_rule_add_all_open 0 sg-1 +sg_rule_add_all_open 1 sg-1 +qemu_start_async 1 +qemu_start_async 2 +qemu_start_async 3 +qemu_start_async 4 +qemus_wait 4 3 2 1 +ssh_ping 1 2 +ssh_ping 1 3 +ssh_ping 1 4 +ssh_ping 4 1 +ssh_ping 4 2 +ssh_ping 4 3 +qemu_stop 1 +qemu_stop 2 +qemu_stop 3 +qemu_stop 4 +server_stop 0 +server_stop 1 +network_disconnect 0 1 +return_result