summaryrefslogtreecommitdiffstats
path: root/test/test_quic.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/test_quic.py')
-rw-r--r--test/test_quic.py234
1 files changed, 136 insertions, 98 deletions
diff --git a/test/test_quic.py b/test/test_quic.py
index 339557d4419..fde781c4f4a 100644
--- a/test/test_quic.py
+++ b/test/test_quic.py
@@ -12,20 +12,29 @@ from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
class QUICAppWorker(Worker):
- """ QUIC Test Application Worker """
+ """QUIC Test Application Worker"""
+
process = None
- def __init__(self, appname, executable_args, logger, role,
- testcase, env=None, *args, **kwargs):
+ def __init__(
+ self,
+ appname,
+ executable_args,
+ logger,
+ role,
+ testcase,
+ env=None,
+ *args,
+ **kwargs,
+ ):
if env is None:
env = {}
app = f"{config.vpp_build_dir}/vpp/bin/{appname}"
self.args = [app] + executable_args
self.role = role
- self.wait_for_gdb = 'wait-for-gdb'
+ self.wait_for_gdb = "wait-for-gdb"
self.testcase = testcase
- super(QUICAppWorker, self).__init__(self.args, logger, env,
- *args, **kwargs)
+ super(QUICAppWorker, self).__init__(self.args, logger, env, *args, **kwargs)
def run(self):
super(QUICAppWorker, self).run()
@@ -44,7 +53,7 @@ class QUICAppWorker(Worker):
class QUICTestCase(VppTestCase):
- """ QUIC Test Case """
+ """QUIC Test Case"""
timeout = 20
pre_test_sleep = 0.3
@@ -57,7 +66,7 @@ class QUICTestCase(VppTestCase):
def setUp(self):
super(QUICTestCase, self).setUp()
- self.vppDebug = 'vpp_debug' in config.vpp_build_dir
+ self.vppDebug = "vpp_debug" in config.vpp_build_dir
self.create_loopback_interfaces(2)
self.uri = "quic://%s/1234" % self.loop0.local_ip4
@@ -74,20 +83,28 @@ class QUICTestCase(VppTestCase):
table_id += 1
# Configure namespaces
- self.vapi.app_namespace_add_del(namespace_id="server",
- sw_if_index=self.loop0.sw_if_index)
- self.vapi.app_namespace_add_del(namespace_id="client",
- sw_if_index=self.loop1.sw_if_index)
+ self.vapi.app_namespace_add_del(
+ namespace_id="server", sw_if_index=self.loop0.sw_if_index
+ )
+ self.vapi.app_namespace_add_del(
+ namespace_id="client", sw_if_index=self.loop1.sw_if_index
+ )
# Add inter-table routes
- self.ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
- [VppRoutePath("0.0.0.0",
- 0xffffffff,
- nh_table_id=2)], table_id=1)
- self.ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
- [VppRoutePath("0.0.0.0",
- 0xffffffff,
- nh_table_id=1)], table_id=2)
+ self.ip_t01 = VppIpRoute(
+ self,
+ self.loop1.local_ip4,
+ 32,
+ [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=2)],
+ table_id=1,
+ )
+ self.ip_t10 = VppIpRoute(
+ self,
+ self.loop0.local_ip4,
+ 32,
+ [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)],
+ table_id=2,
+ )
self.ip_t01.add_vpp_config()
self.ip_t10.add_vpp_config()
self.logger.debug(self.vapi.cli("show ip fib"))
@@ -106,13 +123,15 @@ class QUICTestCase(VppTestCase):
class QUICEchoIntTestCase(QUICTestCase):
"""QUIC Echo Internal Test Case"""
- test_bytes = ' test-bytes'
+
+ test_bytes = " test-bytes"
extra_vpp_punt_config = ["session", "{", "enable", "poll-main", "}"]
def setUp(self):
super(QUICEchoIntTestCase, self).setUp()
- self.client_args = 'uri {uri} fifo-size 64{testbytes} appns client' \
- .format(uri=self.uri, testbytes=self.test_bytes)
+ self.client_args = "uri {uri} fifo-size 64{testbytes} appns client".format(
+ uri=self.uri, testbytes=self.test_bytes
+ )
self.server_args = "uri %s fifo-size 64 appns server" % self.uri
def tearDown(self):
@@ -120,16 +139,16 @@ class QUICEchoIntTestCase(QUICTestCase):
def server(self, *args):
error = self.vapi.cli(
- "test echo server %s %s" %
- (self.server_args, ' '.join(args)))
+ "test echo server %s %s" % (self.server_args, " ".join(args))
+ )
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
def client(self, *args):
error = self.vapi.cli(
- "test echo client %s %s" %
- (self.client_args, ' '.join(args)))
+ "test echo client %s %s" % (self.client_args, " ".join(args))
+ )
if error:
self.logger.critical(error)
self.assertNotIn("failed", error)
@@ -138,6 +157,7 @@ class QUICEchoIntTestCase(QUICTestCase):
@tag_fixme_vpp_workers
class QUICEchoIntTransferTestCase(QUICEchoIntTestCase):
"""QUIC Echo Internal Transfer Test Case"""
+
def test_quic_int_transfer(self):
"""QUIC internal transfer"""
self.server()
@@ -147,6 +167,7 @@ class QUICEchoIntTransferTestCase(QUICEchoIntTestCase):
@tag_fixme_vpp_workers
class QUICEchoIntSerialTestCase(QUICEchoIntTestCase):
"""QUIC Echo Internal Serial Transfer Test Case"""
+
def test_quic_serial_int_transfer(self):
"""QUIC serial internal transfer"""
self.server()
@@ -160,6 +181,7 @@ class QUICEchoIntSerialTestCase(QUICEchoIntTestCase):
@tag_fixme_vpp_workers
class QUICEchoIntMStreamTestCase(QUICEchoIntTestCase):
"""QUIC Echo Internal MultiStream Test Case"""
+
def test_quic_int_multistream_transfer(self):
"""QUIC internal multi-stream transfer"""
self.server()
@@ -176,36 +198,63 @@ class QUICEchoExtTestCase(QUICTestCase):
vpp_worker_count = 1
server_fifo_size = "1M"
client_fifo_size = "4M"
- extra_vpp_punt_config = ["session", "{",
- "enable", "poll-main", "evt_qs_memfd_seg",
- "evt_qs_seg_size", "64M",
- "event-queue-length", f"{evt_q_len}",
- "preallocated-sessions", "1024",
- "v4-session-table-buckets", "20000",
- "v4-session-table-memory", "64M",
- "v4-halfopen-table-buckets", "20000",
- "v4-halfopen-table-memory", "64M",
- "local-endpoints-table-buckets", "250000",
- "local-endpoints-table-memory", "512M",
- "}"]
+ extra_vpp_punt_config = [
+ "session",
+ "{",
+ "enable",
+ "poll-main",
+ "evt_qs_memfd_seg",
+ "evt_qs_seg_size",
+ "64M",
+ "event-queue-length",
+ f"{evt_q_len}",
+ "preallocated-sessions",
+ "1024",
+ "v4-session-table-buckets",
+ "20000",
+ "v4-session-table-memory",
+ "64M",
+ "v4-halfopen-table-buckets",
+ "20000",
+ "v4-halfopen-table-memory",
+ "64M",
+ "local-endpoints-table-buckets",
+ "250000",
+ "local-endpoints-table-memory",
+ "512M",
+ "}",
+ ]
def setUp(self):
super(QUICEchoExtTestCase, self).setUp()
common_args = [
- "uri", self.uri,
+ "uri",
+ self.uri,
"json",
self.test_bytes,
- "socket-name", self.get_api_sock_path(),
- "quic-setup", self.quic_setup,
- "nthreads", "1",
- "mq-size", f"{self.evt_q_len}"
+ "socket-name",
+ self.get_api_sock_path(),
+ "quic-setup",
+ self.quic_setup,
+ "nthreads",
+ "1",
+ "mq-size",
+ f"{self.evt_q_len}",
+ ]
+ self.server_echo_test_args = common_args + [
+ "server",
+ "appns",
+ "server",
+ "fifo-size",
+ f"{self.server_fifo_size}",
+ ]
+ self.client_echo_test_args = common_args + [
+ "client",
+ "appns",
+ "client",
+ "fifo-size",
+ f"{self.client_fifo_size}",
]
- self.server_echo_test_args = common_args + \
- ["server", "appns", "server", "fifo-size",
- f"{self.server_fifo_size}"]
- self.client_echo_test_args = common_args + \
- ["client", "appns", "client", "fifo-size",
- f"{self.client_fifo_size}"]
error = self.vapi.cli("quic set fifo-size 2M")
if error:
self.logger.critical(error)
@@ -213,23 +262,13 @@ class QUICEchoExtTestCase(QUICTestCase):
def server(self, *args):
_args = self.server_echo_test_args + list(args)
- self.worker_server = QUICAppWorker(
- self.app,
- _args,
- self.logger,
- 'server',
- self)
+ self.worker_server = QUICAppWorker(self.app, _args, self.logger, "server", self)
self.worker_server.start()
self.sleep(self.pre_test_sleep)
def client(self, *args):
_args = self.client_echo_test_args + list(args)
- self.worker_client = QUICAppWorker(
- self.app,
- _args,
- self.logger,
- 'client',
- self)
+ self.worker_client = QUICAppWorker(self.app, _args, self.logger, "client", self)
self.worker_client.start()
timeout = None if self.debug_all else self.timeout
self.worker_client.join(timeout)
@@ -246,22 +285,18 @@ class QUICEchoExtTestCase(QUICTestCase):
def validate_ext_test_results(self):
server_result = self.worker_server.result
client_result = self.worker_client.result
- self.logger.info("Server worker result is `%s'" %
- server_result)
- self.logger.info("Client worker result is `%s'" %
- client_result)
+ self.logger.info("Server worker result is `%s'" % server_result)
+ self.logger.info("Client worker result is `%s'" % client_result)
server_kill_error = False
if self.worker_server.result is None:
- server_kill_error = self.worker_server.teardown(
- self.logger, self.timeout)
+ server_kill_error = self.worker_server.teardown(self.logger, self.timeout)
if self.worker_client.result is None:
self.worker_client.teardown(self.logger, self.timeout)
err_msg = "Wrong server worker return code (%s)" % server_result
self.assertEqual(server_result, 0, err_msg)
self.assertIsNotNone(
- client_result,
- "Timeout! Client worker did not finish in %ss" %
- self.timeout)
+ client_result, "Timeout! Client worker did not finish in %ss" % self.timeout
+ )
err_msg = "Wrong client worker return code (%s)" % client_result
self.assertEqual(client_result, 0, err_msg)
self.assertFalse(server_kill_error, "Server kill errored")
@@ -269,6 +304,7 @@ class QUICEchoExtTestCase(QUICTestCase):
class QUICEchoExtTransferTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Test Case"""
+
timeout = 60
def test_quic_ext_transfer(self):
@@ -280,9 +316,10 @@ class QUICEchoExtTransferTestCase(QUICEchoExtTestCase):
class QUICEchoExtTransferBigTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Big Test Case"""
- server_fifo_size = '4M'
- client_fifo_size = '4M'
- test_bytes = ''
+
+ server_fifo_size = "4M"
+ client_fifo_size = "4M"
+ test_bytes = ""
timeout = 60
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -312,8 +349,7 @@ class QUICEchoExtQcloseTxTestCase(QUICEchoExtTestCase):
@unittest.skip("testcase under development")
def test_quic_ext_qclose_tx(self):
"""QUIC external transfer, tx close"""
- self.server("TX=0", "RX=10M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.server("TX=0", "RX=10M", "qclose=W", "sclose=W", "rx-results-diff")
self.client("TX=10M", "RX=0", "qclose=Y", "sclose=N")
self.validate_ext_test_results()
@@ -326,8 +362,7 @@ class QUICEchoExtEarlyQcloseRxTestCase(QUICEchoExtTestCase):
def test_quic_ext_early_qclose_rx(self):
"""QUIC external transfer, early rx close"""
self.server("TX=0", "RX=10M", "qclose=Y", "sclose=N")
- self.client("TX=20M", "RX=0", "qclose=W", "sclose=W",
- "tx-results-diff")
+ self.client("TX=20M", "RX=0", "qclose=W", "sclose=W", "tx-results-diff")
self.validate_ext_test_results()
@@ -338,8 +373,7 @@ class QUICEchoExtEarlyQcloseTxTestCase(QUICEchoExtTestCase):
@unittest.skip("testcase under development")
def test_quic_ext_early_qclose_tx(self):
"""QUIC external transfer, early tx close"""
- self.server("TX=0", "RX=20M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.server("TX=0", "RX=20M", "qclose=W", "sclose=W", "rx-results-diff")
self.client("TX=10M", "RX=0", "qclose=Y", "sclose=N")
self.validate_ext_test_results()
@@ -376,8 +410,7 @@ class QUICEchoExtEarlyScloseRxTestCase(QUICEchoExtTestCase):
def test_quic_ext_early_sclose_rx(self):
"""QUIC external transfer, early rx stream close"""
self.server("TX=0", "RX=10M", "qclose=N", "sclose=Y")
- self.client("TX=20M", "RX=0", "qclose=W", "sclose=W",
- "tx-results-diff")
+ self.client("TX=20M", "RX=0", "qclose=W", "sclose=W", "tx-results-diff")
self.validate_ext_test_results()
@@ -388,14 +421,14 @@ class QUICEchoExtEarlyScloseTxTestCase(QUICEchoExtTestCase):
@unittest.skip("testcase under development")
def test_quic_ext_early_sclose_tx(self):
"""QUIC external transfer, early tx stream close"""
- self.server("TX=0", "RX=20M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.server("TX=0", "RX=20M", "qclose=W", "sclose=W", "rx-results-diff")
self.client("TX=10M", "RX=0", "qclose=Y", "sclose=Y")
self.validate_ext_test_results()
class QUICEchoExtServerStreamTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Test Case"""
+
quic_setup = "serverstream"
timeout = 60
@@ -408,10 +441,11 @@ class QUICEchoExtServerStreamTestCase(QUICEchoExtTestCase):
class QUICEchoExtServerStreamBigTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Big Test Case"""
+
quic_setup = "serverstream"
- server_fifo_size = '4M'
- client_fifo_size = '4M'
- test_bytes = ''
+ server_fifo_size = "4M"
+ client_fifo_size = "4M"
+ test_bytes = ""
timeout = 60
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -424,6 +458,7 @@ class QUICEchoExtServerStreamBigTestCase(QUICEchoExtTestCase):
class QUICEchoExtServerStreamQcloseRxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Qclose Rx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -437,6 +472,7 @@ class QUICEchoExtServerStreamQcloseRxTestCase(QUICEchoExtTestCase):
class QUICEchoExtServerStreamQcloseTxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Qclose Tx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -444,27 +480,27 @@ class QUICEchoExtServerStreamQcloseTxTestCase(QUICEchoExtTestCase):
def test_quic_ext_server_stream_qclose_tx(self):
"""QUIC external server transfer, tx close"""
self.server("TX=10M", "RX=0", "qclose=Y", "sclose=N")
- self.client("TX=0", "RX=10M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.client("TX=0", "RX=10M", "qclose=W", "sclose=W", "rx-results-diff")
self.validate_ext_test_results()
class QUICEchoExtServerStreamEarlyQcloseRxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Early Qclose Rx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@unittest.skip("testcase under development")
def test_quic_ext_server_stream_early_qclose_rx(self):
"""QUIC external server transfer, early rx close"""
- self.server("TX=20M", "RX=0", "qclose=W", "sclose=W",
- "tx-results-diff")
+ self.server("TX=20M", "RX=0", "qclose=W", "sclose=W", "tx-results-diff")
self.client("TX=0", "RX=10M", "qclose=Y", "sclose=N")
self.validate_ext_test_results()
class QUICEchoExtServerStreamEarlyQcloseTxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Early Qclose Tx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -472,13 +508,13 @@ class QUICEchoExtServerStreamEarlyQcloseTxTestCase(QUICEchoExtTestCase):
def test_quic_ext_server_stream_early_qclose_tx(self):
"""QUIC external server transfer, early tx close"""
self.server("TX=10M", "RX=0", "qclose=Y", "sclose=N")
- self.client("TX=0", "RX=20M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.client("TX=0", "RX=20M", "qclose=W", "sclose=W", "rx-results-diff")
self.validate_ext_test_results()
class QUICEchoExtServerStreamScloseRxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Sclose Rx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -492,6 +528,7 @@ class QUICEchoExtServerStreamScloseRxTestCase(QUICEchoExtTestCase):
class QUICEchoExtServerStreamScloseTxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Sclose Tx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -505,20 +542,21 @@ class QUICEchoExtServerStreamScloseTxTestCase(QUICEchoExtTestCase):
class QUICEchoExtServerStreamEarlyScloseRxTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream Early Sclose Rx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@unittest.skip("testcase under development")
def test_quic_ext_server_stream_early_sclose_rx(self):
"""QUIC external server transfer, early rx stream close"""
- self.server("TX=20M", "RX=0", "qclose=W", "sclose=W",
- "tx-results-diff")
+ self.server("TX=20M", "RX=0", "qclose=W", "sclose=W", "tx-results-diff")
self.client("TX=0", "RX=10M", "qclose=N", "sclose=Y")
self.validate_ext_test_results()
class QUICEchoExtServerStreamEarlyScloseTxTestCase(QUICEchoExtTestCase):
"""QUIC Echo Ext Transfer Server Stream Early Sclose Tx Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -526,13 +564,13 @@ class QUICEchoExtServerStreamEarlyScloseTxTestCase(QUICEchoExtTestCase):
def test_quic_ext_server_stream_early_sclose_tx(self):
"""QUIC external server transfer, early tx stream close"""
self.server("TX=10M", "RX=0", "qclose=Y", "sclose=Y")
- self.client("TX=0", "RX=20M", "qclose=W", "sclose=W",
- "rx-results-diff")
+ self.client("TX=0", "RX=20M", "qclose=W", "sclose=W", "rx-results-diff")
self.validate_ext_test_results()
class QUICEchoExtServerStreamWorkersTestCase(QUICEchoExtTestCase):
"""QUIC Echo External Transfer Server Stream MultiWorker Test Case"""
+
quic_setup = "serverstream"
@unittest.skipUnless(config.extended, "part of extended tests")
@@ -544,5 +582,5 @@ class QUICEchoExtServerStreamWorkersTestCase(QUICEchoExtTestCase):
self.validate_ext_test_results()
-if __name__ == '__main__':
+if __name__ == "__main__":
unittest.main(testRunner=VppTestRunner)