Wireless Daemon for Linux
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: iwd@lists.01.org
Subject: [PATCH 3/4] auto-t: add test_ip_connected to testutil
Date: Tue, 17 Nov 2020 12:53:03 -0800	[thread overview]
Message-ID: <20201117205304.3542997-3-prestwoj@gmail.com> (raw)
In-Reply-To: <20201117205304.3542997-1-prestwoj@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 916 bytes --]

Used to check IP connectivity between namespaces. The input
should be two tuples containing the IP and namespace to ping
from/to.
---
 autotests/util/testutil.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/autotests/util/testutil.py b/autotests/util/testutil.py
index faa81f65..94f8ef32 100644
--- 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))
-- 
2.26.2

  parent reply	other threads:[~2020-11-17 20:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-17 20:53 [PATCH 1/4] test-runner: introduce network namespaces James Prestwood
2020-11-17 20:53 ` [PATCH 2/4] auto-t: update utilities to use namespaces James Prestwood
2020-11-17 20:53 ` James Prestwood [this message]
2020-11-17 20:53 ` [PATCH 4/4] auto-t: add namespaces to testAP James Prestwood
2020-11-18 17:01 ` [PATCH 1/4] test-runner: introduce network namespaces Denis Kenzior

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=20201117205304.3542997-3-prestwoj@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=iwd@lists.01.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