public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
8c7ce31e1ce252519deec87204d700e1d132bf2b blob 1805 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
 
#! /usr/bin/env python3
#
# SPDX-License-Identifier: GPL-2.0-or-later
#
# test/pasta/ndp.py - pasta NDP functionality
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

import contextlib
import dataclasses
from typing import Iterator

import exeter
import tunbridge
import tasst


@dataclasses.dataclass
class UnconfiguredScenario(exeter.Scenario):
    """Tests for a pasta instance without --config-net"""

    host: tunbridge.Site
    guest: tunbridge.Site
    ifname: str
    addr6: tunbridge.ip.AddrMask6
    gw6: tunbridge.ip.Addr6

    @exeter.scenariotest
    def test_ifname(self) -> None:
        ifs = tunbridge.ip.ifs(self.guest)
        exeter.assert_eq(set(ifs), {'lo', self.ifname})

    @tunbridge.ndp.NdpScenario.subscenario
    def test_ndp(self) -> tunbridge.ndp.NdpScenario:
        tunbridge.ip.ifup(self.guest, self.ifname)
        return tunbridge.ndp.NdpScenario(client=self.guest,
                                         ifname=self.ifname,
                                         network=self.addr6.network,
                                         gateway=self.gw6)


@UnconfiguredScenario.test
@contextlib.contextmanager
def simh_pasta_setup() -> Iterator[UnconfiguredScenario]:
    with (tunbridge.sample.simple_host('host') as simh,
          tunbridge.sample.isolated('guest', simh.site) as guest):
        assert simh.ip6 is not None
        assert simh.gw6_ll is not None
        with tasst.pasta.pasta(simh.site, guest):
            yield UnconfiguredScenario(host=simh.site,
                                       guest=guest,
                                       ifname=simh.ifname,
                                       addr6=simh.ip6,
                                       gw6=simh.gw6_ll)


if __name__ == '__main__':
    exeter.main()
debug log:

solving 8c7ce31e ...
found 8c7ce31e in https://archives.passt.top/passt-dev/20251002075708.461931-4-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20251002075708.461931-4-david@gibson.dropbear.id.au/
diff --git a/test/pasta/ndp.py b/test/pasta/ndp.py
new file mode 100755
index 00000000..8c7ce31e

Checking patch test/pasta/ndp.py...
Applied patch test/pasta/ndp.py cleanly.

index at:
100755 8c7ce31e1ce252519deec87204d700e1d132bf2b	test/pasta/ndp.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).