8 from framework import VppTestCase, VppTestRunner, running_extended_tests, \
10 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, DpoProto
13 class VCLAppWorker(Worker):
14 """ VCL Test Application Worker """
16 def __init__(self, build_dir, appname, args, logger, env={}):
17 vcl_lib_dir = "%s/vpp/.libs" % build_dir
18 if "iperf" in appname:
20 env.update({'LD_PRELOAD':
21 "%s/libvcl_ldpreload.so.0.0.0" % vcl_lib_dir})
23 app = "%s/%s" % (vcl_lib_dir, appname)
24 if not os.path.isfile(app):
25 app = "%s/vpp/%s" % (build_dir, appname)
26 env.update({'LD_PRELOAD':
27 "%s/libvcl_ldpreload.so.0.0.0" % vcl_lib_dir})
28 self.args = [app] + args
29 super(VCLAppWorker, self).__init__(self.args, logger, env)
32 class VCLTestCase(VppTestCase):
33 """ VCL Test Class """
35 def __init__(self, methodName):
36 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
41 self.server_addr = "127.0.0.1"
42 self.server_port = "22000"
43 self.server_args = [self.server_port]
44 self.server_ipv6_addr = "::1"
45 self.server_ipv6_args = ["-6", self.server_port]
47 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
49 super(VCLTestCase, self).__init__(methodName)
51 def cut_thru_setup(self):
52 self.vapi.session_enable_disable(is_enabled=1)
54 def cut_thru_tear_down(self):
55 self.vapi.session_enable_disable(is_enabled=0)
57 def cut_thru_test(self, server_app, server_args, client_app, client_args):
58 self.env = {'VCL_API_PREFIX': self.shm_prefix,
59 'VCL_APP_SCOPE_LOCAL': "true"}
61 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
62 self.logger, self.env)
65 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
66 self.logger, self.env)
68 worker_client.join(self.timeout)
70 self.validateResults(worker_client, worker_server, self.timeout)
71 except Exception as error:
72 self.fail("Failed with %s" % error)
74 def thru_host_stack_setup(self):
75 self.vapi.session_enable_disable(is_enabled=1)
76 self.create_loopback_interfaces(2)
80 for i in self.lo_interfaces:
84 tbl = VppIpTable(self, table_id)
87 i.set_table_ip4(table_id)
91 # Configure namespaces
92 self.vapi.app_namespace_add(namespace_id="1", secret=1234,
93 sw_if_index=self.loop0.sw_if_index)
94 self.vapi.app_namespace_add(namespace_id="2", secret=5678,
95 sw_if_index=self.loop1.sw_if_index)
97 # Add inter-table routes
98 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
99 [VppRoutePath("0.0.0.0",
101 nh_table_id=2)], table_id=1)
102 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
103 [VppRoutePath("0.0.0.0",
105 nh_table_id=1)], table_id=2)
106 ip_t01.add_vpp_config()
107 ip_t10.add_vpp_config()
108 self.logger.debug(self.vapi.cli("show ip fib"))
110 def thru_host_stack_tear_down(self):
111 for i in self.lo_interfaces:
116 self.vapi.session_enable_disable(is_enabled=0)
118 def thru_host_stack_ipv6_setup(self):
119 self.vapi.session_enable_disable(is_enabled=1)
120 self.create_loopback_interfaces(2)
124 for i in self.lo_interfaces:
127 tbl = VppIpTable(self, table_id, is_ip6=1)
130 i.set_table_ip6(table_id)
134 # Configure namespaces
135 self.vapi.app_namespace_add(namespace_id="1", secret=1234,
136 sw_if_index=self.loop0.sw_if_index)
137 self.vapi.app_namespace_add(namespace_id="2", secret=5678,
138 sw_if_index=self.loop1.sw_if_index)
140 # Add inter-table routes
141 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
142 [VppRoutePath("::0", 0xffffffff,
144 proto=DpoProto.DPO_PROTO_IP6)],
145 table_id=1, is_ip6=1)
146 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
147 [VppRoutePath("::0", 0xffffffff,
149 proto=DpoProto.DPO_PROTO_IP6)],
150 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"))
156 def thru_host_stack_ipv6_tear_down(self):
157 for i in self.lo_interfaces:
162 self.vapi.session_enable_disable(is_enabled=0)
164 def thru_host_stack_test(self, server_app, server_args,
165 client_app, client_args):
166 self.env = {'VCL_API_PREFIX': self.shm_prefix,
167 'VCL_APP_SCOPE_GLOBAL': "true",
168 'VCL_APP_NAMESPACE_ID': "1",
169 'VCL_APP_NAMESPACE_SECRET': "1234"}
171 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
172 self.logger, self.env)
173 worker_server.start()
176 self.env.update({'VCL_APP_NAMESPACE_ID': "2",
177 'VCL_APP_NAMESPACE_SECRET': "5678"})
178 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
179 self.logger, self.env)
180 worker_client.start()
181 worker_client.join(self.timeout)
184 self.validateResults(worker_client, worker_server, self.timeout)
185 except Exception as error:
186 self.fail("Failed with %s" % error)
188 def validateResults(self, worker_client, worker_server, timeout):
189 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)
194 self.logger.info("Client worker result is `%s'" % worker_client.result)
196 if worker_client.result is None:
200 "Timeout: %ss! Killing client worker process (pid %d)" %
201 (timeout, worker_client.process.pid))
202 os.killpg(os.getpgid(worker_client.process.pid),
207 "Couldn't kill client worker process")
211 "Timeout! Client worker did not finish in %ss" % timeout)
212 self.assert_equal(worker_client.result, 0, "Binary test return code")
215 class VCLCutThruTestCase(VCLTestCase):
216 """ VCL Cut Thru Tests """
219 super(VCLCutThruTestCase, self).setUp()
221 self.cut_thru_setup()
222 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
223 self.server_addr, self.server_port]
224 self.client_iperf3_timeout = 20
225 self.client_iperf3_args = ["-V4d", "-c", self.server_addr]
226 self.server_iperf3_args = ["-V4d", "-s"]
227 self.client_uni_dir_nsock_timeout = 60
228 self.client_uni_dir_nsock_test_args = ["-I", "5", "-U", "-X",
231 self.client_bi_dir_nsock_timeout = 120
232 self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
237 self.cut_thru_tear_down()
239 super(VCLCutThruTestCase, self).tearDown()
241 def test_ldp_cut_thru_echo(self):
242 """ run LDP cut thru echo test """
244 self.cut_thru_test("sock_test_server", self.server_args,
245 "sock_test_client", self.client_echo_test_args)
247 def test_ldp_cut_thru_iperf3(self):
248 """ run LDP cut thru iperf3 test """
251 subprocess.check_output(['iperf3', '-v'])
253 self.logger.error("WARNING: 'iperf3' is not installed,")
254 self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!")
257 self.timeout = self.client_iperf3_timeout
258 self.cut_thru_test("iperf3", self.server_iperf3_args,
259 "iperf3", self.client_iperf3_args)
261 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
262 def test_ldp_cut_thru_uni_dir_nsock(self):
263 """ run LDP cut thru uni-directional (multiple sockets) test """
265 self.timeout = self.client_uni_dir_nsock_timeout
266 self.cut_thru_test("sock_test_server", self.server_args,
268 self.client_uni_dir_nsock_test_args)
270 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
271 def test_ldp_cut_thru_bi_dir_nsock(self):
272 """ run LDP cut thru bi-directional (multiple sockets) test """
274 self.timeout = self.client_bi_dir_nsock_timeout
275 self.cut_thru_test("sock_test_server", self.server_args,
277 self.client_bi_dir_nsock_test_args)
279 def test_vcl_cut_thru_echo(self):
280 """ run VCL cut thru echo test """
282 self.cut_thru_test("vcl_test_server", self.server_args,
283 "vcl_test_client", self.client_echo_test_args)
285 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
286 def test_vcl_cut_thru_uni_dir_nsock(self):
287 """ run VCL cut thru uni-directional (multiple sockets) test """
289 self.timeout = self.client_uni_dir_nsock_timeout
290 self.cut_thru_test("vcl_test_server", self.server_args,
292 self.client_uni_dir_nsock_test_args)
294 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
295 def test_vcl_cut_thru_bi_dir_nsock(self):
296 """ run VCL cut thru bi-directional (multiple sockets) test """
298 self.timeout = self.client_bi_dir_nsock_timeout
299 self.cut_thru_test("vcl_test_server", self.server_args,
301 self.client_bi_dir_nsock_test_args)
304 class VCLThruHostStackTestCase(VCLTestCase):
305 """ VCL Thru Host Stack Tests """
308 super(VCLThruHostStackTestCase, self).setUp()
310 self.thru_host_stack_setup()
311 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
312 self.loop0.local_ip4,
316 self.thru_host_stack_tear_down()
318 super(VCLThruHostStackTestCase, self).tearDown()
320 def test_ldp_thru_host_stack_echo(self):
321 """ run LDP thru host stack echo test """
323 self.thru_host_stack_test("sock_test_server", self.server_args,
325 self.client_echo_test_args)
326 # TBD: Remove these when VPP thru host teardown config bug is fixed.
327 self.thru_host_stack_test("vcl_test_server", self.server_args,
329 self.client_echo_test_args)
331 def test_vcl_thru_host_stack_echo(self):
332 """ run VCL thru host stack echo test """
334 # TBD: Enable this when VPP thru host teardown config bug is fixed.
335 # self.thru_host_stack_test("vcl_test_server", self.server_args,
337 # self.client_echo_test_args)
339 # TBD: Remove VCLThruHostStackExtended*TestCase classes and move
340 # tests here when VPP thru host teardown/setup config bug
344 class VCLThruHostStackExtendedATestCase(VCLTestCase):
345 """ VCL Thru Host Stack Extended Tests """
348 super(VCLThruHostStackExtendedATestCase, self).setUp()
350 self.thru_host_stack_setup()
352 self.client_bi_dir_nsock_timeout = 120
353 self.client_bi_dir_nsock_test_args = ["-B", "-X",
354 self.loop0.local_ip4,
357 self.client_bi_dir_nsock_timeout = 90
358 self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
359 self.loop0.local_ip4,
363 self.thru_host_stack_tear_down()
365 super(VCLThruHostStackExtendedATestCase, self).tearDown()
367 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
368 def test_vcl_thru_host_stack_bi_dir_nsock(self):
369 """ run VCL thru host stack bi-directional (multiple sockets) test """
371 self.timeout = self.client_bi_dir_nsock_timeout
372 self.thru_host_stack_test("vcl_test_server", self.server_args,
374 self.client_bi_dir_nsock_test_args)
377 class VCLThruHostStackExtendedBTestCase(VCLTestCase):
378 """ VCL Thru Host Stack Extended Tests """
381 super(VCLThruHostStackExtendedBTestCase, self).setUp()
383 self.thru_host_stack_setup()
385 self.client_bi_dir_nsock_timeout = 120
386 self.client_bi_dir_nsock_test_args = ["-B", "-X",
387 self.loop0.local_ip4,
390 self.client_bi_dir_nsock_timeout = 60
391 self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X",
392 self.loop0.local_ip4,
396 self.thru_host_stack_tear_down()
398 super(VCLThruHostStackExtendedBTestCase, self).tearDown()
400 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
401 def test_ldp_thru_host_stack_bi_dir_nsock(self):
402 """ run LDP thru host stack bi-directional (multiple sockets) test """
404 self.timeout = self.client_bi_dir_nsock_timeout
405 self.thru_host_stack_test("sock_test_server", self.server_args,
407 self.client_bi_dir_nsock_test_args)
410 class VCLThruHostStackExtendedCTestCase(VCLTestCase):
411 """ VCL Thru Host Stack Extended Tests """
414 super(VCLThruHostStackExtendedCTestCase, self).setUp()
416 self.thru_host_stack_setup()
418 self.client_uni_dir_nsock_timeout = 120
419 self.numSockets = "2"
421 self.client_uni_dir_nsock_timeout = 120
422 self.numSockets = "5"
424 self.client_uni_dir_nsock_test_args = ["-I", self.numSockets,
426 self.loop0.local_ip4,
430 self.thru_host_stack_tear_down()
432 super(VCLThruHostStackExtendedCTestCase, self).tearDown()
434 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
435 def test_ldp_thru_host_stack_uni_dir_nsock(self):
436 """ run LDP thru host stack uni-directional (multiple sockets) test """
438 self.timeout = self.client_uni_dir_nsock_timeout
439 self.thru_host_stack_test("sock_test_server", self.server_args,
441 self.client_uni_dir_nsock_test_args)
444 class VCLThruHostStackExtendedDTestCase(VCLTestCase):
445 """ VCL Thru Host Stack Extended Tests """
448 super(VCLThruHostStackExtendedDTestCase, self).setUp()
450 self.thru_host_stack_setup()
452 self.client_uni_dir_nsock_timeout = 120
453 self.numSockets = "2"
455 self.client_uni_dir_nsock_timeout = 120
456 self.numSockets = "5"
458 self.client_uni_dir_nsock_test_args = ["-I", self.numSockets,
460 self.loop0.local_ip4,
464 self.thru_host_stack_tear_down()
466 super(VCLThruHostStackExtendedDTestCase, self).tearDown()
468 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
469 def test_vcl_thru_host_stack_uni_dir_nsock(self):
470 """ run VCL thru host stack uni-directional (multiple sockets) test """
472 self.timeout = self.client_uni_dir_nsock_timeout
473 self.thru_host_stack_test("vcl_test_server", self.server_args,
475 self.client_uni_dir_nsock_test_args)
478 class VCLThruHostStackIperfTestCase(VCLTestCase):
479 """ VCL Thru Host Stack Iperf Tests """
482 super(VCLThruHostStackIperfTestCase, self).setUp()
484 self.thru_host_stack_setup()
485 self.client_iperf3_timeout = 20
486 self.client_iperf3_args = ["-V4d", "-c", self.loop0.local_ip4]
487 self.server_iperf3_args = ["-V4d", "-s"]
490 self.thru_host_stack_tear_down()
492 super(VCLThruHostStackIperfTestCase, self).tearDown()
494 def test_ldp_thru_host_stack_iperf3(self):
495 """ run LDP thru host stack iperf3 test """
498 subprocess.check_output(['iperf3', '-v'])
500 self.logger.error("WARNING: 'iperf3' is not installed,")
502 " 'test_ldp_thru_host_stack_iperf3' not run!")
505 self.timeout = self.client_iperf3_timeout
506 self.thru_host_stack_test("iperf3", self.server_iperf3_args,
507 "iperf3", self.client_iperf3_args)
510 class VCLIpv6CutThruTestCase(VCLTestCase):
511 """ VCL IPv6 Cut Thru Tests """
514 super(VCLIpv6CutThruTestCase, self).setUp()
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,
523 self.client_ipv6_iperf3_args = ["-V6d", "-c", self.server_ipv6_addr]
524 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
525 self.client_ipv6_uni_dir_nsock_test_args = ["-6", "-I", "5",
527 self.server_ipv6_addr,
529 self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2",
531 self.server_ipv6_addr,
535 self.cut_thru_tear_down()
537 super(VCLIpv6CutThruTestCase, self).tearDown()
539 def test_ldp_ipv6_cut_thru_echo(self):
540 """ run LDP IPv6 cut thru echo test """
542 self.cut_thru_test("sock_test_server",
543 self.server_ipv6_args,
545 self.client_ipv6_echo_test_args)
547 def test_ldp_ipv6_cut_thru_iperf3(self):
548 """ run LDP IPv6 cut thru iperf3 test """
551 subprocess.check_output(['iperf3', '-v'])
553 self.logger.error("WARNING: 'iperf3' is not installed,")
555 " 'test_ldp_ipv6_cut_thru_iperf3' not run!")
558 self.timeout = self.client_iperf3_timeout
559 self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args,
560 "iperf3", self.client_ipv6_iperf3_args)
562 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
563 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
564 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
566 self.timeout = self.client_uni_dir_nsock_timeout
567 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
569 self.client_ipv6_uni_dir_nsock_test_args)
571 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
572 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
573 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
575 self.timeout = self.client_bi_dir_nsock_timeout
576 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
578 self.client_ipv6_bi_dir_nsock_test_args)
580 def test_vcl_ipv6_cut_thru_echo(self):
581 """ run VCL IPv6 cut thru echo test """
583 self.cut_thru_test("vcl_test_server",
584 self.server_ipv6_args,
586 self.client_ipv6_echo_test_args)
588 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
589 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
590 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
592 self.timeout = self.client_uni_dir_nsock_timeout
593 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
595 self.client_ipv6_uni_dir_nsock_test_args)
597 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
598 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
599 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
601 self.timeout = self.client_bi_dir_nsock_timeout
602 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
604 self.client_ipv6_bi_dir_nsock_test_args)
607 class VCLIpv6ThruHostStackTestCase(VCLTestCase):
608 """ VCL IPv6 Thru Host Stack Tests """
611 super(VCLIpv6ThruHostStackTestCase, self).setUp()
613 self.thru_host_stack_ipv6_setup()
614 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
615 self.loop0.local_ip6,
619 self.thru_host_stack_ipv6_tear_down()
621 super(VCLIpv6ThruHostStackTestCase, self).tearDown()
623 def test_ldp_ipv6_thru_host_stack_echo(self):
624 """ run LDP IPv6 thru host stack echo test """
626 self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
628 self.client_ipv6_echo_test_args)
629 # TBD: Remove these when VPP thru host teardown config bug is fixed.
630 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
632 self.client_ipv6_echo_test_args)
634 def test_vcl_ipv6_thru_host_stack_echo(self):
635 """ run VCL IPv6 thru host stack echo test """
637 # self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
639 # self.client_ipv6_echo_test_args)
641 # TBD: Remove VCLIpv6ThruHostStackExtended*TestCase classes and move
642 # tests here when VPP thru host teardown/setup config bug
646 class VCLIpv6ThruHostStackExtendedATestCase(VCLTestCase):
647 """ VCL IPv6 Thru Host Stack Extended Tests """
650 super(VCLIpv6ThruHostStackExtendedATestCase, self).setUp()
652 self.thru_host_stack_ipv6_setup()
654 self.client_bi_dir_nsock_timeout = 120
655 self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X",
656 self.loop0.local_ip6,
659 self.client_bi_dir_nsock_timeout = 90
660 self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I",
662 self.loop0.local_ip6,
666 self.thru_host_stack_ipv6_tear_down()
668 super(VCLIpv6ThruHostStackExtendedATestCase, self).tearDown()
670 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
671 def test_vcl_thru_host_stack_bi_dir_nsock(self):
672 """ run VCL thru host stack bi-directional (multiple sockets) test """
674 self.timeout = self.client_bi_dir_nsock_timeout
675 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
677 self.client_ipv6_bi_dir_nsock_test_args)
680 class VCLIpv6ThruHostStackExtendedBTestCase(VCLTestCase):
681 """ VCL IPv6 Thru Host Stack Extended Tests """
684 super(VCLIpv6ThruHostStackExtendedBTestCase, self).setUp()
686 self.thru_host_stack_ipv6_setup()
688 self.client_bi_dir_nsock_timeout = 120
689 self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X",
690 self.loop0.local_ip6,
693 self.client_bi_dir_nsock_timeout = 60
694 self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2",
696 self.loop0.local_ip6,
700 self.thru_host_stack_ipv6_tear_down()
702 super(VCLIpv6ThruHostStackExtendedBTestCase, self).tearDown()
704 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
705 def test_ldp_thru_host_stack_bi_dir_nsock(self):
706 """ run LDP thru host stack bi-directional (multiple sockets) test """
708 self.timeout = self.client_bi_dir_nsock_timeout
709 self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
711 self.client_ipv6_bi_dir_nsock_test_args)
714 class VCLIpv6ThruHostStackExtendedCTestCase(VCLTestCase):
715 """ VCL IPv6 Thru Host Stack Extended Tests """
718 super(VCLIpv6ThruHostStackExtendedCTestCase, self).setUp()
720 self.thru_host_stack_ipv6_setup()
722 self.client_uni_dir_nsock_timeout = 120
723 self.numSockets = "2"
725 self.client_uni_dir_nsock_timeout = 120
726 self.numSockets = "5"
728 self.client_ipv6_uni_dir_nsock_test_args = ["-6",
729 "-I", self.numSockets,
731 self.loop0.local_ip6,
735 self.thru_host_stack_ipv6_tear_down()
737 super(VCLIpv6ThruHostStackExtendedCTestCase, self).tearDown()
739 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
740 def test_ldp_thru_host_stack_uni_dir_nsock(self):
741 """ run LDP thru host stack uni-directional (multiple sockets) test """
743 self.timeout = self.client_uni_dir_nsock_timeout
744 self.thru_host_stack_test("sock_test_server", self.server_ipv6_args,
746 self.client_ipv6_uni_dir_nsock_test_args)
749 class VCLIpv6ThruHostStackExtendedDTestCase(VCLTestCase):
750 """ VCL IPv6 Thru Host Stack Extended Tests """
753 super(VCLIpv6ThruHostStackExtendedDTestCase, self).setUp()
755 self.thru_host_stack_ipv6_setup()
757 self.client_uni_dir_nsock_timeout = 120
758 self.numSockets = "2"
760 self.client_uni_dir_nsock_timeout = 120
761 self.numSockets = "5"
763 self.client_ipv6_uni_dir_nsock_test_args = ["-6",
764 "-I", self.numSockets,
766 self.loop0.local_ip6,
770 self.thru_host_stack_ipv6_tear_down()
772 super(VCLIpv6ThruHostStackExtendedDTestCase, self).tearDown()
774 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
775 def test_vcl_thru_host_stack_uni_dir_nsock(self):
776 """ run VCL thru host stack uni-directional (multiple sockets) test """
778 self.timeout = self.client_uni_dir_nsock_timeout
779 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
781 self.client_ipv6_uni_dir_nsock_test_args)
784 class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase):
785 """ VCL IPv6 Thru Host Stack Iperf Tests """
788 super(VCLIpv6ThruHostStackIperfTestCase, self).setUp()
790 self.thru_host_stack_ipv6_setup()
791 self.client_iperf3_timeout = 20
792 self.client_ipv6_iperf3_args = ["-V6d", "-c", self.loop0.local_ip6]
793 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
796 self.thru_host_stack_ipv6_tear_down()
798 super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown()
800 @unittest.skipUnless(running_extended_tests(), "part of extended tests")
801 def test_ldp_thru_host_stack_iperf3(self):
802 """ run LDP thru host stack iperf3 test """
805 subprocess.check_output(['iperf3', '-v'])
807 self.logger.error("WARNING: 'iperf3' is not installed,")
809 " 'test_ldp_thru_host_stack_iperf3' not run!")
812 self.timeout = self.client_iperf3_timeout
813 self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args,
814 "iperf3", self.client_ipv6_iperf3_args)
817 if __name__ == '__main__':
818 unittest.main(testRunner=VppTestRunner)