9 from framework import VppTestCase, VppTestRunner, running_extended_tests, \
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, build_dir, appname, executable_args, logger, env=None,
36 role=None, *args, **kwargs):
38 vpp_install_path = os.getenv('VPP_INSTALL_PATH')
40 vcl_ldpreload_glob = "{}/**/{}".format(vpp_install_path, self.libname)
41 vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True)
43 if len(vcl_ldpreload_so) < 1:
44 raise LibraryNotFound("cannot locate library: {}".format(
47 vcl_ldpreload_so = vcl_ldpreload_so[0]
51 if "iperf" in appname:
53 env.update({'LD_PRELOAD': vcl_ldpreload_so})
54 elif "sock" in appname:
55 app = "%s/vpp/bin/%s" % (build_dir, appname)
56 env.update({'LD_PRELOAD': vcl_ldpreload_so})
58 app = "%s/vpp/bin/%s" % (build_dir, appname)
59 self.args = [app] + executable_args
60 super(VCLAppWorker, self).__init__(self.args, logger, env,
64 class VCLTestCase(VppTestCase):
65 """ VCL Test Class """
66 session_startup = ["poll-main"]
70 if cls.session_startup:
71 conf = "session {" + " ".join(cls.session_startup) + "}"
72 cls.extra_vpp_punt_config = [conf]
73 super(VCLTestCase, cls).setUpClass()
76 def tearDownClass(cls):
77 super(VCLTestCase, cls).tearDownClass()
81 self.build_dir = os.getenv(var, None)
82 if self.build_dir is None:
83 raise EnvironmentError("Environment variable `%s' not set" % var)
84 self.vppDebug = 'vpp_debug' in self.build_dir
85 self.server_addr = "127.0.0.1"
86 self.server_port = "22000"
87 self.server_args = [self.server_port]
88 self.server_ipv6_addr = "::1"
89 self.server_ipv6_args = ["-6", self.server_port]
91 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
92 self.pre_test_sleep = 0.3
93 self.post_test_sleep = 0.2
94 self.sapi_client_sock = ""
95 self.sapi_server_sock = ""
97 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
98 os.remove("/tmp/ldp_server_af_unix_socket")
100 super(VCLTestCase, self).setUp()
102 def update_vcl_app_env(self, ns_id, ns_secret, attach_sock):
104 if 'VCL_APP_NAMESPACE_ID' in self.vcl_app_env:
105 del self.vcl_app_env['VCL_APP_NAMESPACE_ID']
107 self.vcl_app_env['VCL_APP_NAMESPACE_ID'] = ns_id
110 if 'VCL_APP_NAMESPACE_SECRET' in self.vcl_app_env:
111 del self.vcl_app_env['VCL_APP_NAMESPACE_SECRET']
113 self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] = ns_secret
116 self.vcl_app_env['VCL_VPP_API_SOCKET'] = self.get_api_sock_path()
117 if 'VCL_VPP_SAPI_SOCKET' in self.vcl_app_env:
118 del self.vcl_app_env['VCL_VPP_SAPI_SOCKET']
120 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
121 self.vcl_app_env['VCL_VPP_SAPI_SOCKET'] = sapi_sock
122 if 'VCL_VPP_API_SOCKET' in self.vcl_app_env:
123 del self.vcl_app_env['VCL_VPP_API_SOCKET']
125 def cut_thru_setup(self):
126 self.vapi.session_enable_disable(is_enable=1)
128 def cut_thru_tear_down(self):
129 self.vapi.session_enable_disable(is_enable=0)
131 def cut_thru_test(self, server_app, server_args, client_app, client_args):
132 self.vcl_app_env = {'VCL_APP_SCOPE_LOCAL': "true"}
134 self.update_vcl_app_env("", "", self.sapi_server_sock)
135 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
136 self.logger, self.vcl_app_env, "server")
137 worker_server.start()
138 self.sleep(self.pre_test_sleep)
140 self.update_vcl_app_env("", "", self.sapi_client_sock)
141 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
142 self.logger, self.vcl_app_env, "client")
143 worker_client.start()
144 worker_client.join(self.timeout)
146 self.validateResults(worker_client, worker_server, self.timeout)
147 except Exception as error:
148 self.fail("Failed with %s" % error)
149 self.sleep(self.post_test_sleep)
151 def thru_host_stack_setup(self):
152 self.vapi.session_enable_disable(is_enable=1)
153 self.create_loopback_interfaces(2)
157 for i in self.lo_interfaces:
161 tbl = VppIpTable(self, table_id)
164 i.set_table_ip4(table_id)
168 # Configure namespaces
169 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
170 sw_if_index=self.loop0.sw_if_index)
171 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
172 sw_if_index=self.loop1.sw_if_index)
174 # Add inter-table routes
175 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
176 [VppRoutePath("0.0.0.0",
178 nh_table_id=2)], table_id=1)
179 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
180 [VppRoutePath("0.0.0.0",
182 nh_table_id=1)], table_id=2)
183 ip_t01.add_vpp_config()
184 ip_t10.add_vpp_config()
185 self.logger.debug(self.vapi.cli("show ip fib"))
187 def thru_host_stack_tear_down(self):
188 for i in self.lo_interfaces:
193 def thru_host_stack_ipv6_setup(self):
194 self.vapi.session_enable_disable(is_enable=1)
195 self.create_loopback_interfaces(2)
199 for i in self.lo_interfaces:
202 tbl = VppIpTable(self, table_id, is_ip6=1)
205 i.set_table_ip6(table_id)
209 # Configure namespaces
210 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
211 sw_if_index=self.loop0.sw_if_index)
212 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
213 sw_if_index=self.loop1.sw_if_index)
215 # Add inter-table routes
216 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
217 [VppRoutePath("::0", 0xffffffff,
220 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
221 [VppRoutePath("::0", 0xffffffff,
224 ip_t01.add_vpp_config()
225 ip_t10.add_vpp_config()
226 self.logger.debug(self.vapi.cli("show interface addr"))
227 self.logger.debug(self.vapi.cli("show ip6 fib"))
229 def thru_host_stack_ipv6_tear_down(self):
230 for i in self.lo_interfaces:
235 self.vapi.session_enable_disable(is_enable=0)
237 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
238 def thru_host_stack_test(self, server_app, server_args,
239 client_app, client_args):
240 self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"}
242 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
243 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
244 self.logger, self.vcl_app_env, "server")
245 worker_server.start()
246 self.sleep(self.pre_test_sleep)
248 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
249 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
250 self.logger, self.vcl_app_env, "client")
251 worker_client.start()
252 worker_client.join(self.timeout)
255 self.validateResults(worker_client, worker_server, self.timeout)
256 except Exception as error:
257 self.fail("Failed with %s" % error)
258 self.sleep(self.post_test_sleep)
260 def validateResults(self, worker_client, worker_server, timeout):
261 if worker_server.process is None:
262 raise RuntimeError('worker_server is not running.')
263 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
264 self.logger.info("Killing server worker process (pid %d)" %
265 worker_server.process.pid)
266 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
268 self.logger.info("Client worker result is `%s'" % worker_client.result)
270 if worker_client.result is None:
274 "Timeout: %ss! Killing client worker process (pid %d)" %
275 (timeout, worker_client.process.pid))
276 os.killpg(os.getpgid(worker_client.process.pid),
281 "Couldn't kill client worker process")
285 "Timeout! Client worker did not finish in %ss" % timeout)
286 self.assert_equal(worker_client.result, 0, "Binary test return code")
289 class LDPCutThruTestCase(VCLTestCase):
290 """ LDP Cut Thru Tests """
294 cls.session_startup = ["poll-main", "use-app-socket-api"]
295 super(LDPCutThruTestCase, cls).setUpClass()
298 def tearDownClass(cls):
299 super(LDPCutThruTestCase, cls).tearDownClass()
302 super(LDPCutThruTestCase, self).setUp()
304 self.cut_thru_setup()
305 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
306 self.server_addr, self.server_port]
307 self.client_iperf3_timeout = 20
308 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
309 self.server_iperf3_args = ["-4", "-s"]
310 self.client_uni_dir_nsock_timeout = 20
311 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
315 self.client_bi_dir_nsock_timeout = 20
316 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
320 self.sapi_client_sock = "default"
321 self.sapi_server_sock = "default"
324 super(LDPCutThruTestCase, self).tearDown()
325 self.cut_thru_tear_down()
327 def show_commands_at_teardown(self):
328 self.logger.debug(self.vapi.cli("show session verbose 2"))
329 self.logger.debug(self.vapi.cli("show app mq"))
331 @unittest.skipUnless(running_extended_tests, "part of extended tests")
332 def test_ldp_cut_thru_echo(self):
333 """ run LDP cut thru echo test """
335 self.cut_thru_test("sock_test_server", self.server_args,
336 "sock_test_client", self.client_echo_test_args)
338 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
339 def test_ldp_cut_thru_iperf3(self):
340 """ run LDP cut thru iperf3 test """
342 self.timeout = self.client_iperf3_timeout
343 self.cut_thru_test(iperf3, self.server_iperf3_args,
344 iperf3, self.client_iperf3_args)
346 @unittest.skipUnless(running_extended_tests, "part of extended tests")
347 def test_ldp_cut_thru_uni_dir_nsock(self):
348 """ run LDP cut thru uni-directional (multiple sockets) test """
350 self.timeout = self.client_uni_dir_nsock_timeout
351 self.cut_thru_test("sock_test_server", self.server_args,
353 self.client_uni_dir_nsock_test_args)
355 @unittest.skipUnless(running_extended_tests, "part of extended tests")
356 @unittest.skip("sock test apps need to be improved")
357 def test_ldp_cut_thru_bi_dir_nsock(self):
358 """ run LDP cut thru bi-directional (multiple sockets) test """
360 self.timeout = self.client_bi_dir_nsock_timeout
361 self.cut_thru_test("sock_test_server", self.server_args,
363 self.client_bi_dir_nsock_test_args)
366 class VCLCutThruTestCase(VCLTestCase):
367 """ VCL Cut Thru Tests """
371 super(VCLCutThruTestCase, cls).setUpClass()
374 def tearDownClass(cls):
375 super(VCLCutThruTestCase, cls).tearDownClass()
378 super(VCLCutThruTestCase, self).setUp()
380 self.cut_thru_setup()
381 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
382 self.server_addr, self.server_port]
384 self.client_uni_dir_nsock_timeout = 20
385 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
389 self.client_bi_dir_nsock_timeout = 20
390 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
396 super(VCLCutThruTestCase, self).tearDown()
398 def show_commands_at_teardown(self):
399 self.logger.debug(self.vapi.cli("show session verbose 2"))
400 self.logger.debug(self.vapi.cli("show app mq"))
402 def test_vcl_cut_thru_echo(self):
403 """ run VCL cut thru echo test """
405 self.cut_thru_test("vcl_test_server", self.server_args,
406 "vcl_test_client", self.client_echo_test_args)
408 def test_vcl_cut_thru_uni_dir_nsock(self):
409 """ run VCL cut thru uni-directional (multiple sockets) test """
411 self.timeout = self.client_uni_dir_nsock_timeout
412 self.cut_thru_test("vcl_test_server", self.server_args,
414 self.client_uni_dir_nsock_test_args)
416 def test_vcl_cut_thru_bi_dir_nsock(self):
417 """ run VCL cut thru bi-directional (multiple sockets) test """
419 self.timeout = self.client_bi_dir_nsock_timeout
420 self.cut_thru_test("vcl_test_server", self.server_args,
422 self.client_bi_dir_nsock_test_args)
425 class VCLThruHostStackEcho(VCLTestCase):
426 """ VCL Thru Host Stack Echo """
430 super(VCLThruHostStackEcho, cls).setUpClass()
433 def tearDownClass(cls):
434 super(VCLThruHostStackEcho, cls).tearDownClass()
437 super(VCLThruHostStackEcho, self).setUp()
439 self.thru_host_stack_setup()
440 self.client_bi_dir_nsock_timeout = 20
441 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
443 self.loop0.local_ip4,
445 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
446 self.loop0.local_ip4,
450 self.thru_host_stack_tear_down()
451 super(VCLThruHostStackEcho, self).tearDown()
453 def show_commands_at_teardown(self):
454 self.logger.debug(self.vapi.cli("show app server"))
455 self.logger.debug(self.vapi.cli("show session verbose"))
456 self.logger.debug(self.vapi.cli("show app mq"))
459 class VCLThruHostStackTLS(VCLTestCase):
460 """ VCL Thru Host Stack TLS """
464 cls.session_startup = ["poll-main", "use-app-socket-api"]
465 super(VCLThruHostStackTLS, cls).setUpClass()
468 def tearDownClass(cls):
469 super(VCLThruHostStackTLS, cls).tearDownClass()
472 super(VCLThruHostStackTLS, self).setUp()
474 self.thru_host_stack_setup()
475 self.client_uni_dir_tls_timeout = 20
476 self.server_tls_args = ["-L", self.server_port]
477 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
478 self.loop0.local_ip4,
480 self.sapi_server_sock = "1"
481 self.sapi_client_sock = "2"
483 def test_vcl_thru_host_stack_tls_uni_dir(self):
484 """ run VCL thru host stack uni-directional TLS test """
486 self.timeout = self.client_uni_dir_tls_timeout
487 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
489 self.client_uni_dir_tls_test_args)
492 self.thru_host_stack_tear_down()
493 super(VCLThruHostStackTLS, self).tearDown()
495 def show_commands_at_teardown(self):
496 self.logger.debug(self.vapi.cli("show app server"))
497 self.logger.debug(self.vapi.cli("show session verbose 2"))
498 self.logger.debug(self.vapi.cli("show app mq"))
501 class VCLThruHostStackDTLS(VCLTestCase):
502 """ VCL Thru Host Stack DTLS """
506 super(VCLThruHostStackDTLS, cls).setUpClass()
509 def tearDownClass(cls):
510 super(VCLThruHostStackDTLS, cls).tearDownClass()
513 super(VCLThruHostStackDTLS, self).setUp()
515 self.thru_host_stack_setup()
516 self.client_uni_dir_dtls_timeout = 20
517 self.server_dtls_args = ["-p", "dtls", self.server_port]
518 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
519 "-p", "dtls", "-T 1400",
520 self.loop0.local_ip4,
523 def test_vcl_thru_host_stack_dtls_uni_dir(self):
524 """ run VCL thru host stack uni-directional DTLS test """
526 self.timeout = self.client_uni_dir_dtls_timeout
527 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
529 self.client_uni_dir_dtls_test_args)
532 self.thru_host_stack_tear_down()
533 super(VCLThruHostStackDTLS, self).tearDown()
535 def show_commands_at_teardown(self):
536 self.logger.debug(self.vapi.cli("show app server"))
537 self.logger.debug(self.vapi.cli("show session verbose 2"))
538 self.logger.debug(self.vapi.cli("show app mq"))
541 class VCLThruHostStackQUIC(VCLTestCase):
542 """ VCL Thru Host Stack QUIC """
546 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
547 super(VCLThruHostStackQUIC, cls).setUpClass()
550 def tearDownClass(cls):
551 super(VCLThruHostStackQUIC, cls).tearDownClass()
554 super(VCLThruHostStackQUIC, self).setUp()
556 self.thru_host_stack_setup()
557 self.client_uni_dir_quic_timeout = 20
558 self.server_quic_args = ["-p", "quic", self.server_port]
559 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
561 self.loop0.local_ip4,
564 @unittest.skipUnless(running_extended_tests, "part of extended tests")
565 def test_vcl_thru_host_stack_quic_uni_dir(self):
566 """ run VCL thru host stack uni-directional QUIC test """
568 self.timeout = self.client_uni_dir_quic_timeout
569 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
571 self.client_uni_dir_quic_test_args)
574 self.thru_host_stack_tear_down()
575 super(VCLThruHostStackQUIC, self).tearDown()
577 def show_commands_at_teardown(self):
578 self.logger.debug(self.vapi.cli("show app server"))
579 self.logger.debug(self.vapi.cli("show session verbose 2"))
580 self.logger.debug(self.vapi.cli("show app mq"))
583 class VCLThruHostStackBidirNsock(VCLTestCase):
584 """ VCL Thru Host Stack Bidir Nsock """
588 super(VCLThruHostStackBidirNsock, cls).setUpClass()
591 def tearDownClass(cls):
592 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
595 super(VCLThruHostStackBidirNsock, self).setUp()
597 self.thru_host_stack_setup()
598 self.client_bi_dir_nsock_timeout = 20
599 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
601 self.loop0.local_ip4,
603 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
604 self.loop0.local_ip4,
608 self.thru_host_stack_tear_down()
609 super(VCLThruHostStackBidirNsock, self).tearDown()
611 def show_commands_at_teardown(self):
612 self.logger.debug(self.vapi.cli("show session verbose 2"))
613 self.logger.debug(self.vapi.cli("show app mq"))
615 def test_vcl_thru_host_stack_bi_dir_nsock(self):
616 """ run VCL thru host stack bi-directional (multiple sockets) test """
618 self.timeout = self.client_bi_dir_nsock_timeout
619 self.thru_host_stack_test("vcl_test_server", self.server_args,
621 self.client_bi_dir_nsock_test_args)
624 class LDPThruHostStackBidirNsock(VCLTestCase):
625 """ LDP Thru Host Stack Bidir Nsock """
629 super(LDPThruHostStackBidirNsock, cls).setUpClass()
632 def tearDownClass(cls):
633 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
636 super(LDPThruHostStackBidirNsock, self).setUp()
638 self.thru_host_stack_setup()
639 self.client_bi_dir_nsock_timeout = 20
640 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
641 # OUCH! Host Stack Bug?
642 # Only fails when running
643 # 'make test TEST_JOBS=auto'
646 self.loop0.local_ip4,
650 self.thru_host_stack_tear_down()
651 super(LDPThruHostStackBidirNsock, self).tearDown()
653 def show_commands_at_teardown(self):
654 self.logger.debug(self.vapi.cli("show session verbose 2"))
655 self.logger.debug(self.vapi.cli("show app mq"))
657 def test_ldp_thru_host_stack_bi_dir_nsock(self):
658 """ run LDP thru host stack bi-directional (multiple sockets) test """
660 self.timeout = self.client_bi_dir_nsock_timeout
661 self.thru_host_stack_test("sock_test_server", self.server_args,
663 self.client_bi_dir_nsock_test_args)
666 class LDPThruHostStackNsock(VCLTestCase):
667 """ LDP Thru Host Stack Nsock """
671 super(LDPThruHostStackNsock, cls).setUpClass()
674 def tearDownClass(cls):
675 super(LDPThruHostStackNsock, cls).tearDownClass()
678 super(LDPThruHostStackNsock, self).setUp()
680 self.thru_host_stack_setup()
682 self.client_uni_dir_nsock_timeout = 20
683 self.numSockets = "2"
685 self.client_uni_dir_nsock_timeout = 20
686 self.numSockets = "5"
688 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
689 "-I", self.numSockets,
690 self.loop0.local_ip4,
694 self.thru_host_stack_tear_down()
695 super(LDPThruHostStackNsock, self).tearDown()
697 def test_ldp_thru_host_stack_uni_dir_nsock(self):
698 """ run LDP thru host stack uni-directional (multiple sockets) test """
700 self.timeout = self.client_uni_dir_nsock_timeout
701 self.thru_host_stack_test("sock_test_server", self.server_args,
703 self.client_uni_dir_nsock_test_args)
706 class VCLThruHostStackNsock(VCLTestCase):
707 """ VCL Thru Host Stack Nsock """
711 super(VCLThruHostStackNsock, cls).setUpClass()
714 def tearDownClass(cls):
715 super(VCLThruHostStackNsock, cls).tearDownClass()
718 super(VCLThruHostStackNsock, self).setUp()
720 self.thru_host_stack_setup()
722 self.client_uni_dir_nsock_timeout = 20
723 self.numSockets = "2"
725 self.client_uni_dir_nsock_timeout = 20
726 self.numSockets = "5"
728 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
729 "-I", self.numSockets,
730 self.loop0.local_ip4,
734 self.thru_host_stack_tear_down()
735 super(VCLThruHostStackNsock, self).tearDown()
737 def test_vcl_thru_host_stack_uni_dir_nsock(self):
738 """ run VCL thru host stack uni-directional (multiple sockets) test """
740 self.timeout = self.client_uni_dir_nsock_timeout
741 self.thru_host_stack_test("vcl_test_server", self.server_args,
743 self.client_uni_dir_nsock_test_args)
746 class LDPThruHostStackIperf(VCLTestCase):
747 """ LDP Thru Host Stack Iperf """
751 super(LDPThruHostStackIperf, cls).setUpClass()
754 def tearDownClass(cls):
755 super(LDPThruHostStackIperf, cls).tearDownClass()
758 super(LDPThruHostStackIperf, self).setUp()
760 self.thru_host_stack_setup()
761 self.client_iperf3_timeout = 20
762 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
763 self.server_iperf3_args = ["-4", "-s"]
766 self.thru_host_stack_tear_down()
767 super(LDPThruHostStackIperf, self).tearDown()
769 def show_commands_at_teardown(self):
770 self.logger.debug(self.vapi.cli("show session verbose 2"))
771 self.logger.debug(self.vapi.cli("show app mq"))
773 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
774 def test_ldp_thru_host_stack_iperf3(self):
775 """ run LDP thru host stack iperf3 test """
777 self.timeout = self.client_iperf3_timeout
778 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
779 iperf3, self.client_iperf3_args)
782 class LDPThruHostStackIperfUdp(VCLTestCase):
783 """ LDP Thru Host Stack Iperf UDP """
787 super(LDPThruHostStackIperfUdp, cls).setUpClass()
790 def tearDownClass(cls):
791 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
794 super(LDPThruHostStackIperfUdp, self).setUp()
796 self.thru_host_stack_setup()
797 self.client_iperf3_timeout = 20
798 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
799 "-c", self.loop0.local_ip4]
800 self.server_iperf3_args = ["-4", "-s"]
803 self.thru_host_stack_tear_down()
804 super(LDPThruHostStackIperfUdp, self).tearDown()
806 def show_commands_at_teardown(self):
807 self.logger.debug(self.vapi.cli("show session verbose 2"))
808 self.logger.debug(self.vapi.cli("show app mq"))
810 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
811 def test_ldp_thru_host_stack_iperf3_udp(self):
812 """ run LDP thru host stack iperf3 UDP test """
814 self.timeout = self.client_iperf3_timeout
815 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
816 iperf3, self.client_iperf3_args)
819 class LDPIpv6CutThruTestCase(VCLTestCase):
820 """ LDP IPv6 Cut Thru Tests """
824 super(LDPIpv6CutThruTestCase, cls).setUpClass()
827 def tearDownClass(cls):
828 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
830 def show_commands_at_teardown(self):
831 self.logger.debug(self.vapi.cli("show session verbose 2"))
832 self.logger.debug(self.vapi.cli("show app mq"))
835 super(LDPIpv6CutThruTestCase, self).setUp()
837 self.cut_thru_setup()
838 self.client_iperf3_timeout = 20
839 self.client_uni_dir_nsock_timeout = 20
840 self.client_bi_dir_nsock_timeout = 20
841 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
842 self.server_ipv6_addr,
844 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
845 self.server_ipv6_addr]
846 self.server_ipv6_iperf3_args = ["-6", "-s"]
847 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
850 self.server_ipv6_addr,
852 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
855 self.server_ipv6_addr,
859 super(LDPIpv6CutThruTestCase, self).tearDown()
860 self.cut_thru_tear_down()
862 def test_ldp_ipv6_cut_thru_echo(self):
863 """ run LDP IPv6 cut thru echo test """
865 self.cut_thru_test("sock_test_server",
866 self.server_ipv6_args,
868 self.client_ipv6_echo_test_args)
870 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
871 @unittest.skipUnless(running_extended_tests, "part of extended tests")
872 def test_ldp_ipv6_cut_thru_iperf3(self):
873 """ run LDP IPv6 cut thru iperf3 test """
875 self.timeout = self.client_iperf3_timeout
876 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
877 iperf3, self.client_ipv6_iperf3_args)
879 @unittest.skipUnless(running_extended_tests, "part of extended tests")
880 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
881 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
883 self.timeout = self.client_uni_dir_nsock_timeout
884 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
886 self.client_ipv6_uni_dir_nsock_test_args)
888 @unittest.skipUnless(running_extended_tests, "part of extended tests")
889 @unittest.skip("sock test apps need to be improved")
890 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
891 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
893 self.timeout = self.client_bi_dir_nsock_timeout
894 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
896 self.client_ipv6_bi_dir_nsock_test_args)
899 class VCLIpv6CutThruTestCase(VCLTestCase):
900 """ VCL IPv6 Cut Thru Tests """
904 super(VCLIpv6CutThruTestCase, cls).setUpClass()
907 def tearDownClass(cls):
908 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
910 def show_commands_at_teardown(self):
911 self.logger.debug(self.vapi.cli("show session verbose 2"))
912 self.logger.debug(self.vapi.cli("show app mq"))
915 super(VCLIpv6CutThruTestCase, self).setUp()
917 self.cut_thru_setup()
918 self.client_uni_dir_nsock_timeout = 20
919 self.client_bi_dir_nsock_timeout = 20
920 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
921 self.server_ipv6_addr,
923 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
926 self.server_ipv6_addr,
928 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
931 self.server_ipv6_addr,
935 super(VCLIpv6CutThruTestCase, self).tearDown()
936 self.cut_thru_tear_down()
938 def show_commands_at_teardown(self):
939 self.logger.debug(self.vapi.cli("show session verbose 2"))
940 self.logger.debug(self.vapi.cli("show app mq"))
942 def test_vcl_ipv6_cut_thru_echo(self):
943 """ run VCL IPv6 cut thru echo test """
945 self.cut_thru_test("vcl_test_server",
946 self.server_ipv6_args,
948 self.client_ipv6_echo_test_args)
950 @unittest.skipUnless(running_extended_tests, "part of extended tests")
951 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
952 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
954 self.timeout = self.client_uni_dir_nsock_timeout
955 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
957 self.client_ipv6_uni_dir_nsock_test_args)
959 @unittest.skipUnless(running_extended_tests, "part of extended tests")
960 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
961 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
963 self.timeout = self.client_bi_dir_nsock_timeout
964 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
966 self.client_ipv6_bi_dir_nsock_test_args)
969 class VCLIpv6ThruHostStackEcho(VCLTestCase):
970 """ VCL IPv6 Thru Host Stack Echo """
974 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
977 def tearDownClass(cls):
978 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
981 super(VCLIpv6ThruHostStackEcho, self).setUp()
983 self.thru_host_stack_ipv6_setup()
984 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
985 self.loop0.local_ip6,
989 self.thru_host_stack_ipv6_tear_down()
990 super(VCLIpv6ThruHostStackEcho, self).tearDown()
992 def test_vcl_ipv6_thru_host_stack_echo(self):
993 """ run VCL IPv6 thru host stack echo test """
995 self.thru_host_stack_test("vcl_test_server",
996 self.server_ipv6_args,
998 self.client_ipv6_echo_test_args)
1001 if __name__ == '__main__':
1002 unittest.main(testRunner=VppTestRunner)