Skip to contentSkip to conversation

network: new tests for mpls over gre, gre6 and sit

PATCH New Alexey Kodanev 2 participants 15 messages Oct 29, 2018 – Nov 13, 2018

lore
Share & tools
lore
#0 lore raw

cover network: new tests for mpls over gre, gre6 and sit

Before using sit tunnels with MPLS, add stand-alone sit01 test. It is done by the first two patches.

The rest of the patches add various MPLS tests:
* mpls01: functional test, creates/removes MPLS routes, checks sysctl parameters.
* mpls02: MPLS over the default test network configuration
* mpls03/mpls04: MPLS over GRE and SIT.

Alexey Kodanev (6):
network/virt: add support for sit tunnel network/sit01: new test for sit tunnel network/mpls01: new test for mpls labels network/mpls02: new test with lwtunnel network/mpls03: add MPLS over GRE and GREv6 network/mpls04: new test with mpls over sit tunnel

 runtest/net.features               |   10 ++++
 testcases/network/mpls/Makefile    |   10 ++++
 testcases/network/mpls/mpls01.sh   |   70 ++++++++++++++++++++++++
 testcases/network/mpls/mpls02.sh   |   53 ++++++++++++++++++
 testcases/network/mpls/mpls03.sh   |   24 ++++++++
 testcases/network/mpls/mpls04.sh   |   19 +++++++
 testcases/network/mpls/mpls_lib.sh |  105 ++++++++++++++++++++++++++++++++++++
 testcases/network/virt/sit01.sh    |   23 ++++++++
 testcases/network/virt/virt_lib.sh |    8 +++-
 9 files changed, 321 insertions(+), 1 deletions(-)
 create mode 100644 testcases/network/mpls/Makefile
 create mode 100755 testcases/network/mpls/mpls01.sh
 create mode 100755 testcases/network/mpls/mpls02.sh
 create mode 100755 testcases/network/mpls/mpls03.sh
 create mode 100755 testcases/network/mpls/mpls04.sh
 create mode 100755 testcases/network/mpls/mpls_lib.sh
 create mode 100755 testcases/network/virt/sit01.sh
#1 lore raw

PATCH 1/6 network/virt: add support for sit tunnel

---
 testcases/network/virt/virt_lib.sh |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)
testcases/network/virt/virt_lib.sh +7 -1
index de3aba6..c9fe80c 100644
@@ -116,10 +116,13 @@ virt_add()
 		[ -z "$opt" ] && \
 			opt="remote $(tst_ipaddr rhost) dev $(tst_iface)"
 	;;
+	sit)
+		[ -z "$opt" ] && opt="remote $(tst_ipaddr rhost) local $(tst_ipaddr)"
+	;;
 	esac
 
 	case $virt_type in
-	vxlan|geneve)
+	vxlan|geneve|sit)
 		ip li add $vname type $virt_type $opt
 	;;
 	gre|ip6gre)
@@ -140,6 +143,9 @@ virt_add_rhost()
 		[ "$vxlan_dstport" -eq 1 ] && opt="$opt dstport 0"
 		tst_rhost_run -s -c "ip li add ltp_v0 type $virt_type $@ $opt"
 	;;
+	sit)
+		tst_rhost_run -s -c "ip link add ltp_v0 type $virt_type $@"
+	;;
 	gre|ip6gre)
 		tst_rhost_run -s -c "ip -f inet$TST_IPV6 tu add ltp_v0 \
 				     mode $virt_type $@"
Signature · 1 line
1.7.1
#2 lore raw

PATCH 2/6 network/sit01: new test for sit tunnel

In reply to Alexey Kodanev
---
 runtest/net.features            |    2 ++
 testcases/network/virt/sit01.sh |   23 +++++++++++++++++++++++
 2 files changed, 25 insertions(+), 0 deletions(-)
 create mode 100755 testcases/network/virt/sit01.sh
runtest/net.features +2 -0
index eac1b2b..de49e76 100644
@@ -58,3 +58,5 @@ dctcp_ipv6_01 dctcp01.sh -6
 
 geneve01 geneve01.sh
 geneve01_ipv6 geneve01.sh -6
