blob: 68322651eb8cf204236fcbf13352bdf6237842d2 [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, \
Dave Wallace5c520912021-05-27 19:44:50 -04009 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,
Dave Wallace4ee17d82021-05-20 14:01:51 -040030 role=None, *args, **kwargs):
31 self.role = role
Paul Vinciguerra48bdbcd2019-12-04 19:43:53 -050032 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 Coras4c45d6f2021-08-12 08:38:02 -070052 session_startup = ["poll-main"]
Dave Wallace42996c02018-02-26 14:40:13 -050053
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080054 @classmethod
55 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -070056 if cls.session_startup:
57 conf = "session {" + " ".join(cls.session_startup) + "}"
58 cls.extra_vpp_punt_config = [conf]
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080059 super(VCLTestCase, cls).setUpClass()
60
61 @classmethod
62 def tearDownClass(cls):
63 super(VCLTestCase, cls).tearDownClass()
64
65 def setUp(self):
Klement Sekerab8c72a42018-11-08 11:21:39 +010066 var = "VPP_BUILD_DIR"
Dave Wallaced85075e2018-03-02 13:19:30 -050067 self.build_dir = os.getenv(var, None)
68 if self.build_dir is None:
Paul Vinciguerra063366e2019-06-30 15:38:55 -040069 raise EnvironmentError("Environment variable `%s' not set" % var)
Dave Wallaced85075e2018-03-02 13:19:30 -050070 self.vppDebug = 'vpp_debug' in self.build_dir
Dave Wallace9f11c012018-02-28 17:55:23 -050071 self.server_addr = "127.0.0.1"
72 self.server_port = "22000"
Dave Wallace816833f2018-03-14 20:01:28 -040073 self.server_args = [self.server_port]
Dave Wallacede910062018-03-20 09:22:13 -040074 self.server_ipv6_addr = "::1"
75 self.server_ipv6_args = ["-6", self.server_port]
Florin Corasdc2e2512018-12-03 17:47:26 -080076 self.timeout = 20
Dave Wallace9f11c012018-02-28 17:55:23 -050077 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
Florin Corasdc2e2512018-12-03 17:47:26 -080078 self.pre_test_sleep = 0.3
79 self.post_test_sleep = 0.2
Florin Coras4c45d6f2021-08-12 08:38:02 -070080 self.sapi_client_sock = ""
81 self.sapi_server_sock = ""
Florin Corasdc2e2512018-12-03 17:47:26 -080082
83 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
84 os.remove("/tmp/ldp_server_af_unix_socket")
Dave Wallace42996c02018-02-26 14:40:13 -050085
Paul Vinciguerra8d991d92019-01-25 14:05:48 -080086 super(VCLTestCase, self).setUp()
Dave Wallace42996c02018-02-26 14:40:13 -050087
Florin Coras4c45d6f2021-08-12 08:38:02 -070088 def update_vcl_app_env(self, ns_id, ns_secret, attach_sock):
89 if not ns_id:
90 if 'VCL_APP_NAMESPACE_ID' in self.vcl_app_env:
91 del self.vcl_app_env['VCL_APP_NAMESPACE_ID']
92 else:
93 self.vcl_app_env['VCL_APP_NAMESPACE_ID'] = ns_id
94
95 if not ns_secret:
96 if 'VCL_APP_NAMESPACE_SECRET' in self.vcl_app_env:
97 del self.vcl_app_env['VCL_APP_NAMESPACE_SECRET']
98 else:
99 self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] = ns_secret
100
101 if not attach_sock:
102 self.vcl_app_env['VCL_VPP_API_SOCKET'] = self.get_api_sock_path()
103 if 'VCL_VPP_SAPI_SOCKET' in self.vcl_app_env:
104 del self.vcl_app_env['VCL_VPP_SAPI_SOCKET']
105 else:
106 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
107 self.vcl_app_env['VCL_VPP_SAPI_SOCKET'] = sapi_sock
108 if 'VCL_VPP_API_SOCKET' in self.vcl_app_env:
109 del self.vcl_app_env['VCL_VPP_API_SOCKET']
110
Dave Wallace9f11c012018-02-28 17:55:23 -0500111 def cut_thru_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100112 self.vapi.session_enable_disable(is_enable=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500113
Dave Wallace9f11c012018-02-28 17:55:23 -0500114 def cut_thru_tear_down(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100115 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500116
Dave Wallace816833f2018-03-14 20:01:28 -0400117 def cut_thru_test(self, server_app, server_args, client_app, client_args):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700118 self.vcl_app_env = {'VCL_APP_SCOPE_LOCAL': "true"}
119
120 self.update_vcl_app_env("", "", self.sapi_server_sock)
Dave Wallace816833f2018-03-14 20:01:28 -0400121 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700122 self.logger, self.vcl_app_env, "server")
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500123 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800124 self.sleep(self.pre_test_sleep)
Florin Coras4c45d6f2021-08-12 08:38:02 -0700125
126 self.update_vcl_app_env("", "", self.sapi_client_sock)
Dave Wallace816833f2018-03-14 20:01:28 -0400127 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700128 self.logger, self.vcl_app_env, "client")
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500129 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500130 worker_client.join(self.timeout)
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500131 try:
132 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200133 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500134 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800135 self.sleep(self.post_test_sleep)
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500136
Dave Wallace9f11c012018-02-28 17:55:23 -0500137 def thru_host_stack_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100138 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200139 self.create_loopback_interfaces(2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500140
Florin Coras56b39f62018-03-27 17:29:32 -0700141 table_id = 1
Dave Wallacea67a03e2018-02-20 12:39:37 -0500142
143 for i in self.lo_interfaces:
144 i.admin_up()
145
146 if table_id != 0:
147 tbl = VppIpTable(self, table_id)
148 tbl.add_vpp_config()
149
150 i.set_table_ip4(table_id)
151 i.config_ip4()
152 table_id += 1
153
154 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100155 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100156 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100157 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100158 sw_if_index=self.loop1.sw_if_index)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500159
Dave Wallacea67a03e2018-02-20 12:39:37 -0500160 # Add inter-table routes
161 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
162 [VppRoutePath("0.0.0.0",
163 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700164 nh_table_id=2)], table_id=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500165 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
166 [VppRoutePath("0.0.0.0",
167 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700168 nh_table_id=1)], table_id=2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500169 ip_t01.add_vpp_config()
170 ip_t10.add_vpp_config()
Florin Coras56b39f62018-03-27 17:29:32 -0700171 self.logger.debug(self.vapi.cli("show ip fib"))
Dave Wallacea67a03e2018-02-20 12:39:37 -0500172
Dave Wallace9f11c012018-02-28 17:55:23 -0500173 def thru_host_stack_tear_down(self):
174 for i in self.lo_interfaces:
175 i.unconfig_ip4()
176 i.set_table_ip4(0)
177 i.admin_down()
178
Dave Wallacede910062018-03-20 09:22:13 -0400179 def thru_host_stack_ipv6_setup(self):
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100180 self.vapi.session_enable_disable(is_enable=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200181 self.create_loopback_interfaces(2)
Dave Wallacede910062018-03-20 09:22:13 -0400182
183 table_id = 1
184
185 for i in self.lo_interfaces:
186 i.admin_up()
187
188 tbl = VppIpTable(self, table_id, is_ip6=1)
189 tbl.add_vpp_config()
190
191 i.set_table_ip6(table_id)
192 i.config_ip6()
193 table_id += 1
194
195 # Configure namespaces
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100196 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
Ole Troane1ade682019-03-04 23:55:43 +0100197 sw_if_index=self.loop0.sw_if_index)
Jakub Grajciarb4e5e502020-01-31 09:35:29 +0100198 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
Ole Troane1ade682019-03-04 23:55:43 +0100199 sw_if_index=self.loop1.sw_if_index)
Dave Wallacede910062018-03-20 09:22:13 -0400200
201 # Add inter-table routes
202 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700203 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700204 nh_table_id=2)],
205 table_id=1)
Dave Wallacede910062018-03-20 09:22:13 -0400206 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700207 [VppRoutePath("::0", 0xffffffff,
Neale Ranns097fa662018-05-01 05:17:55 -0700208 nh_table_id=1)],
209 table_id=2)
Dave Wallacede910062018-03-20 09:22:13 -0400210 ip_t01.add_vpp_config()
211 ip_t10.add_vpp_config()
212 self.logger.debug(self.vapi.cli("show interface addr"))
213 self.logger.debug(self.vapi.cli("show ip6 fib"))
214
215 def thru_host_stack_ipv6_tear_down(self):
216 for i in self.lo_interfaces:
217 i.unconfig_ip6()
218 i.set_table_ip6(0)
219 i.admin_down()
220
Jakub Grajciar6a2794e2020-11-24 11:22:01 +0100221 self.vapi.session_enable_disable(is_enable=0)
Dave Wallacede910062018-03-20 09:22:13 -0400222
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400223 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400224 def thru_host_stack_test(self, server_app, server_args,
225 client_app, client_args):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700226 self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"}
Dave Wallace9f11c012018-02-28 17:55:23 -0500227
Florin Coras4c45d6f2021-08-12 08:38:02 -0700228 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
Dave Wallace816833f2018-03-14 20:01:28 -0400229 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700230 self.logger, self.vcl_app_env, "server")
Dave Wallacea67a03e2018-02-20 12:39:37 -0500231 worker_server.start()
Florin Corasdc2e2512018-12-03 17:47:26 -0800232 self.sleep(self.pre_test_sleep)
Dave Wallace42996c02018-02-26 14:40:13 -0500233
Florin Coras4c45d6f2021-08-12 08:38:02 -0700234 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
Dave Wallace816833f2018-03-14 20:01:28 -0400235 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Florin Coras4c45d6f2021-08-12 08:38:02 -0700236 self.logger, self.vcl_app_env, "client")
Dave Wallacea67a03e2018-02-20 12:39:37 -0500237 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500238 worker_client.join(self.timeout)
239
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500240 try:
241 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200242 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500243 self.fail("Failed with %s" % error)
Florin Corasdc2e2512018-12-03 17:47:26 -0800244 self.sleep(self.post_test_sleep)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500245
Dave Wallace9f11c012018-02-28 17:55:23 -0500246 def validateResults(self, worker_client, worker_server, timeout):
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400247 if worker_server.process is None:
248 raise RuntimeError('worker_server is not running.')
Dave Wallaced85075e2018-03-02 13:19:30 -0500249 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
250 self.logger.info("Killing server worker process (pid %d)" %
251 worker_server.process.pid)
Dave Barachad646872019-05-06 10:49:41 -0400252 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
Dave Wallaced85075e2018-03-02 13:19:30 -0500253 worker_server.join()
Dave Wallace9f11c012018-02-28 17:55:23 -0500254 self.logger.info("Client worker result is `%s'" % worker_client.result)
255 error = False
256 if worker_client.result is None:
257 try:
258 error = True
259 self.logger.error(
Dave Wallaced85075e2018-03-02 13:19:30 -0500260 "Timeout: %ss! Killing client worker process (pid %d)" %
261 (timeout, worker_client.process.pid))
Dave Wallace9f11c012018-02-28 17:55:23 -0500262 os.killpg(os.getpgid(worker_client.process.pid),
Florin Corasdc2e2512018-12-03 17:47:26 -0800263 signal.SIGKILL)
Dave Wallace9f11c012018-02-28 17:55:23 -0500264 worker_client.join()
Dave Wallace07c0a9d2019-05-13 19:21:24 -0400265 except OSError:
Dave Wallace9f11c012018-02-28 17:55:23 -0500266 self.logger.debug(
267 "Couldn't kill client worker process")
268 raise
269 if error:
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400270 raise RuntimeError(
Dave Wallace9f11c012018-02-28 17:55:23 -0500271 "Timeout! Client worker did not finish in %ss" % timeout)
272 self.assert_equal(worker_client.result, 0, "Binary test return code")
273
274
Florin Coras0ae445e2018-11-29 18:22:10 -0800275class LDPCutThruTestCase(VCLTestCase):
276 """ LDP Cut Thru Tests """
Dave Wallace9f11c012018-02-28 17:55:23 -0500277
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800278 @classmethod
279 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700280 cls.session_startup = ["poll-main", "use-app-socket-api"]
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800281 super(LDPCutThruTestCase, cls).setUpClass()
282
283 @classmethod
284 def tearDownClass(cls):
285 super(LDPCutThruTestCase, cls).tearDownClass()
286
Dave Wallace9f11c012018-02-28 17:55:23 -0500287 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800288 super(LDPCutThruTestCase, self).setUp()
Dave Wallace9f11c012018-02-28 17:55:23 -0500289
290 self.cut_thru_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400291 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
292 self.server_addr, self.server_port]
Dave Wallace816833f2018-03-14 20:01:28 -0400293 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700294 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
295 self.server_iperf3_args = ["-4", "-s"]
Florin Coras2eb42e72018-11-29 00:39:53 -0800296 self.client_uni_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400297 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
298 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400299 self.server_addr,
300 self.server_port]
Florin Coras2eb42e72018-11-29 00:39:53 -0800301 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400302 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
303 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400304 self.server_addr,
305 self.server_port]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700306 self.sapi_client_sock = "default"
307 self.sapi_server_sock = "default"
Dave Wallace9f11c012018-02-28 17:55:23 -0500308
309 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800310 super(LDPCutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400311 self.cut_thru_tear_down()
Dave Wallace9f11c012018-02-28 17:55:23 -0500312
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700313 def show_commands_at_teardown(self):
314 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800315 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700316
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800317 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallace9f11c012018-02-28 17:55:23 -0500318 def test_ldp_cut_thru_echo(self):
319 """ run LDP cut thru echo test """
320
Florin Corasab2f6db2018-08-31 14:31:41 -0700321 self.cut_thru_test("sock_test_server", self.server_args,
322 "sock_test_client", self.client_echo_test_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400323
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400324 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400325 def test_ldp_cut_thru_iperf3(self):
326 """ run LDP cut thru iperf3 test """
327
Dave Wallace816833f2018-03-14 20:01:28 -0400328 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400329 self.cut_thru_test(iperf3, self.server_iperf3_args,
330 iperf3, self.client_iperf3_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500331
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800332 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallaced85075e2018-03-02 13:19:30 -0500333 def test_ldp_cut_thru_uni_dir_nsock(self):
334 """ run LDP cut thru uni-directional (multiple sockets) test """
335
336 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700337 self.cut_thru_test("sock_test_server", self.server_args,
338 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500339 self.client_uni_dir_nsock_test_args)
340
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800341 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700342 @unittest.skip("sock test apps need to be improved")
Dave Wallaced85075e2018-03-02 13:19:30 -0500343 def test_ldp_cut_thru_bi_dir_nsock(self):
344 """ run LDP cut thru bi-directional (multiple sockets) test """
345
346 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700347 self.cut_thru_test("sock_test_server", self.server_args,
348 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500349 self.client_bi_dir_nsock_test_args)
350
Florin Coras0ae445e2018-11-29 18:22:10 -0800351
352class VCLCutThruTestCase(VCLTestCase):
353 """ VCL Cut Thru Tests """
354
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800355 @classmethod
356 def setUpClass(cls):
357 super(VCLCutThruTestCase, cls).setUpClass()
358
359 @classmethod
360 def tearDownClass(cls):
361 super(VCLCutThruTestCase, cls).tearDownClass()
362
Florin Coras0ae445e2018-11-29 18:22:10 -0800363 def setUp(self):
364 super(VCLCutThruTestCase, self).setUp()
365
366 self.cut_thru_setup()
367 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
368 self.server_addr, self.server_port]
369
370 self.client_uni_dir_nsock_timeout = 20
371 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
372 "-I", "2",
373 self.server_addr,
374 self.server_port]
375 self.client_bi_dir_nsock_timeout = 20
376 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
377 "-I", "2",
378 self.server_addr,
379 self.server_port]
380
381 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800382 super(VCLCutThruTestCase, self).tearDown()
383
Florin Coras317b8e02019-04-17 09:57:46 -0700384 def show_commands_at_teardown(self):
385 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800386 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras317b8e02019-04-17 09:57:46 -0700387
Dave Wallace9f11c012018-02-28 17:55:23 -0500388 def test_vcl_cut_thru_echo(self):
389 """ run VCL cut thru echo test """
390
Florin Corasab2f6db2018-08-31 14:31:41 -0700391 self.cut_thru_test("vcl_test_server", self.server_args,
392 "vcl_test_client", self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500393
Dave Wallaced85075e2018-03-02 13:19:30 -0500394 def test_vcl_cut_thru_uni_dir_nsock(self):
395 """ run VCL cut thru uni-directional (multiple sockets) test """
396
397 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700398 self.cut_thru_test("vcl_test_server", self.server_args,
399 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500400 self.client_uni_dir_nsock_test_args)
401
Dave Wallaced85075e2018-03-02 13:19:30 -0500402 def test_vcl_cut_thru_bi_dir_nsock(self):
403 """ run VCL cut thru bi-directional (multiple sockets) test """
404
405 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700406 self.cut_thru_test("vcl_test_server", self.server_args,
407 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500408 self.client_bi_dir_nsock_test_args)
409
Dave Wallace9f11c012018-02-28 17:55:23 -0500410
Florin Corasdc2e2512018-12-03 17:47:26 -0800411class VCLThruHostStackEcho(VCLTestCase):
412 """ VCL Thru Host Stack Echo """
Dave Wallaced85075e2018-03-02 13:19:30 -0500413
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800414 @classmethod
415 def setUpClass(cls):
416 super(VCLThruHostStackEcho, cls).setUpClass()
417
418 @classmethod
419 def tearDownClass(cls):
420 super(VCLThruHostStackEcho, cls).tearDownClass()
421
Dave Wallaced85075e2018-03-02 13:19:30 -0500422 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800423 super(VCLThruHostStackEcho, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500424
425 self.thru_host_stack_setup()
Florin Corasdc2e2512018-12-03 17:47:26 -0800426 self.client_bi_dir_nsock_timeout = 20
427 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
428 "-I", "2",
429 self.loop0.local_ip4,
430 self.server_port]
431 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
432 self.loop0.local_ip4,
433 self.server_port]
434
435 def tearDown(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800436 self.thru_host_stack_tear_down()
437 super(VCLThruHostStackEcho, self).tearDown()
438
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700439 def show_commands_at_teardown(self):
440 self.logger.debug(self.vapi.cli("show app server"))
441 self.logger.debug(self.vapi.cli("show session verbose"))
Florin Coras41d5f542021-01-15 13:49:33 -0800442 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700443
Florin Corasdc2e2512018-12-03 17:47:26 -0800444
Florin Coras8a140612019-02-18 22:39:39 -0800445class VCLThruHostStackTLS(VCLTestCase):
446 """ VCL Thru Host Stack TLS """
447
448 @classmethod
449 def setUpClass(cls):
Florin Coras4c45d6f2021-08-12 08:38:02 -0700450 cls.session_startup = ["poll-main", "use-app-socket-api"]
Florin Coras8a140612019-02-18 22:39:39 -0800451 super(VCLThruHostStackTLS, cls).setUpClass()
452
453 @classmethod
454 def tearDownClass(cls):
455 super(VCLThruHostStackTLS, cls).tearDownClass()
456
457 def setUp(self):
458 super(VCLThruHostStackTLS, self).setUp()
459
460 self.thru_host_stack_setup()
461 self.client_uni_dir_tls_timeout = 20
Dave Wallace03dd90a2019-03-25 19:34:50 -0400462 self.server_tls_args = ["-L", self.server_port]
463 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
Florin Coras8a140612019-02-18 22:39:39 -0800464 self.loop0.local_ip4,
465 self.server_port]
Florin Coras4c45d6f2021-08-12 08:38:02 -0700466 self.sapi_server_sock = "1"
467 self.sapi_client_sock = "2"
Florin Coras8a140612019-02-18 22:39:39 -0800468
469 def test_vcl_thru_host_stack_tls_uni_dir(self):
470 """ run VCL thru host stack uni-directional TLS test """
471
472 self.timeout = self.client_uni_dir_tls_timeout
473 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
474 "vcl_test_client",
475 self.client_uni_dir_tls_test_args)
476
477 def tearDown(self):
Florin Coras8a140612019-02-18 22:39:39 -0800478 self.thru_host_stack_tear_down()
479 super(VCLThruHostStackTLS, self).tearDown()
480
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700481 def show_commands_at_teardown(self):
482 self.logger.debug(self.vapi.cli("show app server"))
483 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800484 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700485
Florin Coras8a140612019-02-18 22:39:39 -0800486
Florin Corascec1b272021-05-06 12:46:04 -0700487class VCLThruHostStackDTLS(VCLTestCase):
488 """ VCL Thru Host Stack DTLS """
489
490 @classmethod
491 def setUpClass(cls):
492 super(VCLThruHostStackDTLS, cls).setUpClass()
493
494 @classmethod
495 def tearDownClass(cls):
496 super(VCLThruHostStackDTLS, cls).tearDownClass()
497
498 def setUp(self):
499 super(VCLThruHostStackDTLS, self).setUp()
500
501 self.thru_host_stack_setup()
502 self.client_uni_dir_dtls_timeout = 20
Florin Corasfb50bc32021-05-18 00:28:59 -0700503 self.server_dtls_args = ["-p", "dtls", self.server_port]
Florin Corascec1b272021-05-06 12:46:04 -0700504 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
Florin Corasfb50bc32021-05-18 00:28:59 -0700505 "-p", "dtls", "-T 1400",
Florin Corascec1b272021-05-06 12:46:04 -0700506 self.loop0.local_ip4,
507 self.server_port]
508
509 def test_vcl_thru_host_stack_dtls_uni_dir(self):
510 """ run VCL thru host stack uni-directional DTLS test """
511
512 self.timeout = self.client_uni_dir_dtls_timeout
513 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
514 "vcl_test_client",
515 self.client_uni_dir_dtls_test_args)
516
517 def tearDown(self):
518 self.thru_host_stack_tear_down()
519 super(VCLThruHostStackDTLS, self).tearDown()
520
521 def show_commands_at_teardown(self):
522 self.logger.debug(self.vapi.cli("show app server"))
523 self.logger.debug(self.vapi.cli("show session verbose 2"))
524 self.logger.debug(self.vapi.cli("show app mq"))
525
526
Florin Corasdebb3522021-05-18 00:35:50 -0700527class VCLThruHostStackQUIC(VCLTestCase):
528 """ VCL Thru Host Stack QUIC """
529
530 @classmethod
531 def setUpClass(cls):
532 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
533 super(VCLThruHostStackQUIC, cls).setUpClass()
534
535 @classmethod
536 def tearDownClass(cls):
537 super(VCLThruHostStackQUIC, cls).tearDownClass()
538
539 def setUp(self):
540 super(VCLThruHostStackQUIC, self).setUp()
541
542 self.thru_host_stack_setup()
543 self.client_uni_dir_quic_timeout = 20
544 self.server_quic_args = ["-p", "quic", self.server_port]
545 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
546 "-p", "quic",
547 self.loop0.local_ip4,
548 self.server_port]
549
550 @unittest.skipUnless(running_extended_tests, "part of extended tests")
551 def test_vcl_thru_host_stack_quic_uni_dir(self):
552 """ run VCL thru host stack uni-directional QUIC test """
553
554 self.timeout = self.client_uni_dir_quic_timeout
555 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
556 "vcl_test_client",
557 self.client_uni_dir_quic_test_args)
558
559 def tearDown(self):
560 self.thru_host_stack_tear_down()
561 super(VCLThruHostStackQUIC, self).tearDown()
562
563 def show_commands_at_teardown(self):
564 self.logger.debug(self.vapi.cli("show app server"))
565 self.logger.debug(self.vapi.cli("show session verbose 2"))
566 self.logger.debug(self.vapi.cli("show app mq"))
567
568
Florin Corasdc2e2512018-12-03 17:47:26 -0800569class VCLThruHostStackBidirNsock(VCLTestCase):
570 """ VCL Thru Host Stack Bidir Nsock """
571
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800572 @classmethod
573 def setUpClass(cls):
574 super(VCLThruHostStackBidirNsock, cls).setUpClass()
575
576 @classmethod
577 def tearDownClass(cls):
578 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
579
Florin Corasdc2e2512018-12-03 17:47:26 -0800580 def setUp(self):
581 super(VCLThruHostStackBidirNsock, self).setUp()
582
583 self.thru_host_stack_setup()
584 self.client_bi_dir_nsock_timeout = 20
585 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
586 "-I", "2",
587 self.loop0.local_ip4,
588 self.server_port]
589 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
590 self.loop0.local_ip4,
591 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500592
593 def tearDown(self):
594 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800595 super(VCLThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500596
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700597 def show_commands_at_teardown(self):
598 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800599 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700600
Dave Wallaced85075e2018-03-02 13:19:30 -0500601 def test_vcl_thru_host_stack_bi_dir_nsock(self):
602 """ run VCL thru host stack bi-directional (multiple sockets) test """
603
604 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700605 self.thru_host_stack_test("vcl_test_server", self.server_args,
606 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500607 self.client_bi_dir_nsock_test_args)
608
609
Florin Corasdc2e2512018-12-03 17:47:26 -0800610class LDPThruHostStackBidirNsock(VCLTestCase):
611 """ LDP Thru Host Stack Bidir Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500612
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800613 @classmethod
614 def setUpClass(cls):
615 super(LDPThruHostStackBidirNsock, cls).setUpClass()
616
617 @classmethod
618 def tearDownClass(cls):
619 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
620
Dave Wallaced85075e2018-03-02 13:19:30 -0500621 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800622 super(LDPThruHostStackBidirNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500623
624 self.thru_host_stack_setup()
Dave Wallace3102c382020-04-03 19:48:48 -0400625 self.client_bi_dir_nsock_timeout = 20
626 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
627 # OUCH! Host Stack Bug?
628 # Only fails when running
629 # 'make test TEST_JOBS=auto'
630 # or TEST_JOBS > 1
631 # "-I", "2",
632 self.loop0.local_ip4,
633 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500634
635 def tearDown(self):
636 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800637 super(LDPThruHostStackBidirNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500638
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700639 def show_commands_at_teardown(self):
640 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800641 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700642
Dave Wallaced85075e2018-03-02 13:19:30 -0500643 def test_ldp_thru_host_stack_bi_dir_nsock(self):
644 """ run LDP thru host stack bi-directional (multiple sockets) test """
645
646 self.timeout = self.client_bi_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400647 self.thru_host_stack_test("sock_test_server", self.server_args,
648 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500649 self.client_bi_dir_nsock_test_args)
650
651
Florin Corasdc2e2512018-12-03 17:47:26 -0800652class LDPThruHostStackNsock(VCLTestCase):
653 """ LDP Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500654
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800655 @classmethod
656 def setUpClass(cls):
657 super(LDPThruHostStackNsock, cls).setUpClass()
658
659 @classmethod
660 def tearDownClass(cls):
661 super(LDPThruHostStackNsock, cls).tearDownClass()
662
Dave Wallaced85075e2018-03-02 13:19:30 -0500663 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800664 super(LDPThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500665
666 self.thru_host_stack_setup()
667 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800668 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500669 self.numSockets = "2"
670 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800671 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500672 self.numSockets = "5"
673
Dave Wallace45cd3a32018-06-26 01:14:04 -0400674 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
675 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400676 self.loop0.local_ip4,
677 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500678
679 def tearDown(self):
680 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800681 super(LDPThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500682
Dave Wallaced85075e2018-03-02 13:19:30 -0500683 def test_ldp_thru_host_stack_uni_dir_nsock(self):
684 """ run LDP thru host stack uni-directional (multiple sockets) test """
685
686 self.timeout = self.client_uni_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400687 self.thru_host_stack_test("sock_test_server", self.server_args,
688 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500689 self.client_uni_dir_nsock_test_args)
690
691
Florin Corasdc2e2512018-12-03 17:47:26 -0800692class VCLThruHostStackNsock(VCLTestCase):
693 """ VCL Thru Host Stack Nsock """
Dave Wallaced85075e2018-03-02 13:19:30 -0500694
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800695 @classmethod
696 def setUpClass(cls):
697 super(VCLThruHostStackNsock, cls).setUpClass()
698
699 @classmethod
700 def tearDownClass(cls):
701 super(VCLThruHostStackNsock, cls).tearDownClass()
702
Dave Wallaced85075e2018-03-02 13:19:30 -0500703 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800704 super(VCLThruHostStackNsock, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500705
706 self.thru_host_stack_setup()
707 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800708 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500709 self.numSockets = "2"
710 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800711 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500712 self.numSockets = "5"
713
Dave Wallace45cd3a32018-06-26 01:14:04 -0400714 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
715 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400716 self.loop0.local_ip4,
717 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500718
719 def tearDown(self):
720 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800721 super(VCLThruHostStackNsock, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500722
Dave Wallaced85075e2018-03-02 13:19:30 -0500723 def test_vcl_thru_host_stack_uni_dir_nsock(self):
724 """ run VCL thru host stack uni-directional (multiple sockets) test """
725
726 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700727 self.thru_host_stack_test("vcl_test_server", self.server_args,
728 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500729 self.client_uni_dir_nsock_test_args)
730
731
Florin Corasdc2e2512018-12-03 17:47:26 -0800732class LDPThruHostStackIperf(VCLTestCase):
733 """ LDP Thru Host Stack Iperf """
Dave Wallace816833f2018-03-14 20:01:28 -0400734
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800735 @classmethod
736 def setUpClass(cls):
737 super(LDPThruHostStackIperf, cls).setUpClass()
738
739 @classmethod
740 def tearDownClass(cls):
741 super(LDPThruHostStackIperf, cls).tearDownClass()
742
Dave Wallace816833f2018-03-14 20:01:28 -0400743 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800744 super(LDPThruHostStackIperf, self).setUp()
Dave Wallace816833f2018-03-14 20:01:28 -0400745
746 self.thru_host_stack_setup()
747 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700748 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
749 self.server_iperf3_args = ["-4", "-s"]
Dave Wallace816833f2018-03-14 20:01:28 -0400750
751 def tearDown(self):
752 self.thru_host_stack_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800753 super(LDPThruHostStackIperf, self).tearDown()
Dave Wallace816833f2018-03-14 20:01:28 -0400754
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700755 def show_commands_at_teardown(self):
756 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800757 self.logger.debug(self.vapi.cli("show app mq"))
Paul Vinciguerra90cf21b2019-03-13 09:23:05 -0700758
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400759 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Dave Wallace816833f2018-03-14 20:01:28 -0400760 def test_ldp_thru_host_stack_iperf3(self):
761 """ run LDP thru host stack iperf3 test """
762
Dave Wallace816833f2018-03-14 20:01:28 -0400763 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400764 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
765 iperf3, self.client_iperf3_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400766
767
Florin Coras57a5a2d2020-04-01 23:16:11 +0000768class LDPThruHostStackIperfUdp(VCLTestCase):
769 """ LDP Thru Host Stack Iperf UDP """
770
771 @classmethod
772 def setUpClass(cls):
773 super(LDPThruHostStackIperfUdp, cls).setUpClass()
774
775 @classmethod
776 def tearDownClass(cls):
777 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
778
779 def setUp(self):
780 super(LDPThruHostStackIperfUdp, self).setUp()
781
782 self.thru_host_stack_setup()
783 self.client_iperf3_timeout = 20
Florin Coras1d879142021-05-06 00:08:18 -0700784 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
Florin Coras57a5a2d2020-04-01 23:16:11 +0000785 "-c", self.loop0.local_ip4]
Florin Coras1d879142021-05-06 00:08:18 -0700786 self.server_iperf3_args = ["-4", "-s"]
Florin Coras57a5a2d2020-04-01 23:16:11 +0000787
788 def tearDown(self):
789 self.thru_host_stack_tear_down()
790 super(LDPThruHostStackIperfUdp, self).tearDown()
791
792 def show_commands_at_teardown(self):
793 self.logger.debug(self.vapi.cli("show session verbose 2"))
Florin Coras41d5f542021-01-15 13:49:33 -0800794 self.logger.debug(self.vapi.cli("show app mq"))
Florin Coras57a5a2d2020-04-01 23:16:11 +0000795
796 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
797 def test_ldp_thru_host_stack_iperf3_udp(self):
798 """ run LDP thru host stack iperf3 UDP test """
799
800 self.timeout = self.client_iperf3_timeout
801 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
802 iperf3, self.client_iperf3_args)
803
804
Florin Coras0ae445e2018-11-29 18:22:10 -0800805class LDPIpv6CutThruTestCase(VCLTestCase):
806 """ LDP IPv6 Cut Thru Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400807
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800808 @classmethod
809 def setUpClass(cls):
810 super(LDPIpv6CutThruTestCase, cls).setUpClass()
811
812 @classmethod
813 def tearDownClass(cls):
814 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
815
Florin Coras41d5f542021-01-15 13:49:33 -0800816 def show_commands_at_teardown(self):
817 self.logger.debug(self.vapi.cli("show session verbose 2"))
818 self.logger.debug(self.vapi.cli("show app mq"))
819
Dave Wallacede910062018-03-20 09:22:13 -0400820 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800821 super(LDPIpv6CutThruTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400822
823 self.cut_thru_setup()
824 self.client_iperf3_timeout = 20
Florin Coras2eb42e72018-11-29 00:39:53 -0800825 self.client_uni_dir_nsock_timeout = 20
826 self.client_bi_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400827 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
828 self.server_ipv6_addr,
829 self.server_port]
Florin Coras1d879142021-05-06 00:08:18 -0700830 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
Florin Corasab2f6db2018-08-31 14:31:41 -0700831 self.server_ipv6_addr]
Florin Coras1d879142021-05-06 00:08:18 -0700832 self.server_ipv6_iperf3_args = ["-6", "-s"]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400833 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
834 "-6",
835 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400836 self.server_ipv6_addr,
837 self.server_port]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400838 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
839 "-6",
840 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400841 self.server_ipv6_addr,
842 self.server_port]
843
844 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800845 super(LDPIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400846 self.cut_thru_tear_down()
Dave Wallacede910062018-03-20 09:22:13 -0400847
848 def test_ldp_ipv6_cut_thru_echo(self):
849 """ run LDP IPv6 cut thru echo test """
850
Florin Corasab2f6db2018-08-31 14:31:41 -0700851 self.cut_thru_test("sock_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400852 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700853 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400854 self.client_ipv6_echo_test_args)
855
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400856 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800857 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400858 def test_ldp_ipv6_cut_thru_iperf3(self):
859 """ run LDP IPv6 cut thru iperf3 test """
860
Dave Wallacede910062018-03-20 09:22:13 -0400861 self.timeout = self.client_iperf3_timeout
Paul Vinciguerra063366e2019-06-30 15:38:55 -0400862 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
863 iperf3, self.client_ipv6_iperf3_args)
Dave Wallacede910062018-03-20 09:22:13 -0400864
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800865 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400866 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
867 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
868
869 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700870 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
871 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400872 self.client_ipv6_uni_dir_nsock_test_args)
873
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800874 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Florin Coras0f46e162019-07-02 19:33:15 -0700875 @unittest.skip("sock test apps need to be improved")
Dave Wallacede910062018-03-20 09:22:13 -0400876 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
877 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
878
879 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700880 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
881 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400882 self.client_ipv6_bi_dir_nsock_test_args)
883
Florin Coras0ae445e2018-11-29 18:22:10 -0800884
885class VCLIpv6CutThruTestCase(VCLTestCase):
886 """ VCL IPv6 Cut Thru Tests """
887
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800888 @classmethod
889 def setUpClass(cls):
890 super(VCLIpv6CutThruTestCase, cls).setUpClass()
891
892 @classmethod
893 def tearDownClass(cls):
894 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
895
Florin Coras41d5f542021-01-15 13:49:33 -0800896 def show_commands_at_teardown(self):
897 self.logger.debug(self.vapi.cli("show session verbose 2"))
898 self.logger.debug(self.vapi.cli("show app mq"))
899
Florin Coras0ae445e2018-11-29 18:22:10 -0800900 def setUp(self):
901 super(VCLIpv6CutThruTestCase, self).setUp()
902
903 self.cut_thru_setup()
904 self.client_uni_dir_nsock_timeout = 20
905 self.client_bi_dir_nsock_timeout = 20
906 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
907 self.server_ipv6_addr,
908 self.server_port]
909 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
910 "-6",
911 "-I", "2",
912 self.server_ipv6_addr,
913 self.server_port]
914 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
915 "-6",
916 "-I", "2",
917 self.server_ipv6_addr,
918 self.server_port]
919
920 def tearDown(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800921 super(VCLIpv6CutThruTestCase, self).tearDown()
Paul Vinciguerra9673e3e2019-05-10 20:41:08 -0400922 self.cut_thru_tear_down()
Florin Coras0ae445e2018-11-29 18:22:10 -0800923
Florin Coras41d5f542021-01-15 13:49:33 -0800924 def show_commands_at_teardown(self):
925 self.logger.debug(self.vapi.cli("show session verbose 2"))
926 self.logger.debug(self.vapi.cli("show app mq"))
927
Dave Wallacede910062018-03-20 09:22:13 -0400928 def test_vcl_ipv6_cut_thru_echo(self):
929 """ run VCL IPv6 cut thru echo test """
930
Florin Corasab2f6db2018-08-31 14:31:41 -0700931 self.cut_thru_test("vcl_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400932 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700933 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400934 self.client_ipv6_echo_test_args)
935
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800936 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400937 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
938 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
939
940 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700941 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
942 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400943 self.client_ipv6_uni_dir_nsock_test_args)
944
Paul Vinciguerradefde0f2018-12-06 07:46:13 -0800945 @unittest.skipUnless(running_extended_tests, "part of extended tests")
Dave Wallacede910062018-03-20 09:22:13 -0400946 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
947 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
948
949 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700950 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
951 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400952 self.client_ipv6_bi_dir_nsock_test_args)
953
954
Florin Corasdc2e2512018-12-03 17:47:26 -0800955class VCLIpv6ThruHostStackEcho(VCLTestCase):
956 """ VCL IPv6 Thru Host Stack Echo """
Dave Wallacede910062018-03-20 09:22:13 -0400957
Paul Vinciguerra8d991d92019-01-25 14:05:48 -0800958 @classmethod
959 def setUpClass(cls):
960 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
961
962 @classmethod
963 def tearDownClass(cls):
964 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
965
Dave Wallacede910062018-03-20 09:22:13 -0400966 def setUp(self):
Florin Corasdc2e2512018-12-03 17:47:26 -0800967 super(VCLIpv6ThruHostStackEcho, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400968
969 self.thru_host_stack_ipv6_setup()
970 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
971 self.loop0.local_ip6,
972 self.server_port]
973
974 def tearDown(self):
975 self.thru_host_stack_ipv6_tear_down()
Florin Corasdc2e2512018-12-03 17:47:26 -0800976 super(VCLIpv6ThruHostStackEcho, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400977
978 def test_vcl_ipv6_thru_host_stack_echo(self):
979 """ run VCL IPv6 thru host stack echo test """
980
Florin Corasdc2e2512018-12-03 17:47:26 -0800981 self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200982 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700983 "vcl_test_client",
Florin Corasdc2e2512018-12-03 17:47:26 -0800984 self.client_ipv6_echo_test_args)
Dave Wallacede910062018-03-20 09:22:13 -0400985
986
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500987if __name__ == '__main__':
988 unittest.main(testRunner=VppTestRunner)