selftests: forwarding: mirror_lib: Move here do_test_span_vlan_dir_ips()

Move the function do_test_span_vlan_dir_ips() from mirror_vlan.sh test
to a library file mirror_lib.sh to allow reuse. Fill in other entry
points similar to other testing functions in mirror_lib.sh, they will be
useful in following patches.

Signed-off-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Petr Machata 2018-05-31 19:52:09 +02:00 committed by David S. Miller
parent 2004a9bcb8
commit 900530f3f8
2 changed files with 35 additions and 15 deletions

View file

@ -92,3 +92,38 @@ test_span_dir()
{
test_span_dir_ips "$@" 192.0.2.1 192.0.2.2
}
do_test_span_vlan_dir_ips()
{
local expect=$1; shift
local dev=$1; shift
local vid=$1; shift
local direction=$1; shift
local ip1=$1; shift
local ip2=$1; shift
vlan_capture_install $dev "vlan_id $vid"
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
vlan_capture_uninstall $dev
}
quick_test_span_vlan_dir_ips()
{
do_test_span_vlan_dir_ips 10 "$@"
}
fail_test_span_vlan_dir_ips()
{
do_test_span_vlan_dir_ips 0 "$@"
}
quick_test_span_vlan_dir()
{
quick_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
}
fail_test_span_vlan_dir()
{
fail_test_span_vlan_dir_ips "$@" 192.0.2.1 192.0.2.2
}

View file

@ -76,21 +76,6 @@ test_vlan()
test_vlan_dir egress 0 8
}
do_test_span_vlan_dir_ips()
{
local expect=$1; shift
local dev=$1; shift
local vid=$1; shift
local direction=$1; shift
local ip1=$1; shift
local ip2=$1; shift
vlan_capture_install $dev "vlan_id $vid"
mirror_test v$h1 $ip1 $ip2 $dev 100 $expect
mirror_test v$h2 $ip2 $ip1 $dev 100 $expect
vlan_capture_uninstall $dev
}
test_tagged_vlan_dir()
{
local direction=$1; shift