+
+sit01 sit01.sh
testcases/network/virt/sit01.sh new file +23 -0
new file mode 100755
index 0000000..4ecc1f8
@@ -0,0 +1,23 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Oracle and/or its affiliates.
+
+TST_NEEDS_TMPDIR=1
+TST_TESTFUNC=virt_netperf_msg_sizes
+TST_SETUP=do_setup
+TST_CLEANUP=virt_cleanup
+virt_type="sit"
+. virt_lib.sh
+
+do_setup()
+{
+	[ -n "$TST_IPV6" ] && tst_res TBROK "invalid option '-6' for sit tunnel"
+
+	virt_lib_setup
+
+	tst_res TINFO "test $virt_type"
+	virt_setup "local $(tst_ipaddr) remote $(tst_ipaddr rhost)" \
+		   "local $(tst_ipaddr rhost) remote $(tst_ipaddr)"
+}
+
+tst_run
Signature · 1 line
1.7.1
#3 lore raw

PATCH 3/6 network/mpls01: new test for mpls labels

In reply to Alexey Kodanev

Checks basic functionality (adds/deletes routes), related sysctl parameters.

---
 runtest/net.features             |    2 +
 testcases/network/mpls/Makefile  |   10 +++++
 testcases/network/mpls/mpls01.sh |   70 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 82 insertions(+), 0 deletions(-)
 create mode 100644 testcases/network/mpls/Makefile
 create mode 100755 testcases/network/mpls/mpls01.sh
runtest/net.features +2 -0
index de49e76..f858421 100644
@@ -60,3 +60,5 @@ geneve01 geneve01.sh
 geneve01_ipv6 geneve01.sh -6
 
 sit01 sit01.sh
+
+mpls01 mpls01.sh
testcases/network/mpls/Makefile new file +10 -0
new file mode 100644
index 0000000..3a54269
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
+
+top_srcdir		?= ../../..
+
+include $(top_srcdir)/include/mk/testcases.mk
+
+INSTALL_TARGETS		:= *.sh
+
+include $(top_srcdir)/include/mk/generic_leaf_target.mk
testcases/network/mpls/mpls01.sh new file +70 -0

70 lines not on this page · raw message

Signature · 1 line
1.7.1
#4 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

In reply to Alexey Kodanev

Setup MPLS encapsulation over the default test network setup, use ICMP, UDP and TCP inner protocols.

---
 runtest/net.features               |    2 +
 testcases/network/mpls/mpls02.sh   |   53 ++++++++++++++++++++++++++++++++++++
 testcases/network/mpls/mpls_lib.sh |   46 +++++++++++++++++++++++++++++++
 3 files changed, 101 insertions(+), 0 deletions(-)
 create mode 100755 testcases/network/mpls/mpls02.sh
 create mode 100755 testcases/network/mpls/mpls_lib.sh
runtest/net.features +2 -0
index f858421..29d5092 100644
@@ -62,3 +62,5 @@ geneve01_ipv6 geneve01.sh -6
 sit01 sit01.sh
 
 mpls01 mpls01.sh
+mpls02 mpls02.sh
+mpls02_ipv6 mpls02.sh -6
testcases/network/mpls/mpls02.sh new file +53 -0

53 lines not on this page · raw message

testcases/network/mpls/mpls_lib.sh new file +46 -0

46 lines not on this page · raw message

Signature · 1 line
1.7.1
#5 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

Hi,

Quoted 5 lines

Setup MPLS encapsulation over the default test network setup, use ICMP, UDP and TCP inner protocols.

---

Just some minor things bellow.

testcases/network/mpls/mpls_lib.sh line 8

Quoted 4 lines
testcases/network/mpls/mpls_lib.sh new file +4 -0
+TST_MIN_KVER="4.3"
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel"

Here is missing mpls_gso

...

testcases/network/mpls/mpls_lib.sh line 31

