blob: 7977c1d4e778badee44c1a676f6409c583d6872a [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
Dave Wallaced85075e2018-03-02 13:19:30 -05008from framework import VppTestCase, VppTestRunner, running_extended_tests, \
9 Worker
Neale Ranns097fa662018-05-01 05:17:55 -070010from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto
Dave Wallacecfcf2f42018-02-16 18:31:56 -050011
Paul Vinciguerra063366e2019-06-30 15:38:55 -040012iperf3 = '/usr/bin/iperf3'
13
14
15def have_app(app):
16 try:
17 subprocess.check_output([app, '-v'])
18 except (subprocess.CalledProcessError, OSError):
19 return False
20 return True
21
22
23_have_iperf3 = have_app(iperf3)
Paul Vinciguerra063366e2019-06-30 15:38:55 -040024
Dave Wallacecfcf2f42018-02-16 18:31:56 -050025
Dave Wallace816833f2018-03-14 20:01:28 -040026class VCLAppWorker(Worker):
Dave Wallace42996c02018-02-26 14:40:13 -050027 """ VCL Test Application Worker """
28
Paul Vinciguerra48bdbcd2019-12-04 19:43:53 -050029 def __init__(self, build_dir, appname, executable_args, logger, env=None,
30 *args, **kwargs):
31
32 if env is None:
33 env = {}
Damjan Marion855e2682018-08-24 13:37:45 +020034 vcl_lib_dir = "%s/vpp/lib" % build_dir
Dave Wallace816833f2018-03-14 20:01:28 -040035 if "iperf" in appname:
36 app = appname
Dave Wallace9f11c012018-02-28 17:55:23 -050037 env.update({'LD_PRELOAD':
Damjan Marion855e2682018-08-24 13:37:45 +020038 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
Florin Corasab2f6db2018-08-31 14:31:41 -070039 elif "sock" in appname:
40 app = "%s/vpp/bin/%s" % (build_dir, appname)
41 env.update({'LD_PRELOAD':
42 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
Dave Wallace816833f2018-03-14 20:01:28 -040043 else:
Florin Corasab2f6db2018-08-31 14:31:41 -070044 app = "%s/vpp/bin/%s" % (build_dir, appname)
Paul Vinciguerra48bdbcd2019-12-04 19:43:53 -050045 self.args = [app] + executable_args
46 super(VCLAppWorker, self).__init__(self.args, logger, env,
47 *args, **kwargs)
Dave Wallace42996c02018-02-26 14:40:13 -050048
49
Dave Wallace816833f2018-03-14 20:01:28 -040050class VCLTestCase(VppTestCase):
Dave Wallace42996c02018-02-26 14:40:13 -050051 """ VCL Test Class """
Florin Corase92c9462020-11-25 08:44:16 -080052 extra_vpp_punt_config = ["session", "{", "poll-main", "}"]
Dave Wallace42996c02018-02-26 14:40:13 -050053
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080054 @classmethod
55 def setUpClass(cls):
56 super(VCLTestCase, cls).setUpClass()
57
58 @classmethod
59 def tearDownClass(cls):
60 super(VCLTestCase, cls).tearDownClass()
61
62 def setUp(self):
Klement Sekerab8c72a42018-11-08 11:21:39 +010063 var = "VPP_BUILD_DIR"
Dave Wallaced85075e2018-03-02 13:19:30 -050064 self.build_dir = os.getenv(var, None)
65 if self.build_dir is None:
Paul Vinciguerra063366e2019-06-30 15:38:55 -040066 raise EnvironmentError("Environment variable `%s' not set" % var)
Dave Wallaced85075e2018-03-02 13:19:30 -050067 self.vppDebug = 'vpp_debug' in self.build_dir
Dave Wallace9f11c012018-02-28 17:55:23 -050068 self.server_addr = "127.0.0.1"
69 self.server_port = "22000"
Dave Wallace816833f2018-03-14 20:01:28 -040070 self.server_args = [self.server_port]
Dave Wallacede910062018-03-20 09:22:13 -040071 self.server_ipv6_addr = "::1"
72 self.server_ipv6_args = ["-6", self.server_port]
Florin Corasdc2e2512018-12-03 17:47:26 -080073 self.timeout = 20
Dave Wallace9f11c012018-02-28 17:55:23 -050074 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
Florin Corasdc2e2512018-12-03 17:47:26 -080075 self.pre_test_sleep = 0.3
76 self.post_test_sleep = 0.2
77
78 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
79 os.remove("/tmp/ldp_server_af_unix_socket")
Dave Wallace42996c02018-02-26 14:40:13 -050080
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080081 super(VCLTestCase, self).setUp()
Dave Wallace42996c02018-02-26 14:40:13 -050082
Dave Wallace9f11c012018-02-28 17:55:23 -050083 def cut_thru_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +010084 self.vapi.session_enable_disable(is_enable=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -050085
Dave Wallace9f11c012018-02-28 17:55:23 -050086 def cut_thru_tear_down(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +010087 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacea67a03e2018-02-20 12:39:37 -050088
Dave Wallace816833f2018-03-14 20:01:28 -040089 def cut_thru_test(self, server_app, server_args, client_app, client_args):
Klement Sekerae2636852021-03-16 12:52:12 +010090 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
Dave Wallace42996c02018-02-26 14:40:13 -050091 'VCL_APP_SCOPE_LOCAL': "true"}
Dave Wallace816833f2018-03-14 20:01:28 -040092 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Dave Wallace42996c02018-02-26 14:40:13 -050093 self.logger, self.env)
Dave Wallacecfcf2f42018-02-16 18:31:56 -050094 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -080095 self.sleep(self.pre_test_sleep)
Dave Wallace816833f2018-03-14 20:01:28 -040096 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Dave Wallace42996c02018-02-26 14:40:13 -050097 self.logger, self.env)
Dave Wallacecfcf2f42018-02-16 18:31:56 -050098 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -050099 worker_client.join(self.timeout)
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500100 try:
101 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200102 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500103 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800104 self.sleep(self.post_test_sleep)
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500105
Dave Wallace9f11c012018-02-28 17:55:23 -0500106 def thru_host_stack_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100107 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200108 self.create_loopback_interfaces(2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500109
Florin Coras56b39f62018-03-27 17:29:32 -0700110 table_id = 1
Dave Wallacea67a03e2018-02-20 12:39:37 -0500111
112 for i in self.lo_interfaces:
113 i.admin_up()
114
115 if table_id != 0:
116 tbl = VppIpTable(self, table_id)
117 tbl.add_vpp_config()
118
119 i.set_table_ip4(table_id)
120 i.config_ip4()
121 table_id += 1
122
123 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100124 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100125 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100126 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100127 sw_if_index=self.loop1.sw_if_index)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500128
Dave Wallacea67a03e2018-02-20 12:39:37 -0500129 # Add inter-table routes
130 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
131 [VppRoutePath("0.0.0.0",
132 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700133 nh_table_id=2)], table_id=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500134 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
135 [VppRoutePath("0.0.0.0",
136 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700137 nh_table_id=1)], table_id=2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500138 ip_t01.add_vpp_config()
139 ip_t10.add_vpp_config()
Florin Coras56b39f62018-03-27 17:29:32 -0700140 self.logger.debug(self.vapi.cli("show ip fib"))
Dave Wallacea67a03e2018-02-20 12:39:37 -0500141
Dave Wallace9f11c012018-02-28 17:55:23 -0500142 def thru_host_stack_tear_down(self):
143 for i in self.lo_interfaces:
144 i.unconfig_ip4()
145 i.set_table_ip4(0)
146 i.admin_down()
147
Dave Wallacede910062018-03-20 09:22:13 -0400148 def thru_host_stack_ipv6_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100149 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200150 self.create_loopback_interfaces(2)
Dave Wallacede910062018-03-20 09:22:13 -0400151
152 table_id = 1
153
154 for i in self.lo_interfaces:
155 i.admin_up()
156
157 tbl = VppIpTable(self, table_id, is_ip6=1)
158 tbl.add_vpp_config()
159
160 i.set_table_ip6(table_id)
161 i.config_ip6()
162 table_id += 1
163
164 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100165 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100166 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100167 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100168 sw_if_index=self.loop1.sw_if_index)
Dave Wallacede910062018-03-20 09:22:13 -0400169
170 # Add inter-table routes
171 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700172 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700173 nh_table_id=2)],
174 table_id=1)
Dave Wallacede910062018-03-20 09:22:13 -0400175 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700176 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700177 nh_table_id=1)],
178 table_id=2)
Dave Wallacede910062018-03-20 09:22:13 -0400179 ip_t01.add_vpp_config()
180 ip_t10.add_vpp_config()
181 self.logger.debug(self.vapi.cli("show interface addr"))
182 self.logger.debug(self.vapi.cli("show ip6 fib"))
183
184 def thru_host_stack_ipv6_tear_down(self):
185 for i in self.lo_interfaces:
186 i.unconfig_ip6()
187 i.set_table_ip6(0)
188 i.admin_down()
189
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100190 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacede910062018-03-20 09:22:13 -0400191
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400192 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400193 def thru_host_stack_test(self, server_app, server_args,
194 client_app, client_args):
Klement Sekerae2636852021-03-16 12:52:12 +0100195 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
Dave Wallace9f11c012018-02-28 17:55:23 -0500196 'VCL_APP_SCOPE_GLOBAL': "true",
Florin Coras56b39f62018-03-27 17:29:32 -0700197 'VCL_APP_NAMESPACE_ID': "1",
Dave Wallace9f11c012018-02-28 17:55:23 -0500198 'VCL_APP_NAMESPACE_SECRET': "1234"}
199
Dave Wallace816833f2018-03-14 20:01:28 -0400200 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Dave Wallace42996c02018-02-26 14:40:13 -0500201 self.logger, self.env)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500202 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800203 self.sleep(self.pre_test_sleep)
Dave Wallace42996c02018-02-26 14:40:13 -0500204
Florin Coras56b39f62018-03-27 17:29:32 -0700205 self.env.update({'VCL_APP_NAMESPACE_ID': "2",
Dave Wallace42996c02018-02-26 14:40:13 -0500206 'VCL_APP_NAMESPACE_SECRET': "5678"})
Dave Wallace816833f2018-03-14 20:01:28 -0400207 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Dave Wallace42996c02018-02-26 14:40:13 -0500208 self.logger, self.env)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500209 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500210 worker_client.join(self.timeout)
211
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500212 try:
213 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200214 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500215 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800216 self.sleep(self.post_test_sleep)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500217
Dave Wallace9f11c012018-02-28 17:55:23 -0500218 def validateResults(self, worker_client, worker_server, timeout):
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400219 if worker_server.process is None:
220 raise RuntimeError('worker_server is not running.')
Dave Wallaced85075e2018-03-02 13:19:30 -0500221 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
222 self.logger.info("Killing server worker process (pid %d)" %
223 worker_server.process.pid)
Dave Barachad646872019-05-06 10:49:41 -0400224 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
Dave Wallaced85075e2018-03-02 13:19:30 -0500225 worker_server.join()
Dave Wallace9f11c012018-02-28 17:55:23 -0500226 self.logger.info("Client worker result is `%s'" % worker_client.result)
227 error = False
228 if worker_client.result is None:
229 try:
230 error = True
231 self.logger.error(
Dave Wallaced85075e2018-03-02 13:19:30 -0500232 "Timeout: %ss! Killing client worker process (pid %d)" %
233 (timeout, worker_client.process.pid))
Dave Wallace9f11c012018-02-28 17:55:23 -0500234 os.killpg(os.getpgid(worker_client.process.pid),
Florin Corasdc2e2512018-12-03 17:47:26 -0800235 signal.SIGKILL)
Dave Wallace9f11c012018-02-28 17:55:23 -0500236 worker_client.join()
Dave Wallace07c0a9d2019-05-13 19:21:24 -0400237 except OSError:
Dave Wallace9f11c012018-02-28 17:55:23 -0500238 self.logger.debug(
239 "Couldn't kill client worker process")
240 raise
241 if error:
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400242 raise RuntimeError(
Dave Wallace9f11c012018-02-28 17:55:23 -0500243 "Timeout! Client worker did not finish in %ss" % timeout)
244 self.assert_equal(worker_client.result, 0, "Binary test return code")
245
246
Florin Coras0ae445e2018-11-29 18:22:10 -0800247class LDPCutThruTestCase(VCLTestCase):
248 """ LDP Cut Thru Tests """
Dave Wallace9f11c012018-02-28 17:55:23 -0500249
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800250 @classmethod
251 def setUpClass(cls):
252 super(LDPCutThruTestCase, cls).setUpClass()
253
254 @classmethod
255 def tearDownClass(cls):
256 super(LDPCutThruTestCase, cls).tearDownClass()
257
Dave Wallace9f11c012018-02-28 17:55:23 -0500258 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800259 super(LDPCutThruTestCase, self).setUp()
Dave Wallace9f11c012018-02-28 17:55:23 -0500260
261 self.cut_thru_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400262 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
263 self.server_addr, self.server_port]
Dave Wallace816833f2018-03-14 20:01:28 -0400264 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700265 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
266 self.server_iperf3_args = ["-4", "-s"]
Florin Coras2eb42e72018-11-29 00:39:53 -0800267 self.client_uni_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400268 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
269 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400270 self.server_addr,
271 self.server_port]
Florin Coras2eb42e72018-11-29 00:39:53 -0800272 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400273 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
274 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400275 self.server_addr,
276 self.server_port]
Dave Wallace9f11c012018-02-28 17:55:23 -0500277
278 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800279 super(LDPCutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400280 self.cut_thru_tear_down()
Dave Wallace9f11c012018-02-28 17:55:23 -0500281
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700282 def show_commands_at_teardown(self):
283 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800284 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700285
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800286 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallace9f11c012018-02-28 17:55:23 -0500287 def test_ldp_cut_thru_echo(self):
288 """ run LDP cut thru echo test """
289
Florin Corasab2f6db2018-08-31 14:31:41 -0700290 self.cut_thru_test("sock_test_server", self.server_args,
291 "sock_test_client", self.client_echo_test_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400292
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400293 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400294 def test_ldp_cut_thru_iperf3(self):
295 """ run LDP cut thru iperf3 test """
296
Dave Wallace816833f2018-03-14 20:01:28 -0400297 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400298 self.cut_thru_test(iperf3, self.server_iperf3_args,
299 iperf3, self.client_iperf3_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500300
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800301 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallaced85075e2018-03-02 13:19:30 -0500302 def test_ldp_cut_thru_uni_dir_nsock(self):
303 """ run LDP cut thru uni-directional (multiple sockets) test """
304
305 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700306 self.cut_thru_test("sock_test_server", self.server_args,
307 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500308 self.client_uni_dir_nsock_test_args)
309
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800310 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700311 @unittest.skip("sock test apps need to be improved")
Dave Wallaced85075e2018-03-02 13:19:30 -0500312 def test_ldp_cut_thru_bi_dir_nsock(self):
313 """ run LDP cut thru bi-directional (multiple sockets) test """
314
315 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700316 self.cut_thru_test("sock_test_server", self.server_args,
317 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500318 self.client_bi_dir_nsock_test_args)
319
Florin Coras0ae445e2018-11-29 18:22:10 -0800320
321class VCLCutThruTestCase(VCLTestCase):
322 """ VCL Cut Thru Tests """
323
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800324 @classmethod
325 def setUpClass(cls):
326 super(VCLCutThruTestCase, cls).setUpClass()
327
328 @classmethod
329 def tearDownClass(cls):
330 super(VCLCutThruTestCase, cls).tearDownClass()
331
Florin Coras0ae445e2018-11-29 18:22:10 -0800332 def setUp(self):
333 super(VCLCutThruTestCase, self).setUp()
334
335 self.cut_thru_setup()
336 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
337 self.server_addr, self.server_port]
338
339 self.client_uni_dir_nsock_timeout = 20
340 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
341 "-I", "2",
342 self.server_addr,
343 self.server_port]
344 self.client_bi_dir_nsock_timeout = 20
345 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
346 "-I", "2",
347 self.server_addr,
348 self.server_port]
349
350 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800351 super(VCLCutThruTestCase, self).tearDown()
352
Florin Coras317b8e02019-04-17 09:57:46 -0700353 def show_commands_at_teardown(self):
354 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800355 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras317b8e02019-04-17 09:57:46 -0700356
Dave Wallace9f11c012018-02-28 17:55:23 -0500357 def test_vcl_cut_thru_echo(self):
358 """ run VCL cut thru echo test """
359
Florin Corasab2f6db2018-08-31 14:31:41 -0700360 self.cut_thru_test("vcl_test_server", self.server_args,
361 "vcl_test_client", self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500362
Dave Wallaced85075e2018-03-02 13:19:30 -0500363 def test_vcl_cut_thru_uni_dir_nsock(self):
364 """ run VCL cut thru uni-directional (multiple sockets) test """
365
366 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700367 self.cut_thru_test("vcl_test_server", self.server_args,
368 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500369 self.client_uni_dir_nsock_test_args)
370
Dave Wallaced85075e2018-03-02 13:19:30 -0500371 def test_vcl_cut_thru_bi_dir_nsock(self):
372 """ run VCL cut thru bi-directional (multiple sockets) test """
373
374 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700375 self.cut_thru_test("vcl_test_server", self.server_args,
376 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500377 self.client_bi_dir_nsock_test_args)
378
Dave Wallace9f11c012018-02-28 17:55:23 -0500379
Florin Corasdc2e2512018-12-03 17:47:26 -0800380class VCLThruHostStackEcho(VCLTestCase):
381 """ VCL Thru Host Stack Echo """
Dave Wallaced85075e2018-03-02 13:19:30 -0500382
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800383 @classmethod
384 def setUpClass(cls):
385 super(VCLThruHostStackEcho, cls).setUpClass()
386
387 @classmethod
388 def tearDownClass(cls):
389 super(VCLThruHostStackEcho, cls).tearDownClass()
390
Dave Wallaced85075e2018-03-02 13:19:30 -0500391 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800392 super(VCLThruHostStackEcho, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500393
394 self.thru_host_stack_setup()
Florin Corasdc2e2512018-12-03 17:47:26 -0800395 self.client_bi_dir_nsock_timeout = 20
396 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
397 "-I", "2",
398 self.loop0.local_ip4,
399 self.server_port]
400 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
401 self.loop0.local_ip4,
402 self.server_port]
403
404 def tearDown(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800405 self.thru_host_stack_tear_down()
406 super(VCLThruHostStackEcho, self).tearDown()
407
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700408 def show_commands_at_teardown(self):
409 self.logger.debug(self.vapi.cli("show app server"))
410 self.logger.debug(self.vapi.cli("show session verbose"))
Florin Coras41d5f542021-01-15 13:49:33 -0800411 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700412
Florin Corasdc2e2512018-12-03 17:47:26 -0800413
Florin Coras8a140612019-02-18 22:39:39 -0800414class VCLThruHostStackTLS(VCLTestCase):
415 """ VCL Thru Host Stack TLS """
416
417 @classmethod
418 def setUpClass(cls):
419 super(VCLThruHostStackTLS, cls).setUpClass()
420
421 @classmethod
422 def tearDownClass(cls):
423 super(VCLThruHostStackTLS, cls).tearDownClass()
424
425 def setUp(self):
426 super(VCLThruHostStackTLS, self).setUp()
427
428 self.thru_host_stack_setup()
429 self.client_uni_dir_tls_timeout = 20
Dave Wallace03dd90a2019-03-25 19:34:50 -0400430 self.server_tls_args = ["-L", self.server_port]
431 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
Florin Coras8a140612019-02-18 22:39:39 -0800432 self.loop0.local_ip4,
433 self.server_port]
434
435 def test_vcl_thru_host_stack_tls_uni_dir(self):
436 """ run VCL thru host stack uni-directional TLS test """
437
438 self.timeout = self.client_uni_dir_tls_timeout
439 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
440 "vcl_test_client",
441 self.client_uni_dir_tls_test_args)
442
443 def tearDown(self):
Florin Coras8a140612019-02-18 22:39:39 -0800444 self.thru_host_stack_tear_down()
445 super(VCLThruHostStackTLS, self).tearDown()
446
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700447 def show_commands_at_teardown(self):
448 self.logger.debug(self.vapi.cli("show app server"))
449 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800450 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700451
Florin Coras8a140612019-02-18 22:39:39 -0800452
Florin Corascec1b272021-05-06 12:46:04 -0700453class VCLThruHostStackDTLS(VCLTestCase):
454 """ VCL Thru Host Stack DTLS """
455
456 @classmethod
457 def setUpClass(cls):
458 super(VCLThruHostStackDTLS, cls).setUpClass()
459
460 @classmethod
461 def tearDownClass(cls):
462 super(VCLThruHostStackDTLS, cls).tearDownClass()
463
464 def setUp(self):
465 super(VCLThruHostStackDTLS, self).setUp()
466
467 self.thru_host_stack_setup()
468 self.client_uni_dir_dtls_timeout = 20
Florin Corasfb50bc32021-05-18 00:28:59 -0700469 self.server_dtls_args = ["-p", "dtls", self.server_port]
Florin Corascec1b272021-05-06 12:46:04 -0700470 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
Florin Corasfb50bc32021-05-18 00:28:59 -0700471 "-p", "dtls", "-T 1400",
Florin Corascec1b272021-05-06 12:46:04 -0700472 self.loop0.local_ip4,
473 self.server_port]
474
475 def test_vcl_thru_host_stack_dtls_uni_dir(self):
476 """ run VCL thru host stack uni-directional DTLS test """
477
478 self.timeout = self.client_uni_dir_dtls_timeout
479 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
480 "vcl_test_client",
481 self.client_uni_dir_dtls_test_args)
482
483 def tearDown(self):
484 self.thru_host_stack_tear_down()
485 super(VCLThruHostStackDTLS, self).tearDown()
486
487 def show_commands_at_teardown(self):
488 self.logger.debug(self.vapi.cli("show app server"))
489 self.logger.debug(self.vapi.cli("show session verbose 2"))
490 self.logger.debug(self.vapi.cli("show app mq"))
491
492
Florin Corasdc2e2512018-12-03 17:47:26 -0800493class VCLThruHostStackBidirNsock(VCLTestCase):
494 """ VCL Thru Host Stack Bidir Nsock """
495
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800496 @classmethod
497 def setUpClass(cls):
498 super(VCLThruHostStackBidirNsock, cls).setUpClass()
499
500 @classmethod
501 def tearDownClass(cls):
502 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
503
Florin Corasdc2e2512018-12-03 17:47:26 -0800504 def setUp(self):
505 super(VCLThruHostStackBidirNsock, self).setUp()
506
507 self.thru_host_stack_setup()
508 self.client_bi_dir_nsock_timeout = 20
509 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
510 "-I", "2",
511 self.loop0.local_ip4,
512 self.server_port]
513 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
514 self.loop0.local_ip4,
515 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500516
517 def tearDown(self):
518 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800519 super(VCLThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500520
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700521 def show_commands_at_teardown(self):
522 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800523 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700524
Dave Wallaced85075e2018-03-02 13:19:30 -0500525 def test_vcl_thru_host_stack_bi_dir_nsock(self):
526 """ run VCL thru host stack bi-directional (multiple sockets) test """
527
528 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700529 self.thru_host_stack_test("vcl_test_server", self.server_args,
530 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500531 self.client_bi_dir_nsock_test_args)
532
533
Florin Corasdc2e2512018-12-03 17:47:26 -0800534class LDPThruHostStackBidirNsock(VCLTestCase):
535 """ LDP Thru Host Stack Bidir Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500536
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800537 @classmethod
538 def setUpClass(cls):
539 super(LDPThruHostStackBidirNsock, cls).setUpClass()
540
541 @classmethod
542 def tearDownClass(cls):
543 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
544
Dave Wallaced85075e2018-03-02 13:19:30 -0500545 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800546 super(LDPThruHostStackBidirNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500547
548 self.thru_host_stack_setup()
Dave Wallace3102c382020-04-03 19:48:48 -0400549 self.client_bi_dir_nsock_timeout = 20
550 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
551 # OUCH! Host Stack Bug?
552 # Only fails when running
553 # 'make test TEST_JOBS=auto'
554 # or TEST_JOBS > 1
555 # "-I", "2",
556 self.loop0.local_ip4,
557 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500558
559 def tearDown(self):
560 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800561 super(LDPThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500562
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700563 def show_commands_at_teardown(self):
564 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800565 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700566
Dave Wallaced85075e2018-03-02 13:19:30 -0500567 def test_ldp_thru_host_stack_bi_dir_nsock(self):
568 """ run LDP thru host stack bi-directional (multiple sockets) test """
569
570 self.timeout = self.client_bi_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400571 self.thru_host_stack_test("sock_test_server", self.server_args,
572 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500573 self.client_bi_dir_nsock_test_args)
574
575
Florin Corasdc2e2512018-12-03 17:47:26 -0800576class LDPThruHostStackNsock(VCLTestCase):
577 """ LDP Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500578
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800579 @classmethod
580 def setUpClass(cls):
581 super(LDPThruHostStackNsock, cls).setUpClass()
582
583 @classmethod
584 def tearDownClass(cls):
585 super(LDPThruHostStackNsock, cls).tearDownClass()
586
Dave Wallaced85075e2018-03-02 13:19:30 -0500587 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800588 super(LDPThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500589
590 self.thru_host_stack_setup()
591 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800592 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500593 self.numSockets = "2"
594 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800595 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500596 self.numSockets = "5"
597
Dave Wallace45cd3a32018-06-26 01:14:04 -0400598 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
599 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400600 self.loop0.local_ip4,
601 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500602
603 def tearDown(self):
604 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800605 super(LDPThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500606
Dave Wallaced85075e2018-03-02 13:19:30 -0500607 def test_ldp_thru_host_stack_uni_dir_nsock(self):
608 """ run LDP thru host stack uni-directional (multiple sockets) test """
609
610 self.timeout = self.client_uni_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400611 self.thru_host_stack_test("sock_test_server", self.server_args,
612 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500613 self.client_uni_dir_nsock_test_args)
614
615
Florin Corasdc2e2512018-12-03 17:47:26 -0800616class VCLThruHostStackNsock(VCLTestCase):
617 """ VCL Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500618
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800619 @classmethod
620 def setUpClass(cls):
621 super(VCLThruHostStackNsock, cls).setUpClass()
622
623 @classmethod
624 def tearDownClass(cls):
625 super(VCLThruHostStackNsock, cls).tearDownClass()
626
Dave Wallaced85075e2018-03-02 13:19:30 -0500627 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800628 super(VCLThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500629
630 self.thru_host_stack_setup()
631 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800632 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500633 self.numSockets = "2"
634 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800635 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500636 self.numSockets = "5"
637
Dave Wallace45cd3a32018-06-26 01:14:04 -0400638 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
639 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400640 self.loop0.local_ip4,
641 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500642
643 def tearDown(self):
644 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800645 super(VCLThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500646
Dave Wallaced85075e2018-03-02 13:19:30 -0500647 def test_vcl_thru_host_stack_uni_dir_nsock(self):
648 """ run VCL thru host stack uni-directional (multiple sockets) test """
649
650 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700651 self.thru_host_stack_test("vcl_test_server", self.server_args,
652 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500653 self.client_uni_dir_nsock_test_args)
654
655
Florin Corasdc2e2512018-12-03 17:47:26 -0800656class LDPThruHostStackIperf(VCLTestCase):
657 """ LDP Thru Host Stack Iperf """
Dave Wallace816833f2018-03-14 20:01:28 -0400658
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800659 @classmethod
660 def setUpClass(cls):
661 super(LDPThruHostStackIperf, cls).setUpClass()
662
663 @classmethod
664 def tearDownClass(cls):
665 super(LDPThruHostStackIperf, cls).tearDownClass()
666
Dave Wallace816833f2018-03-14 20:01:28 -0400667 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800668 super(LDPThruHostStackIperf, self).setUp()
Dave Wallace816833f2018-03-14 20:01:28 -0400669
670 self.thru_host_stack_setup()
671 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700672 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
673 self.server_iperf3_args = ["-4", "-s"]
Dave Wallace816833f2018-03-14 20:01:28 -0400674
675 def tearDown(self):
676 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800677 super(LDPThruHostStackIperf, self).tearDown()
Dave Wallace816833f2018-03-14 20:01:28 -0400678
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700679 def show_commands_at_teardown(self):
680 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800681 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700682
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400683 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400684 def test_ldp_thru_host_stack_iperf3(self):
685 """ run LDP thru host stack iperf3 test """
686
Dave Wallace816833f2018-03-14 20:01:28 -0400687 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400688 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
689 iperf3, self.client_iperf3_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400690
691
Florin Coras57a5a2d2020-04-01 23:16:11 +0000692class LDPThruHostStackIperfUdp(VCLTestCase):
693 """ LDP Thru Host Stack Iperf UDP """
694
695 @classmethod
696 def setUpClass(cls):
697 super(LDPThruHostStackIperfUdp, cls).setUpClass()
698
699 @classmethod
700 def tearDownClass(cls):
701 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
702
703 def setUp(self):
704 super(LDPThruHostStackIperfUdp, self).setUp()
705
706 self.thru_host_stack_setup()
707 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700708 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
Florin Coras57a5a2d2020-04-01 23:16:11 +0000709 "-c", self.loop0.local_ip4]
Florin Coras1d879142021-05-06 00:08:18 -0700710 self.server_iperf3_args = ["-4", "-s"]
Florin Coras57a5a2d2020-04-01 23:16:11 +0000711
712 def tearDown(self):
713 self.thru_host_stack_tear_down()
714 super(LDPThruHostStackIperfUdp, self).tearDown()
715
716 def show_commands_at_teardown(self):
717 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800718 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras57a5a2d2020-04-01 23:16:11 +0000719
720 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
721 def test_ldp_thru_host_stack_iperf3_udp(self):
722 """ run LDP thru host stack iperf3 UDP test """
723
724 self.timeout = self.client_iperf3_timeout
725 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
726 iperf3, self.client_iperf3_args)
727
728
Florin Coras0ae445e2018-11-29 18:22:10 -0800729class LDPIpv6CutThruTestCase(VCLTestCase):
730 """ LDP IPv6 Cut Thru Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400731
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800732 @classmethod
733 def setUpClass(cls):
734 super(LDPIpv6CutThruTestCase, cls).setUpClass()
735
736 @classmethod
737 def tearDownClass(cls):
738 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
739
Florin Coras41d5f542021-01-15 13:49:33 -0800740 def show_commands_at_teardown(self):
741 self.logger.debug(self.vapi.cli("show session verbose 2"))
742 self.logger.debug(self.vapi.cli("show app mq"))
743
Dave Wallacede910062018-03-20 09:22:13 -0400744 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800745 super(LDPIpv6CutThruTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400746
747 self.cut_thru_setup()
748 self.client_iperf3_timeout = 20
Florin Coras2eb42e72018-11-29 00:39:53 -0800749 self.client_uni_dir_nsock_timeout = 20
750 self.client_bi_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400751 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
752 self.server_ipv6_addr,
753 self.server_port]
Florin Coras1d879142021-05-06 00:08:18 -0700754 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
Florin Corasab2f6db2018-08-31 14:31:41 -0700755 self.server_ipv6_addr]
Florin Coras1d879142021-05-06 00:08:18 -0700756 self.server_ipv6_iperf3_args = ["-6", "-s"]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400757 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
758 "-6",
759 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400760 self.server_ipv6_addr,
761 self.server_port]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400762 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
763 "-6",
764 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400765 self.server_ipv6_addr,
766 self.server_port]
767
768 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800769 super(LDPIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400770 self.cut_thru_tear_down()
Dave Wallacede910062018-03-20 09:22:13 -0400771
772 def test_ldp_ipv6_cut_thru_echo(self):
773 """ run LDP IPv6 cut thru echo test """
774
Florin Corasab2f6db2018-08-31 14:31:41 -0700775 self.cut_thru_test("sock_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400776 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700777 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400778 self.client_ipv6_echo_test_args)
779
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400780 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800781 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400782 def test_ldp_ipv6_cut_thru_iperf3(self):
783 """ run LDP IPv6 cut thru iperf3 test """
784
Dave Wallacede910062018-03-20 09:22:13 -0400785 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400786 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
787 iperf3, self.client_ipv6_iperf3_args)
Dave Wallacede910062018-03-20 09:22:13 -0400788
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800789 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400790 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
791 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
792
793 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700794 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
795 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400796 self.client_ipv6_uni_dir_nsock_test_args)
797
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800798 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700799 @unittest.skip("sock test apps need to be improved")
Dave Wallacede910062018-03-20 09:22:13 -0400800 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
801 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
802
803 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700804 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
805 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400806 self.client_ipv6_bi_dir_nsock_test_args)
807
Florin Coras0ae445e2018-11-29 18:22:10 -0800808
809class VCLIpv6CutThruTestCase(VCLTestCase):
810 """ VCL IPv6 Cut Thru Tests """
811
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800812 @classmethod
813 def setUpClass(cls):
814 super(VCLIpv6CutThruTestCase, cls).setUpClass()
815
816 @classmethod
817 def tearDownClass(cls):
818 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
819
Florin Coras41d5f542021-01-15 13:49:33 -0800820 def show_commands_at_teardown(self):
821 self.logger.debug(self.vapi.cli("show session verbose 2"))
822 self.logger.debug(self.vapi.cli("show app mq"))
823
Florin Coras0ae445e2018-11-29 18:22:10 -0800824 def setUp(self):
825 super(VCLIpv6CutThruTestCase, self).setUp()
826
827 self.cut_thru_setup()
828 self.client_uni_dir_nsock_timeout = 20
829 self.client_bi_dir_nsock_timeout = 20
830 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
831 self.server_ipv6_addr,
832 self.server_port]
833 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
834 "-6",
835 "-I", "2",
836 self.server_ipv6_addr,
837 self.server_port]
838 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
839 "-6",
840 "-I", "2",
841 self.server_ipv6_addr,
842 self.server_port]
843
844 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800845 super(VCLIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400846 self.cut_thru_tear_down()
Florin Coras0ae445e2018-11-29 18:22:10 -0800847
Florin Coras41d5f542021-01-15 13:49:33 -0800848 def show_commands_at_teardown(self):
849 self.logger.debug(self.vapi.cli("show session verbose 2"))
850 self.logger.debug(self.vapi.cli("show app mq"))
851
Dave Wallacede910062018-03-20 09:22:13 -0400852 def test_vcl_ipv6_cut_thru_echo(self):
853 """ run VCL IPv6 cut thru echo test """
854
Florin Corasab2f6db2018-08-31 14:31:41 -0700855 self.cut_thru_test("vcl_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400856 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700857 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400858 self.client_ipv6_echo_test_args)
859
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800860 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400861 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
862 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
863
864 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700865 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
866 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400867 self.client_ipv6_uni_dir_nsock_test_args)
868
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800869 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400870 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
871 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
872
873 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700874 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
875 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400876 self.client_ipv6_bi_dir_nsock_test_args)
877
878
Florin Corasdc2e2512018-12-03 17:47:26 -0800879class VCLIpv6ThruHostStackEcho(VCLTestCase):
880 """ VCL IPv6 Thru Host Stack Echo """
Dave Wallacede910062018-03-20 09:22:13 -0400881
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800882 @classmethod
883 def setUpClass(cls):
884 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
885
886 @classmethod
887 def tearDownClass(cls):
888 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
889
Dave Wallacede910062018-03-20 09:22:13 -0400890 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800891 super(VCLIpv6ThruHostStackEcho, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400892
893 self.thru_host_stack_ipv6_setup()
894 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
895 self.loop0.local_ip6,
896 self.server_port]
897
898 def tearDown(self):
899 self.thru_host_stack_ipv6_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800900 super(VCLIpv6ThruHostStackEcho, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400901
902 def test_vcl_ipv6_thru_host_stack_echo(self):
903 """ run VCL IPv6 thru host stack echo test """
904
Florin Corasdc2e2512018-12-03 17:47:26 -0800905 self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200906 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700907 "vcl_test_client",
Florin Corasdc2e2512018-12-03 17:47:26 -0800908 self.client_ipv6_echo_test_args)
Dave Wallacede910062018-03-20 09:22:13 -0400909
910
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500911if __name__ == '__main__':
912 unittest.main(testRunner=VppTestRunner)