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):
35 def __init__(self, appname, executable_args, logger, env=None,
36 role=None, *args, **kwargs):
38 vcl_ldpreload_glob = f"{config.vpp_install_dir}/**/{self.libname}"
39 vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True)
41 if len(vcl_ldpreload_so) < 1:
42 raise LibraryNotFound("cannot locate library: {}".format(
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,
62 class VCLTestCase(VppTestCase):
63 """ VCL Test Class """
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(server_app, server_args,
130 self.logger, self.vcl_app_env, "server")
131 worker_server.start()
132 self.sleep(self.pre_test_sleep)
134 self.update_vcl_app_env("", "", self.sapi_client_sock)
135 worker_client = VCLAppWorker(client_app, client_args,
136 self.logger, self.vcl_app_env, "client")
137 worker_client.start()
138 worker_client.join(self.timeout)
140 self.validateResults(worker_client, worker_server, self.timeout)
141 except Exception as error:
142 self.fail("Failed with %s" % error)
143 self.sleep(self.post_test_sleep)
145 def thru_host_stack_setup(self):
146 self.vapi.session_enable_disable(is_enable=1)
147 self.create_loopback_interfaces(2)
151 for i in self.lo_interfaces:
155 tbl = VppIpTable(self, table_id)
158 i.set_table_ip4(table_id)
162 # Configure namespaces
163 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
164 sw_if_index=self.loop0.sw_if_index)
165 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
166 sw_if_index=self.loop1.sw_if_index)
168 # Add inter-table routes
169 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
170 [VppRoutePath("0.0.0.0",
172 nh_table_id=2)], table_id=1)
173 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
174 [VppRoutePath("0.0.0.0",
176 nh_table_id=1)], table_id=2)
177 ip_t01.add_vpp_config()
178 ip_t10.add_vpp_config()
179 self.logger.debug(self.vapi.cli("show ip fib"))
181 def thru_host_stack_tear_down(self):
182 for i in self.lo_interfaces:
187 def thru_host_stack_ipv6_setup(self):
188 self.vapi.session_enable_disable(is_enable=1)
189 self.create_loopback_interfaces(2)
193 for i in self.lo_interfaces:
196 tbl = VppIpTable(self, table_id, is_ip6=1)
199 i.set_table_ip6(table_id)
203 # Configure namespaces
204 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
205 sw_if_index=self.loop0.sw_if_index)
206 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
207 sw_if_index=self.loop1.sw_if_index)
209 # Add inter-table routes
210 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
211 [VppRoutePath("::0", 0xffffffff,
214 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
215 [VppRoutePath("::0", 0xffffffff,
218 ip_t01.add_vpp_config()
219 ip_t10.add_vpp_config()
220 self.logger.debug(self.vapi.cli("show interface addr"))
221 self.logger.debug(self.vapi.cli("show ip6 fib"))
223 def thru_host_stack_ipv6_tear_down(self):
224 for i in self.lo_interfaces:
229 self.vapi.session_enable_disable(is_enable=0)
231 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
232 def thru_host_stack_test(self, server_app, server_args,
233 client_app, client_args):
234 self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"}
236 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
237 worker_server = VCLAppWorker(server_app, server_args,
238 self.logger, self.vcl_app_env, "server")
239 worker_server.start()
240 self.sleep(self.pre_test_sleep)
242 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
243 worker_client = VCLAppWorker(client_app, client_args,
244 self.logger, self.vcl_app_env, "client")
245 worker_client.start()
246 worker_client.join(self.timeout)
249 self.validateResults(worker_client, worker_server, self.timeout)
250 except Exception as error:
251 self.fail("Failed with %s" % error)
252 self.sleep(self.post_test_sleep)
254 def validateResults(self, worker_client, worker_server, timeout):
255 if worker_server.process is None:
256 raise RuntimeError('worker_server is not running.')
257 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
258 self.logger.info("Killing server worker process (pid %d)" %
259 worker_server.process.pid)
260 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
262 self.logger.info("Client worker result is `%s'" % worker_client.result)
264 if worker_client.result is None:
268 "Timeout: %ss! Killing client worker process (pid %d)" %
269 (timeout, worker_client.process.pid))
270 os.killpg(os.getpgid(worker_client.process.pid),
275 "Couldn't kill client worker process")
279 "Timeout! Client worker did not finish in %ss" % timeout)
280 self.assert_equal(worker_client.result, 0, "Binary test return code")
283 class LDPCutThruTestCase(VCLTestCase):
284 """ LDP Cut Thru Tests """
288 cls.session_startup = ["poll-main", "use-app-socket-api"]
289 super(LDPCutThruTestCase, cls).setUpClass()
292 def tearDownClass(cls):
293 super(LDPCutThruTestCase, cls).tearDownClass()
296 super(LDPCutThruTestCase, self).setUp()
298 self.cut_thru_setup()
299 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
300 self.server_addr, self.server_port]
301 self.client_iperf3_timeout = 20
302 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
303 self.server_iperf3_args = ["-4", "-s"]
304 self.client_uni_dir_nsock_timeout = 20
305 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
309 self.client_bi_dir_nsock_timeout = 20
310 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
314 self.sapi_client_sock = "default"
315 self.sapi_server_sock = "default"
318 super(LDPCutThruTestCase, self).tearDown()
319 self.cut_thru_tear_down()
321 def show_commands_at_teardown(self):
322 self.logger.debug(self.vapi.cli("show session verbose 2"))
323 self.logger.debug(self.vapi.cli("show app mq"))
325 @unittest.skipUnless(config.extended, "part of extended tests")
326 def test_ldp_cut_thru_echo(self):
327 """ run LDP cut thru echo test """
329 self.cut_thru_test("sock_test_server", self.server_args,
330 "sock_test_client", self.client_echo_test_args)
332 def test_ldp_cut_thru_iperf3(self):
333 """ run LDP cut thru iperf3 test """
335 self.timeout = self.client_iperf3_timeout
336 self.cut_thru_test(iperf3, self.server_iperf3_args,
337 iperf3, self.client_iperf3_args)
339 @unittest.skipUnless(config.extended, "part of extended tests")
340 def test_ldp_cut_thru_uni_dir_nsock(self):
341 """ run LDP cut thru uni-directional (multiple sockets) test """
343 self.timeout = self.client_uni_dir_nsock_timeout
344 self.cut_thru_test("sock_test_server", self.server_args,
346 self.client_uni_dir_nsock_test_args)
348 @unittest.skipUnless(config.extended, "part of extended tests")
349 @unittest.skip("sock test apps need to be improved")
350 def test_ldp_cut_thru_bi_dir_nsock(self):
351 """ run LDP cut thru bi-directional (multiple sockets) test """
353 self.timeout = self.client_bi_dir_nsock_timeout
354 self.cut_thru_test("sock_test_server", self.server_args,
356 self.client_bi_dir_nsock_test_args)
359 class VCLCutThruTestCase(VCLTestCase):
360 """ VCL Cut Thru Tests """
364 super(VCLCutThruTestCase, cls).setUpClass()
367 def tearDownClass(cls):
368 super(VCLCutThruTestCase, cls).tearDownClass()
371 super(VCLCutThruTestCase, self).setUp()
373 self.cut_thru_setup()
374 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
375 self.server_addr, self.server_port]
377 self.client_uni_dir_nsock_timeout = 20
378 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
382 self.client_bi_dir_nsock_timeout = 20
383 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
389 super(VCLCutThruTestCase, self).tearDown()
391 def show_commands_at_teardown(self):
392 self.logger.debug(self.vapi.cli("show session verbose 2"))
393 self.logger.debug(self.vapi.cli("show app mq"))
395 def test_vcl_cut_thru_echo(self):
396 """ run VCL cut thru echo test """
398 self.cut_thru_test("vcl_test_server", self.server_args,
399 "vcl_test_client", self.client_echo_test_args)
401 def test_vcl_cut_thru_uni_dir_nsock(self):
402 """ run VCL cut thru uni-directional (multiple sockets) test """
404 self.timeout = self.client_uni_dir_nsock_timeout
405 self.cut_thru_test("vcl_test_server", self.server_args,
407 self.client_uni_dir_nsock_test_args)
409 def test_vcl_cut_thru_bi_dir_nsock(self):
410 """ run VCL cut thru bi-directional (multiple sockets) test """
412 self.timeout = self.client_bi_dir_nsock_timeout
413 self.cut_thru_test("vcl_test_server", self.server_args,
415 self.client_bi_dir_nsock_test_args)
418 class VCLThruHostStackEcho(VCLTestCase):
419 """ VCL Thru Host Stack Echo """
423 super(VCLThruHostStackEcho, cls).setUpClass()
426 def tearDownClass(cls):
427 super(VCLThruHostStackEcho, cls).tearDownClass()
430 super(VCLThruHostStackEcho, self).setUp()
432 self.thru_host_stack_setup()
433 self.client_bi_dir_nsock_timeout = 20
434 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
436 self.loop0.local_ip4,
438 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
439 self.loop0.local_ip4,
443 self.thru_host_stack_tear_down()
444 super(VCLThruHostStackEcho, self).tearDown()
446 def test_vcl_thru_host_stack_echo(self):
447 """ run VCL IPv4 thru host stack echo test """
449 self.thru_host_stack_test("vcl_test_server",
452 self.client_echo_test_args)
454 def show_commands_at_teardown(self):
455 self.logger.debug(self.vapi.cli("show app server"))
456 self.logger.debug(self.vapi.cli("show session verbose"))
457 self.logger.debug(self.vapi.cli("show app mq"))
460 class VCLThruHostStackTLS(VCLTestCase):
461 """ VCL Thru Host Stack TLS """
465 cls.session_startup = ["poll-main", "use-app-socket-api"]
466 super(VCLThruHostStackTLS, cls).setUpClass()
469 def tearDownClass(cls):
470 super(VCLThruHostStackTLS, cls).tearDownClass()
473 super(VCLThruHostStackTLS, self).setUp()
475 self.thru_host_stack_setup()
476 self.client_uni_dir_tls_timeout = 20
477 self.server_tls_args = ["-L", self.server_port]
478 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
479 self.loop0.local_ip4,
481 self.sapi_server_sock = "1"
482 self.sapi_client_sock = "2"
484 def test_vcl_thru_host_stack_tls_uni_dir(self):
485 """ run VCL thru host stack uni-directional TLS test """
487 self.timeout = self.client_uni_dir_tls_timeout
488 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
490 self.client_uni_dir_tls_test_args)
493 self.thru_host_stack_tear_down()
494 super(VCLThruHostStackTLS, self).tearDown()
496 def show_commands_at_teardown(self):
497 self.logger.debug(self.vapi.cli("show app server"))
498 self.logger.debug(self.vapi.cli("show session verbose 2"))
499 self.logger.debug(self.vapi.cli("show app mq"))
502 class VCLThruHostStackDTLS(VCLTestCase):
503 """ VCL Thru Host Stack DTLS """
507 super(VCLThruHostStackDTLS, cls).setUpClass()
510 def tearDownClass(cls):
511 super(VCLThruHostStackDTLS, cls).tearDownClass()
514 super(VCLThruHostStackDTLS, self).setUp()
516 self.thru_host_stack_setup()
517 self.client_uni_dir_dtls_timeout = 20
518 self.server_dtls_args = ["-p", "dtls", self.server_port]
519 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
520 "-p", "dtls", "-T 1400",
521 self.loop0.local_ip4,
524 def test_vcl_thru_host_stack_dtls_uni_dir(self):
525 """ run VCL thru host stack uni-directional DTLS test """
527 self.timeout = self.client_uni_dir_dtls_timeout
528 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
530 self.client_uni_dir_dtls_test_args)
533 self.thru_host_stack_tear_down()
534 super(VCLThruHostStackDTLS, self).tearDown()
536 def show_commands_at_teardown(self):
537 self.logger.debug(self.vapi.cli("show app server"))
538 self.logger.debug(self.vapi.cli("show session verbose 2"))
539 self.logger.debug(self.vapi.cli("show app mq"))
542 class VCLThruHostStackQUIC(VCLTestCase):
543 """ VCL Thru Host Stack QUIC """
547 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
548 super(VCLThruHostStackQUIC, cls).setUpClass()
551 def tearDownClass(cls):
552 super(VCLThruHostStackQUIC, cls).tearDownClass()
555 super(VCLThruHostStackQUIC, self).setUp()
557 self.thru_host_stack_setup()
558 self.client_uni_dir_quic_timeout = 20
559 self.server_quic_args = ["-p", "quic", self.server_port]
560 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
562 self.loop0.local_ip4,
565 @unittest.skipUnless(config.extended, "part of extended tests")
566 def test_vcl_thru_host_stack_quic_uni_dir(self):
567 """ run VCL thru host stack uni-directional QUIC test """
569 self.timeout = self.client_uni_dir_quic_timeout
570 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
572 self.client_uni_dir_quic_test_args)
575 self.thru_host_stack_tear_down()
576 super(VCLThruHostStackQUIC, self).tearDown()
578 def show_commands_at_teardown(self):
579 self.logger.debug(self.vapi.cli("show app server"))
580 self.logger.debug(self.vapi.cli("show session verbose 2"))
581 self.logger.debug(self.vapi.cli("show app mq"))
584 class VCLThruHostStackBidirNsock(VCLTestCase):
585 """ VCL Thru Host Stack Bidir Nsock """
589 super(VCLThruHostStackBidirNsock, cls).setUpClass()
592 def tearDownClass(cls):
593 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
596 super(VCLThruHostStackBidirNsock, self).setUp()
598 self.thru_host_stack_setup()
599 self.client_bi_dir_nsock_timeout = 20
600 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
602 self.loop0.local_ip4,
604 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
605 self.loop0.local_ip4,
609 self.thru_host_stack_tear_down()
610 super(VCLThruHostStackBidirNsock, self).tearDown()
612 def show_commands_at_teardown(self):
613 self.logger.debug(self.vapi.cli("show session verbose 2"))
614 self.logger.debug(self.vapi.cli("show app mq"))
616 def test_vcl_thru_host_stack_bi_dir_nsock(self):
617 """ run VCL thru host stack bi-directional (multiple sockets) test """
619 self.timeout = self.client_bi_dir_nsock_timeout
620 self.thru_host_stack_test("vcl_test_server", self.server_args,
622 self.client_bi_dir_nsock_test_args)
625 class LDPThruHostStackBidirNsock(VCLTestCase):
626 """ LDP Thru Host Stack Bidir Nsock """
630 super(LDPThruHostStackBidirNsock, cls).setUpClass()
633 def tearDownClass(cls):
634 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
637 super(LDPThruHostStackBidirNsock, self).setUp()
639 self.thru_host_stack_setup()
640 self.client_bi_dir_nsock_timeout = 20
641 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
642 # OUCH! Host Stack Bug?
643 # Only fails when running
644 # 'make test TEST_JOBS=auto'
647 self.loop0.local_ip4,
651 self.thru_host_stack_tear_down()
652 super(LDPThruHostStackBidirNsock, self).tearDown()
654 def show_commands_at_teardown(self):
655 self.logger.debug(self.vapi.cli("show session verbose 2"))
656 self.logger.debug(self.vapi.cli("show app mq"))
658 def test_ldp_thru_host_stack_bi_dir_nsock(self):
659 """ run LDP thru host stack bi-directional (multiple sockets) test """
661 self.timeout = self.client_bi_dir_nsock_timeout
662 self.thru_host_stack_test("sock_test_server", self.server_args,
664 self.client_bi_dir_nsock_test_args)
667 class LDPThruHostStackNsock(VCLTestCase):
668 """ LDP Thru Host Stack Nsock """
672 super(LDPThruHostStackNsock, cls).setUpClass()
675 def tearDownClass(cls):
676 super(LDPThruHostStackNsock, cls).tearDownClass()
679 super(LDPThruHostStackNsock, self).setUp()
681 self.thru_host_stack_setup()
683 self.client_uni_dir_nsock_timeout = 20
684 self.numSockets = "2"
686 self.client_uni_dir_nsock_timeout = 20
687 self.numSockets = "5"
689 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
690 "-I", self.numSockets,
691 self.loop0.local_ip4,
695 self.thru_host_stack_tear_down()
696 super(LDPThruHostStackNsock, self).tearDown()
698 def test_ldp_thru_host_stack_uni_dir_nsock(self):
699 """ run LDP thru host stack uni-directional (multiple sockets) test """
701 self.timeout = self.client_uni_dir_nsock_timeout
702 self.thru_host_stack_test("sock_test_server", self.server_args,
704 self.client_uni_dir_nsock_test_args)
707 class VCLThruHostStackNsock(VCLTestCase):
708 """ VCL Thru Host Stack Nsock """
712 super(VCLThruHostStackNsock, cls).setUpClass()
715 def tearDownClass(cls):
716 super(VCLThruHostStackNsock, cls).tearDownClass()
719 super(VCLThruHostStackNsock, self).setUp()
721 self.thru_host_stack_setup()
723 self.client_uni_dir_nsock_timeout = 20
724 self.numSockets = "2"
726 self.client_uni_dir_nsock_timeout = 20
727 self.numSockets = "5"
729 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
730 "-I", self.numSockets,
731 self.loop0.local_ip4,
735 self.thru_host_stack_tear_down()
736 super(VCLThruHostStackNsock, self).tearDown()
738 def test_vcl_thru_host_stack_uni_dir_nsock(self):
739 """ run VCL thru host stack uni-directional (multiple sockets) test """
741 self.timeout = self.client_uni_dir_nsock_timeout
742 self.thru_host_stack_test("vcl_test_server", self.server_args,
744 self.client_uni_dir_nsock_test_args)
747 class LDPThruHostStackIperf(VCLTestCase):
748 """ LDP Thru Host Stack Iperf """
752 super(LDPThruHostStackIperf, cls).setUpClass()
755 def tearDownClass(cls):
756 super(LDPThruHostStackIperf, cls).tearDownClass()
759 super(LDPThruHostStackIperf, self).setUp()
761 self.thru_host_stack_setup()
762 self.client_iperf3_timeout = 20
763 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
764 self.server_iperf3_args = ["-4", "-s"]
767 self.thru_host_stack_tear_down()
768 super(LDPThruHostStackIperf, self).tearDown()
770 def show_commands_at_teardown(self):
771 self.logger.debug(self.vapi.cli("show session verbose 2"))
772 self.logger.debug(self.vapi.cli("show app mq"))
774 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
775 def test_ldp_thru_host_stack_iperf3(self):
776 """ run LDP thru host stack iperf3 test """
778 self.timeout = self.client_iperf3_timeout
779 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
780 iperf3, self.client_iperf3_args)
783 class LDPThruHostStackIperfUdp(VCLTestCase):
784 """ LDP Thru Host Stack Iperf UDP """
788 super(LDPThruHostStackIperfUdp, cls).setUpClass()
791 def tearDownClass(cls):
792 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
795 super(LDPThruHostStackIperfUdp, self).setUp()
797 self.thru_host_stack_setup()
798 self.client_iperf3_timeout = 20
799 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
800 "-c", self.loop0.local_ip4]
801 self.server_iperf3_args = ["-4", "-s"]
804 self.thru_host_stack_tear_down()
805 super(LDPThruHostStackIperfUdp, self).tearDown()
807 def show_commands_at_teardown(self):
808 self.logger.debug(self.vapi.cli("show session verbose 2"))
809 self.logger.debug(self.vapi.cli("show app mq"))
811 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
812 def test_ldp_thru_host_stack_iperf3_udp(self):
813 """ run LDP thru host stack iperf3 UDP test """
815 self.timeout = self.client_iperf3_timeout
816 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
817 iperf3, self.client_iperf3_args)
820 class LDPIpv6CutThruTestCase(VCLTestCase):
821 """ LDP IPv6 Cut Thru Tests """
825 super(LDPIpv6CutThruTestCase, cls).setUpClass()
828 def tearDownClass(cls):
829 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
831 def show_commands_at_teardown(self):
832 self.logger.debug(self.vapi.cli("show session verbose 2"))
833 self.logger.debug(self.vapi.cli("show app mq"))
836 super(LDPIpv6CutThruTestCase, self).setUp()
838 self.cut_thru_setup()
839 self.client_iperf3_timeout = 20
840 self.client_uni_dir_nsock_timeout = 20
841 self.client_bi_dir_nsock_timeout = 20
842 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
843 self.server_ipv6_addr,
845 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
846 self.server_ipv6_addr]
847 self.server_ipv6_iperf3_args = ["-6", "-s"]
848 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
851 self.server_ipv6_addr,
853 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
856 self.server_ipv6_addr,
860 super(LDPIpv6CutThruTestCase, self).tearDown()
861 self.cut_thru_tear_down()
863 @unittest.skipUnless(config.extended, "part of extended tests")
864 def test_ldp_ipv6_cut_thru_echo(self):
865 """ run LDP IPv6 cut thru echo test """
867 self.cut_thru_test("sock_test_server",
868 self.server_ipv6_args,
870 self.client_ipv6_echo_test_args)
872 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
873 def test_ldp_ipv6_cut_thru_iperf3(self):
874 """ run LDP IPv6 cut thru iperf3 test """
876 self.timeout = self.client_iperf3_timeout
877 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
878 iperf3, self.client_ipv6_iperf3_args)
880 @unittest.skipUnless(config.extended, "part of extended tests")
881 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
882 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
884 self.timeout = self.client_uni_dir_nsock_timeout
885 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
887 self.client_ipv6_uni_dir_nsock_test_args)
889 @unittest.skipUnless(config.extended, "part of extended tests")
890 @unittest.skip("sock test apps need to be improved")
891 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
892 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
894 self.timeout = self.client_bi_dir_nsock_timeout
895 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
897 self.client_ipv6_bi_dir_nsock_test_args)
900 class VCLIpv6CutThruTestCase(VCLTestCase):
901 """ VCL IPv6 Cut Thru Tests """
905 super(VCLIpv6CutThruTestCase, cls).setUpClass()
908 def tearDownClass(cls):
909 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
911 def show_commands_at_teardown(self):
912 self.logger.debug(self.vapi.cli("show session verbose 2"))
913 self.logger.debug(self.vapi.cli("show app mq"))
916 super(VCLIpv6CutThruTestCase, self).setUp()
918 self.cut_thru_setup()
919 self.client_uni_dir_nsock_timeout = 20
920 self.client_bi_dir_nsock_timeout = 20
921 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
922 self.server_ipv6_addr,
924 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
927 self.server_ipv6_addr,
929 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
932 self.server_ipv6_addr,
936 super(VCLIpv6CutThruTestCase, self).tearDown()
937 self.cut_thru_tear_down()
939 def show_commands_at_teardown(self):
940 self.logger.debug(self.vapi.cli("show session verbose 2"))
941 self.logger.debug(self.vapi.cli("show app mq"))
943 def test_vcl_ipv6_cut_thru_echo(self):
944 """ run VCL IPv6 cut thru echo test """
946 self.cut_thru_test("vcl_test_server",
947 self.server_ipv6_args,
949 self.client_ipv6_echo_test_args)
951 @unittest.skipUnless(config.extended, "part of extended tests")
952 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
953 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
955 self.timeout = self.client_uni_dir_nsock_timeout
956 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
958 self.client_ipv6_uni_dir_nsock_test_args)
960 @unittest.skipUnless(config.extended, "part of extended tests")
961 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
962 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
964 self.timeout = self.client_bi_dir_nsock_timeout
965 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
967 self.client_ipv6_bi_dir_nsock_test_args)
970 class VCLIpv6ThruHostStackEcho(VCLTestCase):
971 """ VCL IPv6 Thru Host Stack Echo """
975 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
978 def tearDownClass(cls):
979 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
982 super(VCLIpv6ThruHostStackEcho, self).setUp()
984 self.thru_host_stack_ipv6_setup()
985 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
986 self.loop0.local_ip6,
990 self.thru_host_stack_ipv6_tear_down()
991 super(VCLIpv6ThruHostStackEcho, self).tearDown()
993 def test_vcl_ipv6_thru_host_stack_echo(self):
994 """ run VCL IPv6 thru host stack echo test """
996 self.thru_host_stack_test("vcl_test_server",
997 self.server_ipv6_args,
999 self.client_ipv6_echo_test_args)
1002 if __name__ == '__main__':
1003 unittest.main(testRunner=VppTestRunner)