From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (gandalf.ozlabs.org [150.107.74.76]) by passt.top (Postfix) with ESMTPS id 16C035A0271 for ; Tue, 27 Jun 2023 04:54:46 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4Qqq7K0YqLz4wqq; Tue, 27 Jun 2023 12:54:37 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1687834477; bh=/jLyy5gLkr0pIg6cJGTSzju0n3Z5vx5bmGaub339RUk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ffaCQXSJ1xwsYqMdLORh0HIchzhA+esSlat2IhrgqgTHWjHdvLDbUeDwM4C/Gq41p rcvGUvdASrZeGPcCXSBKvhOlNktpGI4mDedq8kLkgOHuJUgQTmHM71WOAsGCP5MKZG gNfnw7lW6168CdtdKR8tl0K76YufWqwcyfBt3BII= From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH 18/27] tasst: Add helper for getting MTU of a network interface Date: Tue, 27 Jun 2023 12:54:19 +1000 Message-ID: <20230627025429.2209702-19-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230627025429.2209702-1-david@gibson.dropbear.id.au> References: <20230627025429.2209702-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: TGBVOAICSHHHWJCUZF6LTCPWLQAPSXU2 X-Message-ID-Hash: TGBVOAICSHHHWJCUZF6LTCPWLQAPSXU2 X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: crosa@redhat.com, jarichte@redhat.com, David Gibson X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Signed-off-by: David Gibson --- test/tasst/exesite.py | 11 ++++++++++- test/tasst/meta/veth.py | 9 ++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/test/tasst/exesite.py b/test/tasst/exesite.py index 246f9b3f..63872c34 100644 --- a/test/tasst/exesite.py +++ b/test/tasst/exesite.py @@ -124,6 +124,11 @@ class Site(contextlib.AbstractContextManager): for ai in self.addrinfos(ifname, **criteria) if 'tentative' not in ai] + def mtu(self, ifname): + self.require_cmds('ip') + (info,) = json.loads(self.output(f'ip -j link show {ifname}')) + return info['mtu'] + def test_site(sitefn): def test_true(s): @@ -184,10 +189,14 @@ def test_site(sitefn): with s as site: assert_eq_unordered(site.addrs('lo'), expected) + def test_lo_mtu(s): + with s as site: + assert_eq(site.mtu('lo'), 65536) + return test_output(test_true, test_false, test_echo, test_timeout, test_bg_true, test_bg_false, test_bg_echo, test_bg_timeout, test_bg_context_timeout, - test_has_lo, test_lo_addrs)(sitefn) + test_has_lo, test_lo_addrs, test_lo_mtu)(sitefn) def test_isolated_site(sitefn): diff --git a/test/tasst/meta/veth.py b/test/tasst/meta/veth.py index 9cef6271..053bd9c8 100644 --- a/test/tasst/meta/veth.py +++ b/test/tasst/meta/veth.py @@ -13,7 +13,7 @@ meta/veth.py - Test various veth configurations import contextlib -from avocado_classless.test import assert_eq_unordered, test +from avocado_classless.test import assert_eq, assert_eq_unordered, test from tasst.nstool import unshare_site @@ -31,3 +31,10 @@ def test_ifs(): with unconfigured_veth() as (ns1, ns2): assert_eq_unordered(ns1.ifs(), ['lo', 'veth1']) assert_eq_unordered(ns2.ifs(), ['lo', 'veth2']) + + +@test +def test_mtu(): + with unconfigured_veth() as (ns1, ns2): + assert_eq(ns1.mtu('veth1'), 1500) + assert_eq(ns2.mtu('veth2'), 1500) -- 2.41.0