Skip to contentSkip to conversation

selftests/net/forwarding: configurable seed tests

PATCH In review Pavel Balaev 3 participants 3 messages Apr 28, 2021

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH v6 3/3 selftests/net/forwarding: configurable seed tests

Test equal and different seed values for IPv4/IPv6 multipath routing.

---
 .../testing/selftests/net/forwarding/Makefile |   1 +
 tools/testing/selftests/net/forwarding/lib.sh |  28 ++
 .../net/forwarding/router_mpath_seed.sh       | 347 ++++++++++++++++++
 3 files changed, 376 insertions(+)
 create mode 100755 tools/testing/selftests/net/forwarding/router_mpath_seed.sh
tools/testing/selftests/net/forwarding/Makefile +1 -0
index d97bd6889..080af970c 100644
@@ -38,6 +38,7 @@ TEST_PROGS = bridge_igmp.sh \
 	router_mpath_nh.sh \
 	router_multicast.sh \
 	router_multipath.sh \
+	router_mpath_seed.sh \
 	router.sh \
 	router_vid_1.sh \
 	sch_ets.sh \
tools/testing/selftests/net/forwarding/lib.sh +28 -0
index 42e28c983..b7445b1c5 100644
@@ -10,6 +10,7 @@ PING6=${PING6:=ping6}
 MZ=${MZ:=mausezahn}
 ARPING=${ARPING:=arping}
 TEAMD=${TEAMD:=teamd}
+OPENSSL=${OPENSSL:=openssl}
 WAIT_TIME=${WAIT_TIME:=5}
 PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
 PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no}
@@ -698,6 +699,33 @@ link_stats_rx_errors_get()
 	link_stats_get $1 rx errors
 }
 
+ns_link_stats_get()
+{
+	local netns=$1; shift
+	local if_name=$1; shift
+	local dir=$1; shift
+	local stat=$1; shift
+
+	ip netns exec $netns ip -j -s link show dev $if_name \
+		| jq '.[]["stats64"]["'$dir'"]["'$stat'"]'
+}
+
+ns_link_stats_tx_packets_get()
+{
+	local netns=$1; shift
+	local if_name=$1; shift
+
+	ns_link_stats_get $netns $if_name tx packets
+}
+
+ns_link_stats_rx_errors_get()
+{
+	local netns=$1; shift
+	local if_name=$1; shift
+
+	ns_link_stats_get $netns $if_name rx errors
+}
+
 tc_rule_stats_get()
 {
 	local dev=$1; shift
tools/testing/selftests/net/forwarding/router_mpath_seed.sh new file +347 -0

347 lines not on this page · raw message

Signature · 1 line
2.31.1
#1 lore raw
Quoted 2 lines · Pavel Balaev

Test equal and different seed values for IPv4/IPv6 multipath routing.

The test does not follow the usual convention of forwarding tests that are expected to be run with both veth pairs and loop backed physical devices. See: tools/testing/selftests/net/forwarding/README (and existing tests for reference)

This approach allows us to test both the software and hardware data paths.

You can construct a test where you have multiple VRFs instead of multiple namespaces. These VRFs emulate your hosts and routers. Send multiple flows from one host and check the distribution across the multiple paths connecting your two routers. Change the seed, expect a different distribution. Go back to original seed and expect the original distribution.

#2 lore raw
Quoted 9 lines · Ido Schimmel
Quoted 2 lines · Pavel Balaev

Test equal and different seed values for IPv4/IPv6 multipath routing.

The test does not follow the usual convention of forwarding tests that are expected to be run with both veth pairs and loop backed physical devices. See: tools/testing/selftests/net/forwarding/README (and existing tests for reference)

Quoted 9 lines

This approach allows us to test both the software and hardware data paths.

You can construct a test where you have multiple VRFs instead of multiple namespaces. These VRFs emulate your hosts and routers. Send multiple flows from one host and check the distribution across the multiple paths connecting your two routers. Change the seed, expect a different distribution. Go back to original seed and expect the original distribution.

Pavel: I think net-next is closing soon, so this will need to wait until next cycle (2 weeks from now).

I'll take a look at the patch set in the next few days. You can send follow up sets as RFCs while net-next is closed, so this will be ready once it opens.