9 from config import config
10 from asfframework import VppAsfTestCase, VppTestRunner, Worker
11 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath
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(VppAsfTestCase):
64 session_startup = ["poll-main"]
68 if cls.session_startup:
69 conf = "session {" + " ".join(cls.session_startup) + "}"
70 cls.extra_vpp_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 = 1
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_v4(
166 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
168 self.vapi.app_namespace_add_del_v4(
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:
196 i.remove_vpp_config()
198 def thru_host_stack_ipv6_setup(self):
199 self.vapi.session_enable_disable(is_enable=1)
200 self.create_loopback_interfaces(2)
204 for i in self.lo_interfaces:
207 tbl = VppIpTable(self, table_id, is_ip6=1)
210 i.set_table_ip6(table_id)
214 # Configure namespaces
215 self.vapi.app_namespace_add_del_v4(
216 namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index
218 self.vapi.app_namespace_add_del_v4(
219 namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index
222 # Add inter-table routes
225 self.loop1.local_ip6,
227 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=2)],
232 self.loop0.local_ip6,
234 [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=1)],
237 ip_t01.add_vpp_config()
238 ip_t10.add_vpp_config()
239 self.logger.debug(self.vapi.cli("show interface addr"))
240 self.logger.debug(self.vapi.cli("show ip6 fib"))
242 def thru_host_stack_ipv6_tear_down(self):
243 for i in self.lo_interfaces:
248 self.vapi.session_enable_disable(is_enable=0)
250 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
251 def thru_host_stack_test(self, server_app, server_args, client_app, client_args):
252 self.vcl_app_env = {"VCL_APP_SCOPE_GLOBAL": "true"}
254 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
255 worker_server = VCLAppWorker(
256 server_app, server_args, self.logger, self.vcl_app_env, "server"
258 worker_server.start()
259 self.sleep(self.pre_test_sleep)
261 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
262 worker_client = VCLAppWorker(
263 client_app, client_args, self.logger, self.vcl_app_env, "client"
265 worker_client.start()
266 worker_client.join(self.timeout)
269 self.validateResults(worker_client, worker_server, self.timeout)
270 except Exception as error:
271 self.fail("Failed with %s" % error)
272 self.sleep(self.post_test_sleep)
274 def validateResults(self, worker_client, worker_server, timeout):
275 if worker_server.process is None:
276 raise RuntimeError("worker_server is not running.")
277 if os.path.isdir("/proc/{}".format(worker_server.process.pid)):
279 "Killing server worker process (pid %d)" % worker_server.process.pid
281 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
283 self.logger.info("Client worker result is `%s'" % worker_client.result)
285 if worker_client.result is None:
289 "Timeout: %ss! Killing client worker process (pid %d)"
290 % (timeout, worker_client.process.pid)
292 os.killpg(os.getpgid(worker_client.process.pid), signal.SIGKILL)
295 self.logger.debug("Couldn't kill client worker process")
298 raise RuntimeError("Timeout! Client worker did not finish in %ss" % timeout)
299 self.assert_equal(worker_client.result, 0, "Binary test return code")
302 class LDPCutThruTestCase(VCLTestCase):
303 """LDP Cut Thru Tests"""
307 cls.session_startup = ["poll-main", "use-app-socket-api"]
308 super(LDPCutThruTestCase, cls).setUpClass()
311 def tearDownClass(cls):
312 super(LDPCutThruTestCase, cls).tearDownClass()
315 super(LDPCutThruTestCase, self).setUp()
317 self.cut_thru_setup()
318 self.client_echo_test_args = [
325 self.client_iperf3_timeout = 20
326 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
327 self.server_iperf3_args = ["-4", "-s"]
328 self.client_uni_dir_nsock_timeout = 20
329 self.client_uni_dir_nsock_test_args = [
339 self.client_bi_dir_nsock_timeout = 20
340 self.client_bi_dir_nsock_test_args = [
350 self.sapi_client_sock = "default"
351 self.sapi_server_sock = "default"
354 super(LDPCutThruTestCase, self).tearDown()
355 self.cut_thru_tear_down()
357 def show_commands_at_teardown(self):
358 self.logger.debug(self.vapi.cli("show session verbose 2"))
359 self.logger.debug(self.vapi.cli("show app mq"))
361 @unittest.skipUnless(config.extended, "part of extended tests")
362 def test_ldp_cut_thru_echo(self):
363 """run LDP cut thru echo test"""
369 self.client_echo_test_args,
372 def test_ldp_cut_thru_iperf3(self):
373 """run LDP cut thru iperf3 test"""
375 self.timeout = self.client_iperf3_timeout
377 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
380 @unittest.skipUnless(config.extended, "part of extended tests")
381 def test_ldp_cut_thru_uni_dir_nsock(self):
382 """run LDP cut thru uni-directional (multiple sockets) test"""
384 self.timeout = self.client_uni_dir_nsock_timeout
389 self.client_uni_dir_nsock_test_args,
392 @unittest.skipUnless(config.extended, "part of extended tests")
393 @unittest.skip("sock test apps need to be improved")
394 def test_ldp_cut_thru_bi_dir_nsock(self):
395 """run LDP cut thru bi-directional (multiple sockets) test"""
397 self.timeout = self.client_bi_dir_nsock_timeout
402 self.client_bi_dir_nsock_test_args,
406 class VCLCutThruTestCase(VCLTestCase):
407 """VCL Cut Thru Tests"""
411 super(VCLCutThruTestCase, cls).setUpClass()
414 def tearDownClass(cls):
415 super(VCLCutThruTestCase, cls).tearDownClass()
418 super(VCLCutThruTestCase, self).setUp()
420 self.cut_thru_setup()
421 self.client_echo_test_args = [
429 self.client_uni_dir_nsock_timeout = 20
430 self.client_uni_dir_nsock_test_args = [
440 self.client_bi_dir_nsock_timeout = 20
441 self.client_bi_dir_nsock_test_args = [
453 super(VCLCutThruTestCase, self).tearDown()
455 def show_commands_at_teardown(self):
456 self.logger.debug(self.vapi.cli("show session verbose 2"))
457 self.logger.debug(self.vapi.cli("show app mq"))
459 def test_vcl_cut_thru_echo(self):
460 """run VCL cut thru echo test"""
466 self.client_echo_test_args,
469 def test_vcl_cut_thru_uni_dir_nsock(self):
470 """run VCL cut thru uni-directional (multiple sockets) test"""
472 self.timeout = self.client_uni_dir_nsock_timeout
477 self.client_uni_dir_nsock_test_args,
480 def test_vcl_cut_thru_bi_dir_nsock(self):
481 """run VCL cut thru bi-directional (multiple sockets) test"""
483 self.timeout = self.client_bi_dir_nsock_timeout
488 self.client_bi_dir_nsock_test_args,
492 class VCLThruHostStackEcho(VCLTestCase):
493 """VCL Thru Host Stack Echo"""
497 super(VCLThruHostStackEcho, cls).setUpClass()
500 def tearDownClass(cls):
501 super(VCLThruHostStackEcho, cls).tearDownClass()
504 super(VCLThruHostStackEcho, self).setUp()
506 self.thru_host_stack_setup()
507 self.client_bi_dir_nsock_timeout = 20
508 self.client_bi_dir_nsock_test_args = [
515 self.loop0.local_ip4,
518 self.client_echo_test_args = [
522 self.loop0.local_ip4,
527 self.thru_host_stack_tear_down()
528 super(VCLThruHostStackEcho, self).tearDown()
530 def test_vcl_thru_host_stack_echo(self):
531 """run VCL IPv4 thru host stack echo test"""
533 self.thru_host_stack_test(
537 self.client_echo_test_args,
540 def show_commands_at_teardown(self):
541 self.logger.debug(self.vapi.cli("show app server"))
542 self.logger.debug(self.vapi.cli("show session verbose"))
543 self.logger.debug(self.vapi.cli("show app mq"))
546 class VCLThruHostStackTLS(VCLTestCase):
547 """VCL Thru Host Stack TLS"""
551 cls.session_startup = ["poll-main", "use-app-socket-api"]
552 super(VCLThruHostStackTLS, cls).setUpClass()
555 def tearDownClass(cls):
556 super(VCLThruHostStackTLS, cls).tearDownClass()
559 super(VCLThruHostStackTLS, self).setUp()
561 self.thru_host_stack_setup()
562 self.client_uni_dir_tls_timeout = 20
563 self.server_tls_args = ["-L", self.server_port]
564 self.client_uni_dir_tls_test_args = [
570 self.loop0.local_ip4,
573 self.sapi_server_sock = "1"
574 self.sapi_client_sock = "2"
576 def test_vcl_thru_host_stack_tls_uni_dir(self):
577 """run VCL thru host stack uni-directional TLS test"""
579 self.timeout = self.client_uni_dir_tls_timeout
580 self.thru_host_stack_test(
582 self.server_tls_args,
584 self.client_uni_dir_tls_test_args,
588 self.thru_host_stack_tear_down()
589 super(VCLThruHostStackTLS, self).tearDown()
591 def show_commands_at_teardown(self):
592 self.logger.debug(self.vapi.cli("show app server"))
593 self.logger.debug(self.vapi.cli("show session verbose 2"))
594 self.logger.debug(self.vapi.cli("show app mq"))
597 class VCLThruHostStackEchoInterruptMode(VCLThruHostStackEcho):
598 """VCL Thru Host Stack Echo interrupt mode"""
602 cls.session_startup = ["use-private-rx-mqs", "use-app-socket-api"]
603 super(VCLThruHostStackEcho, cls).setUpClass()
605 def test_vcl_thru_host_stack_echo(self):
606 """run VCL IPv4 thru host stack echo test interrupt mode"""
608 self.sapi_server_sock = "1"
609 self.sapi_client_sock = "2"
611 self.thru_host_stack_test(
615 self.client_echo_test_args,
619 class VCLThruHostStackTLSInterruptMode(VCLThruHostStackTLS):
620 """VCL Thru Host Stack TLS interrupt mode"""
624 cls.session_startup = ["poll-main", "use-app-socket-api", "use-private-rx-mqs"]
625 super(VCLThruHostStackTLS, cls).setUpClass()
628 class VCLThruHostStackDTLS(VCLTestCase):
629 """VCL Thru Host Stack DTLS"""
633 super(VCLThruHostStackDTLS, cls).setUpClass()
636 def tearDownClass(cls):
637 super(VCLThruHostStackDTLS, cls).tearDownClass()
640 super(VCLThruHostStackDTLS, self).setUp()
642 self.thru_host_stack_setup()
643 self.client_uni_dir_dtls_timeout = 20
644 self.server_dtls_args = ["-p", "dtls", self.server_port]
645 self.client_uni_dir_dtls_test_args = [
653 self.loop0.local_ip4,
657 def test_vcl_thru_host_stack_dtls_uni_dir(self):
658 """run VCL thru host stack uni-directional DTLS test"""
660 self.timeout = self.client_uni_dir_dtls_timeout
661 self.thru_host_stack_test(
663 self.server_dtls_args,
665 self.client_uni_dir_dtls_test_args,
669 self.thru_host_stack_tear_down()
670 super(VCLThruHostStackDTLS, self).tearDown()
672 def show_commands_at_teardown(self):
673 self.logger.debug(self.vapi.cli("show app server"))
674 self.logger.debug(self.vapi.cli("show session verbose 2"))
675 self.logger.debug(self.vapi.cli("show app mq"))
678 class VCLThruHostStackQUIC(VCLTestCase):
679 """VCL Thru Host Stack QUIC"""
683 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
684 super(VCLThruHostStackQUIC, cls).setUpClass()
687 def tearDownClass(cls):
688 super(VCLThruHostStackQUIC, cls).tearDownClass()
691 super(VCLThruHostStackQUIC, self).setUp()
693 self.thru_host_stack_setup()
694 self.client_uni_dir_quic_timeout = 20
695 self.server_quic_args = ["-p", "quic", self.server_port]
696 self.client_uni_dir_quic_test_args = [
703 self.loop0.local_ip4,
707 @unittest.skipUnless(config.extended, "part of extended tests")
708 def test_vcl_thru_host_stack_quic_uni_dir(self):
709 """run VCL thru host stack uni-directional QUIC test"""
711 self.timeout = self.client_uni_dir_quic_timeout
712 self.thru_host_stack_test(
714 self.server_quic_args,
716 self.client_uni_dir_quic_test_args,
720 self.thru_host_stack_tear_down()
721 super(VCLThruHostStackQUIC, self).tearDown()
723 def show_commands_at_teardown(self):
724 self.logger.debug(self.vapi.cli("show app server"))
725 self.logger.debug(self.vapi.cli("show session verbose 2"))
726 self.logger.debug(self.vapi.cli("show app mq"))
729 class VCLThruHostStackBidirNsock(VCLTestCase):
730 """VCL Thru Host Stack Bidir Nsock"""
734 super(VCLThruHostStackBidirNsock, cls).setUpClass()
737 def tearDownClass(cls):
738 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
741 super(VCLThruHostStackBidirNsock, self).setUp()
743 self.thru_host_stack_setup()
744 self.client_bi_dir_nsock_timeout = 20
745 self.client_bi_dir_nsock_test_args = [
752 self.loop0.local_ip4,
755 self.client_echo_test_args = [
759 self.loop0.local_ip4,
764 self.thru_host_stack_tear_down()
765 super(VCLThruHostStackBidirNsock, self).tearDown()
767 def show_commands_at_teardown(self):
768 self.logger.debug(self.vapi.cli("show session verbose 2"))
769 self.logger.debug(self.vapi.cli("show app mq"))
771 def test_vcl_thru_host_stack_bi_dir_nsock(self):
772 """run VCL thru host stack bi-directional (multiple sockets) test"""
774 self.timeout = self.client_bi_dir_nsock_timeout
775 self.thru_host_stack_test(
779 self.client_bi_dir_nsock_test_args,
783 class LDPThruHostStackBidirNsock(VCLTestCase):
784 """LDP Thru Host Stack Bidir Nsock"""
788 super(LDPThruHostStackBidirNsock, cls).setUpClass()
791 def tearDownClass(cls):
792 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
795 super(LDPThruHostStackBidirNsock, self).setUp()
797 self.thru_host_stack_setup()
798 self.client_bi_dir_nsock_timeout = 20
799 self.client_bi_dir_nsock_test_args = [
804 # OUCH! Host Stack Bug?
805 # Only fails when running
806 # 'make test TEST_JOBS=auto'
809 self.loop0.local_ip4,
814 self.thru_host_stack_tear_down()
815 super(LDPThruHostStackBidirNsock, self).tearDown()
817 def show_commands_at_teardown(self):
818 self.logger.debug(self.vapi.cli("show session verbose 2"))
819 self.logger.debug(self.vapi.cli("show app mq"))
821 def test_ldp_thru_host_stack_bi_dir_nsock(self):
822 """run LDP thru host stack bi-directional (multiple sockets) test"""
824 self.timeout = self.client_bi_dir_nsock_timeout
825 self.thru_host_stack_test(
829 self.client_bi_dir_nsock_test_args,
833 class LDPThruHostStackNsock(VCLTestCase):
834 """LDP Thru Host Stack Nsock"""
838 super(LDPThruHostStackNsock, cls).setUpClass()
841 def tearDownClass(cls):
842 super(LDPThruHostStackNsock, cls).tearDownClass()
845 super(LDPThruHostStackNsock, self).setUp()
847 self.thru_host_stack_setup()
849 self.client_uni_dir_nsock_timeout = 20
850 self.numSockets = "2"
852 self.client_uni_dir_nsock_timeout = 20
853 self.numSockets = "5"
855 self.client_uni_dir_nsock_test_args = [
862 self.loop0.local_ip4,
867 self.thru_host_stack_tear_down()
868 super(LDPThruHostStackNsock, self).tearDown()
870 def test_ldp_thru_host_stack_uni_dir_nsock(self):
871 """run LDP thru host stack uni-directional (multiple sockets) test"""
873 self.timeout = self.client_uni_dir_nsock_timeout
874 self.thru_host_stack_test(
878 self.client_uni_dir_nsock_test_args,
882 class VCLThruHostStackNsock(VCLTestCase):
883 """VCL Thru Host Stack Nsock"""
887 super(VCLThruHostStackNsock, cls).setUpClass()
890 def tearDownClass(cls):
891 super(VCLThruHostStackNsock, cls).tearDownClass()
894 super(VCLThruHostStackNsock, self).setUp()
896 self.thru_host_stack_setup()
898 self.client_uni_dir_nsock_timeout = 20
899 self.numSockets = "2"
901 self.client_uni_dir_nsock_timeout = 20
902 self.numSockets = "5"
904 self.client_uni_dir_nsock_test_args = [
911 self.loop0.local_ip4,
916 self.thru_host_stack_tear_down()
917 super(VCLThruHostStackNsock, self).tearDown()
919 def test_vcl_thru_host_stack_uni_dir_nsock(self):
920 """run VCL thru host stack uni-directional (multiple sockets) test"""
922 self.timeout = self.client_uni_dir_nsock_timeout
923 self.thru_host_stack_test(
927 self.client_uni_dir_nsock_test_args,
931 class LDPThruHostStackIperf(VCLTestCase):
932 """LDP Thru Host Stack Iperf"""
936 super(LDPThruHostStackIperf, cls).setUpClass()
939 def tearDownClass(cls):
940 super(LDPThruHostStackIperf, cls).tearDownClass()
943 super(LDPThruHostStackIperf, self).setUp()
945 self.thru_host_stack_setup()
946 self.client_iperf3_timeout = 20
947 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
948 self.server_iperf3_args = ["-4", "-s"]
951 self.thru_host_stack_tear_down()
952 super(LDPThruHostStackIperf, self).tearDown()
954 def show_commands_at_teardown(self):
955 self.logger.debug(self.vapi.cli("show session verbose 2"))
956 self.logger.debug(self.vapi.cli("show app mq"))
958 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
959 def test_ldp_thru_host_stack_iperf3(self):
960 """run LDP thru host stack iperf3 test"""
962 self.timeout = self.client_iperf3_timeout
963 self.thru_host_stack_test(
964 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
967 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
968 def test_ldp_thru_host_stack_iperf3_mss(self):
969 """run LDP thru host stack iperf3 test with mss option"""
971 self.timeout = self.client_iperf3_timeout
972 self.client_iperf3_args.append("-M 1000")
973 self.thru_host_stack_test(
974 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
978 class LDPThruHostStackIperfUdp(VCLTestCase):
979 """LDP Thru Host Stack Iperf UDP"""
983 super(LDPThruHostStackIperfUdp, cls).setUpClass()
986 def tearDownClass(cls):
987 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
990 super(LDPThruHostStackIperfUdp, self).setUp()
992 self.thru_host_stack_setup()
993 self.client_iperf3_timeout = 20
994 self.client_iperf3_args = [
1001 self.loop0.local_ip4,
1003 self.server_iperf3_args = ["-4", "-s"]
1006 self.thru_host_stack_tear_down()
1007 super(LDPThruHostStackIperfUdp, self).tearDown()
1009 def show_commands_at_teardown(self):
1010 self.logger.debug(self.vapi.cli("show session verbose 2"))
1011 self.logger.debug(self.vapi.cli("show app mq"))
1013 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
1014 def test_ldp_thru_host_stack_iperf3_udp(self):
1015 """run LDP thru host stack iperf3 UDP test"""
1017 self.timeout = self.client_iperf3_timeout
1018 self.thru_host_stack_test(
1019 iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args
1023 class LDPIpv6CutThruTestCase(VCLTestCase):
1024 """LDP IPv6 Cut Thru Tests"""
1027 def setUpClass(cls):
1028 super(LDPIpv6CutThruTestCase, cls).setUpClass()
1031 def tearDownClass(cls):
1032 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
1034 def show_commands_at_teardown(self):
1035 self.logger.debug(self.vapi.cli("show session verbose 2"))
1036 self.logger.debug(self.vapi.cli("show app mq"))
1039 super(LDPIpv6CutThruTestCase, self).setUp()
1041 self.cut_thru_setup()
1042 self.client_iperf3_timeout = 20
1043 self.client_uni_dir_nsock_timeout = 20
1044 self.client_bi_dir_nsock_timeout = 20
1045 self.client_ipv6_echo_test_args = [
1050 self.server_ipv6_addr,
1053 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c", self.server_ipv6_addr]
1054 self.server_ipv6_iperf3_args = ["-6", "-s"]
1055 self.client_ipv6_uni_dir_nsock_test_args = [
1063 self.server_ipv6_addr,
1066 self.client_ipv6_bi_dir_nsock_test_args = [
1074 self.server_ipv6_addr,
1079 super(LDPIpv6CutThruTestCase, self).tearDown()
1080 self.cut_thru_tear_down()
1082 @unittest.skipUnless(config.extended, "part of extended tests")
1083 def test_ldp_ipv6_cut_thru_echo(self):
1084 """run LDP IPv6 cut thru echo test"""
1088 self.server_ipv6_args,
1090 self.client_ipv6_echo_test_args,
1093 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
1094 def test_ldp_ipv6_cut_thru_iperf3(self):
1095 """run LDP IPv6 cut thru iperf3 test"""
1097 self.timeout = self.client_iperf3_timeout
1099 iperf3, self.server_ipv6_iperf3_args, iperf3, self.client_ipv6_iperf3_args
1102 @unittest.skipUnless(config.extended, "part of extended tests")
1103 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
1104 """run LDP IPv6 cut thru uni-directional (multiple sockets) test"""
1106 self.timeout = self.client_uni_dir_nsock_timeout
1109 self.server_ipv6_args,
1111 self.client_ipv6_uni_dir_nsock_test_args,
1114 @unittest.skipUnless(config.extended, "part of extended tests")
1115 @unittest.skip("sock test apps need to be improved")
1116 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
1117 """run LDP IPv6 cut thru bi-directional (multiple sockets) test"""
1119 self.timeout = self.client_bi_dir_nsock_timeout
1122 self.server_ipv6_args,
1124 self.client_ipv6_bi_dir_nsock_test_args,
1128 class VCLIpv6CutThruTestCase(VCLTestCase):
1129 """VCL IPv6 Cut Thru Tests"""
1132 def setUpClass(cls):
1133 super(VCLIpv6CutThruTestCase, cls).setUpClass()
1136 def tearDownClass(cls):
1137 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
1139 def show_commands_at_teardown(self):
1140 self.logger.debug(self.vapi.cli("show session verbose 2"))
1141 self.logger.debug(self.vapi.cli("show app mq"))
1144 super(VCLIpv6CutThruTestCase, self).setUp()
1146 self.cut_thru_setup()
1147 self.client_uni_dir_nsock_timeout = 20
1148 self.client_bi_dir_nsock_timeout = 20
1149 self.client_ipv6_echo_test_args = [
1154 self.server_ipv6_addr,
1157 self.client_ipv6_uni_dir_nsock_test_args = [
1165 self.server_ipv6_addr,
1168 self.client_ipv6_bi_dir_nsock_test_args = [
1176 self.server_ipv6_addr,
1181 super(VCLIpv6CutThruTestCase, self).tearDown()
1182 self.cut_thru_tear_down()
1184 def show_commands_at_teardown(self):
1185 self.logger.debug(self.vapi.cli("show session verbose 2"))
1186 self.logger.debug(self.vapi.cli("show app mq"))
1188 def test_vcl_ipv6_cut_thru_echo(self):
1189 """run VCL IPv6 cut thru echo test"""
1193 self.server_ipv6_args,
1195 self.client_ipv6_echo_test_args,
1198 @unittest.skipUnless(config.extended, "part of extended tests")
1199 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
1200 """run VCL IPv6 cut thru uni-directional (multiple sockets) test"""
1202 self.timeout = self.client_uni_dir_nsock_timeout
1205 self.server_ipv6_args,
1207 self.client_ipv6_uni_dir_nsock_test_args,
1210 @unittest.skipUnless(config.extended, "part of extended tests")
1211 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
1212 """run VCL IPv6 cut thru bi-directional (multiple sockets) test"""
1214 self.timeout = self.client_bi_dir_nsock_timeout
1217 self.server_ipv6_args,
1219 self.client_ipv6_bi_dir_nsock_test_args,
1223 class VCLIpv6ThruHostStackEcho(VCLTestCase):
1224 """VCL IPv6 Thru Host Stack Echo"""
1227 def setUpClass(cls):
1228 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
1231 def tearDownClass(cls):
1232 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
1235 super(VCLIpv6ThruHostStackEcho, self).setUp()
1237 self.thru_host_stack_ipv6_setup()
1238 self.client_ipv6_echo_test_args = [
1243 self.loop0.local_ip6,
1248 self.thru_host_stack_ipv6_tear_down()
1249 super(VCLIpv6ThruHostStackEcho, self).tearDown()
1251 def test_vcl_ipv6_thru_host_stack_echo(self):
1252 """run VCL IPv6 thru host stack echo test"""
1254 self.thru_host_stack_test(
1256 self.server_ipv6_args,
1258 self.client_ipv6_echo_test_args,
1262 if __name__ == "__main__":
1263 unittest.main(testRunner=VppTestRunner)