Signed-off-by: David Gibson <david(a)gibson.dropbear.id.au> --- 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