blob: d65dc9f0c8eb4ee2f560408a9999e471e388ea03 [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):
Klement Sekerab8c72a42018-11-08 11:21:39 +010036 var = "VPP_BUILD_DIR"
Dave Wallaced85075e2018-03-02 13:19:30 -050037 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()
Florin Coras0ae445e2018-11-29 18:22:10 -080064 self.sleep(0.3)
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()
Florin Coras0ae445e2018-11-29 18:22:10 -0800174 self.sleep(0.3)
Dave Wallace42996c02018-02-26 14:40:13 -0500175
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
Florin Coras0ae445e2018-11-29 18:22:10 -0800215class LDPCutThruTestCase(VCLTestCase):
216 """ LDP Cut Thru Tests """
Dave Wallace9f11c012018-02-28 17:55:23 -0500217
218 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800219 super(LDPCutThruTestCase, self).setUp()
Dave Wallace9f11c012018-02-28 17:55:23 -0500220
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"]
Florin Coras2eb42e72018-11-29 00:39:53 -0800227 self.client_uni_dir_nsock_timeout = 20
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]
Florin Coras2eb42e72018-11-29 00:39:53 -0800232 self.client_bi_dir_nsock_timeout = 20
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
Florin Coras0ae445e2018-11-29 18:22:10 -0800241 super(LDPCutThruTestCase, self).tearDown()
Dave Wallace9f11c012018-02-28 17:55:23 -0500242
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
Florin Coras0ae445e2018-11-29 18:22:10 -0800279
280class VCLCutThruTestCase(VCLTestCase):
281 """ VCL Cut Thru Tests """
282
283 def setUp(self):
284 super(VCLCutThruTestCase, self).setUp()
285
286 self.cut_thru_setup()
287 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
288 self.server_addr, self.server_port]
289
290 self.client_uni_dir_nsock_timeout = 20
291 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
292 "-I", "2",
293 self.server_addr,
294 self.server_port]
295 self.client_bi_dir_nsock_timeout = 20
296 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
297 "-I", "2",
298 self.server_addr,
299 self.server_port]
300
301 def tearDown(self):
302 self.cut_thru_tear_down()
303
304 super(VCLCutThruTestCase, self).tearDown()
305
Dave Wallace9f11c012018-02-28 17:55:23 -0500306 def test_vcl_cut_thru_echo(self):
307 """ run VCL cut thru echo test """
308
Florin Corasab2f6db2018-08-31 14:31:41 -0700309 self.cut_thru_test("vcl_test_server", self.server_args,
310 "vcl_test_client", self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500311
Dave Wallaced85075e2018-03-02 13:19:30 -0500312 def test_vcl_cut_thru_uni_dir_nsock(self):
313 """ run VCL cut thru uni-directional (multiple sockets) test """
314
315 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700316 self.cut_thru_test("vcl_test_server", self.server_args,
317 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500318 self.client_uni_dir_nsock_test_args)
319
Dave Wallaced85075e2018-03-02 13:19:30 -0500320 def test_vcl_cut_thru_bi_dir_nsock(self):
321 """ run VCL cut thru bi-directional (multiple sockets) test """
322
323 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700324 self.cut_thru_test("vcl_test_server", self.server_args,
325 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500326 self.client_bi_dir_nsock_test_args)
327
Dave Wallace9f11c012018-02-28 17:55:23 -0500328
Dave Wallace816833f2018-03-14 20:01:28 -0400329class VCLThruHostStackTestCase(VCLTestCase):
Dave Wallace9f11c012018-02-28 17:55:23 -0500330 """ VCL Thru Host Stack Tests """
331
332 def setUp(self):
333 super(VCLThruHostStackTestCase, self).setUp()
334
335 self.thru_host_stack_setup()
Dave Wallacede910062018-03-20 09:22:13 -0400336 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
337 self.loop0.local_ip4,
338 self.server_port]
Dave Wallace9f11c012018-02-28 17:55:23 -0500339
340 def tearDown(self):
341 self.thru_host_stack_tear_down()
342
343 super(VCLThruHostStackTestCase, self).tearDown()
344
345 def test_ldp_thru_host_stack_echo(self):
346 """ run LDP thru host stack echo test """
347
Florin Corasab2f6db2018-08-31 14:31:41 -0700348 self.thru_host_stack_test("sock_test_server", self.server_args,
349 "sock_test_client",
Dave Wallace9f11c012018-02-28 17:55:23 -0500350 self.client_echo_test_args)
Dave Wallaced85075e2018-03-02 13:19:30 -0500351 # TBD: Remove these when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700352 self.thru_host_stack_test("vcl_test_server", self.server_args,
353 "vcl_test_client",
Dave Wallace9f11c012018-02-28 17:55:23 -0500354 self.client_echo_test_args)
355
356 def test_vcl_thru_host_stack_echo(self):
357 """ run VCL thru host stack echo test """
358
Dave Wallaced85075e2018-03-02 13:19:30 -0500359 # TBD: Enable this when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700360 # self.thru_host_stack_test("vcl_test_server", self.server_args,
361 # "vcl_test_client",
Keith Burns (alagalah)410bcca2018-03-23 13:42:49 -0700362 # self.client_echo_test_args)
Dave Wallace9f11c012018-02-28 17:55:23 -0500363
Dave Wallace45cd3a32018-06-26 01:14:04 -0400364 # TBD: Remove VCLThruHostStackGroup*TestCase classes and move
Dave Wallaced85075e2018-03-02 13:19:30 -0500365 # tests here when VPP thru host teardown/setup config bug
366 # is fixed.
367
368
Florin Coras0e88e852018-09-17 22:09:02 -0700369class VCLThruHostStackNSessionBidirTestCase(VCLTestCase):
370 """ VCL Thru Host Stack NSession Bidir Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500371
372 def setUp(self):
Florin Coras0e88e852018-09-17 22:09:02 -0700373 super(VCLThruHostStackNSessionBidirTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500374
375 self.thru_host_stack_setup()
376 if self.vppDebug:
Florin Corasd85de682018-11-29 17:02:29 -0800377 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400378 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
379 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400380 self.loop0.local_ip4,
381 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500382 else:
Florin Corasd85de682018-11-29 17:02:29 -0800383 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400384 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
385 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400386 self.loop0.local_ip4,
387 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500388
389 def tearDown(self):
390 self.thru_host_stack_tear_down()
391
Florin Coras0e88e852018-09-17 22:09:02 -0700392 super(VCLThruHostStackNSessionBidirTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500393
Dave Wallaced85075e2018-03-02 13:19:30 -0500394 def test_vcl_thru_host_stack_bi_dir_nsock(self):
395 """ run VCL thru host stack bi-directional (multiple sockets) test """
396
397 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700398 self.thru_host_stack_test("vcl_test_server", self.server_args,
399 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500400 self.client_bi_dir_nsock_test_args)
401
402
Dave Wallace45cd3a32018-06-26 01:14:04 -0400403class VCLThruHostStackGroupBTestCase(VCLTestCase):
404 """ VCL Thru Host Stack Group B Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500405
406 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400407 super(VCLThruHostStackGroupBTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500408
409 self.thru_host_stack_setup()
410 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800411 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400412 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
413 # OUCH! Host Stack Bug?
414 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400415 self.loop0.local_ip4,
416 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500417 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800418 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400419 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
420 # OUCH! Host Stack Bug?
421 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400422 self.loop0.local_ip4,
423 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500424
425 def tearDown(self):
426 self.thru_host_stack_tear_down()
427
Dave Wallace45cd3a32018-06-26 01:14:04 -0400428 super(VCLThruHostStackGroupBTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500429
Dave Wallaced85075e2018-03-02 13:19:30 -0500430 def test_ldp_thru_host_stack_bi_dir_nsock(self):
431 """ run LDP thru host stack bi-directional (multiple sockets) test """
432
433 self.timeout = self.client_bi_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400434 self.thru_host_stack_test("sock_test_server", self.server_args,
435 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500436 self.client_bi_dir_nsock_test_args)
437
438
Dave Wallace45cd3a32018-06-26 01:14:04 -0400439class VCLThruHostStackGroupCTestCase(VCLTestCase):
440 """ VCL Thru Host Stack Group C Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500441
442 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400443 super(VCLThruHostStackGroupCTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500444
445 self.thru_host_stack_setup()
446 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800447 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500448 self.numSockets = "2"
449 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800450 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500451 self.numSockets = "5"
452
Dave Wallace45cd3a32018-06-26 01:14:04 -0400453 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
454 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400455 self.loop0.local_ip4,
456 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500457
458 def tearDown(self):
459 self.thru_host_stack_tear_down()
460
Dave Wallace45cd3a32018-06-26 01:14:04 -0400461 super(VCLThruHostStackGroupCTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500462
Dave Wallaced85075e2018-03-02 13:19:30 -0500463 def test_ldp_thru_host_stack_uni_dir_nsock(self):
464 """ run LDP thru host stack uni-directional (multiple sockets) test """
465
466 self.timeout = self.client_uni_dir_nsock_timeout
Dave Wallace816833f2018-03-14 20:01:28 -0400467 self.thru_host_stack_test("sock_test_server", self.server_args,
468 "sock_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500469 self.client_uni_dir_nsock_test_args)
470
471
Dave Wallace45cd3a32018-06-26 01:14:04 -0400472class VCLThruHostStackGroupDTestCase(VCLTestCase):
473 """ VCL Thru Host Stack Group D Tests """
Dave Wallaced85075e2018-03-02 13:19:30 -0500474
475 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400476 super(VCLThruHostStackGroupDTestCase, self).setUp()
Dave Wallaced85075e2018-03-02 13:19:30 -0500477
478 self.thru_host_stack_setup()
479 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800480 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500481 self.numSockets = "2"
482 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800483 self.client_uni_dir_nsock_timeout = 20
Dave Wallaced85075e2018-03-02 13:19:30 -0500484 self.numSockets = "5"
485
Dave Wallace45cd3a32018-06-26 01:14:04 -0400486 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
487 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400488 self.loop0.local_ip4,
489 self.server_port]
Dave Wallaced85075e2018-03-02 13:19:30 -0500490
491 def tearDown(self):
492 self.thru_host_stack_tear_down()
493
Dave Wallace45cd3a32018-06-26 01:14:04 -0400494 super(VCLThruHostStackGroupDTestCase, self).tearDown()
Dave Wallaced85075e2018-03-02 13:19:30 -0500495
Dave Wallaced85075e2018-03-02 13:19:30 -0500496 def test_vcl_thru_host_stack_uni_dir_nsock(self):
497 """ run VCL thru host stack uni-directional (multiple sockets) test """
498
499 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700500 self.thru_host_stack_test("vcl_test_server", self.server_args,
501 "vcl_test_client",
Dave Wallaced85075e2018-03-02 13:19:30 -0500502 self.client_uni_dir_nsock_test_args)
503
504
Dave Wallace816833f2018-03-14 20:01:28 -0400505class VCLThruHostStackIperfTestCase(VCLTestCase):
506 """ VCL Thru Host Stack Iperf Tests """
507
508 def setUp(self):
509 super(VCLThruHostStackIperfTestCase, self).setUp()
510
511 self.thru_host_stack_setup()
512 self.client_iperf3_timeout = 20
Florin Corasab2f6db2018-08-31 14:31:41 -0700513 self.client_iperf3_args = ["-V4d", "-t 5", "-c", self.loop0.local_ip4]
Dave Wallace816833f2018-03-14 20:01:28 -0400514 self.server_iperf3_args = ["-V4d", "-s"]
515
516 def tearDown(self):
517 self.thru_host_stack_tear_down()
518
519 super(VCLThruHostStackIperfTestCase, self).tearDown()
520
521 def test_ldp_thru_host_stack_iperf3(self):
522 """ run LDP thru host stack iperf3 test """
523
524 try:
525 subprocess.check_output(['iperf3', '-v'])
Paul Vinciguerra61e63bf2018-11-24 21:19:38 -0800526 except subprocess.CalledProcessError:
Dave Wallace816833f2018-03-14 20:01:28 -0400527 self.logger.error("WARNING: 'iperf3' is not installed,")
528 self.logger.error(
529 " 'test_ldp_thru_host_stack_iperf3' not run!")
530 return
531
532 self.timeout = self.client_iperf3_timeout
533 self.thru_host_stack_test("iperf3", self.server_iperf3_args,
534 "iperf3", self.client_iperf3_args)
535
536
Florin Coras0ae445e2018-11-29 18:22:10 -0800537class LDPIpv6CutThruTestCase(VCLTestCase):
538 """ LDP IPv6 Cut Thru Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400539
540 def setUp(self):
Florin Coras0ae445e2018-11-29 18:22:10 -0800541 super(LDPIpv6CutThruTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400542
543 self.cut_thru_setup()
544 self.client_iperf3_timeout = 20
Florin Coras2eb42e72018-11-29 00:39:53 -0800545 self.client_uni_dir_nsock_timeout = 20
546 self.client_bi_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400547 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
548 self.server_ipv6_addr,
549 self.server_port]
Florin Corasab2f6db2018-08-31 14:31:41 -0700550 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
551 self.server_ipv6_addr]
Dave Wallacede910062018-03-20 09:22:13 -0400552 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400553 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
554 "-6",
555 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400556 self.server_ipv6_addr,
557 self.server_port]
Dave Wallace45cd3a32018-06-26 01:14:04 -0400558 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
559 "-6",
560 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400561 self.server_ipv6_addr,
562 self.server_port]
563
564 def tearDown(self):
565 self.cut_thru_tear_down()
566
Florin Coras0ae445e2018-11-29 18:22:10 -0800567 super(LDPIpv6CutThruTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400568
569 def test_ldp_ipv6_cut_thru_echo(self):
570 """ run LDP IPv6 cut thru echo test """
571
Florin Corasab2f6db2018-08-31 14:31:41 -0700572 self.cut_thru_test("sock_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400573 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700574 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400575 self.client_ipv6_echo_test_args)
576
577 def test_ldp_ipv6_cut_thru_iperf3(self):
578 """ run LDP IPv6 cut thru iperf3 test """
579
580 try:
581 subprocess.check_output(['iperf3', '-v'])
582 except:
583 self.logger.error("WARNING: 'iperf3' is not installed,")
584 self.logger.error(
585 " 'test_ldp_ipv6_cut_thru_iperf3' not run!")
586 return
587
588 self.timeout = self.client_iperf3_timeout
589 self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args,
590 "iperf3", self.client_ipv6_iperf3_args)
591
Dave Wallacede910062018-03-20 09:22:13 -0400592 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
593 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
594
595 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700596 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
597 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400598 self.client_ipv6_uni_dir_nsock_test_args)
599
Dave Wallacede910062018-03-20 09:22:13 -0400600 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
601 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
602
603 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700604 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
605 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400606 self.client_ipv6_bi_dir_nsock_test_args)
607
Florin Coras0ae445e2018-11-29 18:22:10 -0800608
609class VCLIpv6CutThruTestCase(VCLTestCase):
610 """ VCL IPv6 Cut Thru Tests """
611
612 def setUp(self):
613 super(VCLIpv6CutThruTestCase, self).setUp()
614
615 self.cut_thru_setup()
616 self.client_uni_dir_nsock_timeout = 20
617 self.client_bi_dir_nsock_timeout = 20
618 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
619 self.server_ipv6_addr,
620 self.server_port]
621 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
622 "-6",
623 "-I", "2",
624 self.server_ipv6_addr,
625 self.server_port]
626 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
627 "-6",
628 "-I", "2",
629 self.server_ipv6_addr,
630 self.server_port]
631
632 def tearDown(self):
633 self.cut_thru_tear_down()
634
635 super(VCLIpv6CutThruTestCase, self).tearDown()
636
Dave Wallacede910062018-03-20 09:22:13 -0400637 def test_vcl_ipv6_cut_thru_echo(self):
638 """ run VCL IPv6 cut thru echo test """
639
Florin Corasab2f6db2018-08-31 14:31:41 -0700640 self.cut_thru_test("vcl_test_server",
Dave Wallacede910062018-03-20 09:22:13 -0400641 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700642 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400643 self.client_ipv6_echo_test_args)
644
Dave Wallacede910062018-03-20 09:22:13 -0400645 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
646 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
647
648 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700649 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
650 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400651 self.client_ipv6_uni_dir_nsock_test_args)
652
Dave Wallacede910062018-03-20 09:22:13 -0400653 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
654 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
655
656 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700657 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
658 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400659 self.client_ipv6_bi_dir_nsock_test_args)
660
661
662class VCLIpv6ThruHostStackTestCase(VCLTestCase):
663 """ VCL IPv6 Thru Host Stack Tests """
664
665 def setUp(self):
666 super(VCLIpv6ThruHostStackTestCase, self).setUp()
667
668 self.thru_host_stack_ipv6_setup()
669 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
670 self.loop0.local_ip6,
671 self.server_port]
672
673 def tearDown(self):
674 self.thru_host_stack_ipv6_tear_down()
675
676 super(VCLIpv6ThruHostStackTestCase, self).tearDown()
677
678 def test_ldp_ipv6_thru_host_stack_echo(self):
679 """ run LDP IPv6 thru host stack echo test """
680
Florin Corasab2f6db2018-08-31 14:31:41 -0700681 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200682 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700683 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400684 self.client_ipv6_echo_test_args)
685 # TBD: Remove these when VPP thru host teardown config bug is fixed.
Florin Corasab2f6db2018-08-31 14:31:41 -0700686 self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200687 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700688 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400689 self.client_ipv6_echo_test_args)
690
691 def test_vcl_ipv6_thru_host_stack_echo(self):
692 """ run VCL IPv6 thru host stack echo test """
693
Florin Corasab2f6db2018-08-31 14:31:41 -0700694# self.thru_host_stack_test("vcl_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200695# self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700696# "vcl_test_client",
Keith Burns (alagalah)410bcca2018-03-23 13:42:49 -0700697# self.client_ipv6_echo_test_args)
Dave Wallacede910062018-03-20 09:22:13 -0400698
Dave Wallace45cd3a32018-06-26 01:14:04 -0400699 # TBD: Remove VCLIpv6ThruHostStackGroup*TestCase classes and move
Dave Wallacede910062018-03-20 09:22:13 -0400700 # tests here when VPP thru host teardown/setup config bug
701 # is fixed.
702
703
Dave Wallace45cd3a32018-06-26 01:14:04 -0400704class VCLIpv6ThruHostStackGroupATestCase(VCLTestCase):
705 """ VCL IPv6 Thru Host Stack Group A Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400706
707 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400708 super(VCLIpv6ThruHostStackGroupATestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400709
710 self.thru_host_stack_ipv6_setup()
711 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800712 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400713 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
714 "-B", "-X", "-6",
715 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400716 self.loop0.local_ip6,
717 self.server_port]
718 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800719 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400720 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
721 "-B", "-X", "-6",
722 "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400723 self.loop0.local_ip6,
724 self.server_port]
725
726 def tearDown(self):
727 self.thru_host_stack_ipv6_tear_down()
728
Dave Wallace45cd3a32018-06-26 01:14:04 -0400729 super(VCLIpv6ThruHostStackGroupATestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400730
Dave Wallacede910062018-03-20 09:22:13 -0400731 def test_vcl_thru_host_stack_bi_dir_nsock(self):
732 """ run VCL thru host stack bi-directional (multiple sockets) test """
733
734 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700735 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
736 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400737 self.client_ipv6_bi_dir_nsock_test_args)
738
739
Dave Wallace45cd3a32018-06-26 01:14:04 -0400740class VCLIpv6ThruHostStackGroupBTestCase(VCLTestCase):
741 """ VCL IPv6 Thru Host Stack Group B Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400742
743 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400744 super(VCLIpv6ThruHostStackGroupBTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400745
746 self.thru_host_stack_ipv6_setup()
747 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800748 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400749 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
750 "-B", "-X", "-6",
751 # OUCH! Host Stack Bug?
752 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400753 self.loop0.local_ip6,
754 self.server_port]
755 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800756 self.client_bi_dir_nsock_timeout = 20
Dave Wallace45cd3a32018-06-26 01:14:04 -0400757 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
758 "-B", "-X", "-6",
759 # OUCH! Host Stack Bug?
760 # "-I", "2",
Dave Wallacede910062018-03-20 09:22:13 -0400761 self.loop0.local_ip6,
762 self.server_port]
763
764 def tearDown(self):
765 self.thru_host_stack_ipv6_tear_down()
766
Dave Wallace45cd3a32018-06-26 01:14:04 -0400767 super(VCLIpv6ThruHostStackGroupBTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400768
Dave Wallacede910062018-03-20 09:22:13 -0400769 def test_ldp_thru_host_stack_bi_dir_nsock(self):
770 """ run LDP thru host stack bi-directional (multiple sockets) test """
771
772 self.timeout = self.client_bi_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700773 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200774 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700775 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400776 self.client_ipv6_bi_dir_nsock_test_args)
777
778
Dave Wallace45cd3a32018-06-26 01:14:04 -0400779class VCLIpv6ThruHostStackGroupCTestCase(VCLTestCase):
780 """ VCL IPv6 Thru Host Stack Group C Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400781
782 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400783 super(VCLIpv6ThruHostStackGroupCTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400784
785 self.thru_host_stack_ipv6_setup()
786 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800787 self.client_uni_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400788 self.numSockets = "2"
789 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800790 self.client_uni_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400791 self.numSockets = "5"
792
Dave Wallace45cd3a32018-06-26 01:14:04 -0400793 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
794 "-6",
Dave Wallacede910062018-03-20 09:22:13 -0400795 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400796 self.loop0.local_ip6,
797 self.server_port]
798
799 def tearDown(self):
800 self.thru_host_stack_ipv6_tear_down()
801
Dave Wallace45cd3a32018-06-26 01:14:04 -0400802 super(VCLIpv6ThruHostStackGroupCTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400803
Dave Wallacede910062018-03-20 09:22:13 -0400804 def test_ldp_thru_host_stack_uni_dir_nsock(self):
805 """ run LDP thru host stack uni-directional (multiple sockets) test """
806
807 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700808 self.thru_host_stack_test("sock_test_server",
Damjan Marion855e2682018-08-24 13:37:45 +0200809 self.server_ipv6_args,
Florin Corasab2f6db2018-08-31 14:31:41 -0700810 "sock_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400811 self.client_ipv6_uni_dir_nsock_test_args)
812
813
Dave Wallace45cd3a32018-06-26 01:14:04 -0400814class VCLIpv6ThruHostStackGroupDTestCase(VCLTestCase):
815 """ VCL IPv6 Thru Host Stack Group D Tests """
Dave Wallacede910062018-03-20 09:22:13 -0400816
817 def setUp(self):
Dave Wallace45cd3a32018-06-26 01:14:04 -0400818 super(VCLIpv6ThruHostStackGroupDTestCase, self).setUp()
Dave Wallacede910062018-03-20 09:22:13 -0400819
820 self.thru_host_stack_ipv6_setup()
821 if self.vppDebug:
Florin Coras2eb42e72018-11-29 00:39:53 -0800822 self.client_uni_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400823 self.numSockets = "2"
824 else:
Florin Coras2eb42e72018-11-29 00:39:53 -0800825 self.client_uni_dir_nsock_timeout = 20
Dave Wallacede910062018-03-20 09:22:13 -0400826 self.numSockets = "5"
827
Dave Wallace45cd3a32018-06-26 01:14:04 -0400828 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
829 "-6",
Dave Wallacede910062018-03-20 09:22:13 -0400830 "-I", self.numSockets,
Dave Wallacede910062018-03-20 09:22:13 -0400831 self.loop0.local_ip6,
832 self.server_port]
833
834 def tearDown(self):
835 self.thru_host_stack_ipv6_tear_down()
836
Dave Wallace45cd3a32018-06-26 01:14:04 -0400837 super(VCLIpv6ThruHostStackGroupDTestCase, self).tearDown()
Dave Wallacede910062018-03-20 09:22:13 -0400838
Dave Wallacede910062018-03-20 09:22:13 -0400839 def test_vcl_thru_host_stack_uni_dir_nsock(self):
840 """ run VCL thru host stack uni-directional (multiple sockets) test """
841
842 self.timeout = self.client_uni_dir_nsock_timeout
Florin Corasab2f6db2018-08-31 14:31:41 -0700843 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
844 "vcl_test_client",
Dave Wallacede910062018-03-20 09:22:13 -0400845 self.client_ipv6_uni_dir_nsock_test_args)
846
847
848class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase):
849 """ VCL IPv6 Thru Host Stack Iperf Tests """
850
851 def setUp(self):
852 super(VCLIpv6ThruHostStackIperfTestCase, self).setUp()
853
854 self.thru_host_stack_ipv6_setup()
855 self.client_iperf3_timeout = 20
Florin Corasab2f6db2018-08-31 14:31:41 -0700856 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
857 self.loop0.local_ip6]
Dave Wallacede910062018-03-20 09:22:13 -0400858 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
859
860 def tearDown(self):
861 self.thru_host_stack_ipv6_tear_down()
862
863 super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown()
864
865 def test_ldp_thru_host_stack_iperf3(self):
866 """ run LDP thru host stack iperf3 test """
867
868 try:
869 subprocess.check_output(['iperf3', '-v'])
Paul Vinciguerra61e63bf2018-11-24 21:19:38 -0800870 except subprocess.CalledProcessError:
Dave Wallacede910062018-03-20 09:22:13 -0400871 self.logger.error("WARNING: 'iperf3' is not installed,")
872 self.logger.error(
873 " 'test_ldp_thru_host_stack_iperf3' not run!")
874 return
875
876 self.timeout = self.client_iperf3_timeout
877 self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args,
878 "iperf3", self.client_ipv6_iperf3_args)
879
880
Dave Wallacecfcf2f42018-02-16 18:31:56 -0500881if __name__ == '__main__':
882 unittest.main(testRunner=VppTestRunner)