All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test
@ 2018-03-11  7:57 Ido Schimmel
  2018-03-11  7:57 ` [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge Ido Schimmel
                   ` (4 more replies)
  0 siblings, 5 replies; 10+ messages in thread
From: Ido Schimmel @ 2018-03-11  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, mlxsw, Ido Schimmel

First patch adds a new test for VLAN-unaware bridges.

Next two patches make the tests fail in case they are missing interfaces
or dependencies.

Last patch allows one to create the veth interfaces even without the
optional configuration file.

Ido Schimmel (4):
  selftests: forwarding: Add a test for VLAN-unaware bridge
  selftests: forwarding: Exit with error when missing dependencies
  selftests: forwarding: Exit with error when missing interfaces
  selftests: forwarding: Allow creation of interfaces without a config
    file

 .../net/forwarding/bridge_vlan_unaware.sh          | 86 ++++++++++++++++++++++
 .../net/forwarding/forwarding.config.sample        |  9 +--
 tools/testing/selftests/net/forwarding/lib.sh      |  8 +-
 3 files changed, 95 insertions(+), 8 deletions(-)
 create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh

-- 
2.14.3

^ permalink raw reply	[flat|nested] 10+ messages in thread

* [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge
  2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
@ 2018-03-11  7:57 ` Ido Schimmel
  2018-03-12  2:09   ` David Ahern
  2018-03-11  7:57 ` [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies Ido Schimmel
                   ` (3 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2018-03-11  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, mlxsw, Ido Schimmel

Similar to the VLAN-aware bridge test, test the VLAN-unaware bridge and
make sure that ping, FDB learning and flooding work as expected.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 .../net/forwarding/bridge_vlan_unaware.sh          | 86 ++++++++++++++++++++++
 1 file changed, 86 insertions(+)
 create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh

diff --git a/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh b/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh
new file mode 100755
index 000000000000..1cddf06f691d
--- /dev/null
+++ b/tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh
@@ -0,0 +1,86 @@
+#!/bin/bash
+# SPDX-License-Identifier: GPL-2.0
+
+NUM_NETIFS=4
+source lib.sh
+
+h1_create()
+{
+	simple_if_init $h1 192.0.2.1/24 2001:db8:1::1/64
+}
+
+h1_destroy()
+{
+	simple_if_fini $h1 192.0.2.1/24 2001:db8:1::1/64
+}
+
+h2_create()
+{
+	simple_if_init $h2 192.0.2.2/24 2001:db8:1::2/64
+}
+
+h2_destroy()
+{
+	simple_if_fini $h2 192.0.2.2/24 2001:db8:1::2/64
+}
+
+switch_create()
+{
+	# 10 Seconds ageing time.
+	ip link add dev br0 type bridge ageing_time 1000 mcast_snooping 0
+
+	ip link set dev $swp1 master br0
+	ip link set dev $swp2 master br0
+
+	ip link set dev br0 up
+	ip link set dev $swp1 up
+	ip link set dev $swp2 up
+}
+
+switch_destroy()
+{
+	ip link set dev $swp2 down
+	ip link set dev $swp1 down
+
+	ip link del dev br0
+}
+
+setup_prepare()
+{
+	h1=${NETIFS[p1]}
+	swp1=${NETIFS[p2]}
+
+	swp2=${NETIFS[p3]}
+	h2=${NETIFS[p4]}
+
+	vrf_prepare
+
+	h1_create
+	h2_create
+
+	switch_create
+}
+
+cleanup()
+{
+	pre_cleanup
+
+	switch_destroy
+
+	h2_destroy
+	h1_destroy
+
+	vrf_cleanup
+}
+
+trap cleanup EXIT
+
+setup_prepare
+setup_wait
+
+ping_test $h1 192.0.2.2
+ping6_test $h1 2001:db8:1::2
+learning_test "br0" $swp1 $h1 $h2
+flood_test $swp2 $h1 $h2
+
+exit $EXIT_STATUS
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies
  2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
  2018-03-11  7:57 ` [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge Ido Schimmel
@ 2018-03-11  7:57 ` Ido Schimmel
  2018-03-12  2:10   ` David Ahern
  2018-03-11  7:57 ` [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces Ido Schimmel
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2018-03-11  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, mlxsw, Ido Schimmel

We already return an error when some dependencies (e.g., 'jq') are
missing so lets be consistent and do that for all.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 273511ef2b43..6ac8a98fa270 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -50,7 +50,7 @@ fi
 
 if [[ ! -x "$(command -v $MZ)" ]]; then
 	echo "SKIP: $MZ not installed"
-	exit 0
+	exit 1
 fi
 
 if [[ ! -v NUM_NETIFS ]]; then
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces
  2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
  2018-03-11  7:57 ` [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge Ido Schimmel
  2018-03-11  7:57 ` [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies Ido Schimmel
@ 2018-03-11  7:57 ` Ido Schimmel
  2018-03-12  2:10   ` David Ahern
  2018-03-11  7:57 ` [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file Ido Schimmel
  2018-03-12  2:44 ` [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test David Miller
  4 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2018-03-11  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, mlxsw, Ido Schimmel

Returning 0 gives a false sense of success when the required modules did
not even manage to be initialized and register the required net devices.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 tools/testing/selftests/net/forwarding/lib.sh | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index 6ac8a98fa270..e989d8a1d4fb 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -55,7 +55,7 @@ fi
 
 if [[ ! -v NUM_NETIFS ]]; then
 	echo "SKIP: importer does not define \"NUM_NETIFS\""
-	exit 0
+	exit 1
 fi
 
 ##############################################################################
@@ -115,7 +115,7 @@ for i in $(eval echo {1..$NUM_NETIFS}); do
 	ip link show dev ${NETIFS[p$i]} &> /dev/null
 	if [[ $? -ne 0 ]]; then
 		echo "SKIP: could not find all required interfaces"
-		exit 0
+		exit 1
 	fi
 done
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file
  2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
                   ` (2 preceding siblings ...)
  2018-03-11  7:57 ` [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces Ido Schimmel
@ 2018-03-11  7:57 ` Ido Schimmel
  2018-03-12  2:10   ` David Ahern
  2018-03-12  2:44 ` [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test David Miller
  4 siblings, 1 reply; 10+ messages in thread
From: Ido Schimmel @ 2018-03-11  7:57 UTC (permalink / raw)
  To: netdev; +Cc: davem, jiri, dsahern, mlxsw, Ido Schimmel

Some users want to be able to run the tests without a configuration file
which is useful when one needs to test both virtual and physical
interfaces on the same machine.

Move the defines that set the type of interface to create and whether to
create it away from the optional configuration file to the library like
the rest of the defines.

Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 tools/testing/selftests/net/forwarding/forwarding.config.sample | 9 ++++-----
 tools/testing/selftests/net/forwarding/lib.sh                   | 2 ++
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/tools/testing/selftests/net/forwarding/forwarding.config.sample b/tools/testing/selftests/net/forwarding/forwarding.config.sample
index df54c9eb5100..e819d049d9ce 100644
--- a/tools/testing/selftests/net/forwarding/forwarding.config.sample
+++ b/tools/testing/selftests/net/forwarding/forwarding.config.sample
@@ -14,11 +14,6 @@ NETIFS[p6]=veth5
 NETIFS[p7]=veth6
 NETIFS[p8]=veth7
 
-NETIF_TYPE=veth
-
-# only virtual interfaces (veth) can be created by test infra
-#NETIF_CREATE=yes
-
 ##############################################################################
 # Defines
 
@@ -34,3 +29,7 @@ WAIT_TIME=5
 PAUSE_ON_FAIL=no
 # Whether to pause on cleanup or not.
 PAUSE_ON_CLEANUP=no
+# Type of network interface to create
+NETIF_TYPE=veth
+# Whether to create virtual interfaces (veth) or not
+NETIF_CREATE=yes
diff --git a/tools/testing/selftests/net/forwarding/lib.sh b/tools/testing/selftests/net/forwarding/lib.sh
index e989d8a1d4fb..1ac6c62271f3 100644
--- a/tools/testing/selftests/net/forwarding/lib.sh
+++ b/tools/testing/selftests/net/forwarding/lib.sh
@@ -11,6 +11,8 @@ MZ=${MZ:=mausezahn}
 WAIT_TIME=${WAIT_TIME:=5}
 PAUSE_ON_FAIL=${PAUSE_ON_FAIL:=no}
 PAUSE_ON_CLEANUP=${PAUSE_ON_CLEANUP:=no}
+NETIF_TYPE=${NETIF_TYPE:=veth}
+NETIF_CREATE=${NETIF_CREATE:=yes}
 
 if [[ -f forwarding.config ]]; then
 	source forwarding.config
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge
  2018-03-11  7:57 ` [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge Ido Schimmel
@ 2018-03-12  2:09   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-03-12  2:09 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, jiri, mlxsw

On 3/11/18 12:57 AM, Ido Schimmel wrote:
> Similar to the VLAN-aware bridge test, test the VLAN-unaware bridge and
> make sure that ping, FDB learning and flooding work as expected.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  .../net/forwarding/bridge_vlan_unaware.sh          | 86 ++++++++++++++++++++++
>  1 file changed, 86 insertions(+)
>  create mode 100755 tools/testing/selftests/net/forwarding/bridge_vlan_unaware.sh
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies
  2018-03-11  7:57 ` [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies Ido Schimmel
@ 2018-03-12  2:10   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-03-12  2:10 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, jiri, mlxsw

On 3/11/18 12:57 AM, Ido Schimmel wrote:
> We already return an error when some dependencies (e.g., 'jq') are
> missing so lets be consistent and do that for all.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  tools/testing/selftests/net/forwarding/lib.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces
  2018-03-11  7:57 ` [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces Ido Schimmel
@ 2018-03-12  2:10   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-03-12  2:10 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, jiri, mlxsw

On 3/11/18 12:57 AM, Ido Schimmel wrote:
> Returning 0 gives a false sense of success when the required modules did
> not even manage to be initialized and register the required net devices.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  tools/testing/selftests/net/forwarding/lib.sh | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file
  2018-03-11  7:57 ` [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file Ido Schimmel
@ 2018-03-12  2:10   ` David Ahern
  0 siblings, 0 replies; 10+ messages in thread
From: David Ahern @ 2018-03-12  2:10 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, jiri, mlxsw

On 3/11/18 12:57 AM, Ido Schimmel wrote:
> Some users want to be able to run the tests without a configuration file
> which is useful when one needs to test both virtual and physical
> interfaces on the same machine.
> 
> Move the defines that set the type of interface to create and whether to
> create it away from the optional configuration file to the library like
> the rest of the defines.
> 
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reviewed-by: Jiri Pirko <jiri@mellanox.com>
> ---
>  tools/testing/selftests/net/forwarding/forwarding.config.sample | 9 ++++-----
>  tools/testing/selftests/net/forwarding/lib.sh                   | 2 ++
>  2 files changed, 6 insertions(+), 5 deletions(-)
> 

Reviewed-by: David Ahern <dsahern@gmail.com>

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test
  2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
                   ` (3 preceding siblings ...)
  2018-03-11  7:57 ` [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file Ido Schimmel
@ 2018-03-12  2:44 ` David Miller
  4 siblings, 0 replies; 10+ messages in thread
From: David Miller @ 2018-03-12  2:44 UTC (permalink / raw)
  To: idosch; +Cc: netdev, jiri, dsahern, mlxsw

From: Ido Schimmel <idosch@mellanox.com>
Date: Sun, 11 Mar 2018 09:57:21 +0200

> First patch adds a new test for VLAN-unaware bridges.
> 
> Next two patches make the tests fail in case they are missing interfaces
> or dependencies.
> 
> Last patch allows one to create the veth interfaces even without the
> optional configuration file.

Series applied, thank you.

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2018-03-12  2:44 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11  7:57 [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test Ido Schimmel
2018-03-11  7:57 ` [PATCH net-next 1/4] selftests: forwarding: Add a test for VLAN-unaware bridge Ido Schimmel
2018-03-12  2:09   ` David Ahern
2018-03-11  7:57 ` [PATCH net-next 2/4] selftests: forwarding: Exit with error when missing dependencies Ido Schimmel
2018-03-12  2:10   ` David Ahern
2018-03-11  7:57 ` [PATCH net-next 3/4] selftests: forwarding: Exit with error when missing interfaces Ido Schimmel
2018-03-12  2:10   ` David Ahern
2018-03-11  7:57 ` [PATCH net-next 4/4] selftests: forwarding: Allow creation of interfaces without a config file Ido Schimmel
2018-03-12  2:10   ` David Ahern
2018-03-12  2:44 ` [PATCH net-next 0/4] selftests: forwarding: Tweaks and a new test David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.