summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2019-05-13 15:51:52 -0400
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2019-05-14 01:09:32 +0000
commit3bffd4be22c2eeb9177f1b30cad5a7a97528bde3 (patch)
tree15787e3c810a7ade1d9883df3db899b658e923d5
parent419e15f0c1205d27b4b9ae4fd4eaa516b8f4844d (diff)
make test: Add QUIC external echo transfer test
- Add namespace configuration to echo_client - Add external echo transfer testcase - Refactor quic test class to reduce unnecessary method args - Increase default fifo size to 64 and data transfer to 10 mbytes - Remove sleep() between starting internal server & client apps Change-Id: Ia9de46a314d58e7809f005f6a5211760e63789bf Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
-rw-r--r--src/tests/vnet/session/quic_echo.c28
-rw-r--r--test/test_quic.py112
2 files changed, 131 insertions, 9 deletions
diff --git a/src/tests/vnet/session/quic_echo.c b/src/tests/vnet/session/quic_echo.c
index 29b33f5aeb7..c125d3be94c 100644
--- a/src/tests/vnet/session/quic_echo.c
+++ b/src/tests/vnet/session/quic_echo.c
@@ -138,6 +138,10 @@ typedef struct
u8 test_return_packets;
u64 bytes_to_send;
u32 fifo_size;
+ u32 quic_streams;
+ u8 *appns_id;
+ u64 appns_flags;
+ u64 appns_secret;
u32 n_clients;
u64 tx_total;
@@ -286,6 +290,14 @@ application_send_attach (echo_main_t * em)
bmp->options[APP_OPTIONS_ADD_SEGMENT_SIZE] = 128 << 20;
bmp->options[APP_OPTIONS_SEGMENT_SIZE] = 256 << 20;
bmp->options[APP_OPTIONS_EVT_QUEUE_SIZE] = 256;
+ if (em->appns_id)
+ {
+ bmp->namespace_id_len = vec_len (em->appns_id);
+ clib_memcpy_fast (bmp->namespace_id, em->appns_id,
+ bmp->namespace_id_len);
+ bmp->options[APP_OPTIONS_FLAGS] |= em->appns_flags;
+ bmp->options[APP_OPTIONS_NAMESPACE_SECRET] = em->appns_secret;
+ }
vl_msg_api_send_shmem (em->vl_input_queue, (u8 *) & bmp);
cert_mp = vl_msg_api_alloc (sizeof (*cert_mp) + test_srv_crt_rsa_len);
@@ -1456,6 +1468,7 @@ main (int argc, char **argv)
em->fifo_size = 64 << 10;
em->n_clients = 1;
em->max_test_msg = 50;
+ em->quic_streams = 1;
clib_time_init (&em->clib_time);
init_error_string_table (em);
@@ -1476,7 +1489,7 @@ main (int argc, char **argv)
i_am_server = 0;
else if (unformat (a, "no-return"))
em->no_return = 1;
- else if (unformat (a, "test"))
+ else if (unformat (a, "test-bytes"))
test_return_packets = 1;
else if (unformat (a, "bytes %lld", &mbytes))
{
@@ -1498,6 +1511,19 @@ main (int argc, char **argv)
em->fifo_size = tmp << 10;
else if (unformat (a, "nclients %d", &em->n_clients))
;
+ else if (unformat (a, "appns %_%v%_", &em->appns_id))
+ ;
+ else if (unformat (a, "all-scope"))
+ em->appns_flags |= (APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE
+ | APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE);
+ else if (unformat (a, "local-scope"))
+ em->appns_flags = APP_OPTIONS_FLAGS_USE_LOCAL_SCOPE;
+ else if (unformat (a, "global-scope"))
+ em->appns_flags = APP_OPTIONS_FLAGS_USE_GLOBAL_SCOPE;
+ else if (unformat (a, "secret %lu", &em->appns_secret))
+ ;
+ else if (unformat (a, "quic-streams %d", &em->quic_streams))
+ ;
else
{
fformat (stderr, "%s: usage [master|slave]\n", argv[0]);
diff --git a/test/test_quic.py b/test/test_quic.py
index ee6143d3e83..aed34088e00 100644
--- a/test/test_quic.py
+++ b/test/test_quic.py
@@ -1,11 +1,24 @@
#!/usr/bin/env python
+""" Vpp QUIC tests """
import unittest
import os
-from framework import VppTestCase, VppTestRunner, running_extended_tests
+import subprocess
+import signal
+from framework import VppTestCase, VppTestRunner, running_extended_tests, \
+ Worker
from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
+class QUICAppWorker(Worker):
+ """ QUIC Test Application Worker """
+
+ def __init__(self, build_dir, appname, args, logger, env={}):
+ app = "%s/vpp/bin/%s" % (build_dir, appname)
+ self.args = [app] + args
+ super(QUICAppWorker, self).__init__(self.args, logger, env)
+
+
class QUICTestCase(VppTestCase):
""" QUIC Test Case """
@@ -36,12 +49,10 @@ class QUICTestCase(VppTestCase):
self.create_loopback_interfaces(2)
self.uri = "quic://%s/1234" % self.loop0.local_ip4
- common_args = ["uri", self.uri, "fifo-size", "4"]
+ common_args = ["uri", self.uri, "fifo-size", "64"]
self.server_echo_test_args = common_args + ["appns", "server"]
self.client_echo_test_args = common_args + ["appns", "client",
- "bytes", "1024",
- "test-bytes",
- "no-output"]
+ "test-bytes"]
table_id = 1
for i in self.lo_interfaces:
i.admin_up()
@@ -97,10 +108,59 @@ class QUICTestCase(VppTestCase):
def internal_ipv4_transfer_test(self, server_args, client_args):
self.start_internal_echo_server(server_args)
- self.sleep(self.pre_test_sleep)
self.start_internal_echo_client(client_args)
+
+ def start_external_echo_server(self, args):
+ self.worker_server = QUICAppWorker(self.build_dir, "quic_echo",
+ args, self.logger)
+ self.worker_server.start()
+
+ def start_external_echo_client(self, args):
+ self.client_echo_test_args += "use-svm-api"
+ self.worker_client = QUICAppWorker(self.build_dir, "quic_echo",
+ args, self.logger)
+ self.worker_client.start()
+ self.worker_client.join(self.timeout)
+ try:
+ self.validateExternalTestResults()
+ except Exception as error:
+ self.fail("Failed with %s" % error)
+
+ def external_ipv4_transfer_test(self, server_args, client_args):
+ self.start_external_echo_server(server_args)
+ self.sleep(self.pre_test_sleep)
+ self.start_external_echo_client(client_args)
self.sleep(self.post_test_sleep)
+ def validateExternalTestResults(self):
+ if os.path.isdir('/proc/{}'.format(self.worker_server.process.pid)):
+ self.logger.info("Killing server worker process (pid %d)" %
+ self.worker_server.process.pid)
+ os.killpg(os.getpgid(self.worker_server.process.pid),
+ signal.SIGTERM)
+ self.worker_server.join()
+ self.logger.info("Client worker result is `%s'" %
+ self.worker_client.result)
+ error = False
+ if self.worker_client.result is None:
+ try:
+ error = True
+ self.logger.error(
+ "Timeout: %ss! Killing client worker process (pid %d)" %
+ (self.timeout, self.worker_client.process.pid))
+ os.killpg(os.getpgid(self.worker_client.process.pid),
+ signal.SIGKILL)
+ self.worker_client.join()
+ except OSError:
+ self.logger.debug(
+ "Couldn't kill client worker process")
+ raise
+ if error:
+ raise Exception(
+ "Timeout! Client worker did not finish in %ss" % timeout)
+ self.assert_equal(self.worker_client.result, 0,
+ "Binary test return code")
+
class QUICInternalEchoIPv4TestCase(QUICTestCase):
""" QUIC Internal Echo IPv4 Transfer Test Cases """
@@ -129,7 +189,8 @@ class QUICInternalEchoIPv4TestCase(QUICTestCase):
""" QUIC internal echo client/server transfer """
self.internal_ipv4_transfer_test(self.server_echo_test_args,
- self.client_echo_test_args)
+ self.client_echo_test_args +
+ ["no-output", "mbytes", "10"])
class QUICInternalEchoIPv4MultiStreamTestCase(QUICTestCase):
@@ -160,7 +221,42 @@ class QUICInternalEchoIPv4MultiStreamTestCase(QUICTestCase):
self.internal_ipv4_transfer_test(self.server_echo_test_args,
self.client_echo_test_args +
- ["quic-streams", "10"])
+ ["quic-streams", "10",
+ "mbytes", "1",
+ "no-output"])
+
+
+class QUICExternalEchoIPv4TestCase(QUICTestCase):
+ """ QUIC External Echo IPv4 Transfer Test Cases """
+
+ @classmethod
+ def setUpClass(cls):
+ super(QUICExternalEchoIPv4TestCase, cls).setUpClass()
+
+ @classmethod
+ def tearDownClass(cls):
+ super(QUICExternalEchoIPv4TestCase, cls).tearDownClass()
+
+ def setUp(self):
+ super(QUICExternalEchoIPv4TestCase, self).setUp()
+ self.thru_host_stack_ipv4_setup()
+
+ def tearDown(self):
+ super(QUICExternalEchoIPv4TestCase, self).tearDown()
+ self.thru_host_stack_ipv4_tear_down()
+
+ def show_commands_at_teardown(self):
+ self.logger.debug(self.vapi.cli("show session verbose 2"))
+
+ @unittest.skipUnless(running_extended_tests, "part of extended tests")
+ def test_quic_external_transfer(self):
+ """ QUIC external echo client/server transfer """
+
+ self.external_ipv4_transfer_test(self.server_echo_test_args +
+ ["socket-name", self.api_sock],
+ self.client_echo_test_args +
+ ["socket-name", self.api_sock,
+ "mbytes", "10"])
if __name__ == '__main__':