From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from gandalf.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 68F245A026F for ; Wed, 31 May 2023 03:59:02 +0200 (CEST) Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4QWC9S3R2Qz4x4k; Wed, 31 May 2023 11:58:52 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=201602; t=1685498332; bh=+4ilhDC94LmHaglWwBD8QV8CvkHg22oozyt9KnBwc80=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=X8XXT/d07i+xfQknIsM4NqekiDSu5GFPP81+pOZ10tdDAdSFcub6xZoXssSCztYf+ Rr66PMoFUeryVEcHPCbcokTKlDtDpZHA4yrjPYg+RjJf+RZjPAZ/4TsuTJIf+/0+po 5C7LI6qZhgGufBL9hQgzhuUimRXGNjaoehxn8bkw= From: David Gibson To: passt-dev@passt.top, Stefano Brivio Subject: [PATCH v3 12/20] avocado/tasst: Add helper for getting MTU of a network interface Date: Wed, 31 May 2023 11:58:41 +1000 Message-Id: <20230531015849.3229596-13-david@gibson.dropbear.id.au> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230531015849.3229596-1-david@gibson.dropbear.id.au> References: <20230531015849.3229596-1-david@gibson.dropbear.id.au> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Message-ID-Hash: 32GRPX3WCDLBS5RPZ4X7UEF6AENC6KDY X-Message-ID-Hash: 32GRPX3WCDLBS5RPZ4X7UEF6AENC6KDY 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: Cleber Rosa , 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 --- avocado/tasst/meta/veth.py | 5 +++++ avocado/tasst/site.py | 9 +++++++++ 2 files changed, 14 insertions(+) diff --git a/avocado/tasst/meta/veth.py b/avocado/tasst/meta/veth.py index c4cdcf7..301ccb9 100644 --- a/avocado/tasst/meta/veth.py +++ b/avocado/tasst/meta/veth.py @@ -41,3 +41,8 @@ class VethTasst(Tasst): with self.setup_veth() as (ns1, ns2): self.assertCountEqual(ns1.ifs(), ['lo', 'veth1']) self.assertCountEqual(ns2.ifs(), ['lo', 'veth2']) + + def test_mtu(self): + with self.setup_veth() as (ns1, ns2): + self.assertEquals(ns1.mtu('veth1'), 1500) + self.assertEquals(ns2.mtu('veth2'), 1500) diff --git a/avocado/tasst/site.py b/avocado/tasst/site.py index 3cb3721..f19a3fc 100644 --- a/avocado/tasst/site.py +++ b/avocado/tasst/site.py @@ -61,6 +61,11 @@ class Site(contextlib.AbstractContextManager): self.require_cmds('ip') self.fg('ip link set {} up'.format(ifname), sudo=True) + def mtu(self, ifname): + self.require_cmds('ip') + (info,) = json.loads(self.output('ip -j link show {}'.format(ifname))) + return info['mtu'] + def addrinfos(self, ifname, **filter): self.require_cmds('ip') info = json.loads(self.output('ip -j addr show {}'.format(ifname))) @@ -129,6 +134,10 @@ class SiteTasst(Tasst): for a in ['127.0.0.1/8', '::1/128']] self.assertCountEqual(site.addrs('lo'), expected) + def test_lo_mtu(self): + with self.setup_site() as site: + self.assertEqual(site.mtu('lo'), 65536) + class IsolatedSiteTasst(SiteTasst): """ -- 2.40.1