Quoted 7 lines
testcases/network/mpls/mpls_lib.sh new file +7 -0
+mpls_setup()
+{
+	local label="$1"
+
+	ROD modprobe mpls_router
+	ROD modprobe mpls_iptunnel
+	ROD modprobe mpls_gso

Maybe just?
ROD modprobe mpls_gso $TST_NEEDS_DRIVERS

testcases/network/mpls/mpls_lib.sh line 33

Quoted 2 lines
testcases/network/mpls/mpls_lib.sh new file +2 -0
+	ROD sysctl -q net.mpls.conf.$(tst_iface).input=1
+	ROD sysctl -q net.mpls.conf.lo.input=1

This one can be set with tst_set_sysctl, as it's the same for both lhost and rhost.

testcases/network/mpls/mpls_lib.sh line 34

Quoted 1 line
testcases/network/mpls/mpls_lib.sh new file +1 -0
+	ROD sysctl -q net.mpls.platform_labels=$label

The same is for this one ...

testcases/network/mpls/mpls_lib.sh line 36

Quoted 2 lines
testcases/network/mpls/mpls_lib.sh new file +2 -0
+	rpf_loc="$(sysctl -n net.ipv4.conf.all.rp_filter)"
+	ROD sysctl -q net.ipv4.conf.all.rp_filter=2

... and this one.

testcases/network/mpls/mpls_lib.sh line 40

Quoted 3 lines
testcases/network/mpls/mpls_lib.sh new file +3 -0
+	tst_rhost_run -s -c "modprobe mpls_router"
+	tst_rhost_run -s -c "modprobe mpls_iptunnel"
+	tst_rhost_run -s -c "modprobe mpls_gso"

tst_rhost_run -s -c "modprobe $TST_NEEDS_DRIVERS"

testcases/network/mpls/mpls_lib.sh line 46

Quoted 6 lines
testcases/network/mpls/mpls_lib.sh new file +6 -0
+	tst_rhost_run -s -c "sysctl -q net.mpls.conf.$(tst_iface rhost).input=1"
+	tst_rhost_run -s -c "sysctl -q net.mpls.conf.lo.input=1"
+	tst_rhost_run -s -c "sysctl -q net.mpls.platform_labels=$label"
+	rpf_rmt="$(tst_rhost_run -c 'sysctl -n net.ipv4.conf.all.rp_filter')"
+	tst_rhost_run -s -c "sysctl -q net.ipv4.conf.all.rp_filter=2"
+}

Kind regards,
Petr

#6 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

Hi Petr,

Quoted 7 lines · Petr Vorel

Hi,

Quoted 5 lines

Setup MPLS encapsulation over the default test network setup, use ICMP, UDP and TCP inner protocols.

---

Quoted 9 lines

Just some minor things bellow.

testcases/network/mpls/mpls_lib.sh line 8

Quoted 4 lines
testcases/network/mpls/mpls_lib.sh new file +4 -0
+TST_MIN_KVER="4.3"
+TST_NEEDS_TMPDIR=1
+TST_NEEDS_ROOT=1
+TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel"

Here is missing mpls_gso

Right.

Quoted 10 lines

...

testcases/network/mpls/mpls_lib.sh line 31

Quoted 7 lines
testcases/network/mpls/mpls_lib.sh new file +7 -0
+mpls_setup()
+{
+	local label="$1"
+
+	ROD modprobe mpls_router
+	ROD modprobe mpls_iptunnel
+	ROD modprobe mpls_gso

Maybe just?
ROD modprobe mpls_gso $TST_NEEDS_DRIVERS

OK, and it will need the '-a' option.

Quoted 11 lines

testcases/network/mpls/mpls_lib.sh line 33

Quoted 3 lines
testcases/network/mpls/mpls_lib.sh new file +2 -0
+	ROD sysctl -q net.mpls.conf.$(tst_iface).input=1
+	ROD sysctl -q net.mpls.conf.lo.input=1

This one can be set with tst_set_sysctl, as it's the same for both lhost and rhost.

testcases/network/mpls/mpls_lib.sh line 34

Quoted 1 line
testcases/network/mpls/mpls_lib.sh new file +1 -0
+	ROD sysctl -q net.mpls.platform_labels=$label

The same is for this one ...

testcases/network/mpls/mpls_lib.sh line 36

Quoted 2 lines
testcases/network/mpls/mpls_lib.sh new file +2 -0
+	rpf_loc="$(sysctl -n net.ipv4.conf.all.rp_filter)"
+	ROD sysctl -q net.ipv4.conf.all.rp_filter=2

... and this one.

Indeed, I almost forgot that we have such a function helper in the library, thanks!

Quoted 16 lines

testcases/network/mpls/mpls_lib.sh line 40

Quoted 3 lines
testcases/network/mpls/mpls_lib.sh new file +3 -0
+	tst_rhost_run -s -c "modprobe mpls_router"
+	tst_rhost_run -s -c "modprobe mpls_iptunnel"
+	tst_rhost_run -s -c "modprobe mpls_gso"

tst_rhost_run -s -c "modprobe $TST_NEEDS_DRIVERS"

testcases/network/mpls/mpls_lib.sh line 46

Quoted 6 lines
testcases/network/mpls/mpls_lib.sh new file +6 -0
+	tst_rhost_run -s -c "sysctl -q net.mpls.conf.$(tst_iface rhost).input=1"
+	tst_rhost_run -s -c "sysctl -q net.mpls.conf.lo.input=1"
+	tst_rhost_run -s -c "sysctl -q net.mpls.platform_labels=$label"
+	rpf_rmt="$(tst_rhost_run -c 'sysctl -n net.ipv4.conf.all.rp_filter')"
+	tst_rhost_run -s -c "sysctl -q net.ipv4.conf.all.rp_filter=2"
+}

