selftests: forwarding: Add a test case for externally learned FDB entries

Test that externally learned FDB entries can roam, but not age out.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Ido Schimmel 2019-01-18 15:58:03 +00:00 committed by David S. Miller
parent 72159272fc
commit 479a2b761d
1 changed files with 33 additions and 1 deletions

View File

@ -1,7 +1,7 @@
#!/bin/bash
# SPDX-License-Identifier: GPL-2.0
ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion"
ALL_TESTS="ping_ipv4 ping_ipv6 learning flooding vlan_deletion extern_learn"
NUM_NETIFS=4
CHECK_TC="yes"
source lib.sh
@ -109,6 +109,38 @@ vlan_deletion()
ping_ipv6
}
extern_learn()
{
local mac=de:ad:be:ef:13:37
local ageing_time
# Test that externally learned FDB entries can roam, but not age out
RET=0
bridge fdb add de:ad:be:ef:13:37 dev $swp1 master extern_learn vlan 1
bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
check_err $? "Did not find FDB entry when should"
# Wait for 10 seconds after the ageing time to make sure the FDB entry
# was not aged out
ageing_time=$(bridge_ageing_time_get br0)
sleep $((ageing_time + 10))
bridge fdb show brport $swp1 | grep -q de:ad:be:ef:13:37
check_err $? "FDB entry was aged out when should not"
$MZ $h2 -c 1 -p 64 -a $mac -t ip -q
bridge fdb show brport $swp2 | grep -q de:ad:be:ef:13:37
check_err $? "FDB entry did not roam when should"
log_test "Externally learned FDB entry - ageing & roaming"
bridge fdb del de:ad:be:ef:13:37 dev $swp2 master vlan 1 &> /dev/null
bridge fdb del de:ad:be:ef:13:37 dev $swp1 master vlan 1 &> /dev/null
}
trap cleanup EXIT
setup_prepare