Skip to content

Commit 74a0f36

Browse files
Lukasz MajewskiNipaLocal
authored andcommitted
test: hsr: Extend the hsr_redbox.sh to have more SAN devices connected
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 <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 1201152 commit 74a0f36

File tree

1 file changed

+49
-22
lines changed

1 file changed

+49
-22
lines changed

tools/testing/selftests/net/hsr/hsr_redbox.sh

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@ source ./hsr_common.sh
88
do_complete_ping_test()
99
{
1010
echo "INFO: Initial validation ping (HSR-SAN/RedBox)."
11-
# Each node has to be able each one.
11+
# Each node has to be able to reach each one.
1212
do_ping "${ns1}" 100.64.0.2
1313
do_ping "${ns2}" 100.64.0.1
14-
# Ping from SAN to hsr1 (via hsr2)
14+
# Ping between SANs (test bridge)
15+
do_ping "${ns4}" 100.64.0.51
16+
do_ping "${ns5}" 100.64.0.41
17+
# Ping from SANs to hsr1 (via hsr2) (and opposite)
1518
do_ping "${ns3}" 100.64.0.1
1619
do_ping "${ns1}" 100.64.0.3
20+
do_ping "${ns1}" 100.64.0.41
21+
do_ping "${ns4}" 100.64.0.1
22+
do_ping "${ns1}" 100.64.0.51
23+
do_ping "${ns5}" 100.64.0.1
1724
stop_if_error "Initial validation failed."
1825

1926
# Wait for MGNT HSR frames being received and nodes being
@@ -23,8 +30,12 @@ do_complete_ping_test()
2330
echo "INFO: Longer ping test (HSR-SAN/RedBox)."
2431
# Ping from SAN to hsr1 (via hsr2)
2532
do_ping_long "${ns3}" 100.64.0.1
26-
# Ping from hsr1 (via hsr2) to SAN
33+
# Ping from hsr1 (via hsr2) to SANs (and opposite)
2734
do_ping_long "${ns1}" 100.64.0.3
35+
do_ping_long "${ns1}" 100.64.0.41
36+
do_ping_long "${ns4}" 100.64.0.1
37+
do_ping_long "${ns1}" 100.64.0.51
38+
do_ping_long "${ns5}" 100.64.0.1
2839
stop_if_error "Longer ping test failed."
2940

3041
echo "INFO: All good."
@@ -35,22 +46,26 @@ setup_hsr_interfaces()
3546
local HSRv="$1"
3647

3748
echo "INFO: preparing interfaces for HSRv${HSRv} (HSR-SAN/RedBox)."
38-
39-
# |NS1 |
40-
# | |
41-
# | /-- hsr1 --\ |
42-
# | ns1eth1 ns1eth2 |
43-
# |------------------------|
44-
# | |
45-
# | |
46-
# | |
47-
# |------------------------| |-----------|
48-
# | ns2eth1 ns2eth2 | | |
49-
# | \-- hsr2 --/ | | |
50-
# | \ | | |
51-
# | ns2eth3 |--------| ns3eth1 |
52-
# | (interlink)| | |
53-
# |NS2 (RedBOX) | |NS3 (SAN) |
49+
#
50+
# IPv4 addresses (100.64.X.Y/24), and [X.Y] is presented on below diagram:
51+
#
52+
#
53+
# |NS1 | |NS4 |
54+
# | [0.1] | | |
55+
# | /-- hsr1 --\ | | [0.41] |
56+
# | ns1eth1 ns1eth2 | | ns4eth1 (SAN) |
57+
# |------------------------| |-------------------|
58+
# | | |
59+
# | | |
60+
# | | |
61+
# |------------------------| |-------------------------------|
62+
# | ns2eth1 ns2eth2 | | ns3eth2 |
63+
# | \-- hsr2 --/ | | / |
64+
# | [0.2] \ | | / | |------------|
65+
# | ns2eth3 |---| ns3eth1 -- ns3br1 -- ns3eth3--|--| ns5eth1 |
66+
# | (interlink)| | [0.3] [0.11] | | [0.51] |
67+
# |NS2 (RedBOX) | |NS3 (BR) | | NS5 (SAN) |
68+
#
5469
#
5570
# Check if iproute2 supports adding interlink port to hsrX device
5671
ip link help hsr | grep -q INTERLINK
@@ -59,7 +74,9 @@ setup_hsr_interfaces()
5974
# Create interfaces for name spaces
6075
ip link add ns1eth1 netns "${ns1}" type veth peer name ns2eth1 netns "${ns2}"
6176
ip link add ns1eth2 netns "${ns1}" type veth peer name ns2eth2 netns "${ns2}"
62-
ip link add ns3eth1 netns "${ns3}" type veth peer name ns2eth3 netns "${ns2}"
77+
ip link add ns2eth3 netns "${ns2}" type veth peer name ns3eth1 netns "${ns3}"
78+
ip link add ns3eth2 netns "${ns3}" type veth peer name ns4eth1 netns "${ns4}"
79+
ip link add ns3eth3 netns "${ns3}" type veth peer name ns5eth1 netns "${ns5}"
6380

6481
sleep 1
6582

@@ -70,21 +87,31 @@ setup_hsr_interfaces()
7087
ip -n "${ns2}" link set ns2eth2 up
7188
ip -n "${ns2}" link set ns2eth3 up
7289

73-
ip -n "${ns3}" link set ns3eth1 up
90+
ip -n "${ns3}" link add name ns3br1 type bridge
91+
ip -n "${ns3}" link set ns3br1 up
92+
ip -n "${ns3}" link set ns3eth1 master ns3br1 up
93+
ip -n "${ns3}" link set ns3eth2 master ns3br1 up
94+
ip -n "${ns3}" link set ns3eth3 master ns3br1 up
95+
96+
ip -n "${ns4}" link set ns4eth1 up
97+
ip -n "${ns5}" link set ns5eth1 up
7498

7599
ip -net "${ns1}" link add name hsr1 type hsr slave1 ns1eth1 slave2 ns1eth2 supervision 45 version ${HSRv} proto 0
76100
ip -net "${ns2}" link add name hsr2 type hsr slave1 ns2eth1 slave2 ns2eth2 interlink ns2eth3 supervision 45 version ${HSRv} proto 0
77101

78102
ip -n "${ns1}" addr add 100.64.0.1/24 dev hsr1
79103
ip -n "${ns2}" addr add 100.64.0.2/24 dev hsr2
104+
ip -n "${ns3}" addr add 100.64.0.11/24 dev ns3br1
80105
ip -n "${ns3}" addr add 100.64.0.3/24 dev ns3eth1
106+
ip -n "${ns4}" addr add 100.64.0.41/24 dev ns4eth1
107+
ip -n "${ns5}" addr add 100.64.0.51/24 dev ns5eth1
81108

82109
ip -n "${ns1}" link set hsr1 up
83110
ip -n "${ns2}" link set hsr2 up
84111
}
85112

86113
check_prerequisites
87-
setup_ns ns1 ns2 ns3
114+
setup_ns ns1 ns2 ns3 ns4 ns5
88115

89116
trap cleanup_all_ns EXIT
90117

0 commit comments

Comments
 (0)