public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 362252ba878829b648f2a326c1e7703dd84dbf6a 1867 bytes (raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# tasst - Test A Simple Socket Transport
#         library of test helpers for passt & pasta
#
# tasst/metatest/veth - Test the veth creation helper
#
# These test code from tasst.site, but require additional support from
# tasst.nstool.
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

import ipaddress

import avocado

from tasst import Tasst
from tasst.site import REAL_HOST
from tasst.nstool import UnshareSite


class VethTasst(Tasst):
    """
    Test helpers for creating veths between namespaces

    :avocado: tags=meta
    """
    def setUp(self):
        super().setUp()
        self.ns1 = UnshareSite(type(self).__name__ + '.1', '-Un')
        self.ns2 = UnshareSite(type(self).__name__ + '.2', '-n',
                               parent=self.ns1, sudo=True)
        self.ns1.veth('veth1', 'veth2', self.ns2)

    def tearDown(self):
        self.ns2.close()
        self.ns1.close()
        super().tearDown()

    def test_ifs(self):
        self.assertCountEqual(self.ns1.ifs(), ['lo', 'veth1'])
        self.assertCountEqual(self.ns2.ifs(), ['lo', 'veth2'])

    def test_mtu(self):
        self.assertEquals(self.ns1.mtu('veth1'), 1500)
        self.assertEquals(self.ns2.mtu('veth2'), 1500)

    def test_slaac(self, dad=None):
        TESTMAC = '02:aa:bb:cc:dd:ee'
        TESTIP = ipaddress.ip_interface('fe80::aa:bbff:fecc:ddee/64')

        self.ns1.fg('ip link set dev veth1 address {}'.format(TESTMAC), sudo=True)

        self.ns1.ifup('veth1', dad=dad)
        self.ns2.ifup('veth2')

        addrs = self.ns1.addr_wait('veth1', family='inet6', scope='link')
        self.assertEqual(addrs, [TESTIP])

    def test_optimistic_dad(self):
        self.test_slaac(dad='optimistic')

    def test_no_dad(self):
        self.test_slaac(dad='disable')

debug log:

solving 362252b ...
found 362252b in https://archives.passt.top/passt-dev/20230516020135.1901256-15-david@gibson.dropbear.id.au/
found afca192 in https://archives.passt.top/passt-dev/20230516020135.1901256-14-david@gibson.dropbear.id.au/
found 48ef88b in https://archives.passt.top/passt-dev/20230516020135.1901256-13-david@gibson.dropbear.id.au/

applying [1/3] https://archives.passt.top/passt-dev/20230516020135.1901256-13-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/veth.py b/avocado/tasst/meta/veth.py
new file mode 100644
index 0000000..48ef88b


applying [2/3] https://archives.passt.top/passt-dev/20230516020135.1901256-14-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/veth.py b/avocado/tasst/meta/veth.py
index 48ef88b..afca192 100644


applying [3/3] https://archives.passt.top/passt-dev/20230516020135.1901256-15-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/veth.py b/avocado/tasst/meta/veth.py
index afca192..362252b 100644

Checking patch avocado/tasst/meta/veth.py...
Applied patch avocado/tasst/meta/veth.py cleanly.
Checking patch avocado/tasst/meta/veth.py...
Applied patch avocado/tasst/meta/veth.py cleanly.
Checking patch avocado/tasst/meta/veth.py...
Applied patch avocado/tasst/meta/veth.py cleanly.

index at:
100644 362252ba878829b648f2a326c1e7703dd84dbf6a	avocado/tasst/meta/veth.py

Code repositories for project(s) associated with this public inbox

	https://passt.top/passt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for IMAP folder(s).