Kind regards,
Petr

#7 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

Hi Alexey,

Quoted 7 lines
Quoted 5 lines

testcases/network/mpls/mpls_lib.sh line 31

Quoted 3 lines
testcases/network/mpls/mpls_lib.sh new file +3 -0
+	ROD modprobe mpls_router
+	ROD modprobe mpls_iptunnel
+	ROD modprobe mpls_gso

Maybe just?
ROD modprobe mpls_gso $TST_NEEDS_DRIVERS

OK, and it will need the '-a' option.

I wonder if we want to have a simple helper in tst_net.sh for loading modules on both sides, similar to tst_set_sysctl and tst_net_driver (from my pull request):

tst_net_driver()
{
ROD modprobe -a $@
tst_rhost_run -c "modprobe -a $@"
}

Kind regards,
Petr

#8 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

Hi Petr,

Quoted 9 lines · Petr Vorel

Hi Alexey,

Quoted 7 lines
Quoted 5 lines

testcases/network/mpls/mpls_lib.sh line 31

Quoted 3 lines
testcases/network/mpls/mpls_lib.sh new file +3 -0
+	ROD modprobe mpls_router
+	ROD modprobe mpls_iptunnel
+	ROD modprobe mpls_gso

Maybe just?
ROD modprobe mpls_gso $TST_NEEDS_DRIVERS

OK, and it will need the '-a' option.

Quoted 9 lines

I wonder if we want to have a simple helper in tst_net.sh for loading modules on both sides, similar to tst_set_sysctl and tst_net_driver (from my pull request):

tst_net_driver()
{
ROD modprobe -a $@
tst_rhost_run -c "modprobe -a $@"
}

Sure or even more generic, for any commands?

#9 lore raw

PATCH 4/6 network/mpls02: new test with lwtunnel

Hi Alexey,

Quoted 10 lines
Quoted 8 lines

I wonder if we want to have a simple helper in tst_net.sh for loading modules on both sides, similar to tst_set_sysctl and tst_net_driver (from my pull request):

tst_net_driver()
{
ROD modprobe -a $@
tst_rhost_run -c "modprobe -a $@"
}

Sure or even more generic, for any commands?

Added here:
https://patchwork.ozlabs.org/patch/994893/

Kind regards,
Petr

#10 lore raw

PATCH 5/6 network/mpls03: add MPLS over GRE and GREv6

In reply to Alexey Kodanev

Note, support for GREv6 was added in Linux 4.19.

---
 runtest/net.features               |    3 ++
 testcases/network/mpls/mpls03.sh   |   24 ++++++++++++++
 testcases/network/mpls/mpls_lib.sh |   59 ++++++++++++++++++++++++++++++++++++
 3 files changed, 86 insertions(+), 0 deletions(-)
 create mode 100755 testcases/network/mpls/mpls03.sh
runtest/net.features +3 -0
index 29d5092..6076e2a 100644
@@ -64,3 +64,6 @@ sit01 sit01.sh
 mpls01 mpls01.sh
 mpls02 mpls02.sh
 mpls02_ipv6 mpls02.sh -6
+mpls03 mpls03.sh
+mpls03_ipv6 mpls03.sh -6
+
testcases/network/mpls/mpls03.sh new file +24 -0
new file mode 100755
index 0000000..0db6dbf
@@ -0,0 +1,24 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
+
+TST_SETUP="setup"
+TST_TESTFUNC="mpls_virt_test"
+TST_CLEANUP="mpls_virt_cleanup"
+
+. virt_lib.sh
+. mpls_lib.sh
+
+setup()
+{
+	virt_type="gre"
+	if [ -n "$TST_IPV6" ]; then
+		tst_kvcmp -lt "4.19" && \
+			tst_brk TCONF "mpls + ip6gre requires kernel 4.19+"
+		virt_type="ip6gre"
+	fi
+
+	mpls_virt_setup
+}
+
+tst_run
testcases/network/mpls/mpls_lib.sh +59 -0

