public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 3e4694b7b45166f6ba2bd7ec5cf9c92480f3ae79 1684 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
 
#! /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/static_ifup - Static address configuration
#
# 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.nstool import UnshareSite


class StaticNetTasst(Tasst):
    """
    Test helpers for static network configuration

    :avocado: tags=meta
    """

    IFNAME = 'testveth'
    TEST_IPS = [ipaddress.ip_interface('192.0.2.1/24'),
                ipaddress.ip_interface('2001:db8:9a55::1/112'),
                ipaddress.ip_interface('10.1.2.3/8')]

    def setUp(self):
        super().setUp()
        self.ns = UnshareSite(type(self).__name__, '-Un')
        self.ns.veth(self.IFNAME, self.IFNAME + 'peer')
        self.ns.ifup(self.IFNAME, *self.TEST_IPS, dad='disable')

    def tearDown(self):
        self.ns.close()
        super().tearDown()

    def test_addr(self):
        self.assertCountEqual(self.ns.addrs(self.IFNAME, scope='global'), self.TEST_IPS)

    def _test_routes(self, class_):
        expected_routes = [i.network for i in TEST_IPS
                           if isinstance(i, class_)]
        actual_routes = [class_(r['dst']).network
                         for r in self.ns.routes(dev=self.IFNAME))]
        self.assertCountEqual(expected_routes, actual_routes)

    def test_routes4(self):
        self._test_routes(IPv4Interface)

    def test_routes6(self):
        self._test_routes(IPv6Interface)

debug log:

solving 3e4694b ...
found 3e4694b in https://archives.passt.top/passt-dev/20230516020135.1901256-16-david@gibson.dropbear.id.au/
found 02d9650 in https://archives.passt.top/passt-dev/20230516020135.1901256-15-david@gibson.dropbear.id.au/

applying [1/2] https://archives.passt.top/passt-dev/20230516020135.1901256-15-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/static_ifup.py b/avocado/tasst/meta/static_ifup.py
new file mode 100644
index 0000000..02d9650


applying [2/2] https://archives.passt.top/passt-dev/20230516020135.1901256-16-david@gibson.dropbear.id.au/
diff --git a/avocado/tasst/meta/static_ifup.py b/avocado/tasst/meta/static_ifup.py
index 02d9650..3e4694b 100644

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

index at:
100644 3e4694b7b45166f6ba2bd7ec5cf9c92480f3ae79	avocado/tasst/meta/static_ifup.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).