commit 4168e20243abdedd0d7901c5369106a12f0967fe
parent 5a7eb91378bfe957571ddded6300e23d508ee719
Author: James Prestwood <prestwoj@gmail.com>
Date: Tue, 17 Nov 2020 12:53:03 -0800
auto-t: add test_ip_connected to testutil
Used to check IP connectivity between namespaces. The input
should be two tuples containing the IP and namespace to ping
from/to.
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/autotests/util/testutil.py b/autotests/util/testutil.py
@@ -152,3 +152,13 @@ def test_ip_address_match(intf, ip):
if ip != addr:
raise Exception('IP for %s did not match %s (was %s)' % (intf, ip, addr))
+
+def test_ip_connected(tup0, tup1):
+ ip0, ns0 = tup0
+ ip1, ns1 = tup1
+
+ try:
+ ns0.start_process(['ping', '-c', '5', '-i', '0.2', ip1], check=True)
+ ns1.start_process(['ping', '-c', '5', '-i', '0.2', ip0], check=True)
+ except:
+ raise Exception('Could not ping between %s and %s' % (ip0, ip1))