From: Ido Schimmel <idosch@idosch.org>
To: Guillaume Nault <gnault@redhat.com>
Cc: David Miller <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org, David Ahern <dsahern@gmail.com>,
Shuah Khan <shuah@kernel.org>,
linux-kselftest@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] selftests: forwarding: Test redirecting gre or ipip packets to Ethernet
Date: Thu, 1 Jul 2021 08:46:46 +0300 [thread overview]
Message-ID: <YN1Wxm0mOFFhbuTl@shredder> (raw)
In-Reply-To: <0a4e63cd3cde3c71cfc422a7f0f5e9bc76c0c1f5.1625056665.git.gnault@redhat.com>
On Wed, Jun 30, 2021 at 02:51:38PM +0200, Guillaume Nault wrote:
> diff --git a/tools/testing/selftests/net/forwarding/topo_nschain_lib.sh b/tools/testing/selftests/net/forwarding/topo_nschain_lib.sh
> new file mode 100644
> index 000000000000..4c0bf2d7328a
> --- /dev/null
> +++ b/tools/testing/selftests/net/forwarding/topo_nschain_lib.sh
> @@ -0,0 +1,267 @@
> +#!/bin/bash
> +# SPDX-License-Identifier: GPL-2.0
> +
> +# A chain of 4 nodes connected with veth pairs.
> +# Each node lives in its own network namespace.
Hi,
The tests under tools/testing/selftests/net/forwarding/ are meant to use
VRFs as lightweight namespaces. This allows us to run the tests on both
physical switches with loopback cables and veth pairs, thereby
validating both the hardware and software datapaths.
See tools/testing/selftests/net/forwarding/README
If the tests cannot be converted to VRFs, then I suggest moving them to
tools/testing/selftests/net/
> +# Each veth interface has an IPv4 and an IPv6 address. A host route provides
> +# connectivity to the adjacent node. This base network only allows nodes to
> +# communicate with their immediate neighbours.
> +#
> +# The two nodes at the extremities of the chain also have 4 host IPs on their
> +# loopback device:
> +# * An IPv4 address, routed as is to the adjacent router.
> +# * An IPv4 address, routed over MPLS to the adjacent router.
> +# * An IPv6 address, routed as is to the adjacent router.
> +# * An IPv6 address, routed over MPLS to the adjacent router.
> +#
> +# This topology doesn't define how RTA and RTB handle these packets: users of
> +# this script are responsible for the plumbing between RTA and RTB.
> +#
> +# As each veth connects two different namespaces, their MAC and IP addresses
> +# are defined depending on the local and remote namespaces. For example
> +# veth-h1-rta, which sits in H1 and links to RTA, has MAC address
> +# 00:00:5e:00:53:1a, IPv4 192.0.2.0x1a and IPv6 2001:db8::1a, where "1a" means
> +# that it's in H1 and links to RTA (the rest of each address is always built
> +# from a IANA documentation prefix).
> +#
> +# Routed addresses in H1 and H2 on the other hand encode the routing type (with
> +# or without MPLS encapsulation) and the namespace the address resides in. For
> +# example H2 has 198.51.100.2 and 2001:db8::1:2, that are routed as is through
> +# RTB. It also has 198.51.100.0x12 and 2001:db8::1:12, that are routed through
> +# RTB with MPLS encapsulation.
> +#
> +# For clarity, the prefixes used for host IPs are different from the ones used
> +# on the veths.
> +#
> +# The MPLS labels follow a similar principle: the first digit represents the
> +# IP version of the encapsulated packet ("4" for IPv4, "6" for IPv6), the
> +# second digit represents the destination host ("1" for H1, "2" for H2).
> +#
> +# +----------------------------------------------------+
> +# | Host 1 (H1) |
> +# | |
> +# | lo |
> +# | 198.51.100.1 (for plain IPv4) |
> +# | 2001:db8::1:1 (for plain IPv6) |
> +# | 198.51.100.0x11 (for IPv4 over MPLS, label 42) |
> +# | 2001:db8::1:11 (for IPv6 over MPLS, label 62) |
> +# | |
> +# | + veth-h1-rta |
> +# | | 192.0.2.0x1a |
> +# | | 2001:db8::1a |
> +# +-|--------------------------------------------------+
> +# |
> +# +-|--------------------+
> +# | | Router A (RTA) |
> +# | | |
> +# | + veth-rta-h1 |
> +# | 192.0.2.0xa1 |
> +# | 2001:db8::a1 |
> +# | |
> +# | + veth-rta-rtb |
> +# | | 192.0.2.0xab |
> +# | | 2001:db8::ab |
> +# +-|--------------------+
> +# |
> +# +-|--------------------+
> +# | | Router B (RTB) |
> +# | | |
> +# | + veth-rtb-rta |
> +# | 192.0.2.0xba |
> +# | 2001:db8::ba |
> +# | |
> +# | + veth-rtb-h2 |
> +# | | 192.0.2.0xb2 |
> +# | | 2001:db8::b2 |
> +# +-|--------------------+
> +# |
> +# +-|--------------------------------------------------+
> +# | | Host 2 (H2) |
> +# | | |
> +# | + veth-h2-rtb |
> +# | 192.0.2.0x2b |
> +# | 2001:db8::2b |
> +# | |
> +# | lo |
> +# | 198.51.100.2 (for plain IPv4) |
> +# | 2001:db8::1:2 (for plain IPv6) |
> +# | 198.51.100.0x12 (for IPv4 over MPLS, label 41) |
> +# | 2001:db8::1:12 (for IPv6 over MPLS, label 61) |
> +# +----------------------------------------------------+
> +#
> +# This topology can be used for testing different routing or switching
> +# scenarios, as H1 and H2 are pre-configured for sending different kinds of
> +# packets (IPv4, IPv6, with or without MPLS encapsulation), which RTA and RTB
> +# can easily match and process according to the forwarding mechanism to test.
next prev parent reply other threads:[~2021-07-01 5:46 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-30 12:51 [PATCH net-next 0/4] selftests: forwarding: Tests redirects between L3 and L2 devices Guillaume Nault
2021-06-30 12:51 ` [PATCH net-next 1/4] selftests: forwarding: Test redirecting gre or ipip packets to Ethernet Guillaume Nault
2021-07-01 5:46 ` Ido Schimmel [this message]
2021-07-01 14:59 ` Guillaume Nault
2021-07-01 15:38 ` David Ahern
2021-07-01 16:59 ` Guillaume Nault
2021-07-06 19:02 ` Guillaume Nault
2021-07-07 15:05 ` David Ahern
2021-07-07 15:42 ` Guillaume Nault
2021-07-08 1:50 ` David Ahern
2021-07-09 16:21 ` Guillaume Nault
2021-06-30 12:51 ` [PATCH net-next 2/4] selftests: forwarding: Test redirecting sit " Guillaume Nault
2021-06-30 12:51 ` [PATCH net-next 3/4] selftests: forwarding: Test redirecting ip6gre and ip6tnl " Guillaume Nault
2021-06-30 12:51 ` [PATCH net-next 4/4] selftests: forwarding: Test redirecting vxlan and bareudp " Guillaume Nault
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=YN1Wxm0mOFFhbuTl@shredder \
--to=idosch@idosch.org \
--cc=davem@davemloft.net \
--cc=dsahern@gmail.com \
--cc=gnault@redhat.com \
--cc=kuba@kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 NNTP newsgroup(s).