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

Source file repositories/reference/linux-study-clean/tools/testing/selftests/net/hsr/hsr_redbox.sh

File Facts

System
Linux kernel
Corpus path
tools/testing/selftests/net/hsr/hsr_redbox.sh
Extension
.sh
Size
4912 bytes
Lines
137
Domain
Support Tooling And Documentation
Bucket
tools
Inferred role
Support Tooling And Documentation: tools
Status
atlas-only

Why This File Exists

Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.

Dependency Surface

Detected Declarations

Annotated Snippet

#!/bin/bash
# SPDX-License-Identifier: GPL-2.0

ipv6=false

source ./hsr_common.sh

do_complete_ping_test()
{
	echo "INFO: Initial validation ping (HSR-SAN/RedBox)."
	# 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 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
	# merged.
	sleep 5

	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 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."
}

setup_hsr_interfaces()
{
	local HSRv="$1"

	echo "INFO: preparing interfaces for HSRv${HSRv} (HSR-SAN/RedBox)."
#
# 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

Annotation

Implementation Notes