blob: bf139fe05372993bc4c1581f0072c5b1957cb6dc [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
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020013iperf3 = "/usr/bin/iperf3"
Paul Vinciguerra063366e2019-06-30 15:38:55 -040014
15
16def have_app(app):
17 try:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020018 subprocess.check_output([app, "-v"])
Paul Vinciguerra063366e2019-06-30 15:38:55 -040019 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):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020028 """VCL Test Application Worker"""
Dave Wallace42996c02018-02-26 14:40:13 -050029
Damjan Marion5546e432021-09-30 20:04:14 +020030 libname = "libvcl_ldpreload.so"
31
32 class LibraryNotFound(Exception):
33 pass
34
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020035 def __init__(
36 self, appname, executable_args, logger, env=None, role=None, *args, **kwargs
37 ):
Dave Wallace4ee17d82021-05-20 14:01:51 -040038 self.role = role
Klement Sekerab23ffd72021-05-31 16:08:53 +020039 vcl_ldpreload_glob = f"{config.vpp_install_dir}/**/{self.libname}"
Damjan Marion5546e432021-09-30 20:04:14 +020040 vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True)
41
42 if len(vcl_ldpreload_so) < 1:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020043 raise LibraryNotFound("cannot locate library: {}".format(self.libname))
Damjan Marion5546e432021-09-30 20:04:14 +020044
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
Klement Sekerad9b0c6f2022-04-26 19:02:15 +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}"
Klement Sekerad9b0c6f2022-04-26 19:02:15 +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
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020058 super(VCLAppWorker, self).__init__(self.args, logger, env, *args, **kwargs)
Dave Wallace42996c02018-02-26 14:40:13 -050059
60
Dave Wallace816833f2018-03-14 20:01:28 -040061class VCLTestCase(VppTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020062 """VCL Test Class"""
63
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 Sekerad9b0c6f2022-04-26 19:02:15 +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:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +020098 if "VCL_APP_NAMESPACE_ID" in self.vcl_app_env:
99 del self.vcl_app_env["VCL_APP_NAMESPACE_ID"]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700100 else:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200101 self.vcl_app_env["VCL_APP_NAMESPACE_ID"] = ns_id
Florin Coras4c45d6f2021-08-12 08:38:02 -0700102
103 if not ns_secret:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200104 if "VCL_APP_NAMESPACE_SECRET" in self.vcl_app_env:
105 del self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700106 else:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200107 self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"] = ns_secret
Florin Coras4c45d6f2021-08-12 08:38:02 -0700108
109 if not attach_sock:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200110 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"]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700113 else:
114 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200115 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"]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700118
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):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200126 self.vcl_app_env = {"VCL_APP_SCOPE_LOCAL": "true"}
Florin Coras4c45d6f2021-08-12 08:38:02 -0700127
128 self.update_vcl_app_env("", "", self.sapi_server_sock)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200129 worker_server = VCLAppWorker(
130 server_app, server_args, self.logger, self.vcl_app_env, "server"
131 )
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500132 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800133 self.sleep(self.pre_test_sleep)
Florin Coras4c45d6f2021-08-12 08:38:02 -0700134
135 self.update_vcl_app_env("", "", self.sapi_client_sock)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200136 worker_client = VCLAppWorker(
137 client_app, client_args, self.logger, self.vcl_app_env, "client"
138 )
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500139 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500140 worker_client.join(self.timeout)
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500141 try:
142 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200143 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500144 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800145 self.sleep(self.post_test_sleep)
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500146
Dave Wallace9f11c012018-02-28 17:55:23 -0500147 def thru_host_stack_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100148 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200149 self.create_loopback_interfaces(2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500150
Florin Coras56b39f62018-03-27 17:29:32 -0700151 table_id = 1
Dave Wallacea67a03e2018-02-20 12:39:37 -0500152
153 for i in self.lo_interfaces:
154 i.admin_up()
155
156 if table_id != 0:
157 tbl = VppIpTable(self, table_id)
158 tbl.add_vpp_config()
159
160 i.set_table_ip4(table_id)
161 i.config_ip4()
162 table_id += 1
163
164 # Configure namespaces
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200165 self.vapi.app_namespace_add_del(
166 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
167 )
168 self.vapi.app_namespace_add_del(
169 namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index
170 )
Dave Wallacea67a03e2018-02-20 12:39:37 -0500171
Dave Wallacea67a03e2018-02-20 12:39:37 -0500172 # Add inter-table routes
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200173 ip_t01 = VppIpRoute(
174 self,
175 self.loop1.local_ip4,
176 32,
177 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=2)],
178 table_id=1,
179 )
180 ip_t10 = VppIpRoute(
181 self,
182 self.loop0.local_ip4,
183 32,
184 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)],
185 table_id=2,
186 )
Dave Wallacea67a03e2018-02-20 12:39:37 -0500187 ip_t01.add_vpp_config()
188 ip_t10.add_vpp_config()
Florin Coras56b39f62018-03-27 17:29:32 -0700189 self.logger.debug(self.vapi.cli("show ip fib"))
Dave Wallacea67a03e2018-02-20 12:39:37 -0500190
Dave Wallace9f11c012018-02-28 17:55:23 -0500191 def thru_host_stack_tear_down(self):
192 for i in self.lo_interfaces:
193 i.unconfig_ip4()
194 i.set_table_ip4(0)
195 i.admin_down()
196
Dave Wallacede910062018-03-20 09:22:13 -0400197 def thru_host_stack_ipv6_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100198 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200199 self.create_loopback_interfaces(2)
Dave Wallacede910062018-03-20 09:22:13 -0400200
201 table_id = 1
202
203 for i in self.lo_interfaces:
204 i.admin_up()
205
206 tbl = VppIpTable(self, table_id, is_ip6=1)
207 tbl.add_vpp_config()
208
209 i.set_table_ip6(table_id)
210 i.config_ip6()
211 table_id += 1
212
213 # Configure namespaces
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200214 self.vapi.app_namespace_add_del(
215 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
216 )
217 self.vapi.app_namespace_add_del(
218 namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index
219 )
Dave Wallacede910062018-03-20 09:22:13 -0400220
221 # Add inter-table routes
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200222 ip_t01 = VppIpRoute(
223 self,
224 self.loop1.local_ip6,
225 128,
226 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=2)],
227 table_id=1,
228 )
229 ip_t10 = VppIpRoute(
230 self,
231 self.loop0.local_ip6,
232 128,
233 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=1)],
234 table_id=2,
235 )
Dave Wallacede910062018-03-20 09:22:13 -0400236 ip_t01.add_vpp_config()
237 ip_t10.add_vpp_config()
238 self.logger.debug(self.vapi.cli("show interface addr"))
239 self.logger.debug(self.vapi.cli("show ip6 fib"))
240
241 def thru_host_stack_ipv6_tear_down(self):
242 for i in self.lo_interfaces:
243 i.unconfig_ip6()
244 i.set_table_ip6(0)
245 i.admin_down()
246
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100247 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacede910062018-03-20 09:22:13 -0400248
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400249 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200250 def thru_host_stack_test(self, server_app, server_args, client_app, client_args):
251 self.vcl_app_env = {"VCL_APP_SCOPE_GLOBAL": "true"}
Dave Wallace9f11c012018-02-28 17:55:23 -0500252
Florin Coras4c45d6f2021-08-12 08:38:02 -0700253 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200254 worker_server = VCLAppWorker(
255 server_app, server_args, self.logger, self.vcl_app_env, "server"
256 )
Dave Wallacea67a03e2018-02-20 12:39:37 -0500257 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800258 self.sleep(self.pre_test_sleep)
Dave Wallace42996c02018-02-26 14:40:13 -0500259
Florin Coras4c45d6f2021-08-12 08:38:02 -0700260 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200261 worker_client = VCLAppWorker(
262 client_app, client_args, self.logger, self.vcl_app_env, "client"
263 )
Dave Wallacea67a03e2018-02-20 12:39:37 -0500264 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500265 worker_client.join(self.timeout)
266
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500267 try:
268 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200269 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500270 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800271 self.sleep(self.post_test_sleep)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500272
Dave Wallace9f11c012018-02-28 17:55:23 -0500273 def validateResults(self, worker_client, worker_server, timeout):
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400274 if worker_server.process is None:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200275 raise RuntimeError("worker_server is not running.")
276 if os.path.isdir("/proc/{}".format(worker_server.process.pid)):
277 self.logger.info(
278 "Killing server worker process (pid %d)" % worker_server.process.pid
279 )
Dave Barachad646872019-05-06 10:49:41 -0400280 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
Dave Wallaced85075e2018-03-02 13:19:30 -0500281 worker_server.join()
Dave Wallace9f11c012018-02-28 17:55:23 -0500282 self.logger.info("Client worker result is `%s'" % worker_client.result)
283 error = False
284 if worker_client.result is None:
285 try:
286 error = True
287 self.logger.error(
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200288 "Timeout: %ss! Killing client worker process (pid %d)"
289 % (timeout, worker_client.process.pid)
290 )
291 os.killpg(os.getpgid(worker_client.process.pid), signal.SIGKILL)
Dave Wallace9f11c012018-02-28 17:55:23 -0500292 worker_client.join()
Dave Wallace07c0a9d2019-05-13 19:21:24 -0400293 except OSError:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200294 self.logger.debug("Couldn't kill client worker process")
Dave Wallace9f11c012018-02-28 17:55:23 -0500295 raise
296 if error:
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200297 raise RuntimeError("Timeout! Client worker did not finish in %ss" % timeout)
Dave Wallace9f11c012018-02-28 17:55:23 -0500298 self.assert_equal(worker_client.result, 0, "Binary test return code")
299
300
Florin Coras0ae445e2018-11-29 18:22:10 -0800301class LDPCutThruTestCase(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200302 """LDP Cut Thru Tests"""
Dave Wallace9f11c012018-02-28 17:55:23 -0500303
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800304 @classmethod
305 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700306 cls.session_startup = ["poll-main", "use-app-socket-api"]
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800307 super(LDPCutThruTestCase, cls).setUpClass()
308
309 @classmethod
310 def tearDownClass(cls):
311 super(LDPCutThruTestCase, cls).tearDownClass()
312
Dave Wallace9f11c012018-02-28 17:55:23 -0500313 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800314 super(LDPCutThruTestCase, self).setUp()
Dave Wallace9f11c012018-02-28 17:55:23 -0500315
316 self.cut_thru_setup()
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200317 self.client_echo_test_args = [
318 "-E",
319 self.echo_phrase,
320 "-X",
321 self.server_addr,
322 self.server_port,
323 ]
Dave Wallace816833f2018-03-14 20:01:28 -0400324 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700325 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
326 self.server_iperf3_args = ["-4", "-s"]
Florin Coras2eb42e72018-11-29 00:39:53 -0800327 self.client_uni_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200328 self.client_uni_dir_nsock_test_args = [
329 "-N",
330 "1000",
331 "-U",
332 "-X",
333 "-I",
334 "2",
335 self.server_addr,
336 self.server_port,
337 ]
Florin Coras2eb42e72018-11-29 00:39:53 -0800338 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200339 self.client_bi_dir_nsock_test_args = [
340 "-N",
341 "1000",
342 "-B",
343 "-X",
344 "-I",
345 "2",
346 self.server_addr,
347 self.server_port,
348 ]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700349 self.sapi_client_sock = "default"
350 self.sapi_server_sock = "default"
Dave Wallace9f11c012018-02-28 17:55:23 -0500351
352 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800353 super(LDPCutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400354 self.cut_thru_tear_down()
Dave Wallace9f11c012018-02-28 17:55:23 -0500355
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700356 def show_commands_at_teardown(self):
357 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800358 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700359
Klement Sekerab23ffd72021-05-31 16:08:53 +0200360 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallace9f11c012018-02-28 17:55:23 -0500361 def test_ldp_cut_thru_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200362 """run LDP cut thru echo test"""
Dave Wallace9f11c012018-02-28 17:55:23 -0500363
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200364 self.cut_thru_test(
365 "sock_test_server",
366 self.server_args,
367 "sock_test_client",
368 self.client_echo_test_args,
369 )
Dave Wallace816833f2018-03-14 20:01:28 -0400370
371 def test_ldp_cut_thru_iperf3(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200372 """run LDP cut thru iperf3 test"""
Dave Wallace816833f2018-03-14 20:01:28 -0400373
Dave Wallace816833f2018-03-14 20:01:28 -0400374 self.timeout = self.client_iperf3_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200375 self.cut_thru_test(
376 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
377 )
Dave Wallace9f11c012018-02-28 17:55:23 -0500378
Klement Sekerab23ffd72021-05-31 16:08:53 +0200379 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallaced85075e2018-03-02 13:19:30 -0500380 def test_ldp_cut_thru_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200381 """run LDP cut thru uni-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500382
383 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200384 self.cut_thru_test(
385 "sock_test_server",
386 self.server_args,
387 "sock_test_client",
388 self.client_uni_dir_nsock_test_args,
389 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500390
Klement Sekerab23ffd72021-05-31 16:08:53 +0200391 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700392 @unittest.skip("sock test apps need to be improved")
Dave Wallaced85075e2018-03-02 13:19:30 -0500393 def test_ldp_cut_thru_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200394 """run LDP cut thru bi-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500395
396 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200397 self.cut_thru_test(
398 "sock_test_server",
399 self.server_args,
400 "sock_test_client",
401 self.client_bi_dir_nsock_test_args,
402 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500403
Florin Coras0ae445e2018-11-29 18:22:10 -0800404
405class VCLCutThruTestCase(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200406 """VCL Cut Thru Tests"""
Florin Coras0ae445e2018-11-29 18:22:10 -0800407
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800408 @classmethod
409 def setUpClass(cls):
410 super(VCLCutThruTestCase, cls).setUpClass()
411
412 @classmethod
413 def tearDownClass(cls):
414 super(VCLCutThruTestCase, cls).tearDownClass()
415
Florin Coras0ae445e2018-11-29 18:22:10 -0800416 def setUp(self):
417 super(VCLCutThruTestCase, self).setUp()
418
419 self.cut_thru_setup()
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200420 self.client_echo_test_args = [
421 "-E",
422 self.echo_phrase,
423 "-X",
424 self.server_addr,
425 self.server_port,
426 ]
Florin Coras0ae445e2018-11-29 18:22:10 -0800427
428 self.client_uni_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200429 self.client_uni_dir_nsock_test_args = [
430 "-N",
431 "1000",
432 "-U",
433 "-X",
434 "-I",
435 "2",
436 self.server_addr,
437 self.server_port,
438 ]
Florin Coras0ae445e2018-11-29 18:22:10 -0800439 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200440 self.client_bi_dir_nsock_test_args = [
441 "-N",
442 "1000",
443 "-B",
444 "-X",
445 "-I",
446 "2",
447 self.server_addr,
448 self.server_port,
449 ]
Florin Coras0ae445e2018-11-29 18:22:10 -0800450
451 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800452 super(VCLCutThruTestCase, self).tearDown()
453
Florin Coras317b8e02019-04-17 09:57:46 -0700454 def show_commands_at_teardown(self):
455 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800456 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras317b8e02019-04-17 09:57:46 -0700457
Dave Wallace9f11c012018-02-28 17:55:23 -0500458 def test_vcl_cut_thru_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200459 """run VCL cut thru echo test"""
Dave Wallace9f11c012018-02-28 17:55:23 -0500460
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200461 self.cut_thru_test(
462 "vcl_test_server",
463 self.server_args,
464 "vcl_test_client",
465 self.client_echo_test_args,
466 )
Dave Wallace9f11c012018-02-28 17:55:23 -0500467
Dave Wallaced85075e2018-03-02 13:19:30 -0500468 def test_vcl_cut_thru_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200469 """run VCL cut thru uni-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500470
471 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200472 self.cut_thru_test(
473 "vcl_test_server",
474 self.server_args,
475 "vcl_test_client",
476 self.client_uni_dir_nsock_test_args,
477 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500478
Dave Wallaced85075e2018-03-02 13:19:30 -0500479 def test_vcl_cut_thru_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200480 """run VCL cut thru bi-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500481
482 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200483 self.cut_thru_test(
484 "vcl_test_server",
485 self.server_args,
486 "vcl_test_client",
487 self.client_bi_dir_nsock_test_args,
488 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500489
Dave Wallace9f11c012018-02-28 17:55:23 -0500490
Florin Corasdc2e2512018-12-03 17:47:26 -0800491class VCLThruHostStackEcho(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200492 """VCL Thru Host Stack Echo"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500493
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800494 @classmethod
495 def setUpClass(cls):
496 super(VCLThruHostStackEcho, cls).setUpClass()
497
498 @classmethod
499 def tearDownClass(cls):
500 super(VCLThruHostStackEcho, cls).tearDownClass()
501
Dave Wallaced85075e2018-03-02 13:19:30 -0500502 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800503 super(VCLThruHostStackEcho, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500504
505 self.thru_host_stack_setup()
Florin Corasdc2e2512018-12-03 17:47:26 -0800506 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200507 self.client_bi_dir_nsock_test_args = [
508 "-N",
509 "1000",
510 "-B",
511 "-X",
512 "-I",
513 "2",
514 self.loop0.local_ip4,
515 self.server_port,
516 ]
517 self.client_echo_test_args = [
518 "-E",
519 self.echo_phrase,
520 "-X",
521 self.loop0.local_ip4,
522 self.server_port,
523 ]
Florin Corasdc2e2512018-12-03 17:47:26 -0800524
525 def tearDown(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800526 self.thru_host_stack_tear_down()
527 super(VCLThruHostStackEcho, self).tearDown()
528
Filip Tehlar48bdf242022-02-08 09:40:00 +0000529 def test_vcl_thru_host_stack_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200530 """run VCL IPv4 thru host stack echo test"""
Filip Tehlar48bdf242022-02-08 09:40:00 +0000531
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200532 self.thru_host_stack_test(
533 "vcl_test_server",
534 self.server_args,
535 "vcl_test_client",
536 self.client_echo_test_args,
537 )
Filip Tehlar48bdf242022-02-08 09:40:00 +0000538
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700539 def show_commands_at_teardown(self):
540 self.logger.debug(self.vapi.cli("show app server"))
541 self.logger.debug(self.vapi.cli("show session verbose"))
Florin Coras41d5f542021-01-15 13:49:33 -0800542 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700543
Florin Corasdc2e2512018-12-03 17:47:26 -0800544
Florin Coras8a140612019-02-18 22:39:39 -0800545class VCLThruHostStackTLS(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200546 """VCL Thru Host Stack TLS"""
Florin Coras8a140612019-02-18 22:39:39 -0800547
548 @classmethod
549 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700550 cls.session_startup = ["poll-main", "use-app-socket-api"]
Florin Coras8a140612019-02-18 22:39:39 -0800551 super(VCLThruHostStackTLS, cls).setUpClass()
552
553 @classmethod
554 def tearDownClass(cls):
555 super(VCLThruHostStackTLS, cls).tearDownClass()
556
557 def setUp(self):
558 super(VCLThruHostStackTLS, self).setUp()
559
560 self.thru_host_stack_setup()
561 self.client_uni_dir_tls_timeout = 20
Dave Wallace03dd90a2019-03-25 19:34:50 -0400562 self.server_tls_args = ["-L", self.server_port]
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200563 self.client_uni_dir_tls_test_args = [
564 "-N",
565 "1000",
566 "-U",
567 "-X",
568 "-L",
569 self.loop0.local_ip4,
570 self.server_port,
571 ]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700572 self.sapi_server_sock = "1"
573 self.sapi_client_sock = "2"
Florin Coras8a140612019-02-18 22:39:39 -0800574
575 def test_vcl_thru_host_stack_tls_uni_dir(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200576 """run VCL thru host stack uni-directional TLS test"""
Florin Coras8a140612019-02-18 22:39:39 -0800577
578 self.timeout = self.client_uni_dir_tls_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200579 self.thru_host_stack_test(
580 "vcl_test_server",
581 self.server_tls_args,
582 "vcl_test_client",
583 self.client_uni_dir_tls_test_args,
584 )
Florin Coras8a140612019-02-18 22:39:39 -0800585
586 def tearDown(self):
Florin Coras8a140612019-02-18 22:39:39 -0800587 self.thru_host_stack_tear_down()
588 super(VCLThruHostStackTLS, self).tearDown()
589
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700590 def show_commands_at_teardown(self):
591 self.logger.debug(self.vapi.cli("show app server"))
592 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800593 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700594
Florin Coras8a140612019-02-18 22:39:39 -0800595
Florin Corascec1b272021-05-06 12:46:04 -0700596class VCLThruHostStackDTLS(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200597 """VCL Thru Host Stack DTLS"""
Florin Corascec1b272021-05-06 12:46:04 -0700598
599 @classmethod
600 def setUpClass(cls):
601 super(VCLThruHostStackDTLS, cls).setUpClass()
602
603 @classmethod
604 def tearDownClass(cls):
605 super(VCLThruHostStackDTLS, cls).tearDownClass()
606
607 def setUp(self):
608 super(VCLThruHostStackDTLS, self).setUp()
609
610 self.thru_host_stack_setup()
611 self.client_uni_dir_dtls_timeout = 20
Florin Corasfb50bc32021-05-18 00:28:59 -0700612 self.server_dtls_args = ["-p", "dtls", self.server_port]
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200613 self.client_uni_dir_dtls_test_args = [
614 "-N",
615 "1000",
616 "-U",
617 "-X",
618 "-p",
619 "dtls",
620 "-T 1400",
621 self.loop0.local_ip4,
622 self.server_port,
623 ]
Florin Corascec1b272021-05-06 12:46:04 -0700624
625 def test_vcl_thru_host_stack_dtls_uni_dir(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200626 """run VCL thru host stack uni-directional DTLS test"""
Florin Corascec1b272021-05-06 12:46:04 -0700627
628 self.timeout = self.client_uni_dir_dtls_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200629 self.thru_host_stack_test(
630 "vcl_test_server",
631 self.server_dtls_args,
632 "vcl_test_client",
633 self.client_uni_dir_dtls_test_args,
634 )
Florin Corascec1b272021-05-06 12:46:04 -0700635
636 def tearDown(self):
637 self.thru_host_stack_tear_down()
638 super(VCLThruHostStackDTLS, self).tearDown()
639
640 def show_commands_at_teardown(self):
641 self.logger.debug(self.vapi.cli("show app server"))
642 self.logger.debug(self.vapi.cli("show session verbose 2"))
643 self.logger.debug(self.vapi.cli("show app mq"))
644
645
Florin Corasdebb3522021-05-18 00:35:50 -0700646class VCLThruHostStackQUIC(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200647 """VCL Thru Host Stack QUIC"""
Florin Corasdebb3522021-05-18 00:35:50 -0700648
649 @classmethod
650 def setUpClass(cls):
651 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
652 super(VCLThruHostStackQUIC, cls).setUpClass()
653
654 @classmethod
655 def tearDownClass(cls):
656 super(VCLThruHostStackQUIC, cls).tearDownClass()
657
658 def setUp(self):
659 super(VCLThruHostStackQUIC, self).setUp()
660
661 self.thru_host_stack_setup()
662 self.client_uni_dir_quic_timeout = 20
663 self.server_quic_args = ["-p", "quic", self.server_port]
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200664 self.client_uni_dir_quic_test_args = [
665 "-N",
666 "1000",
667 "-U",
668 "-X",
669 "-p",
670 "quic",
671 self.loop0.local_ip4,
672 self.server_port,
673 ]
Florin Corasdebb3522021-05-18 00:35:50 -0700674
Klement Sekerab23ffd72021-05-31 16:08:53 +0200675 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Corasdebb3522021-05-18 00:35:50 -0700676 def test_vcl_thru_host_stack_quic_uni_dir(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200677 """run VCL thru host stack uni-directional QUIC test"""
Florin Corasdebb3522021-05-18 00:35:50 -0700678
679 self.timeout = self.client_uni_dir_quic_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200680 self.thru_host_stack_test(
681 "vcl_test_server",
682 self.server_quic_args,
683 "vcl_test_client",
684 self.client_uni_dir_quic_test_args,
685 )
Florin Corasdebb3522021-05-18 00:35:50 -0700686
687 def tearDown(self):
688 self.thru_host_stack_tear_down()
689 super(VCLThruHostStackQUIC, self).tearDown()
690
691 def show_commands_at_teardown(self):
692 self.logger.debug(self.vapi.cli("show app server"))
693 self.logger.debug(self.vapi.cli("show session verbose 2"))
694 self.logger.debug(self.vapi.cli("show app mq"))
695
696
Florin Corasdc2e2512018-12-03 17:47:26 -0800697class VCLThruHostStackBidirNsock(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200698 """VCL Thru Host Stack Bidir Nsock"""
Florin Corasdc2e2512018-12-03 17:47:26 -0800699
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800700 @classmethod
701 def setUpClass(cls):
702 super(VCLThruHostStackBidirNsock, cls).setUpClass()
703
704 @classmethod
705 def tearDownClass(cls):
706 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
707
Florin Corasdc2e2512018-12-03 17:47:26 -0800708 def setUp(self):
709 super(VCLThruHostStackBidirNsock, self).setUp()
710
711 self.thru_host_stack_setup()
712 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200713 self.client_bi_dir_nsock_test_args = [
714 "-N",
715 "1000",
716 "-B",
717 "-X",
718 "-I",
719 "2",
720 self.loop0.local_ip4,
721 self.server_port,
722 ]
723 self.client_echo_test_args = [
724 "-E",
725 self.echo_phrase,
726 "-X",
727 self.loop0.local_ip4,
728 self.server_port,
729 ]
Dave Wallaced85075e2018-03-02 13:19:30 -0500730
731 def tearDown(self):
732 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800733 super(VCLThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500734
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700735 def show_commands_at_teardown(self):
736 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800737 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700738
Dave Wallaced85075e2018-03-02 13:19:30 -0500739 def test_vcl_thru_host_stack_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200740 """run VCL thru host stack bi-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500741
742 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200743 self.thru_host_stack_test(
744 "vcl_test_server",
745 self.server_args,
746 "vcl_test_client",
747 self.client_bi_dir_nsock_test_args,
748 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500749
750
Florin Corasdc2e2512018-12-03 17:47:26 -0800751class LDPThruHostStackBidirNsock(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200752 """LDP Thru Host Stack Bidir Nsock"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500753
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800754 @classmethod
755 def setUpClass(cls):
756 super(LDPThruHostStackBidirNsock, cls).setUpClass()
757
758 @classmethod
759 def tearDownClass(cls):
760 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
761
Dave Wallaced85075e2018-03-02 13:19:30 -0500762 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800763 super(LDPThruHostStackBidirNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500764
765 self.thru_host_stack_setup()
Dave Wallace3102c382020-04-03 19:48:48 -0400766 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200767 self.client_bi_dir_nsock_test_args = [
768 "-N",
769 "1000",
770 "-B",
771 "-X",
772 # OUCH! Host Stack Bug?
773 # Only fails when running
774 # 'make test TEST_JOBS=auto'
775 # or TEST_JOBS > 1
776 # "-I", "2",
777 self.loop0.local_ip4,
778 self.server_port,
779 ]
Dave Wallaced85075e2018-03-02 13:19:30 -0500780
781 def tearDown(self):
782 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800783 super(LDPThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500784
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700785 def show_commands_at_teardown(self):
786 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800787 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700788
Dave Wallaced85075e2018-03-02 13:19:30 -0500789 def test_ldp_thru_host_stack_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200790 """run LDP thru host stack bi-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500791
792 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200793 self.thru_host_stack_test(
794 "sock_test_server",
795 self.server_args,
796 "sock_test_client",
797 self.client_bi_dir_nsock_test_args,
798 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500799
800
Florin Corasdc2e2512018-12-03 17:47:26 -0800801class LDPThruHostStackNsock(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200802 """LDP Thru Host Stack Nsock"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500803
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800804 @classmethod
805 def setUpClass(cls):
806 super(LDPThruHostStackNsock, cls).setUpClass()
807
808 @classmethod
809 def tearDownClass(cls):
810 super(LDPThruHostStackNsock, cls).tearDownClass()
811
Dave Wallaced85075e2018-03-02 13:19:30 -0500812 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800813 super(LDPThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500814
815 self.thru_host_stack_setup()
816 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800817 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500818 self.numSockets = "2"
819 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800820 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500821 self.numSockets = "5"
822
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200823 self.client_uni_dir_nsock_test_args = [
824 "-N",
825 "1000",
826 "-U",
827 "-X",
828 "-I",
829 self.numSockets,
830 self.loop0.local_ip4,
831 self.server_port,
832 ]
Dave Wallaced85075e2018-03-02 13:19:30 -0500833
834 def tearDown(self):
835 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800836 super(LDPThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500837
Dave Wallaced85075e2018-03-02 13:19:30 -0500838 def test_ldp_thru_host_stack_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200839 """run LDP thru host stack uni-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500840
841 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200842 self.thru_host_stack_test(
843 "sock_test_server",
844 self.server_args,
845 "sock_test_client",
846 self.client_uni_dir_nsock_test_args,
847 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500848
849
Florin Corasdc2e2512018-12-03 17:47:26 -0800850class VCLThruHostStackNsock(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200851 """VCL Thru Host Stack Nsock"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500852
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800853 @classmethod
854 def setUpClass(cls):
855 super(VCLThruHostStackNsock, cls).setUpClass()
856
857 @classmethod
858 def tearDownClass(cls):
859 super(VCLThruHostStackNsock, cls).tearDownClass()
860
Dave Wallaced85075e2018-03-02 13:19:30 -0500861 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800862 super(VCLThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500863
864 self.thru_host_stack_setup()
865 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800866 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500867 self.numSockets = "2"
868 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800869 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500870 self.numSockets = "5"
871
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200872 self.client_uni_dir_nsock_test_args = [
873 "-N",
874 "1000",
875 "-U",
876 "-X",
877 "-I",
878 self.numSockets,
879 self.loop0.local_ip4,
880 self.server_port,
881 ]
Dave Wallaced85075e2018-03-02 13:19:30 -0500882
883 def tearDown(self):
884 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800885 super(VCLThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500886
Dave Wallaced85075e2018-03-02 13:19:30 -0500887 def test_vcl_thru_host_stack_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200888 """run VCL thru host stack uni-directional (multiple sockets) test"""
Dave Wallaced85075e2018-03-02 13:19:30 -0500889
890 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200891 self.thru_host_stack_test(
892 "vcl_test_server",
893 self.server_args,
894 "vcl_test_client",
895 self.client_uni_dir_nsock_test_args,
896 )
Dave Wallaced85075e2018-03-02 13:19:30 -0500897
898
Florin Corasdc2e2512018-12-03 17:47:26 -0800899class LDPThruHostStackIperf(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200900 """LDP Thru Host Stack Iperf"""
Dave Wallace816833f2018-03-14 20:01:28 -0400901
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800902 @classmethod
903 def setUpClass(cls):
904 super(LDPThruHostStackIperf, cls).setUpClass()
905
906 @classmethod
907 def tearDownClass(cls):
908 super(LDPThruHostStackIperf, cls).tearDownClass()
909
Dave Wallace816833f2018-03-14 20:01:28 -0400910 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800911 super(LDPThruHostStackIperf, self).setUp()
Dave Wallace816833f2018-03-14 20:01:28 -0400912
913 self.thru_host_stack_setup()
914 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700915 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
916 self.server_iperf3_args = ["-4", "-s"]
Dave Wallace816833f2018-03-14 20:01:28 -0400917
918 def tearDown(self):
919 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800920 super(LDPThruHostStackIperf, self).tearDown()
Dave Wallace816833f2018-03-14 20:01:28 -0400921
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700922 def show_commands_at_teardown(self):
923 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800924 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700925
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400926 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400927 def test_ldp_thru_host_stack_iperf3(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200928 """run LDP thru host stack iperf3 test"""
Dave Wallace816833f2018-03-14 20:01:28 -0400929
Dave Wallace816833f2018-03-14 20:01:28 -0400930 self.timeout = self.client_iperf3_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200931 self.thru_host_stack_test(
932 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
933 )
Dave Wallace816833f2018-03-14 20:01:28 -0400934
935
Florin Coras57a5a2d2020-04-01 23:16:11 +0000936class LDPThruHostStackIperfUdp(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200937 """LDP Thru Host Stack Iperf UDP"""
Florin Coras57a5a2d2020-04-01 23:16:11 +0000938
939 @classmethod
940 def setUpClass(cls):
941 super(LDPThruHostStackIperfUdp, cls).setUpClass()
942
943 @classmethod
944 def tearDownClass(cls):
945 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
946
947 def setUp(self):
948 super(LDPThruHostStackIperfUdp, self).setUp()
949
950 self.thru_host_stack_setup()
951 self.client_iperf3_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200952 self.client_iperf3_args = [
953 "-4",
954 "-t 2",
955 "-u",
956 "-l 1400",
957 "-c",
958 self.loop0.local_ip4,
959 ]
Florin Coras1d879142021-05-06 00:08:18 -0700960 self.server_iperf3_args = ["-4", "-s"]
Florin Coras57a5a2d2020-04-01 23:16:11 +0000961
962 def tearDown(self):
963 self.thru_host_stack_tear_down()
964 super(LDPThruHostStackIperfUdp, self).tearDown()
965
966 def show_commands_at_teardown(self):
967 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800968 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras57a5a2d2020-04-01 23:16:11 +0000969
970 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
971 def test_ldp_thru_host_stack_iperf3_udp(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200972 """run LDP thru host stack iperf3 UDP test"""
Florin Coras57a5a2d2020-04-01 23:16:11 +0000973
974 self.timeout = self.client_iperf3_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200975 self.thru_host_stack_test(
976 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
977 )
Florin Coras57a5a2d2020-04-01 23:16:11 +0000978
979
Florin Coras0ae445e2018-11-29 18:22:10 -0800980class LDPIpv6CutThruTestCase(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +0200981 """LDP IPv6 Cut Thru Tests"""
Dave Wallacede910062018-03-20 09:22:13 -0400982
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800983 @classmethod
984 def setUpClass(cls):
985 super(LDPIpv6CutThruTestCase, cls).setUpClass()
986
987 @classmethod
988 def tearDownClass(cls):
989 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
990
Florin Coras41d5f542021-01-15 13:49:33 -0800991 def show_commands_at_teardown(self):
992 self.logger.debug(self.vapi.cli("show session verbose 2"))
993 self.logger.debug(self.vapi.cli("show app mq"))
994
Dave Wallacede910062018-03-20 09:22:13 -0400995 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800996 super(LDPIpv6CutThruTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400997
998 self.cut_thru_setup()
999 self.client_iperf3_timeout = 20
Florin Coras2eb42e72018-11-29 00:39:53 -08001000 self.client_uni_dir_nsock_timeout = 20
1001 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001002 self.client_ipv6_echo_test_args = [
1003 "-6",
1004 "-E",
1005 self.echo_phrase,
1006 "-X",
1007 self.server_ipv6_addr,
1008 self.server_port,
1009 ]
1010 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c", self.server_ipv6_addr]
Florin Coras1d879142021-05-06 00:08:18 -07001011 self.server_ipv6_iperf3_args = ["-6", "-s"]
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001012 self.client_ipv6_uni_dir_nsock_test_args = [
1013 "-N",
1014 "1000",
1015 "-U",
1016 "-X",
1017 "-6",
1018 "-I",
1019 "2",
1020 self.server_ipv6_addr,
1021 self.server_port,
1022 ]
1023 self.client_ipv6_bi_dir_nsock_test_args = [
1024 "-N",
1025 "1000",
1026 "-B",
1027 "-X",
1028 "-6",
1029 "-I",
1030 "2",
1031 self.server_ipv6_addr,
1032 self.server_port,
1033 ]
Dave Wallacede910062018-03-20 09:22:13 -04001034
1035 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -08001036 super(LDPIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -04001037 self.cut_thru_tear_down()
Dave Wallacede910062018-03-20 09:22:13 -04001038
Klement Sekerab23ffd72021-05-31 16:08:53 +02001039 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -04001040 def test_ldp_ipv6_cut_thru_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001041 """run LDP IPv6 cut thru echo test"""
Dave Wallacede910062018-03-20 09:22:13 -04001042
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001043 self.cut_thru_test(
1044 "sock_test_server",
1045 self.server_ipv6_args,
1046 "sock_test_client",
1047 self.client_ipv6_echo_test_args,
1048 )
Dave Wallacede910062018-03-20 09:22:13 -04001049
Paul Vinciguerra063366e2019-06-30 15:38:55 -04001050 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallacede910062018-03-20 09:22:13 -04001051 def test_ldp_ipv6_cut_thru_iperf3(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001052 """run LDP IPv6 cut thru iperf3 test"""
Dave Wallacede910062018-03-20 09:22:13 -04001053
Dave Wallacede910062018-03-20 09:22:13 -04001054 self.timeout = self.client_iperf3_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001055 self.cut_thru_test(
1056 iperf3, self.server_ipv6_iperf3_args, iperf3, self.client_ipv6_iperf3_args
1057 )
Dave Wallacede910062018-03-20 09:22:13 -04001058
Klement Sekerab23ffd72021-05-31 16:08:53 +02001059 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -04001060 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001061 """run LDP IPv6 cut thru uni-directional (multiple sockets) test"""
Dave Wallacede910062018-03-20 09:22:13 -04001062
1063 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001064 self.cut_thru_test(
1065 "sock_test_server",
1066 self.server_ipv6_args,
1067 "sock_test_client",
1068 self.client_ipv6_uni_dir_nsock_test_args,
1069 )
Dave Wallacede910062018-03-20 09:22:13 -04001070
Klement Sekerab23ffd72021-05-31 16:08:53 +02001071 @unittest.skipUnless(config.extended, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -07001072 @unittest.skip("sock test apps need to be improved")
Dave Wallacede910062018-03-20 09:22:13 -04001073 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001074 """run LDP IPv6 cut thru bi-directional (multiple sockets) test"""
Dave Wallacede910062018-03-20 09:22:13 -04001075
1076 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001077 self.cut_thru_test(
1078 "sock_test_server",
1079 self.server_ipv6_args,
1080 "sock_test_client",
1081 self.client_ipv6_bi_dir_nsock_test_args,
1082 )
Dave Wallacede910062018-03-20 09:22:13 -04001083
Florin Coras0ae445e2018-11-29 18:22:10 -08001084
1085class VCLIpv6CutThruTestCase(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001086 """VCL IPv6 Cut Thru Tests"""
Florin Coras0ae445e2018-11-29 18:22:10 -08001087
Paul Vinciguerra8d991d92019-01-25 14:05:48 -08001088 @classmethod
1089 def setUpClass(cls):
1090 super(VCLIpv6CutThruTestCase, cls).setUpClass()
1091
1092 @classmethod
1093 def tearDownClass(cls):
1094 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
1095
Florin Coras41d5f542021-01-15 13:49:33 -08001096 def show_commands_at_teardown(self):
1097 self.logger.debug(self.vapi.cli("show session verbose 2"))
1098 self.logger.debug(self.vapi.cli("show app mq"))
1099
Florin Coras0ae445e2018-11-29 18:22:10 -08001100 def setUp(self):
1101 super(VCLIpv6CutThruTestCase, self).setUp()
1102
1103 self.cut_thru_setup()
1104 self.client_uni_dir_nsock_timeout = 20
1105 self.client_bi_dir_nsock_timeout = 20
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001106 self.client_ipv6_echo_test_args = [
1107 "-6",
1108 "-E",
1109 self.echo_phrase,
1110 "-X",
1111 self.server_ipv6_addr,
1112 self.server_port,
1113 ]
1114 self.client_ipv6_uni_dir_nsock_test_args = [
1115 "-N",
1116 "1000",
1117 "-U",
1118 "-X",
1119 "-6",
1120 "-I",
1121 "2",
1122 self.server_ipv6_addr,
1123 self.server_port,
1124 ]
1125 self.client_ipv6_bi_dir_nsock_test_args = [
1126 "-N",
1127 "1000",
1128 "-B",
1129 "-X",
1130 "-6",
1131 "-I",
1132 "2",
1133 self.server_ipv6_addr,
1134 self.server_port,
1135 ]
Florin Coras0ae445e2018-11-29 18:22:10 -08001136
1137 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -08001138 super(VCLIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -04001139 self.cut_thru_tear_down()
Florin Coras0ae445e2018-11-29 18:22:10 -08001140
Florin Coras41d5f542021-01-15 13:49:33 -08001141 def show_commands_at_teardown(self):
1142 self.logger.debug(self.vapi.cli("show session verbose 2"))
1143 self.logger.debug(self.vapi.cli("show app mq"))
1144
Dave Wallacede910062018-03-20 09:22:13 -04001145 def test_vcl_ipv6_cut_thru_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001146 """run VCL IPv6 cut thru echo test"""
Dave Wallacede910062018-03-20 09:22:13 -04001147
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001148 self.cut_thru_test(
1149 "vcl_test_server",
1150 self.server_ipv6_args,
1151 "vcl_test_client",
1152 self.client_ipv6_echo_test_args,
1153 )
Dave Wallacede910062018-03-20 09:22:13 -04001154
Klement Sekerab23ffd72021-05-31 16:08:53 +02001155 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -04001156 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001157 """run VCL IPv6 cut thru uni-directional (multiple sockets) test"""
Dave Wallacede910062018-03-20 09:22:13 -04001158
1159 self.timeout = self.client_uni_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001160 self.cut_thru_test(
1161 "vcl_test_server",
1162 self.server_ipv6_args,
1163 "vcl_test_client",
1164 self.client_ipv6_uni_dir_nsock_test_args,
1165 )
Dave Wallacede910062018-03-20 09:22:13 -04001166
Klement Sekerab23ffd72021-05-31 16:08:53 +02001167 @unittest.skipUnless(config.extended, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -04001168 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001169 """run VCL IPv6 cut thru bi-directional (multiple sockets) test"""
Dave Wallacede910062018-03-20 09:22:13 -04001170
1171 self.timeout = self.client_bi_dir_nsock_timeout
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001172 self.cut_thru_test(
1173 "vcl_test_server",
1174 self.server_ipv6_args,
1175 "vcl_test_client",
1176 self.client_ipv6_bi_dir_nsock_test_args,
1177 )
Dave Wallacede910062018-03-20 09:22:13 -04001178
1179
Florin Corasdc2e2512018-12-03 17:47:26 -08001180class VCLIpv6ThruHostStackEcho(VCLTestCase):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001181 """VCL IPv6 Thru Host Stack Echo"""
Dave Wallacede910062018-03-20 09:22:13 -04001182
Paul Vinciguerra8d991d92019-01-25 14:05:48 -08001183 @classmethod
1184 def setUpClass(cls):
1185 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
1186
1187 @classmethod
1188 def tearDownClass(cls):
1189 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
1190
Dave Wallacede910062018-03-20 09:22:13 -04001191 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -08001192 super(VCLIpv6ThruHostStackEcho, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -04001193
1194 self.thru_host_stack_ipv6_setup()
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001195 self.client_ipv6_echo_test_args = [
1196 "-6",
1197 "-E",
1198 self.echo_phrase,
1199 "-X",
1200 self.loop0.local_ip6,
1201 self.server_port,
1202 ]
Dave Wallacede910062018-03-20 09:22:13 -04001203
1204 def tearDown(self):
1205 self.thru_host_stack_ipv6_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -08001206 super(VCLIpv6ThruHostStackEcho, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -04001207
1208 def test_vcl_ipv6_thru_host_stack_echo(self):
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001209 """run VCL IPv6 thru host stack echo test"""
Dave Wallacede910062018-03-20 09:22:13 -04001210
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001211 self.thru_host_stack_test(
1212 "vcl_test_server",
1213 self.server_ipv6_args,
1214 "vcl_test_client",
1215 self.client_ipv6_echo_test_args,
1216 )
Dave Wallacede910062018-03-20 09:22:13 -04001217
1218
Klement Sekerad9b0c6f2022-04-26 19:02:15 +02001219if __name__ == "__main__":
Dave Wallacecfcf2f42018-02-16 18:31:56 -05001220 unittest.main(testRunner=VppTestRunner)