Skip to content

Commit

Permalink
tests: Add function to test Butterfly on IPv4
Browse files Browse the repository at this point in the history
Signed-off-by: Tarrade Nicolas <[email protected]>
  • Loading branch information
outscale-nts committed Dec 1, 2017
1 parent 506bb11 commit ce878e7
Show file tree
Hide file tree
Showing 2 changed files with 54 additions and 0 deletions.
20 changes: 20 additions & 0 deletions tests/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
34 changes: 34 additions & 0 deletions tests/network/bypass/icmp/scenario_05/test.sh
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit ce878e7

Please sign in to comment.