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/lib" % build_dir
18 if "iperf" in appname:
20 env.update({'LD_PRELOAD':
21 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
22 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})
27 app = "%s/vpp/bin/%s" % (build_dir, appname)
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):
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 LDPCutThruTestCase(VCLTestCase):
216 """ LDP Cut Thru Tests """
219 super(LDPCutThruTestCase, 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", "-t 5", "-c", self.server_addr]
226 self.server_iperf3_args = ["-V4d", "-s"]
227 self.client_uni_dir_nsock_timeout = 20
228 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
232 self.client_bi_dir_nsock_timeout = 20
233 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
239 self.cut_thru_tear_down()
241 super(LDPCutThruTestCase, self).tearDown()
243 def test_ldp_cut_thru_echo(self):
244 """ run LDP cut thru echo test """
246 self.cut_thru_test("sock_test_server", self.server_args,
247 "sock_test_client", self.client_echo_test_args)
249 def test_ldp_cut_thru_iperf3(self):
250 """ run LDP cut thru iperf3 test """
253 subprocess.check_output(['iperf3', '-v'])
254 except subprocess.CalledProcessError:
255 self.logger.error("WARNING: 'iperf3' is not installed,")
256 self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!")
259 self.timeout = self.client_iperf3_timeout
260 self.cut_thru_test("iperf3", self.server_iperf3_args,
261 "iperf3", self.client_iperf3_args)
263 def test_ldp_cut_thru_uni_dir_nsock(self):
264 """ run LDP cut thru uni-directional (multiple sockets) test """
266 self.timeout = self.client_uni_dir_nsock_timeout
267 self.cut_thru_test("sock_test_server", self.server_args,
269 self.client_uni_dir_nsock_test_args)
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)
280 class VCLCutThruTestCase(VCLTestCase):
281 """ VCL Cut Thru Tests """
284 super(VCLCutThruTestCase, self).setUp()
286 self.cut_thru_setup()
287 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
288 self.server_addr, self.server_port]
290 self.client_uni_dir_nsock_timeout = 20
291 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
295 self.client_bi_dir_nsock_timeout = 20
296 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
302 self.cut_thru_tear_down()
304 super(VCLCutThruTestCase, self).tearDown()
306 def test_vcl_cut_thru_echo(self):
307 """ run VCL cut thru echo test """
309 self.cut_thru_test("vcl_test_server", self.server_args,
310 "vcl_test_client", self.client_echo_test_args)
312 def test_vcl_cut_thru_uni_dir_nsock(self):
313 """ run VCL cut thru uni-directional (multiple sockets) test """
315 self.timeout = self.client_uni_dir_nsock_timeout
316 self.cut_thru_test("vcl_test_server", self.server_args,
318 self.client_uni_dir_nsock_test_args)
320 def test_vcl_cut_thru_bi_dir_nsock(self):
321 """ run VCL cut thru bi-directional (multiple sockets) test """
323 self.timeout = self.client_bi_dir_nsock_timeout
324 self.cut_thru_test("vcl_test_server", self.server_args,
326 self.client_bi_dir_nsock_test_args)
329 class VCLThruHostStackTestCase(VCLTestCase):
330 """ VCL Thru Host Stack Tests """
333 super(VCLThruHostStackTestCase, self).setUp()
335 self.thru_host_stack_setup()
336 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
337 self.loop0.local_ip4,
341 self.thru_host_stack_tear_down()
343 super(VCLThruHostStackTestCase, self).tearDown()
345 def test_ldp_thru_host_stack_echo(self):
346 """ run LDP thru host stack echo test """
348 self.thru_host_stack_test("sock_test_server", self.server_args,
350 self.client_echo_test_args)
351 # TBD: Remove these when VPP thru host teardown config bug is fixed.
352 self.thru_host_stack_test("vcl_test_server", self.server_args,
354 self.client_echo_test_args)
356 def test_vcl_thru_host_stack_echo(self):
357 """ run VCL thru host stack echo test """
359 # TBD: Enable this when VPP thru host teardown config bug is fixed.
360 # self.thru_host_stack_test("vcl_test_server", self.server_args,
362 # self.client_echo_test_args)
364 # TBD: Remove VCLThruHostStackGroup*TestCase classes and move
365 # tests here when VPP thru host teardown/setup config bug
369 class VCLThruHostStackNSessionBidirTestCase(VCLTestCase):
370 """ VCL Thru Host Stack NSession Bidir Tests """
373 super(VCLThruHostStackNSessionBidirTestCase, self).setUp()
375 self.thru_host_stack_setup()
377 self.client_bi_dir_nsock_timeout = 20
378 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
380 self.loop0.local_ip4,
383 self.client_bi_dir_nsock_timeout = 20
384 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
386 self.loop0.local_ip4,
390 self.thru_host_stack_tear_down()
392 super(VCLThruHostStackNSessionBidirTestCase, self).tearDown()
394 def test_vcl_thru_host_stack_bi_dir_nsock(self):
395 """ run VCL thru host stack bi-directional (multiple sockets) test """
397 self.timeout = self.client_bi_dir_nsock_timeout
398 self.thru_host_stack_test("vcl_test_server", self.server_args,
400 self.client_bi_dir_nsock_test_args)
403 class VCLThruHostStackGroupBTestCase(VCLTestCase):
404 """ VCL Thru Host Stack Group B Tests """
407 super(VCLThruHostStackGroupBTestCase, self).setUp()
409 self.thru_host_stack_setup()
411 self.client_bi_dir_nsock_timeout = 20
412 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
413 # OUCH! Host Stack Bug?
415 self.loop0.local_ip4,
418 self.client_bi_dir_nsock_timeout = 20
419 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
420 # OUCH! Host Stack Bug?
422 self.loop0.local_ip4,
426 self.thru_host_stack_tear_down()
428 super(VCLThruHostStackGroupBTestCase, self).tearDown()
430 def test_ldp_thru_host_stack_bi_dir_nsock(self):
431 """ run LDP thru host stack bi-directional (multiple sockets) test """
433 self.timeout = self.client_bi_dir_nsock_timeout
434 self.thru_host_stack_test("sock_test_server", self.server_args,
436 self.client_bi_dir_nsock_test_args)
439 class VCLThruHostStackGroupCTestCase(VCLTestCase):
440 """ VCL Thru Host Stack Group C Tests """
443 super(VCLThruHostStackGroupCTestCase, self).setUp()
445 self.thru_host_stack_setup()
447 self.client_uni_dir_nsock_timeout = 20
448 self.numSockets = "2"
450 self.client_uni_dir_nsock_timeout = 20
451 self.numSockets = "5"
453 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
454 "-I", self.numSockets,
455 self.loop0.local_ip4,
459 self.thru_host_stack_tear_down()
461 super(VCLThruHostStackGroupCTestCase, self).tearDown()
463 def test_ldp_thru_host_stack_uni_dir_nsock(self):
464 """ run LDP thru host stack uni-directional (multiple sockets) test """
466 self.timeout = self.client_uni_dir_nsock_timeout
467 self.thru_host_stack_test("sock_test_server", self.server_args,
469 self.client_uni_dir_nsock_test_args)
472 class VCLThruHostStackGroupDTestCase(VCLTestCase):
473 """ VCL Thru Host Stack Group D Tests """
476 super(VCLThruHostStackGroupDTestCase, self).setUp()
478 self.thru_host_stack_setup()
480 self.client_uni_dir_nsock_timeout = 20
481 self.numSockets = "2"
483 self.client_uni_dir_nsock_timeout = 20
484 self.numSockets = "5"
486 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
487 "-I", self.numSockets,
488 self.loop0.local_ip4,
492 self.thru_host_stack_tear_down()
494 super(VCLThruHostStackGroupDTestCase, self).tearDown()
496 def test_vcl_thru_host_stack_uni_dir_nsock(self):
497 """ run VCL thru host stack uni-directional (multiple sockets) test """
499 self.timeout = self.client_uni_dir_nsock_timeout
500 self.thru_host_stack_test("vcl_test_server", self.server_args,
502 self.client_uni_dir_nsock_test_args)
505 class VCLThruHostStackIperfTestCase(VCLTestCase):
506 """ VCL Thru Host Stack Iperf Tests """
509 super(VCLThruHostStackIperfTestCase, self).setUp()
511 self.thru_host_stack_setup()
512 self.client_iperf3_timeout = 20
513 self.client_iperf3_args = ["-V4d", "-t 5", "-c", self.loop0.local_ip4]
514 self.server_iperf3_args = ["-V4d", "-s"]
517 self.thru_host_stack_tear_down()
519 super(VCLThruHostStackIperfTestCase, self).tearDown()
521 def test_ldp_thru_host_stack_iperf3(self):
522 """ run LDP thru host stack iperf3 test """
525 subprocess.check_output(['iperf3', '-v'])
526 except subprocess.CalledProcessError:
527 self.logger.error("WARNING: 'iperf3' is not installed,")
529 " 'test_ldp_thru_host_stack_iperf3' not run!")
532 self.timeout = self.client_iperf3_timeout
533 self.thru_host_stack_test("iperf3", self.server_iperf3_args,
534 "iperf3", self.client_iperf3_args)
537 class LDPIpv6CutThruTestCase(VCLTestCase):
538 """ LDP IPv6 Cut Thru Tests """
541 super(LDPIpv6CutThruTestCase, self).setUp()
543 self.cut_thru_setup()
544 self.client_iperf3_timeout = 20
545 self.client_uni_dir_nsock_timeout = 20
546 self.client_bi_dir_nsock_timeout = 20
547 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
548 self.server_ipv6_addr,
550 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
551 self.server_ipv6_addr]
552 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
553 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
556 self.server_ipv6_addr,
558 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
561 self.server_ipv6_addr,
565 self.cut_thru_tear_down()
567 super(LDPIpv6CutThruTestCase, self).tearDown()
569 def test_ldp_ipv6_cut_thru_echo(self):
570 """ run LDP IPv6 cut thru echo test """
572 self.cut_thru_test("sock_test_server",
573 self.server_ipv6_args,
575 self.client_ipv6_echo_test_args)
577 def test_ldp_ipv6_cut_thru_iperf3(self):
578 """ run LDP IPv6 cut thru iperf3 test """
581 subprocess.check_output(['iperf3', '-v'])
583 self.logger.error("WARNING: 'iperf3' is not installed,")
585 " 'test_ldp_ipv6_cut_thru_iperf3' not run!")
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)
592 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
593 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
595 self.timeout = self.client_uni_dir_nsock_timeout
596 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
598 self.client_ipv6_uni_dir_nsock_test_args)
600 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
601 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
603 self.timeout = self.client_bi_dir_nsock_timeout
604 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
606 self.client_ipv6_bi_dir_nsock_test_args)
609 class VCLIpv6CutThruTestCase(VCLTestCase):
610 """ VCL IPv6 Cut Thru Tests """
613 super(VCLIpv6CutThruTestCase, self).setUp()
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,
621 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
624 self.server_ipv6_addr,
626 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
629 self.server_ipv6_addr,
633 self.cut_thru_tear_down()
635 super(VCLIpv6CutThruTestCase, self).tearDown()
637 def test_vcl_ipv6_cut_thru_echo(self):
638 """ run VCL IPv6 cut thru echo test """
640 self.cut_thru_test("vcl_test_server",
641 self.server_ipv6_args,
643 self.client_ipv6_echo_test_args)
645 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
646 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
648 self.timeout = self.client_uni_dir_nsock_timeout
649 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
651 self.client_ipv6_uni_dir_nsock_test_args)
653 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
654 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
656 self.timeout = self.client_bi_dir_nsock_timeout
657 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
659 self.client_ipv6_bi_dir_nsock_test_args)
662 class VCLIpv6ThruHostStackTestCase(VCLTestCase):
663 """ VCL IPv6 Thru Host Stack Tests """
666 super(VCLIpv6ThruHostStackTestCase, self).setUp()
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,
674 self.thru_host_stack_ipv6_tear_down()
676 super(VCLIpv6ThruHostStackTestCase, self).tearDown()
678 def test_ldp_ipv6_thru_host_stack_echo(self):
679 """ run LDP IPv6 thru host stack echo test """
681 self.thru_host_stack_test("sock_test_server",
682 self.server_ipv6_args,
684 self.client_ipv6_echo_test_args)
685 # TBD: Remove these when VPP thru host teardown config bug is fixed.
686 self.thru_host_stack_test("vcl_test_server",
687 self.server_ipv6_args,
689 self.client_ipv6_echo_test_args)
691 def test_vcl_ipv6_thru_host_stack_echo(self):
692 """ run VCL IPv6 thru host stack echo test """
694 # self.thru_host_stack_test("vcl_test_server",
695 # self.server_ipv6_args,
697 # self.client_ipv6_echo_test_args)
699 # TBD: Remove VCLIpv6ThruHostStackGroup*TestCase classes and move
700 # tests here when VPP thru host teardown/setup config bug
704 class VCLIpv6ThruHostStackGroupATestCase(VCLTestCase):
705 """ VCL IPv6 Thru Host Stack Group A Tests """
708 super(VCLIpv6ThruHostStackGroupATestCase, self).setUp()
710 self.thru_host_stack_ipv6_setup()
712 self.client_bi_dir_nsock_timeout = 20
713 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
716 self.loop0.local_ip6,
719 self.client_bi_dir_nsock_timeout = 20
720 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
723 self.loop0.local_ip6,
727 self.thru_host_stack_ipv6_tear_down()
729 super(VCLIpv6ThruHostStackGroupATestCase, self).tearDown()
731 def test_vcl_thru_host_stack_bi_dir_nsock(self):
732 """ run VCL thru host stack bi-directional (multiple sockets) test """
734 self.timeout = self.client_bi_dir_nsock_timeout
735 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
737 self.client_ipv6_bi_dir_nsock_test_args)
740 class VCLIpv6ThruHostStackGroupBTestCase(VCLTestCase):
741 """ VCL IPv6 Thru Host Stack Group B Tests """
744 super(VCLIpv6ThruHostStackGroupBTestCase, self).setUp()
746 self.thru_host_stack_ipv6_setup()
748 self.client_bi_dir_nsock_timeout = 20
749 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
751 # OUCH! Host Stack Bug?
753 self.loop0.local_ip6,
756 self.client_bi_dir_nsock_timeout = 20
757 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000",
759 # OUCH! Host Stack Bug?
761 self.loop0.local_ip6,
765 self.thru_host_stack_ipv6_tear_down()
767 super(VCLIpv6ThruHostStackGroupBTestCase, self).tearDown()
769 def test_ldp_thru_host_stack_bi_dir_nsock(self):
770 """ run LDP thru host stack bi-directional (multiple sockets) test """
772 self.timeout = self.client_bi_dir_nsock_timeout
773 self.thru_host_stack_test("sock_test_server",
774 self.server_ipv6_args,
776 self.client_ipv6_bi_dir_nsock_test_args)
779 class VCLIpv6ThruHostStackGroupCTestCase(VCLTestCase):
780 """ VCL IPv6 Thru Host Stack Group C Tests """
783 super(VCLIpv6ThruHostStackGroupCTestCase, self).setUp()
785 self.thru_host_stack_ipv6_setup()
787 self.client_uni_dir_nsock_timeout = 20
788 self.numSockets = "2"
790 self.client_uni_dir_nsock_timeout = 20
791 self.numSockets = "5"
793 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
795 "-I", self.numSockets,
796 self.loop0.local_ip6,
800 self.thru_host_stack_ipv6_tear_down()
802 super(VCLIpv6ThruHostStackGroupCTestCase, self).tearDown()
804 def test_ldp_thru_host_stack_uni_dir_nsock(self):
805 """ run LDP thru host stack uni-directional (multiple sockets) test """
807 self.timeout = self.client_uni_dir_nsock_timeout
808 self.thru_host_stack_test("sock_test_server",
809 self.server_ipv6_args,
811 self.client_ipv6_uni_dir_nsock_test_args)
814 class VCLIpv6ThruHostStackGroupDTestCase(VCLTestCase):
815 """ VCL IPv6 Thru Host Stack Group D Tests """
818 super(VCLIpv6ThruHostStackGroupDTestCase, self).setUp()
820 self.thru_host_stack_ipv6_setup()
822 self.client_uni_dir_nsock_timeout = 20
823 self.numSockets = "2"
825 self.client_uni_dir_nsock_timeout = 20
826 self.numSockets = "5"
828 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
830 "-I", self.numSockets,
831 self.loop0.local_ip6,
835 self.thru_host_stack_ipv6_tear_down()
837 super(VCLIpv6ThruHostStackGroupDTestCase, self).tearDown()
839 def test_vcl_thru_host_stack_uni_dir_nsock(self):
840 """ run VCL thru host stack uni-directional (multiple sockets) test """
842 self.timeout = self.client_uni_dir_nsock_timeout
843 self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args,
845 self.client_ipv6_uni_dir_nsock_test_args)
848 class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase):
849 """ VCL IPv6 Thru Host Stack Iperf Tests """
852 super(VCLIpv6ThruHostStackIperfTestCase, self).setUp()
854 self.thru_host_stack_ipv6_setup()
855 self.client_iperf3_timeout = 20
856 self.client_ipv6_iperf3_args = ["-V6d", "-t 5", "-c",
857 self.loop0.local_ip6]
858 self.server_ipv6_iperf3_args = ["-V6d", "-s"]
861 self.thru_host_stack_ipv6_tear_down()
863 super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown()
865 def test_ldp_thru_host_stack_iperf3(self):
866 """ run LDP thru host stack iperf3 test """
869 subprocess.check_output(['iperf3', '-v'])
870 except subprocess.CalledProcessError:
871 self.logger.error("WARNING: 'iperf3' is not installed,")
873 " 'test_ldp_thru_host_stack_iperf3' not run!")
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)
881 if __name__ == '__main__':
882 unittest.main(testRunner=VppTestRunner)