68 lines not on this page · raw message

Signature · 1 line
1.7.1
#11 lore raw

PATCH 5/6 network/mpls03: add MPLS over GRE and GREv6

Hi Alexey,

Quoted 3 lines

Note, support for GREv6 was added in Linux 4.19.

Just one more tst_set_sysctl:

Quoted 2 lines
(quoted diff) +2 -0
+mpls_virt_setup()
+{

...

testcases/network/mpls/mpls_lib.sh mpls_setup() · line 88

Quoted 2 lines
testcases/network/mpls/mpls_lib.sh +2 -0
+	ROD sysctl -q net.mpls.conf.ltp_v0.input=1
+	tst_rhost_run -s -c "sysctl -q net.mpls.conf.ltp_v0.input=1"

tst_set_sysctl net.mpls.conf.ltp_v0.input 1 safe

Kind regards,
Petr

#12 lore raw

PATCH 6/6 network/mpls04: new test with mpls over sit tunnel

In reply to Alexey Kodanev

The same as in mpls03 but with sit tunnel.

---
 runtest/net.features             |    1 +
 testcases/network/mpls/mpls04.sh |   19 +++++++++++++++++++
 2 files changed, 20 insertions(+), 0 deletions(-)
 create mode 100755 testcases/network/mpls/mpls04.sh
runtest/net.features +1 -0
index 6076e2a..b37104b 100644
@@ -66,4 +66,5 @@ mpls02 mpls02.sh
 mpls02_ipv6 mpls02.sh -6
 mpls03 mpls03.sh
 mpls03_ipv6 mpls03.sh -6
+mpls04 mpls04.sh
 
testcases/network/mpls/mpls04.sh new file +19 -0
new file mode 100755
index 0000000..639a13e
@@ -0,0 +1,19 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved.
+
+TST_SETUP="setup"
+TST_TESTFUNC="mpls_virt_test"
+TST_CLEANUP="mpls_virt_cleanup"
+
+. virt_lib.sh
+. mpls_lib.sh
+
+setup()
+{
+	virt_type="sit"
+
+	mpls_virt_setup
+}
+
+tst_run
Signature · 1 line
1.7.1
#13 lore raw

cover network: new tests for mpls over gre, gre6 and sit

In reply to Alexey Kodanev

Hi Alexey,

Quoted 9 lines

Before using sit tunnels with MPLS, add stand-alone sit01 test. It is done by the first two patches.

The rest of the patches add various MPLS tests:
* mpls01: functional test, creates/removes MPLS routes, checks sysctl parameters.
* mpls02: MPLS over the default test network configuration
* mpls03/mpls04: MPLS over GRE and SIT.

Quoted 7 lines

Alexey Kodanev (6):
network/virt: add support for sit tunnel network/sit01: new test for sit tunnel network/mpls01: new test for mpls labels network/mpls02: new test with lwtunnel network/mpls03: add MPLS over GRE and GREv6 network/mpls04: new test with mpls over sit tunnel

Thanks for patches, LGTM.

I've sent some minor issues to 4/6 and 5/6.

Kind regards,
Petr

#14 lore raw

cover network: new tests for mpls over gre, gre6 and sit

Quoted 19 lines · Petr Vorel

Hi Alexey,

Quoted 9 lines

Before using sit tunnels with MPLS, add stand-alone sit01 test. It is done by the first two patches.

The rest of the patches add various MPLS tests:
* mpls01: functional test, creates/removes MPLS routes, checks sysctl parameters.
* mpls02: MPLS over the default test network configuration
* mpls03/mpls04: MPLS over GRE and SIT.

Quoted 7 lines

Alexey Kodanev (6):
network/virt: add support for sit tunnel network/sit01: new test for sit tunnel network/mpls01: new test for mpls labels network/mpls02: new test with lwtunnel network/mpls03: add MPLS over GRE and GREv6 network/mpls04: new test with mpls over sit tunnel

Quoted 5 lines

Thanks for patches, LGTM.

I've sent some minor issues to 4/6 and 5/6.

All fixed, thanks for review Petr! Applied.