Linux-kselftest Archive mirror
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: Jakub Kicinski <kuba@kernel.org>
Cc: Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Paolo Abeni <pabeni@redhat.com>, Shuah Khan <shuah@kernel.org>,
	netdev@vger.kernel.org, linux-kselftest@vger.kernel.org,
	Simon Horman <horms@kernel.org>,
	Casper Andersson <casper.casan@gmail.com>,
	linux-kernel@vger.kernel.org, Lukasz Majewski <lukma@denx.de>
Subject: [net-next PATCH] test: hsr: Extend the hsr_redbox.sh to have more SAN devices connected
Date: Fri, 10 May 2024 16:37:10 +0200	[thread overview]
Message-ID: <20240510143710.3916631-1-lukma@denx.de> (raw)

After this change the single SAN device (ns3eth1) is now replaced with
two SAN devices - respectively ns4eth1 and ns5eth1.

It is possible to extend this script to have more SAN devices connected
by adding them to ns3br1 bridge.

Signed-off-by: Lukasz Majewski <lukma@denx.de>
---
 tools/testing/selftests/net/hsr/hsr_redbox.sh | 71 +++++++++++++------
 1 file changed, 49 insertions(+), 22 deletions(-)

diff --git a/tools/testing/selftests/net/hsr/hsr_redbox.sh b/tools/testing/selftests/net/hsr/hsr_redbox.sh
index db69be95ecb3..1f36785347c0 100755
--- a/tools/testing/selftests/net/hsr/hsr_redbox.sh
+++ b/tools/testing/selftests/net/hsr/hsr_redbox.sh
@@ -8,12 +8,19 @@ source ./hsr_common.sh
 do_complete_ping_test()
 {
 	echo "INFO: Initial validation ping (HSR-SAN/RedBox)."
-	# Each node has to be able each one.
+	# Each node has to be able to reach each one.
 	do_ping "${ns1}" 100.64.0.2
 	do_ping "${ns2}" 100.64.0.1
-	# Ping from SAN to hsr1 (via hsr2)
+	# Ping between SANs (test bridge)
+	do_ping "${ns4}" 100.64.0.51
+	do_ping "${ns5}" 100.64.0.41
+	# Ping from SANs to hsr1 (via hsr2) (and opposite)
 	do_ping "${ns3}" 100.64.0.1
 	do_ping "${ns1}" 100.64.0.3
+	do_ping "${ns1}" 100.64.0.41
+	do_ping "${ns4}" 100.64.0.1
+	do_ping "${ns1}" 100.64.0.51
+	do_ping "${ns5}" 100.64.0.1
 	stop_if_error "Initial validation failed."
 
 	# Wait for MGNT HSR frames being received and nodes being
@@ -23,8 +30,12 @@ do_complete_ping_test()
 	echo "INFO: Longer ping test (HSR-SAN/RedBox)."
 	# Ping from SAN to hsr1 (via hsr2)
 	do_ping_long "${ns3}" 100.64.0.1
-	# Ping from hsr1 (via hsr2) to SAN
+	# Ping from hsr1 (via hsr2) to SANs (and opposite)
 	do_ping_long "${ns1}" 100.64.0.3
+	do_ping_long "${ns1}" 100.64.0.41
+	do_ping_long "${ns4}" 100.64.0.1
+	do_ping_long "${ns1}" 100.64.0.51
+	do_ping_long "${ns5}" 100.64.0.1
 	stop_if_error "Longer ping test failed."
 
 	echo "INFO: All good."
@@ -35,22 +46,26 @@ setup_hsr_interfaces()
 	local HSRv="$1"
 
 	echo "INFO: preparing interfaces for HSRv${HSRv} (HSR-SAN/RedBox)."
-
-#       |NS1                     |
-#       |                        |
-#       |    /-- hsr1 --\        |
-#       | ns1eth1     ns1eth2    |
-#       |------------------------|
-#            |            |
-#            |            |
-#            |            |
-#       |------------------------|        |-----------|
-#       | ns2eth1     ns2eth2    |        |           |
-#       |    \-- hsr2 --/        |        |           |
-#       |            \           |        |           |
-#       |             ns2eth3    |--------| ns3eth1   |
-#       |             (interlink)|        |           |
-#       |NS2 (RedBOX)            |        |NS3 (SAN)  |
+#
+# IPv4 addresses (100.64.X.Y/24), and [X.Y] is presented on below diagram:
+#
+#
+# |NS1                     |               |NS4                |
+# |       [0.1]            |               |                   |
+# |    /-- hsr1 --\        |               |    [0.41]         |
+# | ns1eth1     ns1eth2    |               |    ns4eth1 (SAN)  |
+# |------------------------|               |-------------------|
+#      |            |                                |
+#      |            |                                |
+#      |            |                                |
+# |------------------------|   |-------------------------------|
+# | ns2eth1     ns2eth2    |   |                  ns3eth2      |
+# |    \-- hsr2 --/        |   |                 /             |
+# |      [0.2] \           |   |                /              |  |------------|
+# |             ns2eth3    |---| ns3eth1 -- ns3br1 -- ns3eth3--|--| ns5eth1    |
+# |             (interlink)|   | [0.3]      [0.11]             |  | [0.51]     |
+# |NS2 (RedBOX)            |   |NS3 (BR)                       |  | NS5 (SAN)  |
+#
 #
 	# Check if iproute2 supports adding interlink port to hsrX device
 	ip link help hsr | grep -q INTERLINK
@@ -59,7 +74,9 @@ setup_hsr_interfaces()
 	# Create interfaces for name spaces
 	ip link add ns1eth1 netns "${ns1}" type veth peer name ns2eth1 netns "${ns2}"
 	ip link add ns1eth2 netns "${ns1}" type veth peer name ns2eth2 netns "${ns2}"
-	ip link add ns3eth1 netns "${ns3}" type veth peer name ns2eth3 netns "${ns2}"
+	ip link add ns2eth3 netns "${ns2}" type veth peer name ns3eth1 netns "${ns3}"
+	ip link add ns3eth2 netns "${ns3}" type veth peer name ns4eth1 netns "${ns4}"
+	ip link add ns3eth3 netns "${ns3}" type veth peer name ns5eth1 netns "${ns5}"
 
 	sleep 1
 
@@ -70,21 +87,31 @@ setup_hsr_interfaces()
 	ip -n "${ns2}" link set ns2eth2 up
 	ip -n "${ns2}" link set ns2eth3 up
 
-	ip -n "${ns3}" link set ns3eth1 up
+	ip -n "${ns3}" link add name ns3br1 type bridge
+	ip -n "${ns3}" link set ns3br1 up
+	ip -n "${ns3}" link set ns3eth1 master ns3br1 up
+	ip -n "${ns3}" link set ns3eth2 master ns3br1 up
+	ip -n "${ns3}" link set ns3eth3 master ns3br1 up
+
+	ip -n "${ns4}" link set ns4eth1 up
+	ip -n "${ns5}" link set ns5eth1 up
 
 	ip -net "${ns1}" link add name hsr1 type hsr slave1 ns1eth1 slave2 ns1eth2 supervision 45 version ${HSRv} proto 0
 	ip -net "${ns2}" link add name hsr2 type hsr slave1 ns2eth1 slave2 ns2eth2 interlink ns2eth3 supervision 45 version ${HSRv} proto 0
 
 	ip -n "${ns1}" addr add 100.64.0.1/24 dev hsr1
 	ip -n "${ns2}" addr add 100.64.0.2/24 dev hsr2
+	ip -n "${ns3}" addr add 100.64.0.11/24 dev ns3br1
 	ip -n "${ns3}" addr add 100.64.0.3/24 dev ns3eth1
+	ip -n "${ns4}" addr add 100.64.0.41/24 dev ns4eth1
+	ip -n "${ns5}" addr add 100.64.0.51/24 dev ns5eth1
 
 	ip -n "${ns1}" link set hsr1 up
 	ip -n "${ns2}" link set hsr2 up
 }
 
 check_prerequisites
-setup_ns ns1 ns2 ns3
+setup_ns ns1 ns2 ns3 ns4 ns5
 
 trap cleanup_all_ns EXIT
 
-- 
2.20.1


             reply	other threads:[~2024-05-10 14:37 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-10 14:37 Lukasz Majewski [this message]
2024-05-13 23:10 ` [net-next PATCH] test: hsr: Extend the hsr_redbox.sh to have more SAN devices connected patchwork-bot+netdevbpf

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=20240510143710.3916631-1-lukma@denx.de \
    --to=lukma@denx.de \
    --cc=casper.casan@gmail.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).