8 from framework import VppTestCase, VppTestRunner, running_extended_tests, \
10 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto
12 iperf3 = '/usr/bin/iperf3'
17 subprocess.check_output([app, '-v'])
18 except (subprocess.CalledProcessError, OSError):
23 _have_iperf3 = have_app(iperf3)
26 class VCLAppWorker(Worker):
27 """ VCL Test Application Worker """
29 def __init__(self, build_dir, appname, executable_args, logger, env=None,
30 role=None, *args, **kwargs):
34 vcl_lib_dir = "%s/vpp/lib" % build_dir
35 if "iperf" in appname:
37 env.update({'LD_PRELOAD':
38 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
39 elif "sock" in appname:
40 app = "%s/vpp/bin/%s" % (build_dir, appname)
41 env.update({'LD_PRELOAD':
42 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
44 app = "%s/vpp/bin/%s" % (build_dir, appname)
45 self.args = [app] + executable_args
46 super(VCLAppWorker, self).__init__(self.args, logger, env,
50 class VCLTestCase(VppTestCase):
51 """ VCL Test Class """
52 extra_vpp_punt_config = ["session", "{", "poll-main", "}"]
56 super(VCLTestCase, cls).setUpClass()
59 def tearDownClass(cls):
60 super(VCLTestCase, cls).tearDownClass()
64 self.build_dir = os.getenv(var, None)
65 if self.build_dir is None:
66 raise EnvironmentError("Environment variable `%s' not set" % var)
67 self.vppDebug = 'vpp_debug' in self.build_dir
68 self.server_addr = "127.0.0.1"
69 self.server_port = "22000"
70 self.server_args = [self.server_port]
71 self.server_ipv6_addr = "::1"
72 self.server_ipv6_args = ["-6", self.server_port]
74 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
75 self.pre_test_sleep = 0.3
76 self.post_test_sleep = 0.2
78 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
79 os.remove("/tmp/ldp_server_af_unix_socket")
81 super(VCLTestCase, self).setUp()
83 def cut_thru_setup(self):
84 self.vapi.session_enable_disable(is_enable=1)
86 def cut_thru_tear_down(self):
87 self.vapi.session_enable_disable(is_enable=0)
89 def cut_thru_test(self, server_app, server_args, client_app, client_args):
90 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
91 'VCL_APP_SCOPE_LOCAL': "true"}
92 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
93 self.logger, self.env, "server")
95 self.sleep(self.pre_test_sleep)
96 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
97 self.logger, self.env, "client")
99 worker_client.join(self.timeout)
101 self.validateResults(worker_client, worker_server, self.timeout)
102 except Exception as error:
103 self.fail("Failed with %s" % error)
104 self.sleep(self.post_test_sleep)
106 def thru_host_stack_setup(self):
107 self.vapi.session_enable_disable(is_enable=1)
108 self.create_loopback_interfaces(2)
112 for i in self.lo_interfaces:
116 tbl = VppIpTable(self, table_id)
119 i.set_table_ip4(table_id)
123 # Configure namespaces
124 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
125 sw_if_index=self.loop0.sw_if_index)
126 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
127 sw_if_index=self.loop1.sw_if_index)
129 # Add inter-table routes
130 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
131 [VppRoutePath("0.0.0.0",
133 nh_table_id=2)], table_id=1)
134 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
135 [VppRoutePath("0.0.0.0",
137 nh_table_id=1)], table_id=2)
138 ip_t01.add_vpp_config()
139 ip_t10.add_vpp_config()
140 self.logger.debug(self.vapi.cli("show ip fib"))
142 def thru_host_stack_tear_down(self):
143 for i in self.lo_interfaces:
148 def thru_host_stack_ipv6_setup(self):
149 self.vapi.session_enable_disable(is_enable=1)
150 self.create_loopback_interfaces(2)
154 for i in self.lo_interfaces:
157 tbl = VppIpTable(self, table_id, is_ip6=1)
160 i.set_table_ip6(table_id)
164 # Configure namespaces
165 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
166 sw_if_index=self.loop0.sw_if_index)
167 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
168 sw_if_index=self.loop1.sw_if_index)
170 # Add inter-table routes
171 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
172 [VppRoutePath("::0", 0xffffffff,
175 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
176 [VppRoutePath("::0", 0xffffffff,
179 ip_t01.add_vpp_config()
180 ip_t10.add_vpp_config()
181 self.logger.debug(self.vapi.cli("show interface addr"))
182 self.logger.debug(self.vapi.cli("show ip6 fib"))
184 def thru_host_stack_ipv6_tear_down(self):
185 for i in self.lo_interfaces:
190 self.vapi.session_enable_disable(is_enable=0)
192 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
193 def thru_host_stack_test(self, server_app, server_args,
194 client_app, client_args):
195 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
196 'VCL_APP_SCOPE_GLOBAL': "true",
197 'VCL_APP_NAMESPACE_ID': "1",
198 'VCL_APP_NAMESPACE_SECRET': "1234"}
200 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
201 self.logger, self.env, "server")
202 worker_server.start()
203 self.sleep(self.pre_test_sleep)
205 self.env.update({'VCL_APP_NAMESPACE_ID': "2",
206 'VCL_APP_NAMESPACE_SECRET': "5678"})
207 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
208 self.logger, self.env, "client")
209 worker_client.start()
210 worker_client.join(self.timeout)
213 self.validateResults(worker_client, worker_server, self.timeout)
214 except Exception as error:
215 self.fail("Failed with %s" % error)
216 self.sleep(self.post_test_sleep)
218 def validateResults(self, worker_client, worker_server, timeout):
219 if worker_server.process is None:
220 raise RuntimeError('worker_server is not running.')
221 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
222 self.logger.info("Killing server worker process (pid %d)" %
223 worker_server.process.pid)
224 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
226 self.logger.info("Client worker result is `%s'" % worker_client.result)
228 if worker_client.result is None:
232 "Timeout: %ss! Killing client worker process (pid %d)" %
233 (timeout, worker_client.process.pid))
234 os.killpg(os.getpgid(worker_client.process.pid),
239 "Couldn't kill client worker process")
243 "Timeout! Client worker did not finish in %ss" % timeout)
244 self.assert_equal(worker_client.result, 0, "Binary test return code")
247 class LDPCutThruTestCase(VCLTestCase):
248 """ LDP Cut Thru Tests """
252 super(LDPCutThruTestCase, cls).setUpClass()
255 def tearDownClass(cls):
256 super(LDPCutThruTestCase, cls).tearDownClass()
259 super(LDPCutThruTestCase, self).setUp()
261 self.cut_thru_setup()
262 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
263 self.server_addr, self.server_port]
264 self.client_iperf3_timeout = 20
265 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
266 self.server_iperf3_args = ["-4", "-s"]
267 self.client_uni_dir_nsock_timeout = 20
268 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
272 self.client_bi_dir_nsock_timeout = 20
273 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
279 super(LDPCutThruTestCase, self).tearDown()
280 self.cut_thru_tear_down()
282 def show_commands_at_teardown(self):
283 self.logger.debug(self.vapi.cli("show session verbose 2"))
284 self.logger.debug(self.vapi.cli("show app mq"))
286 @unittest.skipUnless(running_extended_tests, "part of extended tests")
287 def test_ldp_cut_thru_echo(self):
288 """ run LDP cut thru echo test """
290 self.cut_thru_test("sock_test_server", self.server_args,
291 "sock_test_client", self.client_echo_test_args)
293 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
294 def test_ldp_cut_thru_iperf3(self):
295 """ run LDP cut thru iperf3 test """
297 self.timeout = self.client_iperf3_timeout
298 self.cut_thru_test(iperf3, self.server_iperf3_args,
299 iperf3, self.client_iperf3_args)
301 @unittest.skipUnless(running_extended_tests, "part of extended tests")
302 def test_ldp_cut_thru_uni_dir_nsock(self):
303 """ run LDP cut thru uni-directional (multiple sockets) test """
305 self.timeout = self.client_uni_dir_nsock_timeout
306 self.cut_thru_test("sock_test_server", self.server_args,
308 self.client_uni_dir_nsock_test_args)
310 @unittest.skipUnless(running_extended_tests, "part of extended tests")
311 @unittest.skip("sock test apps need to be improved")
312 def test_ldp_cut_thru_bi_dir_nsock(self):
313 """ run LDP cut thru bi-directional (multiple sockets) test """
315 self.timeout = self.client_bi_dir_nsock_timeout
316 self.cut_thru_test("sock_test_server", self.server_args,
318 self.client_bi_dir_nsock_test_args)
321 class VCLCutThruTestCase(VCLTestCase):
322 """ VCL Cut Thru Tests """
326 super(VCLCutThruTestCase, cls).setUpClass()
329 def tearDownClass(cls):
330 super(VCLCutThruTestCase, cls).tearDownClass()
333 super(VCLCutThruTestCase, self).setUp()
335 self.cut_thru_setup()
336 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
337 self.server_addr, self.server_port]
339 self.client_uni_dir_nsock_timeout = 20
340 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
344 self.client_bi_dir_nsock_timeout = 20
345 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
351 super(VCLCutThruTestCase, self).tearDown()
353 def show_commands_at_teardown(self):
354 self.logger.debug(self.vapi.cli("show session verbose 2"))
355 self.logger.debug(self.vapi.cli("show app mq"))
357 def test_vcl_cut_thru_echo(self):
358 """ run VCL cut thru echo test """
360 self.cut_thru_test("vcl_test_server", self.server_args,
361 "vcl_test_client", self.client_echo_test_args)
363 def test_vcl_cut_thru_uni_dir_nsock(self):
364 """ run VCL cut thru uni-directional (multiple sockets) test """
366 self.timeout = self.client_uni_dir_nsock_timeout
367 self.cut_thru_test("vcl_test_server", self.server_args,
369 self.client_uni_dir_nsock_test_args)
371 def test_vcl_cut_thru_bi_dir_nsock(self):
372 """ run VCL cut thru bi-directional (multiple sockets) test """
374 self.timeout = self.client_bi_dir_nsock_timeout
375 self.cut_thru_test("vcl_test_server", self.server_args,
377 self.client_bi_dir_nsock_test_args)
380 class VCLThruHostStackEcho(VCLTestCase):
381 """ VCL Thru Host Stack Echo """
385 super(VCLThruHostStackEcho, cls).setUpClass()
388 def tearDownClass(cls):
389 super(VCLThruHostStackEcho, cls).tearDownClass()
392 super(VCLThruHostStackEcho, self).setUp()
394 self.thru_host_stack_setup()
395 self.client_bi_dir_nsock_timeout = 20
396 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
398 self.loop0.local_ip4,
400 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
401 self.loop0.local_ip4,
405 self.thru_host_stack_tear_down()
406 super(VCLThruHostStackEcho, self).tearDown()
408 def show_commands_at_teardown(self):
409 self.logger.debug(self.vapi.cli("show app server"))
410 self.logger.debug(self.vapi.cli("show session verbose"))
411 self.logger.debug(self.vapi.cli("show app mq"))
414 class VCLThruHostStackTLS(VCLTestCase):
415 """ VCL Thru Host Stack TLS """
419 super(VCLThruHostStackTLS, cls).setUpClass()
422 def tearDownClass(cls):
423 super(VCLThruHostStackTLS, cls).tearDownClass()
426 super(VCLThruHostStackTLS, self).setUp()
428 self.thru_host_stack_setup()
429 self.client_uni_dir_tls_timeout = 20
430 self.server_tls_args = ["-L", self.server_port]
431 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
432 self.loop0.local_ip4,
435 def test_vcl_thru_host_stack_tls_uni_dir(self):
436 """ run VCL thru host stack uni-directional TLS test """
438 self.timeout = self.client_uni_dir_tls_timeout
439 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
441 self.client_uni_dir_tls_test_args)
444 self.thru_host_stack_tear_down()
445 super(VCLThruHostStackTLS, self).tearDown()
447 def show_commands_at_teardown(self):
448 self.logger.debug(self.vapi.cli("show app server"))
449 self.logger.debug(self.vapi.cli("show session verbose 2"))
450 self.logger.debug(self.vapi.cli("show app mq"))
453 class VCLThruHostStackDTLS(VCLTestCase):
454 """ VCL Thru Host Stack DTLS """
458 super(VCLThruHostStackDTLS, cls).setUpClass()
461 def tearDownClass(cls):
462 super(VCLThruHostStackDTLS, cls).tearDownClass()
465 super(VCLThruHostStackDTLS, self).setUp()
467 self.thru_host_stack_setup()
468 self.client_uni_dir_dtls_timeout = 20
469 self.server_dtls_args = ["-p", "dtls", self.server_port]
470 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
471 "-p", "dtls", "-T 1400",
472 self.loop0.local_ip4,
475 def test_vcl_thru_host_stack_dtls_uni_dir(self):
476 """ run VCL thru host stack uni-directional DTLS test """
478 self.timeout = self.client_uni_dir_dtls_timeout
479 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
481 self.client_uni_dir_dtls_test_args)
484 self.thru_host_stack_tear_down()
485 super(VCLThruHostStackDTLS, self).tearDown()
487 def show_commands_at_teardown(self):
488 self.logger.debug(self.vapi.cli("show app server"))
489 self.logger.debug(self.vapi.cli("show session verbose 2"))
490 self.logger.debug(self.vapi.cli("show app mq"))
493 class VCLThruHostStackQUIC(VCLTestCase):
494 """ VCL Thru Host Stack QUIC """
498 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
499 super(VCLThruHostStackQUIC, cls).setUpClass()
502 def tearDownClass(cls):
503 super(VCLThruHostStackQUIC, cls).tearDownClass()
506 super(VCLThruHostStackQUIC, self).setUp()
508 self.thru_host_stack_setup()
509 self.client_uni_dir_quic_timeout = 20
510 self.server_quic_args = ["-p", "quic", self.server_port]
511 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
513 self.loop0.local_ip4,
516 @unittest.skipUnless(running_extended_tests, "part of extended tests")
517 def test_vcl_thru_host_stack_quic_uni_dir(self):
518 """ run VCL thru host stack uni-directional QUIC test """
520 self.timeout = self.client_uni_dir_quic_timeout
521 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
523 self.client_uni_dir_quic_test_args)
526 self.thru_host_stack_tear_down()
527 super(VCLThruHostStackQUIC, self).tearDown()
529 def show_commands_at_teardown(self):
530 self.logger.debug(self.vapi.cli("show app server"))
531 self.logger.debug(self.vapi.cli("show session verbose 2"))
532 self.logger.debug(self.vapi.cli("show app mq"))
535 class VCLThruHostStackBidirNsock(VCLTestCase):
536 """ VCL Thru Host Stack Bidir Nsock """
540 super(VCLThruHostStackBidirNsock, cls).setUpClass()
543 def tearDownClass(cls):
544 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
547 super(VCLThruHostStackBidirNsock, self).setUp()
549 self.thru_host_stack_setup()
550 self.client_bi_dir_nsock_timeout = 20
551 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
553 self.loop0.local_ip4,
555 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
556 self.loop0.local_ip4,
560 self.thru_host_stack_tear_down()
561 super(VCLThruHostStackBidirNsock, self).tearDown()
563 def show_commands_at_teardown(self):
564 self.logger.debug(self.vapi.cli("show session verbose 2"))
565 self.logger.debug(self.vapi.cli("show app mq"))
567 def test_vcl_thru_host_stack_bi_dir_nsock(self):
568 """ run VCL thru host stack bi-directional (multiple sockets) test """
570 self.timeout = self.client_bi_dir_nsock_timeout
571 self.thru_host_stack_test("vcl_test_server", self.server_args,
573 self.client_bi_dir_nsock_test_args)
576 class LDPThruHostStackBidirNsock(VCLTestCase):
577 """ LDP Thru Host Stack Bidir Nsock """
581 super(LDPThruHostStackBidirNsock, cls).setUpClass()
584 def tearDownClass(cls):
585 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
588 super(LDPThruHostStackBidirNsock, self).setUp()
590 self.thru_host_stack_setup()
591 self.client_bi_dir_nsock_timeout = 20
592 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
593 # OUCH! Host Stack Bug?
594 # Only fails when running
595 # 'make test TEST_JOBS=auto'
598 self.loop0.local_ip4,
602 self.thru_host_stack_tear_down()
603 super(LDPThruHostStackBidirNsock, self).tearDown()
605 def show_commands_at_teardown(self):
606 self.logger.debug(self.vapi.cli("show session verbose 2"))
607 self.logger.debug(self.vapi.cli("show app mq"))
609 def test_ldp_thru_host_stack_bi_dir_nsock(self):
610 """ run LDP thru host stack bi-directional (multiple sockets) test """
612 self.timeout = self.client_bi_dir_nsock_timeout
613 self.thru_host_stack_test("sock_test_server", self.server_args,
615 self.client_bi_dir_nsock_test_args)
618 class LDPThruHostStackNsock(VCLTestCase):
619 """ LDP Thru Host Stack Nsock """
623 super(LDPThruHostStackNsock, cls).setUpClass()
626 def tearDownClass(cls):
627 super(LDPThruHostStackNsock, cls).tearDownClass()
630 super(LDPThruHostStackNsock, self).setUp()
632 self.thru_host_stack_setup()
634 self.client_uni_dir_nsock_timeout = 20
635 self.numSockets = "2"
637 self.client_uni_dir_nsock_timeout = 20
638 self.numSockets = "5"
640 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
641 "-I", self.numSockets,
642 self.loop0.local_ip4,
646 self.thru_host_stack_tear_down()
647 super(LDPThruHostStackNsock, self).tearDown()
649 def test_ldp_thru_host_stack_uni_dir_nsock(self):
650 """ run LDP thru host stack uni-directional (multiple sockets) test """
652 self.timeout = self.client_uni_dir_nsock_timeout
653 self.thru_host_stack_test("sock_test_server", self.server_args,
655 self.client_uni_dir_nsock_test_args)
658 class VCLThruHostStackNsock(VCLTestCase):
659 """ VCL Thru Host Stack Nsock """
663 super(VCLThruHostStackNsock, cls).setUpClass()
666 def tearDownClass(cls):
667 super(VCLThruHostStackNsock, cls).tearDownClass()
670 super(VCLThruHostStackNsock, self).setUp()
672 self.thru_host_stack_setup()
674 self.client_uni_dir_nsock_timeout = 20
675 self.numSockets = "2"
677 self.client_uni_dir_nsock_timeout = 20
678 self.numSockets = "5"
680 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
681 "-I", self.numSockets,
682 self.loop0.local_ip4,
686 self.thru_host_stack_tear_down()
687 super(VCLThruHostStackNsock, self).tearDown()
689 def test_vcl_thru_host_stack_uni_dir_nsock(self):
690 """ run VCL thru host stack uni-directional (multiple sockets) test """
692 self.timeout = self.client_uni_dir_nsock_timeout
693 self.thru_host_stack_test("vcl_test_server", self.server_args,
695 self.client_uni_dir_nsock_test_args)
698 class LDPThruHostStackIperf(VCLTestCase):
699 """ LDP Thru Host Stack Iperf """
703 super(LDPThruHostStackIperf, cls).setUpClass()
706 def tearDownClass(cls):
707 super(LDPThruHostStackIperf, cls).tearDownClass()
710 super(LDPThruHostStackIperf, self).setUp()
712 self.thru_host_stack_setup()
713 self.client_iperf3_timeout = 20
714 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
715 self.server_iperf3_args = ["-4", "-s"]
718 self.thru_host_stack_tear_down()
719 super(LDPThruHostStackIperf, self).tearDown()
721 def show_commands_at_teardown(self):
722 self.logger.debug(self.vapi.cli("show session verbose 2"))
723 self.logger.debug(self.vapi.cli("show app mq"))
725 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
726 def test_ldp_thru_host_stack_iperf3(self):
727 """ run LDP thru host stack iperf3 test """
729 self.timeout = self.client_iperf3_timeout
730 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
731 iperf3, self.client_iperf3_args)
734 class LDPThruHostStackIperfUdp(VCLTestCase):
735 """ LDP Thru Host Stack Iperf UDP """
739 super(LDPThruHostStackIperfUdp, cls).setUpClass()
742 def tearDownClass(cls):
743 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
746 super(LDPThruHostStackIperfUdp, self).setUp()
748 self.thru_host_stack_setup()
749 self.client_iperf3_timeout = 20
750 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
751 "-c", self.loop0.local_ip4]
752 self.server_iperf3_args = ["-4", "-s"]
755 self.thru_host_stack_tear_down()
756 super(LDPThruHostStackIperfUdp, self).tearDown()
758 def show_commands_at_teardown(self):
759 self.logger.debug(self.vapi.cli("show session verbose 2"))
760 self.logger.debug(self.vapi.cli("show app mq"))
762 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
763 def test_ldp_thru_host_stack_iperf3_udp(self):
764 """ run LDP thru host stack iperf3 UDP test """
766 self.timeout = self.client_iperf3_timeout
767 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
768 iperf3, self.client_iperf3_args)
771 class LDPIpv6CutThruTestCase(VCLTestCase):
772 """ LDP IPv6 Cut Thru Tests """
776 super(LDPIpv6CutThruTestCase, cls).setUpClass()
779 def tearDownClass(cls):
780 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
782 def show_commands_at_teardown(self):
783 self.logger.debug(self.vapi.cli("show session verbose 2"))
784 self.logger.debug(self.vapi.cli("show app mq"))
787 super(LDPIpv6CutThruTestCase, self).setUp()
789 self.cut_thru_setup()
790 self.client_iperf3_timeout = 20
791 self.client_uni_dir_nsock_timeout = 20
792 self.client_bi_dir_nsock_timeout = 20
793 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
794 self.server_ipv6_addr,
796 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
797 self.server_ipv6_addr]
798 self.server_ipv6_iperf3_args = ["-6", "-s"]
799 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
802 self.server_ipv6_addr,
804 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
807 self.server_ipv6_addr,
811 super(LDPIpv6CutThruTestCase, self).tearDown()
812 self.cut_thru_tear_down()
814 def test_ldp_ipv6_cut_thru_echo(self):
815 """ run LDP IPv6 cut thru echo test """
817 self.cut_thru_test("sock_test_server",
818 self.server_ipv6_args,
820 self.client_ipv6_echo_test_args)
822 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
823 @unittest.skipUnless(running_extended_tests, "part of extended tests")
824 def test_ldp_ipv6_cut_thru_iperf3(self):
825 """ run LDP IPv6 cut thru iperf3 test """
827 self.timeout = self.client_iperf3_timeout
828 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
829 iperf3, self.client_ipv6_iperf3_args)
831 @unittest.skipUnless(running_extended_tests, "part of extended tests")
832 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
833 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
835 self.timeout = self.client_uni_dir_nsock_timeout
836 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
838 self.client_ipv6_uni_dir_nsock_test_args)
840 @unittest.skipUnless(running_extended_tests, "part of extended tests")
841 @unittest.skip("sock test apps need to be improved")
842 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
843 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
845 self.timeout = self.client_bi_dir_nsock_timeout
846 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
848 self.client_ipv6_bi_dir_nsock_test_args)
851 class VCLIpv6CutThruTestCase(VCLTestCase):
852 """ VCL IPv6 Cut Thru Tests """
856 super(VCLIpv6CutThruTestCase, cls).setUpClass()
859 def tearDownClass(cls):
860 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
862 def show_commands_at_teardown(self):
863 self.logger.debug(self.vapi.cli("show session verbose 2"))
864 self.logger.debug(self.vapi.cli("show app mq"))
867 super(VCLIpv6CutThruTestCase, self).setUp()
869 self.cut_thru_setup()
870 self.client_uni_dir_nsock_timeout = 20
871 self.client_bi_dir_nsock_timeout = 20
872 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
873 self.server_ipv6_addr,
875 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
878 self.server_ipv6_addr,
880 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
883 self.server_ipv6_addr,
887 super(VCLIpv6CutThruTestCase, self).tearDown()
888 self.cut_thru_tear_down()
890 def show_commands_at_teardown(self):
891 self.logger.debug(self.vapi.cli("show session verbose 2"))
892 self.logger.debug(self.vapi.cli("show app mq"))
894 def test_vcl_ipv6_cut_thru_echo(self):
895 """ run VCL IPv6 cut thru echo test """
897 self.cut_thru_test("vcl_test_server",
898 self.server_ipv6_args,
900 self.client_ipv6_echo_test_args)
902 @unittest.skipUnless(running_extended_tests, "part of extended tests")
903 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
904 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
906 self.timeout = self.client_uni_dir_nsock_timeout
907 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
909 self.client_ipv6_uni_dir_nsock_test_args)
911 @unittest.skipUnless(running_extended_tests, "part of extended tests")
912 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
913 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
915 self.timeout = self.client_bi_dir_nsock_timeout
916 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
918 self.client_ipv6_bi_dir_nsock_test_args)
921 class VCLIpv6ThruHostStackEcho(VCLTestCase):
922 """ VCL IPv6 Thru Host Stack Echo """
926 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
929 def tearDownClass(cls):
930 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
933 super(VCLIpv6ThruHostStackEcho, self).setUp()
935 self.thru_host_stack_ipv6_setup()
936 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
937 self.loop0.local_ip6,
941 self.thru_host_stack_ipv6_tear_down()
942 super(VCLIpv6ThruHostStackEcho, self).tearDown()
944 def test_vcl_ipv6_thru_host_stack_echo(self):
945 """ run VCL IPv6 thru host stack echo test """
947 self.thru_host_stack_test("vcl_test_server",
948 self.server_ipv6_args,
950 self.client_ipv6_echo_test_args)
953 if __name__ == '__main__':
954 unittest.main(testRunner=VppTestRunner)