From: Ido Schimmel <idosch@mellanox.com>
To: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"bridge@lists.linux-foundation.org"
<bridge@lists.linux-foundation.org>
Cc: "davem@davemloft.net" <davem@davemloft.net>,
Jiri Pirko <jiri@mellanox.com>, Petr Machata <petrm@mellanox.com>,
"roopa@cumulusnetworks.com" <roopa@cumulusnetworks.com>,
"nikolay@cumulusnetworks.com" <nikolay@cumulusnetworks.com>,
"stephen@networkplumber.org" <stephen@networkplumber.org>,
"ivecera@redhat.com" <ivecera@redhat.com>,
mlxsw <mlxsw@mellanox.com>, Ido Schimmel <idosch@mellanox.com>
Subject: [PATCH net-next 16/16] selftests: forwarding: vxlan_bridge_1d: Add learning test
Date: Wed, 21 Nov 2018 08:02:52 +0000 [thread overview]
Message-ID: <20181121080141.16676-17-idosch@mellanox.com> (raw)
In-Reply-To: <20181121080141.16676-1-idosch@mellanox.com>
Add a test which checks that the VxLAN driver can learn FDB entries and
that these entries are correctly deleted and aged-out.
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Petr Machata <petrm@mellanox.com>
---
.../net/forwarding/vxlan_bridge_1d.sh | 108 ++++++++++++++++++
1 file changed, 108 insertions(+)
diff --git a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
index 5cc6ac74eb74..56cef3b1c194 100755
--- a/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
+++ b/tools/testing/selftests/net/forwarding/vxlan_bridge_1d.sh
@@ -76,6 +76,7 @@ export VXPORT
ping_ipv4
test_flood
test_unicast
+ test_learning
"}
NUM_NETIFS=6
@@ -663,6 +664,113 @@ test_ecn_decap()
test_ecn_decap_error
}
+test_learning()
+{
+ local mac=de:ad:be:ef:13:37
+ local dst=192.0.2.100
+
+ # Enable learning on the VxLAN device and set ageing time to 10 seconds
+ ip link set dev br1 type bridge ageing_time 1000
+ ip link set dev vx1 type vxlan ageing 10
+ ip link set dev vx1 type vxlan learning
+ reapply_config
+
+ # Check that flooding works
+ RET=0
+
+ vxlan_flood_test $mac $dst 10 10 10
+
+ log_test "VXLAN: flood before learning"
+
+ # Send a packet with source mac set to $mac from host w2 and check that
+ # a corresponding entry is created in VxLAN device vx1
+ RET=0
+
+ in_ns ns1 $MZ w2 -c 1 -p 64 -a $mac -b ff:ff:ff:ff:ff:ff -B $dst \
+ -t icmp -q
+ sleep 1
+
+ bridge fdb show brport vx1 | grep $mac | grep -q self
+ check_err $?
+ bridge fdb show brport vx1 | grep $mac | grep -q -v self
+ check_err $?
+
+ log_test "VXLAN: show learned FDB entry"
+
+ # Repeat first test and check that packets only reach host w2 in ns1
+ RET=0
+
+ vxlan_flood_test $mac $dst 0 10 0
+
+ log_test "VXLAN: learned FDB entry"
+
+ # Delete the learned FDB entry from the VxLAN and bridge devices and
+ # check that packets are flooded
+ RET=0
+
+ bridge fdb del dev vx1 $mac master self
+ sleep 1
+
+ vxlan_flood_test $mac $dst 10 10 10
+
+ log_test "VXLAN: deletion of learned FDB entry"
+
+ # Re-learn the first FDB entry and check that it is correctly aged-out
+ RET=0
+
+ in_ns ns1 $MZ w2 -c 1 -p 64 -a $mac -b ff:ff:ff:ff:ff:ff -B $dst \
+ -t icmp -q
+ sleep 1
+
+ bridge fdb show brport vx1 | grep $mac | grep -q self
+ check_err $?
+ bridge fdb show brport vx1 | grep $mac | grep -q -v self
+ check_err $?
+
+ vxlan_flood_test $mac $dst 0 10 0
+
+ sleep 20
+
+ bridge fdb show brport vx1 | grep $mac | grep -q self
+ check_fail $?
+ bridge fdb show brport vx1 | grep $mac | grep -q -v self
+ check_fail $?
+
+ vxlan_flood_test $mac $dst 10 10 10
+
+ log_test "VXLAN: Ageing of learned FDB entry"
+
+ # Toggle learning on the bridge port and check that the bridge's FDB
+ # is populated only when it should
+ RET=0
+
+ ip link set dev vx1 type bridge_slave learning off
+
+ in_ns ns1 $MZ w2 -c 1 -p 64 -a $mac -b ff:ff:ff:ff:ff:ff -B $dst \
+ -t icmp -q
+ sleep 1
+
+ bridge fdb show brport vx1 | grep $mac | grep -q -v self
+ check_fail $?
+
+ ip link set dev vx1 type bridge_slave learning on
+
+ in_ns ns1 $MZ w2 -c 1 -p 64 -a $mac -b ff:ff:ff:ff:ff:ff -B $dst \
+ -t icmp -q
+ sleep 1
+
+ bridge fdb show brport vx1 | grep $mac | grep -q -v self
+ check_err $?
+
+ log_test "VXLAN: learning toggling on bridge port"
+
+ # Restore previous settings
+ ip link set dev vx1 type vxlan nolearning
+ ip link set dev vx1 type vxlan ageing 300
+ ip link set dev br1 type bridge ageing_time 30000
+ reapply_config
+}
+
test_all()
{
echo "Running tests with UDP port $VXPORT"
--
2.19.1
next prev parent reply other threads:[~2018-11-21 18:36 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-11-21 8:02 [PATCH net-next 00/16] mlxsw: Add VxLAN learning support Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 01/16] vxlan: __vxlan_fdb_delete(): Drop unused argument vid Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 02/16] vxlan: vxlan_fdb_notify(): Make switchdev notification configurable Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 03/16] vxlan: Mark user-added FDB entries Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 04/16] vxlan: Don't override user-added entries with ext-learned ones Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 05/16] vxlan: Add hardware FDB learning Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 06/16] vxlan: Allow changing ageing time Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 07/16] bridge: Allow querying bridge port flags Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 08/16] mlxsw: reg: Add definition of unicast tunnel record for SFN register Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 09/16] mlxsw: spectrum_fid: Store ifindex of NVE device in FID Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 10/16] mlxsw: spectrum_fid: Allow FID lookup by its index Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 11/16] mlxsw: spectrum_nve: Add API to resolve learned IP addresses Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 12/16] mlxsw: spectrum_switchdev: Process learned VxLAN FDB entries Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 13/16] mlxsw: spectrum_switchdev: Allow deletion of learned " Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 14/16] mlxsw: spectrum_nve: Allow VxLAN learning Ido Schimmel
2018-11-21 8:02 ` [PATCH net-next 15/16] selftests: mlxsw: Consider VxLAN learning enabled as valid Ido Schimmel
2018-11-21 8:02 ` Ido Schimmel [this message]
2018-11-22 1:10 ` [PATCH net-next 00/16] mlxsw: Add VxLAN learning support David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20181121080141.16676-17-idosch@mellanox.com \
--to=idosch@mellanox.com \
--cc=bridge@lists.linux-foundation.org \
--cc=davem@davemloft.net \
--cc=ivecera@redhat.com \
--cc=jiri@mellanox.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=nikolay@cumulusnetworks.com \
--cc=petrm@mellanox.com \
--cc=roopa@cumulusnetworks.com \
--cc=stephen@networkplumber.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox