blob: 3875114c3b2099cce10b5cfe15c5f400498966e9 [file] [log] [blame]
Renato Botelho do Coutoead1e532019-10-31 13:31:07 -05001#!/usr/bin/env python3
Dave Wallacecfcf2f42018-02-16 18:31:56 -05002""" Vpp VCL tests """
3
4import unittest
5import os
Dave Wallace816833f2018-03-14 20:01:28 -04006import subprocess
Dave Wallacecfcf2f42018-02-16 18:31:56 -05007import signal
Damjan Marion5546e432021-09-30 20:04:14 +02008import glob
Klement Sekerab23ffd72021-05-31 16:08:53 +02009from config import config
10from framework import VppTestCase, VppTestRunner, Worker
Neale Ranns097fa662018-05-01 05:17:55 -070011from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto
Dave Wallacecfcf2f42018-02-16 18:31:56 -050012
Paul Vinciguerra063366e2019-06-30 15:38:55 -040013iperf3 = '/usr/bin/iperf3'
14
15
16def have_app(app):
17 try:
18 subprocess.check_output([app, '-v'])
19 except (subprocess.CalledProcessError, OSError):
20 return False
21 return True
22
23
24_have_iperf3 = have_app(iperf3)
Paul Vinciguerra063366e2019-06-30 15:38:55 -040025
Dave Wallacecfcf2f42018-02-16 18:31:56 -050026
Dave Wallace816833f2018-03-14 20:01:28 -040027class VCLAppWorker(Worker):
Dave Wallace42996c02018-02-26 14:40:13 -050028 """ VCL Test Application Worker """
29
Damjan Marion5546e432021-09-30 20:04:14 +020030 libname = "libvcl_ldpreload.so"
31
32 class LibraryNotFound(Exception):
33 pass
34
Klement Sekerab23ffd72021-05-31 16:08:53 +020035 def __init__(self, appname, executable_args, logger, env=None,
Dave Wallace4ee17d82021-05-20 14:01:51 -040036 role=None, *args, **kwargs):
37 self.role = role
Klement Sekerab23ffd72021-05-31 16:08:53 +020038 vcl_ldpreload_glob = f"{config.vpp_install_dir}/**/{self.libname}"
Damjan Marion5546e432021-09-30 20:04:14 +020039 vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True)
40
41 if len(vcl_ldpreload_so) < 1:
42 raise LibraryNotFound("cannot locate library: {}".format(
43 self.libname))
44
45 vcl_ldpreload_so = vcl_ldpreload_so[0]
46
Paul Vinciguerra48bdbcd2019-12-04 19:43:53 -050047 if env is None:
48 env = {}
Dave Wallace816833f2018-03-14 20:01:28 -040049 if "iperf" in appname:
50 app = appname
Damjan Marion5546e432021-09-30 20:04:14 +020051 env.update({'LD_PRELOAD': vcl_ldpreload_so})
Florin Corasab2f6db2018-08-31 14:31:41 -070052 elif "sock" in appname:
Klement Sekerab23ffd72021-05-31 16:08:53 +020053 app = f"{config.vpp_build_dir}/vpp/bin/{appname}"
Damjan Marion5546e432021-09-30 20:04:14 +020054 env.update({'LD_PRELOAD': vcl_ldpreload_so})
Dave Wallace816833f2018-03-14 20:01:28 -040055 else:
Klement Sekerab23ffd72021-05-31 16:08:53 +020056 app = f"{config.vpp_build_dir}/vpp/bin/{appname}"
Paul Vinciguerra48bdbcd2019-12-04 19:43:53 -050057 self.args = [app] + executable_args
58 super(VCLAppWorker, self).__init__(self.args, logger, env,
59 *args, **kwargs)
Dave Wallace42996c02018-02-26 14:40:13 -050060
61
Dave Wallace816833f2018-03-14 20:01:28 -040062class VCLTestCase(VppTestCase):
Dave Wallace42996c02018-02-26 14:40:13 -050063 """ VCL Test Class """
Florin Coras4c45d6f2021-08-12 08:38:02 -070064 session_startup = ["poll-main"]
Dave Wallace42996c02018-02-26 14:40:13 -050065
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080066 @classmethod
67 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -070068 if cls.session_startup:
69 conf = "session {" + " ".join(cls.session_startup) + "}"
70 cls.extra_vpp_punt_config = [conf]
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080071 super(VCLTestCase, cls).setUpClass()
72
73 @classmethod
74 def tearDownClass(cls):
75 super(VCLTestCase, cls).tearDownClass()
76
77 def setUp(self):
Klement Sekerab23ffd72021-05-31 16:08:53 +020078 self.vppDebug = 'vpp_debug' in config.vpp_install_dir
Dave Wallace9f11c012018-02-28 17:55:23 -050079 self.server_addr = "127.0.0.1"
80 self.server_port = "22000"
Dave Wallace816833f2018-03-14 20:01:28 -040081 self.server_args = [self.server_port]
Dave Wallacede910062018-03-20 09:22:13 -040082 self.server_ipv6_addr = "::1"
83 self.server_ipv6_args = ["-6", self.server_port]
Florin Corasdc2e2512018-12-03 17:47:26 -080084 self.timeout = 20
Dave Wallace9f11c012018-02-28 17:55:23 -050085 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
Florin Corasdc2e2512018-12-03 17:47:26 -080086 self.pre_test_sleep = 0.3
87 self.post_test_sleep = 0.2
Florin Coras4c45d6f2021-08-12 08:38:02 -070088 self.sapi_client_sock = ""
89 self.sapi_server_sock = ""
Florin Corasdc2e2512018-12-03 17:47:26 -080090
91 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
92 os.remove("/tmp/ldp_server_af_unix_socket")
Dave Wallace42996c02018-02-26 14:40:13 -050093
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080094 super(VCLTestCase, self).setUp()
Dave Wallace42996c02018-02-26 14:40:13 -050095
Florin Coras4c45d6f2021-08-12 08:38:02 -070096 def update_vcl_app_env(self, ns_id, ns_secret, attach_sock):
97 if not ns_id:
98 if 'VCL_APP_NAMESPACE_ID' in self.vcl_app_env:
99 del self.vcl_app_env['VCL_APP_NAMESPACE_ID']
100 else:
101 self.vcl_app_env['VCL_APP_NAMESPACE_ID'] = ns_id
102
103 if not ns_secret:
104 if 'VCL_APP_NAMESPACE_SECRET' in self.vcl_app_env:
105 del self.vcl_app_env['VCL_APP_NAMESPACE_SECRET']
106 else:
107 self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] = ns_secret
108
109 if not attach_sock:
110 self.vcl_app_env['VCL_VPP_API_SOCKET'] = self.get_api_sock_path()
111 if 'VCL_VPP_SAPI_SOCKET' in self.vcl_app_env:
112 del self.vcl_app_env['VCL_VPP_SAPI_SOCKET']
113 else:
114 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
115 self.vcl_app_env['VCL_VPP_SAPI_SOCKET'] = sapi_sock
116 if 'VCL_VPP_API_SOCKET' in self.vcl_app_env:
117 del self.vcl_app_env['VCL_VPP_API_SOCKET']
118
Dave Wallace9f11c012018-02-28 17:55:23 -0500119 def cut_thru_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100120 self.vapi.session_enable_disable(is_enable=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500121
Dave Wallace9f11c012018-02-28 17:55:23 -0500122 def cut_thru_tear_down(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100123 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500124
Dave Wallace816833f2018-03-14 20:01:28 -0400125 def cut_thru_test(self, server_app, server_args, client_app, client_args):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700126 self.vcl_app_env = {'VCL_APP_SCOPE_LOCAL': "true"}
127
128 self.update_vcl_app_env("", "", self.sapi_server_sock)
Klement Sekerab23ffd72021-05-31 16:08:53 +0200129 worker_server = VCLAppWorker(server_app, server_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700130 self.logger, self.vcl_app_env, "server")
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500131 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800132 self.sleep(self.pre_test_sleep)
Florin Coras4c45d6f2021-08-12 08:38:02 -0700133
134 self.update_vcl_app_env("", "", self.sapi_client_sock)
Klement Sekerab23ffd72021-05-31 16:08:53 +0200135 worker_client = VCLAppWorker(client_app, client_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700136 self.logger, self.vcl_app_env, "client")
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500137 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500138 worker_client.join(self.timeout)
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500139 try:
140 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200141 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500142 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800143 self.sleep(self.post_test_sleep)
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500144
Dave Wallace9f11c012018-02-28 17:55:23 -0500145 def thru_host_stack_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100146 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200147 self.create_loopback_interfaces(2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500148
Florin Coras56b39f62018-03-27 17:29:32 -0700149 table_id = 1
Dave Wallacea67a03e2018-02-20 12:39:37 -0500150
151 for i in self.lo_interfaces:
152 i.admin_up()
153
154 if table_id != 0:
155 tbl = VppIpTable(self, table_id)
156 tbl.add_vpp_config()
157
158 i.set_table_ip4(table_id)
159 i.config_ip4()
160 table_id += 1
161
162 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100163 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100164 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100165 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100166 sw_if_index=self.loop1.sw_if_index)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500167
Dave Wallacea67a03e2018-02-20 12:39:37 -0500168 # Add inter-table routes
169 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
170 [VppRoutePath("0.0.0.0",
171 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700172 nh_table_id=2)], table_id=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500173 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
174 [VppRoutePath("0.0.0.0",
175 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700176 nh_table_id=1)], table_id=2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500177 ip_t01.add_vpp_config()
178 ip_t10.add_vpp_config()
Florin Coras56b39f62018-03-27 17:29:32 -0700179 self.logger.debug(self.vapi.cli("show ip fib"))
Dave Wallacea67a03e2018-02-20 12:39:37 -0500180
Dave Wallace9f11c012018-02-28 17:55:23 -0500181 def thru_host_stack_tear_down(self):
182 for i in self.lo_interfaces:
183 i.unconfig_ip4()
184 i.set_table_ip4(0)
185 i.admin_down()
186
Dave Wallacede910062018-03-20 09:22:13 -0400187 def thru_host_stack_ipv6_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100188 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200189 self.create_loopback_interfaces(2)
Dave Wallacede910062018-03-20 09:22:13 -0400190
191 table_id = 1
192
193 for i in self.lo_interfaces:
194 i.admin_up()
195
196 tbl = VppIpTable(self, table_id, is_ip6=1)
197 tbl.add_vpp_config()
198
199 i.set_table_ip6(table_id)
200 i.config_ip6()
201 table_id += 1
202
203 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100204 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100205 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100206 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100207 sw_if_index=self.loop1.sw_if_index)
Dave Wallacede910062018-03-20 09:22:13 -0400208
209 # Add inter-table routes
210 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700211 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700212 nh_table_id=2)],
213 table_id=1)
Dave Wallacede910062018-03-20 09:22:13 -0400214 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700215 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700216 nh_table_id=1)],
217 table_id=2)
Dave Wallacede910062018-03-20 09:22:13 -0400218 ip_t01.add_vpp_config()
219 ip_t10.add_vpp_config()
220 self.logger.debug(self.vapi.cli("show interface addr"))
221 self.logger.debug(self.vapi.cli("show ip6 fib"))
222
223 def thru_host_stack_ipv6_tear_down(self):
224 for i in self.lo_interfaces:
225 i.unconfig_ip6()
226 i.set_table_ip6(0)
227 i.admin_down()
228
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100229 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacede910062018-03-20 09:22:13 -0400230
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400231 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400232 def thru_host_stack_test(self, server_app, server_args,
233 client_app, client_args):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700234 self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"}
Dave Wallace9f11c012018-02-28 17:55:23 -0500235
Florin Coras4c45d6f2021-08-12 08:38:02 -0700236 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
Klement Sekerab23ffd72021-05-31 16:08:53 +0200237 worker_server = VCLAppWorker(server_app, server_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700238 self.logger, self.vcl_app_env, "server")
Dave Wallacea67a03e2018-02-20 12:39:37 -0500239 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800240 self.sleep(self.pre_test_sleep)
Dave Wallace42996c02018-02-26 14:40:13 -0500241
Florin Coras4c45d6f2021-08-12 08:38:02 -0700242 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
Klement Sekerab23ffd72021-05-31 16:08:53 +0200243 worker_client = VCLAppWorker(client_app, client_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700244 self.logger, self.vcl_app_env, "client")
Dave Wallacea67a03e2018-02-20 12:39:37 -0500245 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500246 worker_client.join(self.timeout)
247
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500248 try:
249 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200250 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500251 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800252 self.sleep(self.post_test_sleep)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500253
Dave Wallace9f11c012018-02-28 17:55:23 -0500254 def validateResults(self, worker_client, worker_server, timeout):
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400255 if worker_server.process is None:
256 raise RuntimeError('worker_server is not running.')
Dave Wallaced85075e2018-03-02 13:19:30 -0500257 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
258 self.logger.info("Killing server worker process (pid %d)" %
259 worker_server.process.pid)
Dave Barachad646872019-05-06 10:49:41 -0400260 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
Dave Wallaced85075e2018-03-02 13:19:30 -0500261 worker_server.join()
Dave Wallace9f11c012018-02-28 17:55:23 -0500262 self.logger.info("Client worker result is `%s'" % worker_client.result)
263 error = False
264 if worker_client.result is None:
265 try:
266 error = True
267 self.logger.error(
Dave Wallaced85075e2018-03-02 13:19:30 -0500268 "Timeout: %ss! Killing client worker process (pid %d)" %
269 (timeout, worker_client.process.pid))
Dave Wallace9f11c012018-02-28 17:55:23 -0500270 os.killpg(os.getpgid(worker_client.process.pid),
Florin Corasdc2e2512018-12-03 17:47:26 -0800271 signal.SIGKILL)
Dave Wallace9f11c012018-02-28 17:55:23 -0500272 worker_client.join()
Dave Wallace07c0a9d2019-05-13 19:21:24 -0400273 except OSError:
Dave Wallace9f11c012018-02-28 17:55:23 -0500274 self.logger.debug(
275 "Couldn't kill client worker process")
276 raise
277 if error:
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400278 raise RuntimeError(
Dave Wallace9f11c012018-02-28 17:55:23 -0500279 "Timeout! Client worker did not finish in %ss" % timeout)
280 self.assert_equal(worker_client.result, 0, "Binary test return code")
281
282
Florin Coras0ae445e2018-11-29 18:22:10 -0800283class LDPCutThruTestCase(VCLTestCase):
284 """ LDP Cut Thru Tests """
Dave Wallace9f11c012018-02-28 17:55:23 -0500285
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800286 @classmethod
287 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700288 cls.session_startup = ["poll-main", "use-app-socket-api"]
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800289 super(LDPCutThruTestCase, cls).setUpClass()
290
291 @classmethod
292 def tearDownClass(cls):
293 super(LDPCutThruTestCase, cls).tearDownClass()
294
Dave Wallace9f11c012018-02-28 17:55:23 -0500295 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800296 super(LDPCutThruTestCase, self).setUp()
Dave Wallace9f11c012018-02-28 17:55:23 -0500297
298 self.cut_thru_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400299 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
300 self.server_addr, self.server_port]
Dave Wallace816833f2018-03-14 20:01:28 -0400301 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700302 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
303 self.server_iperf3_args = ["-4", "-s"]
Florin Coras2eb42e72018-11-29 00:39:53 -0800304 self.client_uni_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400305 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
306 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400307 self.server_addr,
308 self.server_port]
Florin Coras2eb42e72018-11-29 00:39:53 -0800309 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400310 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
311 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400312 self.server_addr,
313 self.server_port]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700314 self.sapi_client_sock = "default"
315 self.sapi_server_sock = "default"
Dave Wallace9f11c012018-02-28 17:55:23 -0500316
317 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800318 super(LDPCutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400319 self.cut_thru_tear_down()
Dave Wallace9f11c012018-02-28 17:55:23 -0500320
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700321 def show_commands_at_teardown(self):
322 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800323 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700324
Klement Sekerab23ffd72021-05-31 16:08:53 +0200325 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallace9f11c012018-02-28 17:55:23 -0500326 def test_ldp_cut_thru_echo(self):
327 """ run LDP cut thru echo test """
328
Florin Corasab2f6db2018-08-31 14:31:41 -0700329 self.cut_thru_test("sock_test_server", self.server_args,
330 "sock_test_client", self.client_echo_test_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400331
332 def test_ldp_cut_thru_iperf3(self):
333 """ run LDP cut thru iperf3 test """
334
Dave Wallace816833f2018-03-14 20:01:28 -0400335 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400336 self.cut_thru_test(iperf3, self.server_iperf3_args,
337 iperf3, self.client_iperf3_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500338
Klement Sekerab23ffd72021-05-31 16:08:53 +0200339 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallaced85075e2018-03-02 13:19:30 -0500340 def test_ldp_cut_thru_uni_dir_nsock(self):
341 """ run LDP cut thru uni-directional (multiple sockets) test """
342
343 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700344 self.cut_thru_test("sock_test_server", self.server_args,
345 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500346 self.client_uni_dir_nsock_test_args)
347
Klement Sekerab23ffd72021-05-31 16:08:53 +0200348 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700349 @unittest.skip("sock test apps need to be improved")
Dave Wallaced85075e2018-03-02 13:19:30 -0500350 def test_ldp_cut_thru_bi_dir_nsock(self):
351 """ run LDP cut thru bi-directional (multiple sockets) test """
352
353 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700354 self.cut_thru_test("sock_test_server", self.server_args,
355 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500356 self.client_bi_dir_nsock_test_args)
357
Florin Coras0ae445e2018-11-29 18:22:10 -0800358
359class VCLCutThruTestCase(VCLTestCase):
360 """ VCL Cut Thru Tests """
361
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800362 @classmethod
363 def setUpClass(cls):
364 super(VCLCutThruTestCase, cls).setUpClass()
365
366 @classmethod
367 def tearDownClass(cls):
368 super(VCLCutThruTestCase, cls).tearDownClass()
369
Florin Coras0ae445e2018-11-29 18:22:10 -0800370 def setUp(self):
371 super(VCLCutThruTestCase, self).setUp()
372
373 self.cut_thru_setup()
374 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
375 self.server_addr, self.server_port]
376
377 self.client_uni_dir_nsock_timeout = 20
378 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
379 "-I", "2",
380 self.server_addr,
381 self.server_port]
382 self.client_bi_dir_nsock_timeout = 20
383 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
384 "-I", "2",
385 self.server_addr,
386 self.server_port]
387
388 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800389 super(VCLCutThruTestCase, self).tearDown()
390
Florin Coras317b8e02019-04-17 09:57:46 -0700391 def show_commands_at_teardown(self):
392 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800393 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras317b8e02019-04-17 09:57:46 -0700394
Dave Wallace9f11c012018-02-28 17:55:23 -0500395 def test_vcl_cut_thru_echo(self):
396 """ run VCL cut thru echo test """
397
Florin Corasab2f6db2018-08-31 14:31:41 -0700398 self.cut_thru_test("vcl_test_server", self.server_args,
399 "vcl_test_client", self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500400
Dave Wallaced85075e2018-03-02 13:19:30 -0500401 def test_vcl_cut_thru_uni_dir_nsock(self):
402 """ run VCL cut thru uni-directional (multiple sockets) test """
403
404 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700405 self.cut_thru_test("vcl_test_server", self.server_args,
406 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500407 self.client_uni_dir_nsock_test_args)
408
Dave Wallaced85075e2018-03-02 13:19:30 -0500409 def test_vcl_cut_thru_bi_dir_nsock(self):
410 """ run VCL cut thru bi-directional (multiple sockets) test """
411
412 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700413 self.cut_thru_test("vcl_test_server", self.server_args,
414 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500415 self.client_bi_dir_nsock_test_args)
416
Dave Wallace9f11c012018-02-28 17:55:23 -0500417
Florin Corasdc2e2512018-12-03 17:47:26 -0800418class VCLThruHostStackEcho(VCLTestCase):
419 """ VCL Thru Host Stack Echo """
Dave Wallaced85075e2018-03-02 13:19:30 -0500420
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800421 @classmethod
422 def setUpClass(cls):
423 super(VCLThruHostStackEcho, cls).setUpClass()
424
425 @classmethod
426 def tearDownClass(cls):
427 super(VCLThruHostStackEcho, cls).tearDownClass()
428
Dave Wallaced85075e2018-03-02 13:19:30 -0500429 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800430 super(VCLThruHostStackEcho, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500431
432 self.thru_host_stack_setup()
Florin Corasdc2e2512018-12-03 17:47:26 -0800433 self.client_bi_dir_nsock_timeout = 20
434 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
435 "-I", "2",
436 self.loop0.local_ip4,
437 self.server_port]
438 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
439 self.loop0.local_ip4,
440 self.server_port]
441
442 def tearDown(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800443 self.thru_host_stack_tear_down()
444 super(VCLThruHostStackEcho, self).tearDown()
445
Filip Tehlar48bdf242022-02-08 09:40:00 +0000446 def test_vcl_thru_host_stack_echo(self):
447 """ run VCL IPv4 thru host stack echo test """
448
449 self.thru_host_stack_test("vcl_test_server",
450 self.server_args,
451 "vcl_test_client",
452 self.client_echo_test_args)
453
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700454 def show_commands_at_teardown(self):
455 self.logger.debug(self.vapi.cli("show app server"))
456 self.logger.debug(self.vapi.cli("show session verbose"))
Florin Coras41d5f542021-01-15 13:49:33 -0800457 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700458
Florin Corasdc2e2512018-12-03 17:47:26 -0800459
Florin Coras8a140612019-02-18 22:39:39 -0800460class VCLThruHostStackTLS(VCLTestCase):
461 """ VCL Thru Host Stack TLS """
462
463 @classmethod
464 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700465 cls.session_startup = ["poll-main", "use-app-socket-api"]
Florin Coras8a140612019-02-18 22:39:39 -0800466 super(VCLThruHostStackTLS, cls).setUpClass()
467
468 @classmethod
469 def tearDownClass(cls):
470 super(VCLThruHostStackTLS, cls).tearDownClass()
471
472 def setUp(self):
473 super(VCLThruHostStackTLS, self).setUp()
474
475 self.thru_host_stack_setup()
476 self.client_uni_dir_tls_timeout = 20
Dave Wallace03dd90a2019-03-25 19:34:50 -0400477 self.server_tls_args = ["-L", self.server_port]
478 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
Florin Coras8a140612019-02-18 22:39:39 -0800479 self.loop0.local_ip4,
480 self.server_port]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700481 self.sapi_server_sock = "1"
482 self.sapi_client_sock = "2"
Florin Coras8a140612019-02-18 22:39:39 -0800483
484 def test_vcl_thru_host_stack_tls_uni_dir(self):
485 """ run VCL thru host stack uni-directional TLS test """
486
487 self.timeout = self.client_uni_dir_tls_timeout
488 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
489 "vcl_test_client",
490 self.client_uni_dir_tls_test_args)
491
492 def tearDown(self):
Florin Coras8a140612019-02-18 22:39:39 -0800493 self.thru_host_stack_tear_down()
494 super(VCLThruHostStackTLS, self).tearDown()
495
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700496 def show_commands_at_teardown(self):
497 self.logger.debug(self.vapi.cli("show app server"))
498 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800499 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700500
Florin Coras8a140612019-02-18 22:39:39 -0800501
Florin Corascec1b272021-05-06 12:46:04 -0700502class VCLThruHostStackDTLS(VCLTestCase):
503 """ VCL Thru Host Stack DTLS """
504
505 @classmethod
506 def setUpClass(cls):
507 super(VCLThruHostStackDTLS, cls).setUpClass()
508
509 @classmethod
510 def tearDownClass(cls):
511 super(VCLThruHostStackDTLS, cls).tearDownClass()
512
513 def setUp(self):
514 super(VCLThruHostStackDTLS, self).setUp()
515
516 self.thru_host_stack_setup()
517 self.client_uni_dir_dtls_timeout = 20
Florin Corasfb50bc32021-05-18 00:28:59 -0700518 self.server_dtls_args = ["-p", "dtls", self.server_port]
Florin Corascec1b272021-05-06 12:46:04 -0700519 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
Florin Corasfb50bc32021-05-18 00:28:59 -0700520 "-p", "dtls", "-T 1400",
Florin Corascec1b272021-05-06 12:46:04 -0700521 self.loop0.local_ip4,
522 self.server_port]
523
524 def test_vcl_thru_host_stack_dtls_uni_dir(self):
525 """ run VCL thru host stack uni-directional DTLS test """
526
527 self.timeout = self.client_uni_dir_dtls_timeout
528 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
529 "vcl_test_client",
530 self.client_uni_dir_dtls_test_args)
531
532 def tearDown(self):
533 self.thru_host_stack_tear_down()
534 super(VCLThruHostStackDTLS, self).tearDown()
535
536 def show_commands_at_teardown(self):
537 self.logger.debug(self.vapi.cli("show app server"))
538 self.logger.debug(self.vapi.cli("show session verbose 2"))
539 self.logger.debug(self.vapi.cli("show app mq"))
540
541
Florin Corasdebb3522021-05-18 00:35:50 -0700542class VCLThruHostStackQUIC(VCLTestCase):
543 """ VCL Thru Host Stack QUIC """
544
545 @classmethod
546 def setUpClass(cls):
547 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
548 super(VCLThruHostStackQUIC, cls).setUpClass()
549
550 @classmethod
551 def tearDownClass(cls):
552 super(VCLThruHostStackQUIC, cls).tearDownClass()
553
554 def setUp(self):
555 super(VCLThruHostStackQUIC, self).setUp()
556
557 self.thru_host_stack_setup()
558 self.client_uni_dir_quic_timeout = 20
559 self.server_quic_args = ["-p", "quic", self.server_port]
560 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
561 "-p", "quic",
562 self.loop0.local_ip4,
563 self.server_port]
564
Klement Sekerab23ffd72021-05-31 16:08:53 +0200565 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Corasdebb3522021-05-18 00:35:50 -0700566 def test_vcl_thru_host_stack_quic_uni_dir(self):
567 """ run VCL thru host stack uni-directional QUIC test """
568
569 self.timeout = self.client_uni_dir_quic_timeout
570 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
571 "vcl_test_client",
572 self.client_uni_dir_quic_test_args)
573
574 def tearDown(self):
575 self.thru_host_stack_tear_down()
576 super(VCLThruHostStackQUIC, self).tearDown()
577
578 def show_commands_at_teardown(self):
579 self.logger.debug(self.vapi.cli("show app server"))
580 self.logger.debug(self.vapi.cli("show session verbose 2"))
581 self.logger.debug(self.vapi.cli("show app mq"))
582
583
Florin Corasdc2e2512018-12-03 17:47:26 -0800584class VCLThruHostStackBidirNsock(VCLTestCase):
585 """ VCL Thru Host Stack Bidir Nsock """
586
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800587 @classmethod
588 def setUpClass(cls):
589 super(VCLThruHostStackBidirNsock, cls).setUpClass()
590
591 @classmethod
592 def tearDownClass(cls):
593 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
594
Florin Corasdc2e2512018-12-03 17:47:26 -0800595 def setUp(self):
596 super(VCLThruHostStackBidirNsock, self).setUp()
597
598 self.thru_host_stack_setup()
599 self.client_bi_dir_nsock_timeout = 20
600 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
601 "-I", "2",
602 self.loop0.local_ip4,
603 self.server_port]
604 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
605 self.loop0.local_ip4,
606 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500607
608 def tearDown(self):
609 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800610 super(VCLThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500611
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700612 def show_commands_at_teardown(self):
613 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800614 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700615
Dave Wallaced85075e2018-03-02 13:19:30 -0500616 def test_vcl_thru_host_stack_bi_dir_nsock(self):
617 """ run VCL thru host stack bi-directional (multiple sockets) test """
618
619 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700620 self.thru_host_stack_test("vcl_test_server", self.server_args,
621 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500622 self.client_bi_dir_nsock_test_args)
623
624
Florin Corasdc2e2512018-12-03 17:47:26 -0800625class LDPThruHostStackBidirNsock(VCLTestCase):
626 """ LDP Thru Host Stack Bidir Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500627
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800628 @classmethod
629 def setUpClass(cls):
630 super(LDPThruHostStackBidirNsock, cls).setUpClass()
631
632 @classmethod
633 def tearDownClass(cls):
634 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
635
Dave Wallaced85075e2018-03-02 13:19:30 -0500636 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800637 super(LDPThruHostStackBidirNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500638
639 self.thru_host_stack_setup()
Dave Wallace3102c382020-04-03 19:48:48 -0400640 self.client_bi_dir_nsock_timeout = 20
641 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
642 # OUCH! Host Stack Bug?
643 # Only fails when running
644 # 'make test TEST_JOBS=auto'
645 # or TEST_JOBS > 1
646 # "-I", "2",
647 self.loop0.local_ip4,
648 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500649
650 def tearDown(self):
651 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800652 super(LDPThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500653
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700654 def show_commands_at_teardown(self):
655 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800656 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700657
Dave Wallaced85075e2018-03-02 13:19:30 -0500658 def test_ldp_thru_host_stack_bi_dir_nsock(self):
659 """ run LDP thru host stack bi-directional (multiple sockets) test """
660
661 self.timeout = self.client_bi_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400662 self.thru_host_stack_test("sock_test_server", self.server_args,
663 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500664 self.client_bi_dir_nsock_test_args)
665
666
Florin Corasdc2e2512018-12-03 17:47:26 -0800667class LDPThruHostStackNsock(VCLTestCase):
668 """ LDP Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500669
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800670 @classmethod
671 def setUpClass(cls):
672 super(LDPThruHostStackNsock, cls).setUpClass()
673
674 @classmethod
675 def tearDownClass(cls):
676 super(LDPThruHostStackNsock, cls).tearDownClass()
677
Dave Wallaced85075e2018-03-02 13:19:30 -0500678 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800679 super(LDPThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500680
681 self.thru_host_stack_setup()
682 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800683 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500684 self.numSockets = "2"
685 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800686 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500687 self.numSockets = "5"
688
Dave Wallace45cd3a32018-06-26 01:14:04 -0400689 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
690 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400691 self.loop0.local_ip4,
692 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500693
694 def tearDown(self):
695 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800696 super(LDPThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500697
Dave Wallaced85075e2018-03-02 13:19:30 -0500698 def test_ldp_thru_host_stack_uni_dir_nsock(self):
699 """ run LDP thru host stack uni-directional (multiple sockets) test """
700
701 self.timeout = self.client_uni_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400702 self.thru_host_stack_test("sock_test_server", self.server_args,
703 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500704 self.client_uni_dir_nsock_test_args)
705
706
Florin Corasdc2e2512018-12-03 17:47:26 -0800707class VCLThruHostStackNsock(VCLTestCase):
708 """ VCL Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500709
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800710 @classmethod
711 def setUpClass(cls):
712 super(VCLThruHostStackNsock, cls).setUpClass()
713
714 @classmethod
715 def tearDownClass(cls):
716 super(VCLThruHostStackNsock, cls).tearDownClass()
717
Dave Wallaced85075e2018-03-02 13:19:30 -0500718 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800719 super(VCLThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500720
721 self.thru_host_stack_setup()
722 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800723 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500724 self.numSockets = "2"
725 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800726 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500727 self.numSockets = "5"
728
Dave Wallace45cd3a32018-06-26 01:14:04 -0400729 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
730 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400731 self.loop0.local_ip4,
732 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500733
734 def tearDown(self):
735 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800736 super(VCLThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500737
Dave Wallaced85075e2018-03-02 13:19:30 -0500738 def test_vcl_thru_host_stack_uni_dir_nsock(self):
739 """ run VCL thru host stack uni-directional (multiple sockets) test """
740
741 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700742 self.thru_host_stack_test("vcl_test_server", self.server_args,
743 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500744 self.client_uni_dir_nsock_test_args)
745
746
Florin Corasdc2e2512018-12-03 17:47:26 -0800747class LDPThruHostStackIperf(VCLTestCase):
748 """ LDP Thru Host Stack Iperf """
Dave Wallace816833f2018-03-14 20:01:28 -0400749
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800750 @classmethod
751 def setUpClass(cls):
752 super(LDPThruHostStackIperf, cls).setUpClass()
753
754 @classmethod
755 def tearDownClass(cls):
756 super(LDPThruHostStackIperf, cls).tearDownClass()
757
Dave Wallace816833f2018-03-14 20:01:28 -0400758 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800759 super(LDPThruHostStackIperf, self).setUp()
Dave Wallace816833f2018-03-14 20:01:28 -0400760
761 self.thru_host_stack_setup()
762 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700763 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
764 self.server_iperf3_args = ["-4", "-s"]
Dave Wallace816833f2018-03-14 20:01:28 -0400765
766 def tearDown(self):
767 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800768 super(LDPThruHostStackIperf, self).tearDown()
Dave Wallace816833f2018-03-14 20:01:28 -0400769
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700770 def show_commands_at_teardown(self):
771 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800772 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700773
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400774 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400775 def test_ldp_thru_host_stack_iperf3(self):
776 """ run LDP thru host stack iperf3 test """
777
Dave Wallace816833f2018-03-14 20:01:28 -0400778 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400779 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
780 iperf3, self.client_iperf3_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400781
782
Florin Coras57a5a2d2020-04-01 23:16:11 +0000783class LDPThruHostStackIperfUdp(VCLTestCase):
784 """ LDP Thru Host Stack Iperf UDP """
785
786 @classmethod
787 def setUpClass(cls):
788 super(LDPThruHostStackIperfUdp, cls).setUpClass()
789
790 @classmethod
791 def tearDownClass(cls):
792 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
793
794 def setUp(self):
795 super(LDPThruHostStackIperfUdp, self).setUp()
796
797 self.thru_host_stack_setup()
798 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700799 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
Florin Coras57a5a2d2020-04-01 23:16:11 +0000800 "-c", self.loop0.local_ip4]
Florin Coras1d879142021-05-06 00:08:18 -0700801 self.server_iperf3_args = ["-4", "-s"]
Florin Coras57a5a2d2020-04-01 23:16:11 +0000802
803 def tearDown(self):
804 self.thru_host_stack_tear_down()
805 super(LDPThruHostStackIperfUdp, self).tearDown()
806
807 def show_commands_at_teardown(self):
808 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800809 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras57a5a2d2020-04-01 23:16:11 +0000810
811 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
812 def test_ldp_thru_host_stack_iperf3_udp(self):
813 """ run LDP thru host stack iperf3 UDP test """
814
815 self.timeout = self.client_iperf3_timeout
816 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
817 iperf3, self.client_iperf3_args)
818
819
Florin Coras0ae445e2018-11-29 18:22:10 -0800820class LDPIpv6CutThruTestCase(VCLTestCase):
821 """ LDP IPv6 Cut Thru Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400822
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800823 @classmethod
824 def setUpClass(cls):
825 super(LDPIpv6CutThruTestCase, cls).setUpClass()
826
827 @classmethod
828 def tearDownClass(cls):
829 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
830
Florin Coras41d5f542021-01-15 13:49:33 -0800831 def show_commands_at_teardown(self):
832 self.logger.debug(self.vapi.cli("show session verbose 2"))
833 self.logger.debug(self.vapi.cli("show app mq"))
834
Dave Wallacede910062018-03-20 09:22:13 -0400835 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800836 super(LDPIpv6CutThruTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400837
838 self.cut_thru_setup()
839 self.client_iperf3_timeout = 20
Florin Coras2eb42e72018-11-29 00:39:53 -0800840 self.client_uni_dir_nsock_timeout = 20
841 self.client_bi_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400842 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
843 self.server_ipv6_addr,
844 self.server_port]
Florin Coras1d879142021-05-06 00:08:18 -0700845 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
Florin Corasab2f6db2018-08-31 14:31:41 -0700846 self.server_ipv6_addr]
Florin Coras1d879142021-05-06 00:08:18 -0700847 self.server_ipv6_iperf3_args = ["-6", "-s"]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400848 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
849 "-6",
850 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400851 self.server_ipv6_addr,
852 self.server_port]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400853 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
854 "-6",
855 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400856 self.server_ipv6_addr,
857 self.server_port]
858
859 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800860 super(LDPIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400861 self.cut_thru_tear_down()
Dave Wallacede910062018-03-20 09:22:13 -0400862
Klement Sekerab23ffd72021-05-31 16:08:53 +0200863 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400864 def test_ldp_ipv6_cut_thru_echo(self):
865 """ run LDP IPv6 cut thru echo test """
866
Florin Corasab2f6db2018-08-31 14:31:41 -0700867 self.cut_thru_test("sock_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400868 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700869 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400870 self.client_ipv6_echo_test_args)
871
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400872 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallacede910062018-03-20 09:22:13 -0400873 def test_ldp_ipv6_cut_thru_iperf3(self):
874 """ run LDP IPv6 cut thru iperf3 test """
875
Dave Wallacede910062018-03-20 09:22:13 -0400876 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400877 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
878 iperf3, self.client_ipv6_iperf3_args)
Dave Wallacede910062018-03-20 09:22:13 -0400879
Klement Sekerab23ffd72021-05-31 16:08:53 +0200880 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400881 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
882 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
883
884 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700885 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
886 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400887 self.client_ipv6_uni_dir_nsock_test_args)
888
Klement Sekerab23ffd72021-05-31 16:08:53 +0200889 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700890 @unittest.skip("sock test apps need to be improved")
Dave Wallacede910062018-03-20 09:22:13 -0400891 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
892 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
893
894 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700895 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
896 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400897 self.client_ipv6_bi_dir_nsock_test_args)
898
Florin Coras0ae445e2018-11-29 18:22:10 -0800899
900class VCLIpv6CutThruTestCase(VCLTestCase):
901 """ VCL IPv6 Cut Thru Tests """
902
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800903 @classmethod
904 def setUpClass(cls):
905 super(VCLIpv6CutThruTestCase, cls).setUpClass()
906
907 @classmethod
908 def tearDownClass(cls):
909 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
910
Florin Coras41d5f542021-01-15 13:49:33 -0800911 def show_commands_at_teardown(self):
912 self.logger.debug(self.vapi.cli("show session verbose 2"))
913 self.logger.debug(self.vapi.cli("show app mq"))
914
Florin Coras0ae445e2018-11-29 18:22:10 -0800915 def setUp(self):
916 super(VCLIpv6CutThruTestCase, self).setUp()
917
918 self.cut_thru_setup()
919 self.client_uni_dir_nsock_timeout = 20
920 self.client_bi_dir_nsock_timeout = 20
921 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
922 self.server_ipv6_addr,
923 self.server_port]
924 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
925 "-6",
926 "-I", "2",
927 self.server_ipv6_addr,
928 self.server_port]
929 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
930 "-6",
931 "-I", "2",
932 self.server_ipv6_addr,
933 self.server_port]
934
935 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800936 super(VCLIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400937 self.cut_thru_tear_down()
Florin Coras0ae445e2018-11-29 18:22:10 -0800938
Florin Coras41d5f542021-01-15 13:49:33 -0800939 def show_commands_at_teardown(self):
940 self.logger.debug(self.vapi.cli("show session verbose 2"))
941 self.logger.debug(self.vapi.cli("show app mq"))
942
Dave Wallacede910062018-03-20 09:22:13 -0400943 def test_vcl_ipv6_cut_thru_echo(self):
944 """ run VCL IPv6 cut thru echo test """
945
Florin Corasab2f6db2018-08-31 14:31:41 -0700946 self.cut_thru_test("vcl_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400947 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700948 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400949 self.client_ipv6_echo_test_args)
950
Klement Sekerab23ffd72021-05-31 16:08:53 +0200951 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400952 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
953 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
954
955 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700956 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
957 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400958 self.client_ipv6_uni_dir_nsock_test_args)
959
Klement Sekerab23ffd72021-05-31 16:08:53 +0200960 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400961 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
962 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
963
964 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700965 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
966 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400967 self.client_ipv6_bi_dir_nsock_test_args)
968
969
Florin Corasdc2e2512018-12-03 17:47:26 -0800970class VCLIpv6ThruHostStackEcho(VCLTestCase):
971 """ VCL IPv6 Thru Host Stack Echo """
Dave Wallacede910062018-03-20 09:22:13 -0400972
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800973 @classmethod
974 def setUpClass(cls):
975 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
976
977 @classmethod
978 def tearDownClass(cls):
979 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
980
Dave Wallacede910062018-03-20 09:22:13 -0400981 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800982 super(VCLIpv6ThruHostStackEcho, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400983
984 self.thru_host_stack_ipv6_setup()
985 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
986 self.loop0.local_ip6,
987 self.server_port]
988
989 def tearDown(self):
990 self.thru_host_stack_ipv6_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800991 super(VCLIpv6ThruHostStackEcho, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400992
993 def test_vcl_ipv6_thru_host_stack_echo(self):
994 """ run VCL IPv6 thru host stack echo test """
995
Florin Corasdc2e2512018-12-03 17:47:26 -0800996 self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200997 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700998 "vcl_test_client",
Florin Corasdc2e2512018-12-03 17:47:26 -0800999 self.client_ipv6_echo_test_args)
Dave Wallacede910062018-03-20 09:22:13 -04001000
1001
Dave Wallacecfcf2f42018-02-16 18:31:56 -05001002if __name__ == '__main__':
1003 unittest.main(testRunner=VppTestRunner)