Allow passing of -t to ping resp. ping6.
Signed-off-by: Petr Machata petrm@mellanox.com --- recipes/switchdev/ipip_common.py | 19 +++++++++++-------- test_modules/Icmp6Ping.py | 4 ++++ test_modules/IcmpPing.py | 3 +++ 3 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/recipes/switchdev/ipip_common.py b/recipes/switchdev/ipip_common.py index 8d114ad..c1b07c1 100644 --- a/recipes/switchdev/ipip_common.py +++ b/recipes/switchdev/ipip_common.py @@ -15,18 +15,21 @@ from TestLib import route
def ping_test(tl, m1, sw, addr, m1_if1, gre, require_fastpath=True, fail_expected=False, count=100, - ipv6=False): + ipv6=False, ttl=None): limit = int(0.9 * count) if gre is not None: before_stats = gre.link_stats()["rx_packets"] + options = { + "addr": addr, + "count": count, + "interval": 0.2, + "iface" : m1_if1.get_devname(), + "limit_rate": limit, + } + if ttl is not None: + options["ttl"] = ttl ping_mod = ctl.get_module("IcmpPing" if not ipv6 else "Icmp6Ping", - options={ - "addr": addr, - "count": count, - "interval": 0.2, - "iface" : m1_if1.get_devname(), - "limit_rate": limit, - }) + options) m1.run(ping_mod, fail_expected=fail_expected)
if not fail_expected and gre is not None: diff --git a/test_modules/Icmp6Ping.py b/test_modules/Icmp6Ping.py index 405c756..7c3a88c 100644 --- a/test_modules/Icmp6Ping.py +++ b/test_modules/Icmp6Ping.py @@ -32,6 +32,10 @@ class Icmp6Ping(TestGeneric): if size: cmd += " -s %s" % size
+ ttl = self.get_opt("ttl") + if ttl: + cmd += " -t %s" % ttl + return cmd
def run(self): diff --git a/test_modules/IcmpPing.py b/test_modules/IcmpPing.py index 5b9d888..fb4d094 100644 --- a/test_modules/IcmpPing.py +++ b/test_modules/IcmpPing.py @@ -31,6 +31,9 @@ class IcmpPing(TestGeneric): size = self.get_opt("size") if size: cmd += " -s %s" % size + ttl = self.get_opt("ttl") + if ttl: + cmd += " -t %s" % ttl return cmd
def run(self):
Apologies for the noise, I wanted to send it for in-team review first, but only updated the address at the cover letter. Please ignore.
Thanks, Petr
lnst-developers@lists.fedorahosted.org