9 from config import config
10 from framework import VppTestCase, VppTestRunner, Worker
11 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto
13 iperf3 = "/usr/bin/iperf3"
18 subprocess.check_output([app, "-v"])
19 except (subprocess.CalledProcessError, OSError):
24 _have_iperf3 = have_app(iperf3)
27 class VCLAppWorker(Worker):
28 """VCL Test Application Worker"""
30 libname = "libvcl_ldpreload.so"
32 class LibraryNotFound(Exception):
36 self, appname, executable_args, logger, env=None, role=None, *args, **kwargs
39 vcl_ldpreload_glob = f"{config.vpp_install_dir}/**/{self.libname}"
40 vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True)
42 if len(vcl_ldpreload_so) < 1:
43 raise LibraryNotFound("cannot locate library: {}".format(self.libname))
45 vcl_ldpreload_so = vcl_ldpreload_so[0]
49 if "iperf" in appname:
51 env.update({"LD_PRELOAD": vcl_ldpreload_so})
52 elif "sock" in appname:
53 app = f"{config.vpp_build_dir}/vpp/bin/{appname}"
54 env.update({"LD_PRELOAD": vcl_ldpreload_so})
56 app = f"{config.vpp_build_dir}/vpp/bin/{appname}"
57 self.args = [app] + executable_args
58 super(VCLAppWorker, self).__init__(self.args, logger, env, *args, **kwargs)
61 class VCLTestCase(VppTestCase):
64 session_startup = ["poll-main"]
68 if cls.session_startup:
69 conf = "session {" + " ".join(cls.session_startup) + "}"
70 cls.extra_vpp_punt_config = [conf]
71 super(VCLTestCase, cls).setUpClass()
74 def tearDownClass(cls):
75 super(VCLTestCase, cls).tearDownClass()
78 self.vppDebug = "vpp_debug" in config.vpp_install_dir
79 self.server_addr = "127.0.0.1"
80 self.server_port = "22000"
81 self.server_args = [self.server_port]
82 self.server_ipv6_addr = "::1"
83 self.server_ipv6_args = ["-6", self.server_port]
85 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
86 self.pre_test_sleep = 0.3
87 self.post_test_sleep = 0.2
88 self.sapi_client_sock = ""
89 self.sapi_server_sock = ""
91 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
92 os.remove("/tmp/ldp_server_af_unix_socket")
94 super(VCLTestCase, self).setUp()
96 def update_vcl_app_env(self, ns_id, ns_secret, attach_sock):
98 if "VCL_APP_NAMESPACE_ID" in self.vcl_app_env:
99 del self.vcl_app_env["VCL_APP_NAMESPACE_ID"]
101 self.vcl_app_env["VCL_APP_NAMESPACE_ID"] = ns_id
104 if "VCL_APP_NAMESPACE_SECRET" in self.vcl_app_env:
105 del self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"]
107 self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"] = ns_secret
110 self.vcl_app_env["VCL_VPP_API_SOCKET"] = self.get_api_sock_path()
111 if "VCL_VPP_SAPI_SOCKET" in self.vcl_app_env:
112 del self.vcl_app_env["VCL_VPP_SAPI_SOCKET"]
114 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
115 self.vcl_app_env["VCL_VPP_SAPI_SOCKET"] = sapi_sock
116 if "VCL_VPP_API_SOCKET" in self.vcl_app_env:
117 del self.vcl_app_env["VCL_VPP_API_SOCKET"]
119 def cut_thru_setup(self):
120 self.vapi.session_enable_disable(is_enable=1)
122 def cut_thru_tear_down(self):
123 self.vapi.session_enable_disable(is_enable=0)
125 def cut_thru_test(self, server_app, server_args, client_app, client_args):
126 self.vcl_app_env = {"VCL_APP_SCOPE_LOCAL": "true"}
128 self.update_vcl_app_env("", "", self.sapi_server_sock)
129 worker_server = VCLAppWorker(
130 server_app, server_args, self.logger, self.vcl_app_env, "server"
132 worker_server.start()
133 self.sleep(self.pre_test_sleep)
135 self.update_vcl_app_env("", "", self.sapi_client_sock)
136 worker_client = VCLAppWorker(
137 client_app, client_args, self.logger, self.vcl_app_env, "client"
139 worker_client.start()
140 worker_client.join(self.timeout)
142 self.validateResults(worker_client, worker_server, self.timeout)
143 except Exception as error:
144 self.fail("Failed with %s" % error)
145 self.sleep(self.post_test_sleep)
147 def thru_host_stack_setup(self):
148 self.vapi.session_enable_disable(is_enable=1)
149 self.create_loopback_interfaces(2)
153 for i in self.lo_interfaces:
157 tbl = VppIpTable(self, table_id)
160 i.set_table_ip4(table_id)
164 # Configure namespaces
165 self.vapi.app_namespace_add_del(
166 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
168 self.vapi.app_namespace_add_del(
169 namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index
172 # Add inter-table routes
175 self.loop1.local_ip4,
177 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=2)],
182 self.loop0.local_ip4,
184 [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)],
187 ip_t01.add_vpp_config()
188 ip_t10.add_vpp_config()
189 self.logger.debug(self.vapi.cli("show ip fib"))
191 def thru_host_stack_tear_down(self):
192 for i in self.lo_interfaces:
197 def thru_host_stack_ipv6_setup(self):
198 self.vapi.session_enable_disable(is_enable=1)
199 self.create_loopback_interfaces(2)
203 for i in self.lo_interfaces:
206 tbl = VppIpTable(self, table_id, is_ip6=1)
209 i.set_table_ip6(table_id)
213 # Configure namespaces
214 self.vapi.app_namespace_add_del(
215 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
217 self.vapi.app_namespace_add_del(
218 namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index
221 # Add inter-table routes
224 self.loop1.local_ip6,
226 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=2)],
231 self.loop0.local_ip6,
233 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=1)],
236 ip_t01.add_vpp_config()
237 ip_t10.add_vpp_config()
238 self.logger.debug(self.vapi.cli("show interface addr"))
239 self.logger.debug(self.vapi.cli("show ip6 fib"))
241 def thru_host_stack_ipv6_tear_down(self):
242 for i in self.lo_interfaces:
247 self.vapi.session_enable_disable(is_enable=0)
249 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
250 def thru_host_stack_test(self, server_app, server_args, client_app, client_args):
251 self.vcl_app_env = {"VCL_APP_SCOPE_GLOBAL": "true"}
253 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
254 worker_server = VCLAppWorker(
255 server_app, server_args, self.logger, self.vcl_app_env, "server"
257 worker_server.start()
258 self.sleep(self.pre_test_sleep)
260 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
261 worker_client = VCLAppWorker(
262 client_app, client_args, self.logger, self.vcl_app_env, "client"
264 worker_client.start()
265 worker_client.join(self.timeout)
268 self.validateResults(worker_client, worker_server, self.timeout)
269 except Exception as error:
270 self.fail("Failed with %s" % error)
271 self.sleep(self.post_test_sleep)
273 def validateResults(self, worker_client, worker_server, timeout):
274 if worker_server.process is None:
275 raise RuntimeError("worker_server is not running.")
276 if os.path.isdir("/proc/{}".format(worker_server.process.pid)):
278 "Killing server worker process (pid %d)" % worker_server.process.pid
280 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
282 self.logger.info("Client worker result is `%s'" % worker_client.result)
284 if worker_client.result is None:
288 "Timeout: %ss! Killing client worker process (pid %d)"
289 % (timeout, worker_client.process.pid)
291 os.killpg(os.getpgid(worker_client.process.pid), signal.SIGKILL)
294 self.logger.debug("Couldn't kill client worker process")
297 raise RuntimeError("Timeout! Client worker did not finish in %ss" % timeout)
298 self.assert_equal(worker_client.result, 0, "Binary test return code")
301 class LDPCutThruTestCase(VCLTestCase):
302 """LDP Cut Thru Tests"""
306 cls.session_startup = ["poll-main", "use-app-socket-api"]
307 super(LDPCutThruTestCase, cls).setUpClass()
310 def tearDownClass(cls):
311 super(LDPCutThruTestCase, cls).tearDownClass()
314 super(LDPCutThruTestCase, self).setUp()
316 self.cut_thru_setup()
317 self.client_echo_test_args = [
324 self.client_iperf3_timeout = 20
325 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
326 self.server_iperf3_args = ["-4", "-s"]
327 self.client_uni_dir_nsock_timeout = 20
328 self.client_uni_dir_nsock_test_args = [
338 self.client_bi_dir_nsock_timeout = 20
339 self.client_bi_dir_nsock_test_args = [
349 self.sapi_client_sock = "default"
350 self.sapi_server_sock = "default"
353 super(LDPCutThruTestCase, self).tearDown()
354 self.cut_thru_tear_down()
356 def show_commands_at_teardown(self):
357 self.logger.debug(self.vapi.cli("show session verbose 2"))
358 self.logger.debug(self.vapi.cli("show app mq"))
360 @unittest.skipUnless(config.extended, "part of extended tests")
361 def test_ldp_cut_thru_echo(self):
362 """run LDP cut thru echo test"""
368 self.client_echo_test_args,
371 def test_ldp_cut_thru_iperf3(self):
372 """run LDP cut thru iperf3 test"""
374 self.timeout = self.client_iperf3_timeout
376 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
379 @unittest.skipUnless(config.extended, "part of extended tests")
380 def test_ldp_cut_thru_uni_dir_nsock(self):
381 """run LDP cut thru uni-directional (multiple sockets) test"""
383 self.timeout = self.client_uni_dir_nsock_timeout
388 self.client_uni_dir_nsock_test_args,
391 @unittest.skipUnless(config.extended, "part of extended tests")
392 @unittest.skip("sock test apps need to be improved")
393 def test_ldp_cut_thru_bi_dir_nsock(self):
394 """run LDP cut thru bi-directional (multiple sockets) test"""
396 self.timeout = self.client_bi_dir_nsock_timeout
401 self.client_bi_dir_nsock_test_args,
405 class VCLCutThruTestCase(VCLTestCase):
406 """VCL Cut Thru Tests"""
410 super(VCLCutThruTestCase, cls).setUpClass()
413 def tearDownClass(cls):
414 super(VCLCutThruTestCase, cls).tearDownClass()
417 super(VCLCutThruTestCase, self).setUp()
419 self.cut_thru_setup()
420 self.client_echo_test_args = [
428 self.client_uni_dir_nsock_timeout = 20
429 self.client_uni_dir_nsock_test_args = [
439 self.client_bi_dir_nsock_timeout = 20
440 self.client_bi_dir_nsock_test_args = [
452 super(VCLCutThruTestCase, self).tearDown()
454 def show_commands_at_teardown(self):
455 self.logger.debug(self.vapi.cli("show session verbose 2"))
456 self.logger.debug(self.vapi.cli("show app mq"))
458 def test_vcl_cut_thru_echo(self):
459 """run VCL cut thru echo test"""
465 self.client_echo_test_args,
468 def test_vcl_cut_thru_uni_dir_nsock(self):
469 """run VCL cut thru uni-directional (multiple sockets) test"""
471 self.timeout = self.client_uni_dir_nsock_timeout
476 self.client_uni_dir_nsock_test_args,
479 def test_vcl_cut_thru_bi_dir_nsock(self):
480 """run VCL cut thru bi-directional (multiple sockets) test"""
482 self.timeout = self.client_bi_dir_nsock_timeout
487 self.client_bi_dir_nsock_test_args,
491 class VCLThruHostStackEcho(VCLTestCase):
492 """VCL Thru Host Stack Echo"""
496 super(VCLThruHostStackEcho, cls).setUpClass()
499 def tearDownClass(cls):
500 super(VCLThruHostStackEcho, cls).tearDownClass()
503 super(VCLThruHostStackEcho, self).setUp()
505 self.thru_host_stack_setup()
506 self.client_bi_dir_nsock_timeout = 20
507 self.client_bi_dir_nsock_test_args = [
514 self.loop0.local_ip4,
517 self.client_echo_test_args = [
521 self.loop0.local_ip4,
526 self.thru_host_stack_tear_down()
527 super(VCLThruHostStackEcho, self).tearDown()
529 def test_vcl_thru_host_stack_echo(self):
530 """run VCL IPv4 thru host stack echo test"""
532 self.thru_host_stack_test(
536 self.client_echo_test_args,
539 def show_commands_at_teardown(self):
540 self.logger.debug(self.vapi.cli("show app server"))
541 self.logger.debug(self.vapi.cli("show session verbose"))
542 self.logger.debug(self.vapi.cli("show app mq"))
545 class VCLThruHostStackTLS(VCLTestCase):
546 """VCL Thru Host Stack TLS"""
550 cls.session_startup = ["poll-main", "use-app-socket-api"]
551 super(VCLThruHostStackTLS, cls).setUpClass()
554 def tearDownClass(cls):
555 super(VCLThruHostStackTLS, cls).tearDownClass()
558 super(VCLThruHostStackTLS, self).setUp()
560 self.thru_host_stack_setup()
561 self.client_uni_dir_tls_timeout = 20
562 self.server_tls_args = ["-L", self.server_port]
563 self.client_uni_dir_tls_test_args = [
569 self.loop0.local_ip4,
572 self.sapi_server_sock = "1"
573 self.sapi_client_sock = "2"
575 def test_vcl_thru_host_stack_tls_uni_dir(self):
576 """run VCL thru host stack uni-directional TLS test"""
578 self.timeout = self.client_uni_dir_tls_timeout
579 self.thru_host_stack_test(
581 self.server_tls_args,
583 self.client_uni_dir_tls_test_args,
587 self.thru_host_stack_tear_down()
588 super(VCLThruHostStackTLS, self).tearDown()
590 def show_commands_at_teardown(self):
591 self.logger.debug(self.vapi.cli("show app server"))
592 self.logger.debug(self.vapi.cli("show session verbose 2"))
593 self.logger.debug(self.vapi.cli("show app mq"))
596 class VCLThruHostStackDTLS(VCLTestCase):
597 """VCL Thru Host Stack DTLS"""
601 super(VCLThruHostStackDTLS, cls).setUpClass()
604 def tearDownClass(cls):
605 super(VCLThruHostStackDTLS, cls).tearDownClass()
608 super(VCLThruHostStackDTLS, self).setUp()
610 self.thru_host_stack_setup()
611 self.client_uni_dir_dtls_timeout = 20
612 self.server_dtls_args = ["-p", "dtls", self.server_port]
613 self.client_uni_dir_dtls_test_args = [
621 self.loop0.local_ip4,
625 def test_vcl_thru_host_stack_dtls_uni_dir(self):
626 """run VCL thru host stack uni-directional DTLS test"""
628 self.timeout = self.client_uni_dir_dtls_timeout
629 self.thru_host_stack_test(
631 self.server_dtls_args,
633 self.client_uni_dir_dtls_test_args,
637 self.thru_host_stack_tear_down()
638 super(VCLThruHostStackDTLS, self).tearDown()
640 def show_commands_at_teardown(self):
641 self.logger.debug(self.vapi.cli("show app server"))
642 self.logger.debug(self.vapi.cli("show session verbose 2"))
643 self.logger.debug(self.vapi.cli("show app mq"))
646 class VCLThruHostStackQUIC(VCLTestCase):
647 """VCL Thru Host Stack QUIC"""
651 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
652 super(VCLThruHostStackQUIC, cls).setUpClass()
655 def tearDownClass(cls):
656 super(VCLThruHostStackQUIC, cls).tearDownClass()
659 super(VCLThruHostStackQUIC, self).setUp()
661 self.thru_host_stack_setup()
662 self.client_uni_dir_quic_timeout = 20
663 self.server_quic_args = ["-p", "quic", self.server_port]
664 self.client_uni_dir_quic_test_args = [
671 self.loop0.local_ip4,
675 @unittest.skipUnless(config.extended, "part of extended tests")
676 def test_vcl_thru_host_stack_quic_uni_dir(self):
677 """run VCL thru host stack uni-directional QUIC test"""
679 self.timeout = self.client_uni_dir_quic_timeout
680 self.thru_host_stack_test(
682 self.server_quic_args,
684 self.client_uni_dir_quic_test_args,
688 self.thru_host_stack_tear_down()
689 super(VCLThruHostStackQUIC, self).tearDown()
691 def show_commands_at_teardown(self):
692 self.logger.debug(self.vapi.cli("show app server"))
693 self.logger.debug(self.vapi.cli("show session verbose 2"))
694 self.logger.debug(self.vapi.cli("show app mq"))
697 class VCLThruHostStackBidirNsock(VCLTestCase):
698 """VCL Thru Host Stack Bidir Nsock"""
702 super(VCLThruHostStackBidirNsock, cls).setUpClass()
705 def tearDownClass(cls):
706 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
709 super(VCLThruHostStackBidirNsock, self).setUp()
711 self.thru_host_stack_setup()
712 self.client_bi_dir_nsock_timeout = 20
713 self.client_bi_dir_nsock_test_args = [
720 self.loop0.local_ip4,
723 self.client_echo_test_args = [
727 self.loop0.local_ip4,
732 self.thru_host_stack_tear_down()
733 super(VCLThruHostStackBidirNsock, self).tearDown()
735 def show_commands_at_teardown(self):
736 self.logger.debug(self.vapi.cli("show session verbose 2"))
737 self.logger.debug(self.vapi.cli("show app mq"))
739 def test_vcl_thru_host_stack_bi_dir_nsock(self):
740 """run VCL thru host stack bi-directional (multiple sockets) test"""
742 self.timeout = self.client_bi_dir_nsock_timeout
743 self.thru_host_stack_test(
747 self.client_bi_dir_nsock_test_args,
751 class LDPThruHostStackBidirNsock(VCLTestCase):
752 """LDP Thru Host Stack Bidir Nsock"""
756 super(LDPThruHostStackBidirNsock, cls).setUpClass()
759 def tearDownClass(cls):
760 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
763 super(LDPThruHostStackBidirNsock, self).setUp()
765 self.thru_host_stack_setup()
766 self.client_bi_dir_nsock_timeout = 20
767 self.client_bi_dir_nsock_test_args = [
772 # OUCH! Host Stack Bug?
773 # Only fails when running
774 # 'make test TEST_JOBS=auto'
777 self.loop0.local_ip4,
782 self.thru_host_stack_tear_down()
783 super(LDPThruHostStackBidirNsock, self).tearDown()
785 def show_commands_at_teardown(self):
786 self.logger.debug(self.vapi.cli("show session verbose 2"))
787 self.logger.debug(self.vapi.cli("show app mq"))
789 def test_ldp_thru_host_stack_bi_dir_nsock(self):
790 """run LDP thru host stack bi-directional (multiple sockets) test"""
792 self.timeout = self.client_bi_dir_nsock_timeout
793 self.thru_host_stack_test(
797 self.client_bi_dir_nsock_test_args,
801 class LDPThruHostStackNsock(VCLTestCase):
802 """LDP Thru Host Stack Nsock"""
806 super(LDPThruHostStackNsock, cls).setUpClass()
809 def tearDownClass(cls):
810 super(LDPThruHostStackNsock, cls).tearDownClass()
813 super(LDPThruHostStackNsock, self).setUp()
815 self.thru_host_stack_setup()
817 self.client_uni_dir_nsock_timeout = 20
818 self.numSockets = "2"
820 self.client_uni_dir_nsock_timeout = 20
821 self.numSockets = "5"
823 self.client_uni_dir_nsock_test_args = [
830 self.loop0.local_ip4,
835 self.thru_host_stack_tear_down()
836 super(LDPThruHostStackNsock, self).tearDown()
838 def test_ldp_thru_host_stack_uni_dir_nsock(self):
839 """run LDP thru host stack uni-directional (multiple sockets) test"""
841 self.timeout = self.client_uni_dir_nsock_timeout
842 self.thru_host_stack_test(
846 self.client_uni_dir_nsock_test_args,
850 class VCLThruHostStackNsock(VCLTestCase):
851 """VCL Thru Host Stack Nsock"""
855 super(VCLThruHostStackNsock, cls).setUpClass()
858 def tearDownClass(cls):
859 super(VCLThruHostStackNsock, cls).tearDownClass()
862 super(VCLThruHostStackNsock, self).setUp()
864 self.thru_host_stack_setup()
866 self.client_uni_dir_nsock_timeout = 20
867 self.numSockets = "2"
869 self.client_uni_dir_nsock_timeout = 20
870 self.numSockets = "5"
872 self.client_uni_dir_nsock_test_args = [
879 self.loop0.local_ip4,
884 self.thru_host_stack_tear_down()
885 super(VCLThruHostStackNsock, self).tearDown()
887 def test_vcl_thru_host_stack_uni_dir_nsock(self):
888 """run VCL thru host stack uni-directional (multiple sockets) test"""
890 self.timeout = self.client_uni_dir_nsock_timeout
891 self.thru_host_stack_test(
895 self.client_uni_dir_nsock_test_args,
899 class LDPThruHostStackIperf(VCLTestCase):
900 """LDP Thru Host Stack Iperf"""
904 super(LDPThruHostStackIperf, cls).setUpClass()
907 def tearDownClass(cls):
908 super(LDPThruHostStackIperf, cls).tearDownClass()
911 super(LDPThruHostStackIperf, self).setUp()
913 self.thru_host_stack_setup()
914 self.client_iperf3_timeout = 20
915 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
916 self.server_iperf3_args = ["-4", "-s"]
919 self.thru_host_stack_tear_down()
920 super(LDPThruHostStackIperf, self).tearDown()
922 def show_commands_at_teardown(self):
923 self.logger.debug(self.vapi.cli("show session verbose 2"))
924 self.logger.debug(self.vapi.cli("show app mq"))
926 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
927 def test_ldp_thru_host_stack_iperf3(self):
928 """run LDP thru host stack iperf3 test"""
930 self.timeout = self.client_iperf3_timeout
931 self.thru_host_stack_test(
932 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
936 class LDPThruHostStackIperfUdp(VCLTestCase):
937 """LDP Thru Host Stack Iperf UDP"""
941 super(LDPThruHostStackIperfUdp, cls).setUpClass()
944 def tearDownClass(cls):
945 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
948 super(LDPThruHostStackIperfUdp, self).setUp()
950 self.thru_host_stack_setup()
951 self.client_iperf3_timeout = 20
952 self.client_iperf3_args = [
958 self.loop0.local_ip4,
960 self.server_iperf3_args = ["-4", "-s"]
963 self.thru_host_stack_tear_down()
964 super(LDPThruHostStackIperfUdp, self).tearDown()
966 def show_commands_at_teardown(self):
967 self.logger.debug(self.vapi.cli("show session verbose 2"))
968 self.logger.debug(self.vapi.cli("show app mq"))
970 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
971 def test_ldp_thru_host_stack_iperf3_udp(self):
972 """run LDP thru host stack iperf3 UDP test"""
974 self.timeout = self.client_iperf3_timeout
975 self.thru_host_stack_test(
976 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
980 class LDPIpv6CutThruTestCase(VCLTestCase):
981 """LDP IPv6 Cut Thru Tests"""
985 super(LDPIpv6CutThruTestCase, cls).setUpClass()
988 def tearDownClass(cls):
989 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
991 def show_commands_at_teardown(self):
992 self.logger.debug(self.vapi.cli("show session verbose 2"))
993 self.logger.debug(self.vapi.cli("show app mq"))
996 super(LDPIpv6CutThruTestCase, self).setUp()
998 self.cut_thru_setup()
999 self.client_iperf3_timeout = 20
1000 self.client_uni_dir_nsock_timeout = 20
1001 self.client_bi_dir_nsock_timeout = 20
1002 self.client_ipv6_echo_test_args = [
1007 self.server_ipv6_addr,
1010 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c", self.server_ipv6_addr]
1011 self.server_ipv6_iperf3_args = ["-6", "-s"]
1012 self.client_ipv6_uni_dir_nsock_test_args = [
1020 self.server_ipv6_addr,
1023 self.client_ipv6_bi_dir_nsock_test_args = [
1031 self.server_ipv6_addr,
1036 super(LDPIpv6CutThruTestCase, self).tearDown()
1037 self.cut_thru_tear_down()
1039 @unittest.skipUnless(config.extended, "part of extended tests")
1040 def test_ldp_ipv6_cut_thru_echo(self):
1041 """run LDP IPv6 cut thru echo test"""
1045 self.server_ipv6_args,
1047 self.client_ipv6_echo_test_args,
1050 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
1051 def test_ldp_ipv6_cut_thru_iperf3(self):
1052 """run LDP IPv6 cut thru iperf3 test"""
1054 self.timeout = self.client_iperf3_timeout
1056 iperf3, self.server_ipv6_iperf3_args, iperf3, self.client_ipv6_iperf3_args
1059 @unittest.skipUnless(config.extended, "part of extended tests")
1060 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
1061 """run LDP IPv6 cut thru uni-directional (multiple sockets) test"""
1063 self.timeout = self.client_uni_dir_nsock_timeout
1066 self.server_ipv6_args,
1068 self.client_ipv6_uni_dir_nsock_test_args,
1071 @unittest.skipUnless(config.extended, "part of extended tests")
1072 @unittest.skip("sock test apps need to be improved")
1073 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
1074 """run LDP IPv6 cut thru bi-directional (multiple sockets) test"""
1076 self.timeout = self.client_bi_dir_nsock_timeout
1079 self.server_ipv6_args,
1081 self.client_ipv6_bi_dir_nsock_test_args,
1085 class VCLIpv6CutThruTestCase(VCLTestCase):
1086 """VCL IPv6 Cut Thru Tests"""
1089 def setUpClass(cls):
1090 super(VCLIpv6CutThruTestCase, cls).setUpClass()
1093 def tearDownClass(cls):
1094 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
1096 def show_commands_at_teardown(self):
1097 self.logger.debug(self.vapi.cli("show session verbose 2"))
1098 self.logger.debug(self.vapi.cli("show app mq"))
1101 super(VCLIpv6CutThruTestCase, self).setUp()
1103 self.cut_thru_setup()
1104 self.client_uni_dir_nsock_timeout = 20
1105 self.client_bi_dir_nsock_timeout = 20
1106 self.client_ipv6_echo_test_args = [
1111 self.server_ipv6_addr,
1114 self.client_ipv6_uni_dir_nsock_test_args = [
1122 self.server_ipv6_addr,
1125 self.client_ipv6_bi_dir_nsock_test_args = [
1133 self.server_ipv6_addr,
1138 super(VCLIpv6CutThruTestCase, self).tearDown()
1139 self.cut_thru_tear_down()
1141 def show_commands_at_teardown(self):
1142 self.logger.debug(self.vapi.cli("show session verbose 2"))
1143 self.logger.debug(self.vapi.cli("show app mq"))
1145 def test_vcl_ipv6_cut_thru_echo(self):
1146 """run VCL IPv6 cut thru echo test"""
1150 self.server_ipv6_args,
1152 self.client_ipv6_echo_test_args,
1155 @unittest.skipUnless(config.extended, "part of extended tests")
1156 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
1157 """run VCL IPv6 cut thru uni-directional (multiple sockets) test"""
1159 self.timeout = self.client_uni_dir_nsock_timeout
1162 self.server_ipv6_args,
1164 self.client_ipv6_uni_dir_nsock_test_args,
1167 @unittest.skipUnless(config.extended, "part of extended tests")
1168 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
1169 """run VCL IPv6 cut thru bi-directional (multiple sockets) test"""
1171 self.timeout = self.client_bi_dir_nsock_timeout
1174 self.server_ipv6_args,
1176 self.client_ipv6_bi_dir_nsock_test_args,
1180 class VCLIpv6ThruHostStackEcho(VCLTestCase):
1181 """VCL IPv6 Thru Host Stack Echo"""
1184 def setUpClass(cls):
1185 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
1188 def tearDownClass(cls):
1189 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
1192 super(VCLIpv6ThruHostStackEcho, self).setUp()
1194 self.thru_host_stack_ipv6_setup()
1195 self.client_ipv6_echo_test_args = [
1200 self.loop0.local_ip6,
1205 self.thru_host_stack_ipv6_tear_down()
1206 super(VCLIpv6ThruHostStackEcho, self).tearDown()
1208 def test_vcl_ipv6_thru_host_stack_echo(self):
1209 """run VCL IPv6 thru host stack echo test"""
1211 self.thru_host_stack_test(
1213 self.server_ipv6_args,
1215 self.client_ipv6_echo_test_args,
1219 if __name__ == "__main__":
1220 unittest.main(testRunner=VppTestRunner)