blob: 6027ba75e7dbdb9daa8de7ca0b0c15160d6917d1 [file] [log] [blame]
Dave Wallacecfcf2f42018-02-16 18:31:56 -05001#!/usr/bin/env python
2""" 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
Florin Coras56b39f62018-03-27 17:29:32 -070010from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, DpoProto
Dave Wallacecfcf2f42018-02-16 18:31:56 -050011
12
Dave Wallace816833f2018-03-14 20:01:28 -040013class VCLAppWorker(Worker):
Dave Wallace42996c02018-02-26 14:40:13 -050014 """ VCL Test Application Worker """
15
Dave Wallaced85075e2018-03-02 13:19:30 -050016 def __init__(self, build_dir, appname, args, logger, env={}):
Damjan Marion855e2682018-08-24 13:37:45 +020017 vcl_lib_dir = "%s/vpp/lib" % build_dir
Dave Wallace816833f2018-03-14 20:01:28 -040018 if "iperf" in appname:
19 app = appname
Dave Wallace9f11c012018-02-28 17:55:23 -050020 env.update({'LD_PRELOAD':
Damjan Marion855e2682018-08-24 13:37:45 +020021 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
Florin Corasab2f6db2018-08-31 14:31:41 -070022 elif "sock" in appname:
23 app = "%s/vpp/bin/%s" % (build_dir, appname)
24 env.update({'LD_PRELOAD':
25 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
Dave Wallace816833f2018-03-14 20:01:28 -040026 else:
Florin Corasab2f6db2018-08-31 14:31:41 -070027 app = "%s/vpp/bin/%s" % (build_dir, appname)
Dave Wallace9f11c012018-02-28 17:55:23 -050028 self.args = [app] + args
Dave Wallace816833f2018-03-14 20:01:28 -040029 super(VCLAppWorker, self).__init__(self.args, logger, env)
Dave Wallace42996c02018-02-26 14:40:13 -050030
31
Dave Wallace816833f2018-03-14 20:01:28 -040032class VCLTestCase(VppTestCase):
Dave Wallace42996c02018-02-26 14:40:13 -050033 """ VCL Test Class """
34
Dave Wallace9f11c012018-02-28 17:55:23 -050035 def __init__(self, methodName):
Dave Wallaced85075e2018-03-02 13:19:30 -050036 var = "VPP_TEST_BUILD_DIR"
37 self.build_dir = os.getenv(var, None)
38 if self.build_dir is None:
39 raise Exception("Environment variable `%s' not set" % var)
40 self.vppDebug = 'vpp_debug' in self.build_dir
Dave Wallace9f11c012018-02-28 17:55:23 -050041 self.server_addr = "127.0.0.1"
42 self.server_port = "22000"
Dave Wallace816833f2018-03-14 20:01:28 -040043 self.server_args = [self.server_port]
Dave Wallacede910062018-03-20 09:22:13 -040044 self.server_ipv6_addr = "::1"
45 self.server_ipv6_args = ["-6", self.server_port]
Florin Coras54693d22018-07-17 10:46:29 -070046 self.timeout = 10
Dave Wallace9f11c012018-02-28 17:55:23 -050047 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
Dave Wallace42996c02018-02-26 14:40:13 -050048
Dave Wallace816833f2018-03-14 20:01:28 -040049 super(VCLTestCase, self).__init__(methodName)
Dave Wallace42996c02018-02-26 14:40:13 -050050
Dave Wallace9f11c012018-02-28 17:55:23 -050051 def cut_thru_setup(self):
Dave Wallacea67a03e2018-02-20 12:39:37 -050052 self.vapi.session_enable_disable(is_enabled=1)
53
Dave Wallace9f11c012018-02-28 17:55:23 -050054 def cut_thru_tear_down(self):
Dave Wallacea67a03e2018-02-20 12:39:37 -050055 self.vapi.session_enable_disable(is_enabled=0)
56
Dave Wallace816833f2018-03-14 20:01:28 -040057 def cut_thru_test(self, server_app, server_args, client_app, client_args):
Dave Wallace42996c02018-02-26 14:40:13 -050058 self.env = {'VCL_API_PREFIX': self.shm_prefix,
59 'VCL_APP_SCOPE_LOCAL': "true"}
60
Dave Wallace816833f2018-03-14 20:01:28 -040061 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Dave Wallace42996c02018-02-26 14:40:13 -050062 self.logger, self.env)
Dave Wallacecfcf2f42018-02-16 18:31:56 -050063 worker_server.start()
Dave Wallace42996c02018-02-26 14:40:13 -050064 self.sleep(0.2)
Dave Wallace816833f2018-03-14 20:01:28 -040065 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Dave Wallace42996c02018-02-26 14:40:13 -050066 self.logger, self.env)
Dave Wallacecfcf2f42018-02-16 18:31:56 -050067 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -050068 worker_client.join(self.timeout)
Dave Wallacefef3f7b2018-03-09 12:04:10 -050069 try:
70 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +020071 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -050072 self.fail("Failed with %s" % error)
Dave Wallacecfcf2f42018-02-16 18:31:56 -050073
Dave Wallace9f11c012018-02-28 17:55:23 -050074 def thru_host_stack_setup(self):
Dave Wallacea67a03e2018-02-20 12:39:37 -050075 self.vapi.session_enable_disable(is_enabled=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +020076 self.create_loopback_interfaces(2)
Dave Wallacea67a03e2018-02-20 12:39:37 -050077
Florin Coras56b39f62018-03-27 17:29:32 -070078 table_id = 1
Dave Wallacea67a03e2018-02-20 12:39:37 -050079
80 for i in self.lo_interfaces:
81 i.admin_up()
82
83 if table_id != 0:
84 tbl = VppIpTable(self, table_id)
85 tbl.add_vpp_config()
86
87 i.set_table_ip4(table_id)
88 i.config_ip4()
89 table_id += 1
90
91 # Configure namespaces
Florin Coras56b39f62018-03-27 17:29:32 -070092 self.vapi.app_namespace_add(namespace_id="1", secret=1234,
Dave Wallacea67a03e2018-02-20 12:39:37 -050093 sw_if_index=self.loop0.sw_if_index)
Florin Coras56b39f62018-03-27 17:29:32 -070094 self.vapi.app_namespace_add(namespace_id="2", secret=5678,
Dave Wallacea67a03e2018-02-20 12:39:37 -050095 sw_if_index=self.loop1.sw_if_index)
96
Dave Wallacea67a03e2018-02-20 12:39:37 -050097 # Add inter-table routes
98 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
99 [VppRoutePath("0.0.0.0",
100 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700101 nh_table_id=2)], table_id=1)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500102 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
103 [VppRoutePath("0.0.0.0",
104 0xffffffff,
Florin Coras56b39f62018-03-27 17:29:32 -0700105 nh_table_id=1)], table_id=2)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500106 ip_t01.add_vpp_config()
107 ip_t10.add_vpp_config()
Florin Coras56b39f62018-03-27 17:29:32 -0700108 self.logger.debug(self.vapi.cli("show ip fib"))
Dave Wallacea67a03e2018-02-20 12:39:37 -0500109
Dave Wallace9f11c012018-02-28 17:55:23 -0500110 def thru_host_stack_tear_down(self):
111 for i in self.lo_interfaces:
112 i.unconfig_ip4()
113 i.set_table_ip4(0)
114 i.admin_down()
115
116 self.vapi.session_enable_disable(is_enabled=0)
117
Dave Wallacede910062018-03-20 09:22:13 -0400118 def thru_host_stack_ipv6_setup(self):
119 self.vapi.session_enable_disable(is_enabled=1)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200120 self.create_loopback_interfaces(2)
Dave Wallacede910062018-03-20 09:22:13 -0400121
122 table_id = 1
123
124 for i in self.lo_interfaces:
125 i.admin_up()
126
127 tbl = VppIpTable(self, table_id, is_ip6=1)
128 tbl.add_vpp_config()
129
130 i.set_table_ip6(table_id)
131 i.config_ip6()
132 table_id += 1
133
134 # Configure namespaces
Florin Coras56b39f62018-03-27 17:29:32 -0700135 self.vapi.app_namespace_add(namespace_id="1", secret=1234,
Dave Wallacede910062018-03-20 09:22:13 -0400136 sw_if_index=self.loop0.sw_if_index)
Florin Coras56b39f62018-03-27 17:29:32 -0700137 self.vapi.app_namespace_add(namespace_id="2", secret=5678,
Dave Wallacede910062018-03-20 09:22:13 -0400138 sw_if_index=self.loop1.sw_if_index)
139
140 # Add inter-table routes
141 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700142 [VppRoutePath("::0", 0xffffffff,
143 nh_table_id=2,
144 proto=DpoProto.DPO_PROTO_IP6)],
Dave Wallacede910062018-03-20 09:22:13 -0400145 table_id=1, is_ip6=1)
146 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
Florin Coras56b39f62018-03-27 17:29:32 -0700147 [VppRoutePath("::0", 0xffffffff,
148 nh_table_id=1,
149 proto=DpoProto.DPO_PROTO_IP6)],
Dave Wallacede910062018-03-20 09:22:13 -0400150 table_id=2, is_ip6=1)
151 ip_t01.add_vpp_config()
152 ip_t10.add_vpp_config()
153 self.logger.debug(self.vapi.cli("show interface addr"))
154 self.logger.debug(self.vapi.cli("show ip6 fib"))
155
156 def thru_host_stack_ipv6_tear_down(self):
157 for i in self.lo_interfaces:
158 i.unconfig_ip6()
159 i.set_table_ip6(0)
160 i.admin_down()
161
162 self.vapi.session_enable_disable(is_enabled=0)
163
Dave Wallace816833f2018-03-14 20:01:28 -0400164 def thru_host_stack_test(self, server_app, server_args,
165 client_app, client_args):
Dave Wallace9f11c012018-02-28 17:55:23 -0500166 self.env = {'VCL_API_PREFIX': self.shm_prefix,
167 'VCL_APP_SCOPE_GLOBAL': "true",
Florin Coras56b39f62018-03-27 17:29:32 -0700168 'VCL_APP_NAMESPACE_ID': "1",
Dave Wallace9f11c012018-02-28 17:55:23 -0500169 'VCL_APP_NAMESPACE_SECRET': "1234"}
170
Dave Wallace816833f2018-03-14 20:01:28 -0400171 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
Dave Wallace42996c02018-02-26 14:40:13 -0500172 self.logger, self.env)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500173 worker_server.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500174 self.sleep(0.2)
175
Florin Coras56b39f62018-03-27 17:29:32 -0700176 self.env.update({'VCL_APP_NAMESPACE_ID': "2",
Dave Wallace42996c02018-02-26 14:40:13 -0500177 'VCL_APP_NAMESPACE_SECRET': "5678"})
Dave Wallace816833f2018-03-14 20:01:28 -0400178 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
Dave Wallace42996c02018-02-26 14:40:13 -0500179 self.logger, self.env)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500180 worker_client.start()
Dave Wallace42996c02018-02-26 14:40:13 -0500181 worker_client.join(self.timeout)
182
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500183 try:
184 self.validateResults(worker_client, worker_server, self.timeout)
Klement Sekerab9ef2732018-06-24 22:49:33 +0200185 except Exception as error:
Dave Wallacefef3f7b2018-03-09 12:04:10 -0500186 self.fail("Failed with %s" % error)
Dave Wallacea67a03e2018-02-20 12:39:37 -0500187
Dave Wallace9f11c012018-02-28 17:55:23 -0500188 def validateResults(self, worker_client, worker_server, timeout):
Dave Wallaced85075e2018-03-02 13:19:30 -0500189 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
190 self.logger.info("Killing server worker process (pid %d)" %
191 worker_server.process.pid)
192 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
193 worker_server.join()
Dave Wallace9f11c012018-02-28 17:55:23 -0500194 self.logger.info("Client worker result is `%s'" % worker_client.result)
195 error = False
196 if worker_client.result is None:
197 try:
198 error = True
199 self.logger.error(
Dave Wallaced85075e2018-03-02 13:19:30 -0500200 "Timeout: %ss! Killing client worker process (pid %d)" %
201 (timeout, worker_client.process.pid))
Dave Wallace9f11c012018-02-28 17:55:23 -0500202 os.killpg(os.getpgid(worker_client.process.pid),
203 signal.SIGTERM)
204 worker_client.join()
205 except:
206 self.logger.debug(
207 "Couldn't kill client worker process")
208 raise
209 if error:
Dave Wallace9f11c012018-02-28 17:55:23 -0500210 raise Exception(
211 "Timeout! Client worker did not finish in %ss" % timeout)
212 self.assert_equal(worker_client.result, 0, "Binary test return code")
213
214
Dave Wallace816833f2018-03-14 20:01:28 -0400215class VCLCutThruTestCase(VCLTestCase):
Dave Wallace9f11c012018-02-28 17:55:23 -0500216 """ VCL Cut Thru Tests """
217
218 def setUp(self):
219 super(VCLCutThruTestCase, self).setUp()
220
221 self.cut_thru_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400222 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
223 self.server_addr, self.server_port]
Dave Wallace816833f2018-03-14 20:01:28 -0400224 self.client_iperf3_timeout = 20
Florin Corasab2f6db2018-08-31 14:31:41 -0700225 self.client_iperf3_args = ["-V4d", "-t 5", "-c", self.server_addr]
Dave Wallace816833f2018-03-14 20:01:28 -0400226 self.server_iperf3_args = ["-V4d", "-s"]
Dave Wallaced85075e2018-03-02 13:19:30 -0500227 self.client_uni_dir_nsock_timeout = 60
Dave Wallace45cd3a32018-06-26 01:14:04 -0400228 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
229 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400230 self.server_addr,
231 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500232 self.client_bi_dir_nsock_timeout = 120
Dave Wallace45cd3a32018-06-26 01:14:04 -0400233 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
234 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400235 self.server_addr,
236 self.server_port]
Dave Wallace9f11c012018-02-28 17:55:23 -0500237
238 def tearDown(self):
239 self.cut_thru_tear_down()
240
241 super(VCLCutThruTestCase, self).tearDown()
242
243 def test_ldp_cut_thru_echo(self):
244 """ run LDP cut thru echo test """
245
Florin Corasab2f6db2018-08-31 14:31:41 -0700246 self.cut_thru_test("sock_test_server", self.server_args,
247 "sock_test_client", self.client_echo_test_args)
Dave Wallace816833f2018-03-14 20:01:28 -0400248
249 def test_ldp_cut_thru_iperf3(self):
250 """ run LDP cut thru iperf3 test """
251
252 try:
253 subprocess.check_output(['iperf3', '-v'])
Paul Vinciguerra61e63bf2018-11-24 21:19:38 -0800254 except subprocess.CalledProcessError:
Dave Wallace816833f2018-03-14 20:01:28 -0400255 self.logger.error("WARNING: 'iperf3' is not installed,")
256 self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!")
257 return
258
259 self.timeout = self.client_iperf3_timeout
260 self.cut_thru_test("iperf3", self.server_iperf3_args,
261 "iperf3", self.client_iperf3_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500262
Dave Wallaced85075e2018-03-02 13:19:30 -0500263 def test_ldp_cut_thru_uni_dir_nsock(self):
264 """ run LDP cut thru uni-directional (multiple sockets) test """
265
266 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700267 self.cut_thru_test("sock_test_server", self.server_args,
268 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500269 self.client_uni_dir_nsock_test_args)
270
Dave Wallaced85075e2018-03-02 13:19:30 -0500271 def test_ldp_cut_thru_bi_dir_nsock(self):
272 """ run LDP cut thru bi-directional (multiple sockets) test """
273
274 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700275 self.cut_thru_test("sock_test_server", self.server_args,
276 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500277 self.client_bi_dir_nsock_test_args)
278
Dave Wallace9f11c012018-02-28 17:55:23 -0500279 def test_vcl_cut_thru_echo(self):
280 """ run VCL cut thru echo test """
281
Florin Corasab2f6db2018-08-31 14:31:41 -0700282 self.cut_thru_test("vcl_test_server", self.server_args,
283 "vcl_test_client", self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500284
Dave Wallaced85075e2018-03-02 13:19:30 -0500285 def test_vcl_cut_thru_uni_dir_nsock(self):
286 """ run VCL cut thru uni-directional (multiple sockets) test """
287
288 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700289 self.cut_thru_test("vcl_test_server", self.server_args,
290 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500291 self.client_uni_dir_nsock_test_args)
292
Dave Wallaced85075e2018-03-02 13:19:30 -0500293 def test_vcl_cut_thru_bi_dir_nsock(self):
294 """ run VCL cut thru bi-directional (multiple sockets) test """
295
296 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700297 self.cut_thru_test("vcl_test_server", self.server_args,
298 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500299 self.client_bi_dir_nsock_test_args)
300
Dave Wallace9f11c012018-02-28 17:55:23 -0500301
Dave Wallace816833f2018-03-14 20:01:28 -0400302class VCLThruHostStackTestCase(VCLTestCase):
Dave Wallace9f11c012018-02-28 17:55:23 -0500303 """ VCL Thru Host Stack Tests """
304
305 def setUp(self):
306 super(VCLThruHostStackTestCase, self).setUp()
307
308 self.thru_host_stack_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400309 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
310 self.loop0.local_ip4,
311 self.server_port]
Dave Wallace9f11c012018-02-28 17:55:23 -0500312
313 def tearDown(self):
314 self.thru_host_stack_tear_down()
315
316 super(VCLThruHostStackTestCase, self).tearDown()
317
318 def test_ldp_thru_host_stack_echo(self):
319 """ run LDP thru host stack echo test """
320
Florin Corasab2f6db2018-08-31 14:31:41 -0700321 self.thru_host_stack_test("sock_test_server", self.server_args,
322 "sock_test_client",
Dave Wallace9f11c012018-02-28 17:55:23 -0500323 self.client_echo_test_args)
Dave Wallaced85075e2018-03-02 13:19:30 -0500324 # TBD: Remove these when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700325 self.thru_host_stack_test("vcl_test_server", self.server_args,
326 "vcl_test_client",
Dave Wallace9f11c012018-02-28 17:55:23 -0500327 self.client_echo_test_args)
328
329 def test_vcl_thru_host_stack_echo(self):
330 """ run VCL thru host stack echo test """
331
Dave Wallaced85075e2018-03-02 13:19:30 -0500332 # TBD: Enable this when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700333 # self.thru_host_stack_test("vcl_test_server", self.server_args,
334 # "vcl_test_client",
Keith Burns (alagalah)410bcca2018-03-23 13:42:49 -0700335 # self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500336
Dave Wallace45cd3a32018-06-26 01:14:04 -0400337 # TBD: Remove VCLThruHostStackGroup*TestCase classes and move
Dave Wallaced85075e2018-03-02 13:19:30 -0500338 # tests here when VPP thru host teardown/setup config bug
339 # is fixed.
340
341
Florin Coras0e88e852018-09-17 22:09:02 -0700342class VCLThruHostStackNSessionBidirTestCase(VCLTestCase):
343 """ VCL Thru Host Stack NSession Bidir Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500344
345 def setUp(self):
Florin Coras0e88e852018-09-17 22:09:02 -0700346 super(VCLThruHostStackNSessionBidirTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500347
348 self.thru_host_stack_setup()
349 if self.vppDebug:
350 self.client_bi_dir_nsock_timeout = 120
Dave Wallace45cd3a32018-06-26 01:14:04 -0400351 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
352 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400353 self.loop0.local_ip4,
354 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500355 else:
Dave Wallacede910062018-03-20 09:22:13 -0400356 self.client_bi_dir_nsock_timeout = 90
Dave Wallace45cd3a32018-06-26 01:14:04 -0400357 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
358 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400359 self.loop0.local_ip4,
360 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500361
362 def tearDown(self):
363 self.thru_host_stack_tear_down()
364
Florin Coras0e88e852018-09-17 22:09:02 -0700365 super(VCLThruHostStackNSessionBidirTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500366
Dave Wallaced85075e2018-03-02 13:19:30 -0500367 def test_vcl_thru_host_stack_bi_dir_nsock(self):
368 """ run VCL thru host stack bi-directional (multiple sockets) test """
369
370 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700371 self.thru_host_stack_test("vcl_test_server", self.server_args,
372 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500373 self.client_bi_dir_nsock_test_args)
374
375
Dave Wallace45cd3a32018-06-26 01:14:04 -0400376class VCLThruHostStackGroupBTestCase(VCLTestCase):
377 """ VCL Thru Host Stack Group B Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500378
379 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400380 super(VCLThruHostStackGroupBTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500381
382 self.thru_host_stack_setup()
383 if self.vppDebug:
384 self.client_bi_dir_nsock_timeout = 120
Dave Wallace45cd3a32018-06-26 01:14:04 -0400385 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
386 # OUCH! Host Stack Bug?
387 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400388 self.loop0.local_ip4,
389 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500390 else:
391 self.client_bi_dir_nsock_timeout = 60
Dave Wallace45cd3a32018-06-26 01:14:04 -0400392 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
393 # OUCH! Host Stack Bug?
394 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400395 self.loop0.local_ip4,
396 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500397
398 def tearDown(self):
399 self.thru_host_stack_tear_down()
400
Dave Wallace45cd3a32018-06-26 01:14:04 -0400401 super(VCLThruHostStackGroupBTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500402
Dave Wallaced85075e2018-03-02 13:19:30 -0500403 def test_ldp_thru_host_stack_bi_dir_nsock(self):
404 """ run LDP thru host stack bi-directional (multiple sockets) test """
405
406 self.timeout = self.client_bi_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400407 self.thru_host_stack_test("sock_test_server", self.server_args,
408 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500409 self.client_bi_dir_nsock_test_args)
410
411
Dave Wallace45cd3a32018-06-26 01:14:04 -0400412class VCLThruHostStackGroupCTestCase(VCLTestCase):
413 """ VCL Thru Host Stack Group C Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500414
415 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400416 super(VCLThruHostStackGroupCTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500417
418 self.thru_host_stack_setup()
419 if self.vppDebug:
420 self.client_uni_dir_nsock_timeout = 120
421 self.numSockets = "2"
422 else:
423 self.client_uni_dir_nsock_timeout = 120
424 self.numSockets = "5"
425
Dave Wallace45cd3a32018-06-26 01:14:04 -0400426 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
427 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400428 self.loop0.local_ip4,
429 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500430
431 def tearDown(self):
432 self.thru_host_stack_tear_down()
433
Dave Wallace45cd3a32018-06-26 01:14:04 -0400434 super(VCLThruHostStackGroupCTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500435
Dave Wallaced85075e2018-03-02 13:19:30 -0500436 def test_ldp_thru_host_stack_uni_dir_nsock(self):
437 """ run LDP thru host stack uni-directional (multiple sockets) test """
438
439 self.timeout = self.client_uni_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400440 self.thru_host_stack_test("sock_test_server", self.server_args,
441 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500442 self.client_uni_dir_nsock_test_args)
443
444
Dave Wallace45cd3a32018-06-26 01:14:04 -0400445class VCLThruHostStackGroupDTestCase(VCLTestCase):
446 """ VCL Thru Host Stack Group D Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500447
448 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400449 super(VCLThruHostStackGroupDTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500450
451 self.thru_host_stack_setup()
452 if self.vppDebug:
453 self.client_uni_dir_nsock_timeout = 120
454 self.numSockets = "2"
455 else:
456 self.client_uni_dir_nsock_timeout = 120
457 self.numSockets = "5"
458
Dave Wallace45cd3a32018-06-26 01:14:04 -0400459 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
460 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400461 self.loop0.local_ip4,
462 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500463
464 def tearDown(self):
465 self.thru_host_stack_tear_down()
466
Dave Wallace45cd3a32018-06-26 01:14:04 -0400467 super(VCLThruHostStackGroupDTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500468
Dave Wallaced85075e2018-03-02 13:19:30 -0500469 def test_vcl_thru_host_stack_uni_dir_nsock(self):
470 """ run VCL thru host stack uni-directional (multiple sockets) test """
471
472 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700473 self.thru_host_stack_test("vcl_test_server", self.server_args,
474 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500475 self.client_uni_dir_nsock_test_args)
476
477
Dave Wallace816833f2018-03-14 20:01:28 -0400478class VCLThruHostStackIperfTestCase(VCLTestCase):
479 """ VCL Thru Host Stack Iperf Tests """
480
481 def setUp(self):
482 super(VCLThruHostStackIperfTestCase, self).setUp()
483
484 self.thru_host_stack_setup()
485 self.client_iperf3_timeout = 20
Florin Corasab2f6db2018-08-31 14:31:41 -0700486 self.client_iperf3_args = ["-V4d", "-t 5", "-c", self.loop0.local_ip4]
Dave Wallace816833f2018-03-14 20:01:28 -0400487 self.server_iperf3_args = ["-V4d", "-s"]
488
489 def tearDown(self):
490 self.thru_host_stack_tear_down()
491
492 super(VCLThruHostStackIperfTestCase, self).tearDown()
493
494 def test_ldp_thru_host_stack_iperf3(self):
495 """ run LDP thru host stack iperf3 test """
496
497 try:
498 subprocess.check_output(['iperf3', '-v'])
Paul Vinciguerra61e63bf2018-11-24 21:19:38 -0800499 except subprocess.CalledProcessError:
Dave Wallace816833f2018-03-14 20:01:28 -0400500 self.logger.error("WARNING: 'iperf3' is not installed,")
501 self.logger.error(
502 " 'test_ldp_thru_host_stack_iperf3' not run!")
503 return
504
505 self.timeout = self.client_iperf3_timeout
506 self.thru_host_stack_test("iperf3", self.server_iperf3_args,
507 "iperf3", self.client_iperf3_args)
508
509
Dave Wallacede910062018-03-20 09:22:13 -0400510class VCLIpv6CutThruTestCase(VCLTestCase):
511 """ VCL IPv6 Cut Thru Tests """
512
513 def setUp(self):
514 super(VCLIpv6CutThruTestCase, self).setUp()
515
516 self.cut_thru_setup()
517 self.client_iperf3_timeout = 20
518 self.client_uni_dir_nsock_timeout = 60
519 self.client_bi_dir_nsock_timeout = 120
520 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
521 self.server_ipv6_addr,
522 self.server_port]
Florin Corasab2f6db2018-08-31 14:31:41 -0700523 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
524 self.server_ipv6_addr]
Dave Wallacede910062018-03-20 09:22:13 -0400525 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400526 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
527 "-6",
528 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400529 self.server_ipv6_addr,
530 self.server_port]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400531 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
532 "-6",
533 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400534 self.server_ipv6_addr,
535 self.server_port]
536
537 def tearDown(self):
538 self.cut_thru_tear_down()
539
540 super(VCLIpv6CutThruTestCase, self).tearDown()
541
542 def test_ldp_ipv6_cut_thru_echo(self):
543 """ run LDP IPv6 cut thru echo test """
544
Florin Corasab2f6db2018-08-31 14:31:41 -0700545 self.cut_thru_test("sock_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400546 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700547 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400548 self.client_ipv6_echo_test_args)
549
550 def test_ldp_ipv6_cut_thru_iperf3(self):
551 """ run LDP IPv6 cut thru iperf3 test """
552
553 try:
554 subprocess.check_output(['iperf3', '-v'])
555 except:
556 self.logger.error("WARNING: 'iperf3' is not installed,")
557 self.logger.error(
558 " 'test_ldp_ipv6_cut_thru_iperf3' not run!")
559 return
560
561 self.timeout = self.client_iperf3_timeout
562 self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args,
563 "iperf3", self.client_ipv6_iperf3_args)
564
Dave Wallacede910062018-03-20 09:22:13 -0400565 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
566 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
567
568 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700569 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
570 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400571 self.client_ipv6_uni_dir_nsock_test_args)
572
Dave Wallacede910062018-03-20 09:22:13 -0400573 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
574 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
575
576 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700577 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
578 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400579 self.client_ipv6_bi_dir_nsock_test_args)
580
581 def test_vcl_ipv6_cut_thru_echo(self):
582 """ run VCL IPv6 cut thru echo test """
583
Florin Corasab2f6db2018-08-31 14:31:41 -0700584 self.cut_thru_test("vcl_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400585 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700586 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400587 self.client_ipv6_echo_test_args)
588
Dave Wallacede910062018-03-20 09:22:13 -0400589 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
590 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
591
592 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700593 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
594 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400595 self.client_ipv6_uni_dir_nsock_test_args)
596
Dave Wallacede910062018-03-20 09:22:13 -0400597 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
598 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
599
600 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700601 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
602 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400603 self.client_ipv6_bi_dir_nsock_test_args)
604
605
606class VCLIpv6ThruHostStackTestCase(VCLTestCase):
607 """ VCL IPv6 Thru Host Stack Tests """
608
609 def setUp(self):
610 super(VCLIpv6ThruHostStackTestCase, self).setUp()
611
612 self.thru_host_stack_ipv6_setup()
613 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
614 self.loop0.local_ip6,
615 self.server_port]
616
617 def tearDown(self):
618 self.thru_host_stack_ipv6_tear_down()
619
620 super(VCLIpv6ThruHostStackTestCase, self).tearDown()
621
622 def test_ldp_ipv6_thru_host_stack_echo(self):
623 """ run LDP IPv6 thru host stack echo test """
624
Florin Corasab2f6db2018-08-31 14:31:41 -0700625 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200626 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700627 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400628 self.client_ipv6_echo_test_args)
629 # TBD: Remove these when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700630 self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200631 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700632 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400633 self.client_ipv6_echo_test_args)
634
635 def test_vcl_ipv6_thru_host_stack_echo(self):
636 """ run VCL IPv6 thru host stack echo test """
637
Florin Corasab2f6db2018-08-31 14:31:41 -0700638# self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200639# self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700640# "vcl_test_client",
Keith Burns (alagalah)410bcca2018-03-23 13:42:49 -0700641# self.client_ipv6_echo_test_args)
Dave Wallacede910062018-03-20 09:22:13 -0400642
Dave Wallace45cd3a32018-06-26 01:14:04 -0400643 # TBD: Remove VCLIpv6ThruHostStackGroup*TestCase classes and move
Dave Wallacede910062018-03-20 09:22:13 -0400644 # tests here when VPP thru host teardown/setup config bug
645 # is fixed.
646
647
Dave Wallace45cd3a32018-06-26 01:14:04 -0400648class VCLIpv6ThruHostStackGroupATestCase(VCLTestCase):
649 """ VCL IPv6 Thru Host Stack Group A Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400650
651 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400652 super(VCLIpv6ThruHostStackGroupATestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400653
654 self.thru_host_stack_ipv6_setup()
655 if self.vppDebug:
656 self.client_bi_dir_nsock_timeout = 120
Dave Wallace45cd3a32018-06-26 01:14:04 -0400657 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
658 "-B", "-X", "-6",
659 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400660 self.loop0.local_ip6,
661 self.server_port]
662 else:
663 self.client_bi_dir_nsock_timeout = 90
Dave Wallace45cd3a32018-06-26 01:14:04 -0400664 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
665 "-B", "-X", "-6",
666 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400667 self.loop0.local_ip6,
668 self.server_port]
669
670 def tearDown(self):
671 self.thru_host_stack_ipv6_tear_down()
672
Dave Wallace45cd3a32018-06-26 01:14:04 -0400673 super(VCLIpv6ThruHostStackGroupATestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400674
Dave Wallacede910062018-03-20 09:22:13 -0400675 def test_vcl_thru_host_stack_bi_dir_nsock(self):
676 """ run VCL thru host stack bi-directional (multiple sockets) test """
677
678 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700679 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
680 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400681 self.client_ipv6_bi_dir_nsock_test_args)
682
683
Dave Wallace45cd3a32018-06-26 01:14:04 -0400684class VCLIpv6ThruHostStackGroupBTestCase(VCLTestCase):
685 """ VCL IPv6 Thru Host Stack Group B Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400686
687 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400688 super(VCLIpv6ThruHostStackGroupBTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400689
690 self.thru_host_stack_ipv6_setup()
691 if self.vppDebug:
692 self.client_bi_dir_nsock_timeout = 120
Dave Wallace45cd3a32018-06-26 01:14:04 -0400693 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
694 "-B", "-X", "-6",
695 # OUCH! Host Stack Bug?
696 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400697 self.loop0.local_ip6,
698 self.server_port]
699 else:
700 self.client_bi_dir_nsock_timeout = 60
Dave Wallace45cd3a32018-06-26 01:14:04 -0400701 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
702 "-B", "-X", "-6",
703 # OUCH! Host Stack Bug?
704 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400705 self.loop0.local_ip6,
706 self.server_port]
707
708 def tearDown(self):
709 self.thru_host_stack_ipv6_tear_down()
710
Dave Wallace45cd3a32018-06-26 01:14:04 -0400711 super(VCLIpv6ThruHostStackGroupBTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400712
Dave Wallacede910062018-03-20 09:22:13 -0400713 def test_ldp_thru_host_stack_bi_dir_nsock(self):
714 """ run LDP thru host stack bi-directional (multiple sockets) test """
715
716 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700717 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200718 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700719 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400720 self.client_ipv6_bi_dir_nsock_test_args)
721
722
Dave Wallace45cd3a32018-06-26 01:14:04 -0400723class VCLIpv6ThruHostStackGroupCTestCase(VCLTestCase):
724 """ VCL IPv6 Thru Host Stack Group C Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400725
726 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400727 super(VCLIpv6ThruHostStackGroupCTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400728
729 self.thru_host_stack_ipv6_setup()
730 if self.vppDebug:
731 self.client_uni_dir_nsock_timeout = 120
732 self.numSockets = "2"
733 else:
734 self.client_uni_dir_nsock_timeout = 120
735 self.numSockets = "5"
736
Dave Wallace45cd3a32018-06-26 01:14:04 -0400737 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
738 "-6",
Dave Wallacede910062018-03-20 09:22:13 -0400739 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400740 self.loop0.local_ip6,
741 self.server_port]
742
743 def tearDown(self):
744 self.thru_host_stack_ipv6_tear_down()
745
Dave Wallace45cd3a32018-06-26 01:14:04 -0400746 super(VCLIpv6ThruHostStackGroupCTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400747
Dave Wallacede910062018-03-20 09:22:13 -0400748 def test_ldp_thru_host_stack_uni_dir_nsock(self):
749 """ run LDP thru host stack uni-directional (multiple sockets) test """
750
751 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700752 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200753 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700754 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400755 self.client_ipv6_uni_dir_nsock_test_args)
756
757
Dave Wallace45cd3a32018-06-26 01:14:04 -0400758class VCLIpv6ThruHostStackGroupDTestCase(VCLTestCase):
759 """ VCL IPv6 Thru Host Stack Group D Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400760
761 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400762 super(VCLIpv6ThruHostStackGroupDTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400763
764 self.thru_host_stack_ipv6_setup()
765 if self.vppDebug:
766 self.client_uni_dir_nsock_timeout = 120
767 self.numSockets = "2"
768 else:
769 self.client_uni_dir_nsock_timeout = 120
770 self.numSockets = "5"
771
Dave Wallace45cd3a32018-06-26 01:14:04 -0400772 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
773 "-6",
Dave Wallacede910062018-03-20 09:22:13 -0400774 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400775 self.loop0.local_ip6,
776 self.server_port]
777
778 def tearDown(self):
779 self.thru_host_stack_ipv6_tear_down()
780
Dave Wallace45cd3a32018-06-26 01:14:04 -0400781 super(VCLIpv6ThruHostStackGroupDTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400782
Dave Wallacede910062018-03-20 09:22:13 -0400783 def test_vcl_thru_host_stack_uni_dir_nsock(self):
784 """ run VCL thru host stack uni-directional (multiple sockets) test """
785
786 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700787 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
788 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400789 self.client_ipv6_uni_dir_nsock_test_args)
790
791
792class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase):
793 """ VCL IPv6 Thru Host Stack Iperf Tests """
794
795 def setUp(self):
796 super(VCLIpv6ThruHostStackIperfTestCase, self).setUp()
797
798 self.thru_host_stack_ipv6_setup()
799 self.client_iperf3_timeout = 20
Florin Corasab2f6db2018-08-31 14:31:41 -0700800 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
801 self.loop0.local_ip6]
Dave Wallacede910062018-03-20 09:22:13 -0400802 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
803
804 def tearDown(self):
805 self.thru_host_stack_ipv6_tear_down()
806
807 super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown()
808
809 def test_ldp_thru_host_stack_iperf3(self):
810 """ run LDP thru host stack iperf3 test """
811
812 try:
813 subprocess.check_output(['iperf3', '-v'])
Paul Vinciguerra61e63bf2018-11-24 21:19:38 -0800814 except subprocess.CalledProcessError:
Dave Wallacede910062018-03-20 09:22:13 -0400815 self.logger.error("WARNING: 'iperf3' is not installed,")
816 self.logger.error(
817 " 'test_ldp_thru_host_stack_iperf3' not run!")
818 return
819
820 self.timeout = self.client_iperf3_timeout
821 self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args,
822 "iperf3", self.client_ipv6_iperf3_args)
823
824
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500825if __name__ == '__main__':
826 unittest.main(testRunner=VppTestRunner)