Message ID | 1540818202-11247-5-git-send-email-alexey.kodanev@oracle.com |
---|---|
State | Accepted |
Headers | show |
Series | network: new tests for mpls over gre, gre6 and sit | expand |
Hi, > Setup MPLS encapsulation over the default test network setup, > use ICMP, UDP and TCP inner protocols. > Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> > --- Reviewed-by: Petr Vorel <pvorel@suse.cz> Just some minor things bellow. > +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 ... > +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 > + 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. > + ROD sysctl -q net.mpls.platform_labels=$label The same is for this one ... > + rpf_loc="$(sysctl -n net.ipv4.conf.all.rp_filter)" > + ROD sysctl -q net.ipv4.conf.all.rp_filter=2 ... and this one. > + 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" > + 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
Hi Petr, On 11/02/2018 11:02 PM, Petr Vorel wrote: > Hi, > >> Setup MPLS encapsulation over the default test network setup, >> use ICMP, UDP and TCP inner protocols. > >> Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> >> --- > Reviewed-by: Petr Vorel <pvorel@suse.cz> > Just some minor things bellow. > >> +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. > ... >> +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. > >> + 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. >> + ROD sysctl -q net.mpls.platform_labels=$label > The same is for this one ... >> + 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! >> + 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" > >> + 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 >
Hi Alexey, > >> + 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
Hi Petr, On 11/07/2018 08:36 PM, Petr Vorel wrote: > Hi Alexey, > >>>> + 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 $@" > } > Sure or even more generic, for any commands?
Hi Alexey, > > 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
diff --git a/runtest/net.features b/runtest/net.features index f858421..29d5092 100644 --- a/runtest/net.features +++ b/runtest/net.features @@ -62,3 +62,5 @@ geneve01_ipv6 geneve01.sh -6 sit01 sit01.sh mpls01 mpls01.sh +mpls02 mpls02.sh +mpls02_ipv6 mpls02.sh -6 diff --git a/testcases/network/mpls/mpls02.sh b/testcases/network/mpls/mpls02.sh new file mode 100755 index 0000000..745a414 --- /dev/null +++ b/testcases/network/mpls/mpls02.sh @@ -0,0 +1,53 @@ +#!/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="do_test" +TST_CLEANUP="cleanup" + +. mpls_lib.sh + +cleanup() +{ + ip route del $ip_rmt/$mask > /dev/null 2>&1 + tst_rhost_run -c "ip route del $ip_loc/$mask" > /dev/null + + [ -n "$ip_loc" ] && ip addr del $ip_loc/$mask dev lo > /dev/null 2>&1 + [ -n "$ip_rmt" ] && tst_rhost_run -c "ip addr del $ip_rmt/$mask dev lo" > \ + /dev/null 2>&1 + + mpls_cleanup +} + +setup() +{ + mpls_setup 61 + + ip_loc=$(tst_ipaddr_un) + ip_rmt=$(tst_ipaddr_un rhost) + [ -n "$TST_IPV6" ] && mask=128 || mask=32 + + ROD ip addr add $ip_loc/$mask dev lo + ROD ip route add $ip_rmt/$mask encap mpls 50 via inet$TST_IPV6 $(tst_ipaddr rhost) + ROD ip -f mpls route add 60 dev lo + + tst_rhost_run -s -c "ip addr add $ip_rmt/$mask dev lo" + tst_rhost_run -s -c "ip route add $ip_loc/$mask encap mpls 60 via inet$TST_IPV6 $(tst_ipaddr)" + tst_rhost_run -s -c "ip -f mpls route add 50 dev lo" +} + +do_test() +{ + local type=$2 + local max_size=10000 + + if [ "$type" = "icmp" ]; then + tst_ping $ip_loc $ip_rmt 10 100 1000 2000 $max_size + else + tst_netload -S $ip_loc -H $ip_rmt -T $type -n 10 -N 10 + tst_netload -S $ip_loc -H $ip_rmt -T $type -A $max_size + fi +} + +tst_run diff --git a/testcases/network/mpls/mpls_lib.sh b/testcases/network/mpls/mpls_lib.sh new file mode 100755 index 0000000..87aec5c --- /dev/null +++ b/testcases/network/mpls/mpls_lib.sh @@ -0,0 +1,46 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0-or-later +# Copyright (c) 2018 Oracle and/or its affiliates. All Rights Reserved. + +TST_MIN_KVER="4.3" +TST_NEEDS_TMPDIR=1 +TST_NEEDS_ROOT=1 +TST_NEEDS_DRIVERS="mpls_router mpls_iptunnel" +TST_NEEDS_CMDS="sysctl modprobe" +TST_TEST_DATA="icmp tcp udp" + +. tst_net.sh + +mpls_cleanup() +{ + local flush_dev="ip -f mpls route flush dev" + + $flush_dev lo > /dev/null 2>&1 + tst_rhost_run -c "$flush_dev lo" > /dev/null + + [ -n $rpf_loc ] && sysctl -q net.ipv4.conf.all.rp_filter=$rpf_loc + [ -n $rpf_rmt ] && tst_rhost_run -s -c "sysctl -q net.ipv4.conf.all.rp_filter=$rpf_rmt" +} + +mpls_setup() +{ + local label="$1" + + ROD modprobe mpls_router + ROD modprobe mpls_iptunnel + ROD modprobe mpls_gso + ROD sysctl -q net.mpls.conf.$(tst_iface).input=1 + ROD sysctl -q net.mpls.conf.lo.input=1 + ROD sysctl -q net.mpls.platform_labels=$label + rpf_loc="$(sysctl -n net.ipv4.conf.all.rp_filter)" + ROD sysctl -q net.ipv4.conf.all.rp_filter=2 + + 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 "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" +}
Setup MPLS encapsulation over the default test network setup, use ICMP, UDP and TCP inner protocols. Signed-off-by: Alexey Kodanev <alexey.kodanev@oracle.com> --- 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