public inbox for passt-dev@passt.top
 help / color / mirror / code / Atom feed
blob 9b95772c8ededb7bd41decacee9ceb43b0afe0af 1781 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
 
#! /usr/bin/python3

# SPDX-License-Identifier: GPL-2.0-or-later
#
# avocado/pasta_ndp.py - Test NDP operations with pasta
#
# Copyright Red Hat
# Author: David Gibson <david@gibson.dropbear.id.au>

import ipaddress
import json

import common
from pasta import PastaUnconfiguredTest


class PastaNdpTest(PastaUnconfiguredTest):
    def setUp(self):
        super().setUp()

        self.innerx('ip link set dev {} up'.format(self.IFNAME), sudo=True)
        common.slaac_wait(self.innerx, self.IFNAME)

    def test_addr(self):
        ifinfo = self.innerx('ip -6 -j addr show {}'.format(self.IFNAME))
        ifinfo = json.loads(ifinfo)[0]
        for adinfo in ifinfo['addr_info']:
            if adinfo['scope'] == 'global':
                print(adinfo)
                global_addr = ipaddress.ip_address(adinfo['local'])
                prefixlen = adinfo['prefixlen']

        # The SLAAC address is derived from the guest ns MAC, so
        # probably won't exactly match the host address (we need
        # DHCPv6 for that).  It should match the prefix of the host
        # address, though
        inner_if = ipaddress.IPv6Interface('{}/{}'
                                           .format(global_addr, prefixlen))
        outer_if = ipaddress.IPv6Interface('{}/{}'
                                           .format(self.OUTER_IP6, prefixlen))
        self.assertEquals(inner_if.network, outer_if.network)
        self.shutdown()

    def test_route(self):
        rinfo = self.innerx('ip -j -6 route show')
        rinfo = json.loads(rinfo)
        for route in rinfo:
            if route['dst'] != 'default':
                continue
            gateway = ipaddress.ip_address(route['gateway'])
        self.assertEquals(gateway, self.gw_ll)
        self.shutdown()

debug log:

solving 9b95772 ...
found 9b95772 in https://archives.passt.top/passt-dev/20230420011108.494181-8-david@gibson.dropbear.id.au/

applying [1/1] https://archives.passt.top/passt-dev/20230420011108.494181-8-david@gibson.dropbear.id.au/
diff --git a/avocado/pasta_ndp.py b/avocado/pasta_ndp.py
new file mode 100644
index 0000000..9b95772

Checking patch avocado/pasta_ndp.py...
Applied patch avocado/pasta_ndp.py cleanly.

index at:
100644 9b95772c8ededb7bd41decacee9ceb43b0afe0af	avocado/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).