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

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

import filecmp
import os.path

import common
from pasta import PastaConfiguredTest


class PastaTcpSmall(PastaConfiguredTest):
    DATA_FILE = './test/small.bin'

    def transfer(self, fromx, fromaddr, tox, toaddr):
        tmpfile = os.path.join(self.workdir, 'transfer.tmp')
        listener = tox.subprocess(
            'socat -u {} OPEN:{},create,trunc'.format(toaddr, tmpfile))
        listener.start()
        fromx.system_output(
            'socat -u OPEN:{} {}'.format(self.DATA_FILE, fromaddr))
        status = listener.wait()
        self.assertEquals(status, 0)
        self.assertTrue(filecmp.cmp(self.DATA_FILE, tmpfile, shallow=False))

    def test_inbound_v4(self):
        self.transfer(self.outer, 'TCP4:127.0.0.1:{}'.format(self.INBOUND_FWD),
                      self.inner, 'TCP4-LISTEN:{},bind=127.0.0.1'.format(self.INBOUND_FWD))

    def test_outbound_splice_v4(self):
        self.transfer(self.inner, 'TCP4:127.0.0.1:{}'.format(self.OUTBOUND_FWD),
                      self.outer, 'TCP4-LISTEN:{},bind=127.0.0.1'.format(self.OUTBOUND_FWD))

    def test_outbound_tap_v4(self):
        self.transfer(self.inner, 'TCP4:{}:{}'.format(self.GW_IP4, self.OUTBOUND_FWD),
                      self.outer, 'TCP4-LISTEN:{}'.format(self.OUTBOUND_FWD))

    def test_inbound_v6(self):
        self.transfer(self.outer, 'TCP6:[::1]:{}'.format(self.INBOUND_FWD),
                      self.inner, 'TCP6-LISTEN:{},bind=[::1]'.format(self.INBOUND_FWD))

    def test_outbound_splice_v6(self):
        self.transfer(self.inner, 'TCP6:[::1]:{}'.format(self.OUTBOUND_FWD),
                      self.outer, 'TCP6-LISTEN:{},bind=[::1]'.format(self.OUTBOUND_FWD))

    def test_outbound_tap_v6(self):
        # We need the gateway route to be configured
        common.slaac_wait(self.innerx, self.IFNAME)
        self.transfer(self.inner, 'TCP6:[{}%{}]:{}'.format(self.gw_ll, self.IFNAME, self.OUTBOUND_FWD),
                      self.outer, 'TCP6-LISTEN:{}'.format(self.OUTBOUND_FWD))


# Sane again but with a larger data file
class PastaTcpBig(PastaTcpSmall):
    DATA_FILE = './test/big.bin'
    timeout = 15.0

debug log:

solving 0f90bcd ...
found 0f90bcd 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_tcp.py b/avocado/pasta_tcp.py
new file mode 100644
index 0000000..0f90bcd

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

index at:
100644 0f90bcd0de5042e1896af0675c15bb6f79b4ebde	avocado/pasta_tcp.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).