8 from framework import VppTestCase, VppTestRunner, running_extended_tests, \
10 from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto
12 iperf3 = '/usr/bin/iperf3'
17 subprocess.check_output([app, '-v'])
18 except (subprocess.CalledProcessError, OSError):
23 _have_iperf3 = have_app(iperf3)
26 class VCLAppWorker(Worker):
27 """ VCL Test Application Worker """
29 def __init__(self, build_dir, appname, executable_args, logger, env=None,
30 role=None, *args, **kwargs):
34 vcl_lib_dir = "%s/vpp/lib" % build_dir
35 if "iperf" in appname:
37 env.update({'LD_PRELOAD':
38 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
39 elif "sock" in appname:
40 app = "%s/vpp/bin/%s" % (build_dir, appname)
41 env.update({'LD_PRELOAD':
42 "%s/libvcl_ldpreload.so" % vcl_lib_dir})
44 app = "%s/vpp/bin/%s" % (build_dir, appname)
45 self.args = [app] + executable_args
46 super(VCLAppWorker, self).__init__(self.args, logger, env,
50 class VCLTestCase(VppTestCase):
51 """ VCL Test Class """
52 session_startup = ["poll-main"]
56 if cls.session_startup:
57 conf = "session {" + " ".join(cls.session_startup) + "}"
58 cls.extra_vpp_punt_config = [conf]
59 super(VCLTestCase, cls).setUpClass()
62 def tearDownClass(cls):
63 super(VCLTestCase, cls).tearDownClass()
67 self.build_dir = os.getenv(var, None)
68 if self.build_dir is None:
69 raise EnvironmentError("Environment variable `%s' not set" % var)
70 self.vppDebug = 'vpp_debug' in self.build_dir
71 self.server_addr = "127.0.0.1"
72 self.server_port = "22000"
73 self.server_args = [self.server_port]
74 self.server_ipv6_addr = "::1"
75 self.server_ipv6_args = ["-6", self.server_port]
77 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
78 self.pre_test_sleep = 0.3
79 self.post_test_sleep = 0.2
80 self.sapi_client_sock = ""
81 self.sapi_server_sock = ""
83 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
84 os.remove("/tmp/ldp_server_af_unix_socket")
86 super(VCLTestCase, self).setUp()
88 def update_vcl_app_env(self, ns_id, ns_secret, attach_sock):
90 if 'VCL_APP_NAMESPACE_ID' in self.vcl_app_env:
91 del self.vcl_app_env['VCL_APP_NAMESPACE_ID']
93 self.vcl_app_env['VCL_APP_NAMESPACE_ID'] = ns_id
96 if 'VCL_APP_NAMESPACE_SECRET' in self.vcl_app_env:
97 del self.vcl_app_env['VCL_APP_NAMESPACE_SECRET']
99 self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] = ns_secret
102 self.vcl_app_env['VCL_VPP_API_SOCKET'] = self.get_api_sock_path()
103 if 'VCL_VPP_SAPI_SOCKET' in self.vcl_app_env:
104 del self.vcl_app_env['VCL_VPP_SAPI_SOCKET']
106 sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock)
107 self.vcl_app_env['VCL_VPP_SAPI_SOCKET'] = sapi_sock
108 if 'VCL_VPP_API_SOCKET' in self.vcl_app_env:
109 del self.vcl_app_env['VCL_VPP_API_SOCKET']
111 def cut_thru_setup(self):
112 self.vapi.session_enable_disable(is_enable=1)
114 def cut_thru_tear_down(self):
115 self.vapi.session_enable_disable(is_enable=0)
117 def cut_thru_test(self, server_app, server_args, client_app, client_args):
118 self.vcl_app_env = {'VCL_APP_SCOPE_LOCAL': "true"}
120 self.update_vcl_app_env("", "", self.sapi_server_sock)
121 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
122 self.logger, self.vcl_app_env, "server")
123 worker_server.start()
124 self.sleep(self.pre_test_sleep)
126 self.update_vcl_app_env("", "", self.sapi_client_sock)
127 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
128 self.logger, self.vcl_app_env, "client")
129 worker_client.start()
130 worker_client.join(self.timeout)
132 self.validateResults(worker_client, worker_server, self.timeout)
133 except Exception as error:
134 self.fail("Failed with %s" % error)
135 self.sleep(self.post_test_sleep)
137 def thru_host_stack_setup(self):
138 self.vapi.session_enable_disable(is_enable=1)
139 self.create_loopback_interfaces(2)
143 for i in self.lo_interfaces:
147 tbl = VppIpTable(self, table_id)
150 i.set_table_ip4(table_id)
154 # Configure namespaces
155 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
156 sw_if_index=self.loop0.sw_if_index)
157 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
158 sw_if_index=self.loop1.sw_if_index)
160 # Add inter-table routes
161 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
162 [VppRoutePath("0.0.0.0",
164 nh_table_id=2)], table_id=1)
165 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
166 [VppRoutePath("0.0.0.0",
168 nh_table_id=1)], table_id=2)
169 ip_t01.add_vpp_config()
170 ip_t10.add_vpp_config()
171 self.logger.debug(self.vapi.cli("show ip fib"))
173 def thru_host_stack_tear_down(self):
174 for i in self.lo_interfaces:
179 def thru_host_stack_ipv6_setup(self):
180 self.vapi.session_enable_disable(is_enable=1)
181 self.create_loopback_interfaces(2)
185 for i in self.lo_interfaces:
188 tbl = VppIpTable(self, table_id, is_ip6=1)
191 i.set_table_ip6(table_id)
195 # Configure namespaces
196 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
197 sw_if_index=self.loop0.sw_if_index)
198 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
199 sw_if_index=self.loop1.sw_if_index)
201 # Add inter-table routes
202 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
203 [VppRoutePath("::0", 0xffffffff,
206 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
207 [VppRoutePath("::0", 0xffffffff,
210 ip_t01.add_vpp_config()
211 ip_t10.add_vpp_config()
212 self.logger.debug(self.vapi.cli("show interface addr"))
213 self.logger.debug(self.vapi.cli("show ip6 fib"))
215 def thru_host_stack_ipv6_tear_down(self):
216 for i in self.lo_interfaces:
221 self.vapi.session_enable_disable(is_enable=0)
223 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
224 def thru_host_stack_test(self, server_app, server_args,
225 client_app, client_args):
226 self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"}
228 self.update_vcl_app_env("1", "1234", self.sapi_server_sock)
229 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
230 self.logger, self.vcl_app_env, "server")
231 worker_server.start()
232 self.sleep(self.pre_test_sleep)
234 self.update_vcl_app_env("2", "5678", self.sapi_client_sock)
235 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
236 self.logger, self.vcl_app_env, "client")
237 worker_client.start()
238 worker_client.join(self.timeout)
241 self.validateResults(worker_client, worker_server, self.timeout)
242 except Exception as error:
243 self.fail("Failed with %s" % error)
244 self.sleep(self.post_test_sleep)
246 def validateResults(self, worker_client, worker_server, timeout):
247 if worker_server.process is None:
248 raise RuntimeError('worker_server is not running.')
249 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
250 self.logger.info("Killing server worker process (pid %d)" %
251 worker_server.process.pid)
252 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
254 self.logger.info("Client worker result is `%s'" % worker_client.result)
256 if worker_client.result is None:
260 "Timeout: %ss! Killing client worker process (pid %d)" %
261 (timeout, worker_client.process.pid))
262 os.killpg(os.getpgid(worker_client.process.pid),
267 "Couldn't kill client worker process")
271 "Timeout! Client worker did not finish in %ss" % timeout)
272 self.assert_equal(worker_client.result, 0, "Binary test return code")
275 class LDPCutThruTestCase(VCLTestCase):
276 """ LDP Cut Thru Tests """
280 cls.session_startup = ["poll-main", "use-app-socket-api"]
281 super(LDPCutThruTestCase, cls).setUpClass()
284 def tearDownClass(cls):
285 super(LDPCutThruTestCase, cls).tearDownClass()
288 super(LDPCutThruTestCase, self).setUp()
290 self.cut_thru_setup()
291 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
292 self.server_addr, self.server_port]
293 self.client_iperf3_timeout = 20
294 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
295 self.server_iperf3_args = ["-4", "-s"]
296 self.client_uni_dir_nsock_timeout = 20
297 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
301 self.client_bi_dir_nsock_timeout = 20
302 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
306 self.sapi_client_sock = "default"
307 self.sapi_server_sock = "default"
310 super(LDPCutThruTestCase, self).tearDown()
311 self.cut_thru_tear_down()
313 def show_commands_at_teardown(self):
314 self.logger.debug(self.vapi.cli("show session verbose 2"))
315 self.logger.debug(self.vapi.cli("show app mq"))
317 @unittest.skipUnless(running_extended_tests, "part of extended tests")
318 def test_ldp_cut_thru_echo(self):
319 """ run LDP cut thru echo test """
321 self.cut_thru_test("sock_test_server", self.server_args,
322 "sock_test_client", self.client_echo_test_args)
324 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
325 def test_ldp_cut_thru_iperf3(self):
326 """ run LDP cut thru iperf3 test """
328 self.timeout = self.client_iperf3_timeout
329 self.cut_thru_test(iperf3, self.server_iperf3_args,
330 iperf3, self.client_iperf3_args)
332 @unittest.skipUnless(running_extended_tests, "part of extended tests")
333 def test_ldp_cut_thru_uni_dir_nsock(self):
334 """ run LDP cut thru uni-directional (multiple sockets) test """
336 self.timeout = self.client_uni_dir_nsock_timeout
337 self.cut_thru_test("sock_test_server", self.server_args,
339 self.client_uni_dir_nsock_test_args)
341 @unittest.skipUnless(running_extended_tests, "part of extended tests")
342 @unittest.skip("sock test apps need to be improved")
343 def test_ldp_cut_thru_bi_dir_nsock(self):
344 """ run LDP cut thru bi-directional (multiple sockets) test """
346 self.timeout = self.client_bi_dir_nsock_timeout
347 self.cut_thru_test("sock_test_server", self.server_args,
349 self.client_bi_dir_nsock_test_args)
352 class VCLCutThruTestCase(VCLTestCase):
353 """ VCL Cut Thru Tests """
357 super(VCLCutThruTestCase, cls).setUpClass()
360 def tearDownClass(cls):
361 super(VCLCutThruTestCase, cls).tearDownClass()
364 super(VCLCutThruTestCase, self).setUp()
366 self.cut_thru_setup()
367 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
368 self.server_addr, self.server_port]
370 self.client_uni_dir_nsock_timeout = 20
371 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
375 self.client_bi_dir_nsock_timeout = 20
376 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
382 super(VCLCutThruTestCase, self).tearDown()
384 def show_commands_at_teardown(self):
385 self.logger.debug(self.vapi.cli("show session verbose 2"))
386 self.logger.debug(self.vapi.cli("show app mq"))
388 def test_vcl_cut_thru_echo(self):
389 """ run VCL cut thru echo test """
391 self.cut_thru_test("vcl_test_server", self.server_args,
392 "vcl_test_client", self.client_echo_test_args)
394 def test_vcl_cut_thru_uni_dir_nsock(self):
395 """ run VCL cut thru uni-directional (multiple sockets) test """
397 self.timeout = self.client_uni_dir_nsock_timeout
398 self.cut_thru_test("vcl_test_server", self.server_args,
400 self.client_uni_dir_nsock_test_args)
402 def test_vcl_cut_thru_bi_dir_nsock(self):
403 """ run VCL cut thru bi-directional (multiple sockets) test """
405 self.timeout = self.client_bi_dir_nsock_timeout
406 self.cut_thru_test("vcl_test_server", self.server_args,
408 self.client_bi_dir_nsock_test_args)
411 class VCLThruHostStackEcho(VCLTestCase):
412 """ VCL Thru Host Stack Echo """
416 super(VCLThruHostStackEcho, cls).setUpClass()
419 def tearDownClass(cls):
420 super(VCLThruHostStackEcho, cls).tearDownClass()
423 super(VCLThruHostStackEcho, self).setUp()
425 self.thru_host_stack_setup()
426 self.client_bi_dir_nsock_timeout = 20
427 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
429 self.loop0.local_ip4,
431 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
432 self.loop0.local_ip4,
436 self.thru_host_stack_tear_down()
437 super(VCLThruHostStackEcho, self).tearDown()
439 def show_commands_at_teardown(self):
440 self.logger.debug(self.vapi.cli("show app server"))
441 self.logger.debug(self.vapi.cli("show session verbose"))
442 self.logger.debug(self.vapi.cli("show app mq"))
445 class VCLThruHostStackTLS(VCLTestCase):
446 """ VCL Thru Host Stack TLS """
450 cls.session_startup = ["poll-main", "use-app-socket-api"]
451 super(VCLThruHostStackTLS, cls).setUpClass()
454 def tearDownClass(cls):
455 super(VCLThruHostStackTLS, cls).tearDownClass()
458 super(VCLThruHostStackTLS, self).setUp()
460 self.thru_host_stack_setup()
461 self.client_uni_dir_tls_timeout = 20
462 self.server_tls_args = ["-L", self.server_port]
463 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
464 self.loop0.local_ip4,
466 self.sapi_server_sock = "1"
467 self.sapi_client_sock = "2"
469 def test_vcl_thru_host_stack_tls_uni_dir(self):
470 """ run VCL thru host stack uni-directional TLS test """
472 self.timeout = self.client_uni_dir_tls_timeout
473 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
475 self.client_uni_dir_tls_test_args)
478 self.thru_host_stack_tear_down()
479 super(VCLThruHostStackTLS, self).tearDown()
481 def show_commands_at_teardown(self):
482 self.logger.debug(self.vapi.cli("show app server"))
483 self.logger.debug(self.vapi.cli("show session verbose 2"))
484 self.logger.debug(self.vapi.cli("show app mq"))
487 class VCLThruHostStackDTLS(VCLTestCase):
488 """ VCL Thru Host Stack DTLS """
492 super(VCLThruHostStackDTLS, cls).setUpClass()
495 def tearDownClass(cls):
496 super(VCLThruHostStackDTLS, cls).tearDownClass()
499 super(VCLThruHostStackDTLS, self).setUp()
501 self.thru_host_stack_setup()
502 self.client_uni_dir_dtls_timeout = 20
503 self.server_dtls_args = ["-p", "dtls", self.server_port]
504 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
505 "-p", "dtls", "-T 1400",
506 self.loop0.local_ip4,
509 def test_vcl_thru_host_stack_dtls_uni_dir(self):
510 """ run VCL thru host stack uni-directional DTLS test """
512 self.timeout = self.client_uni_dir_dtls_timeout
513 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
515 self.client_uni_dir_dtls_test_args)
518 self.thru_host_stack_tear_down()
519 super(VCLThruHostStackDTLS, self).tearDown()
521 def show_commands_at_teardown(self):
522 self.logger.debug(self.vapi.cli("show app server"))
523 self.logger.debug(self.vapi.cli("show session verbose 2"))
524 self.logger.debug(self.vapi.cli("show app mq"))
527 class VCLThruHostStackQUIC(VCLTestCase):
528 """ VCL Thru Host Stack QUIC """
532 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
533 super(VCLThruHostStackQUIC, cls).setUpClass()
536 def tearDownClass(cls):
537 super(VCLThruHostStackQUIC, cls).tearDownClass()
540 super(VCLThruHostStackQUIC, self).setUp()
542 self.thru_host_stack_setup()
543 self.client_uni_dir_quic_timeout = 20
544 self.server_quic_args = ["-p", "quic", self.server_port]
545 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
547 self.loop0.local_ip4,
550 @unittest.skipUnless(running_extended_tests, "part of extended tests")
551 def test_vcl_thru_host_stack_quic_uni_dir(self):
552 """ run VCL thru host stack uni-directional QUIC test """
554 self.timeout = self.client_uni_dir_quic_timeout
555 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
557 self.client_uni_dir_quic_test_args)
560 self.thru_host_stack_tear_down()
561 super(VCLThruHostStackQUIC, self).tearDown()
563 def show_commands_at_teardown(self):
564 self.logger.debug(self.vapi.cli("show app server"))
565 self.logger.debug(self.vapi.cli("show session verbose 2"))
566 self.logger.debug(self.vapi.cli("show app mq"))
569 class VCLThruHostStackBidirNsock(VCLTestCase):
570 """ VCL Thru Host Stack Bidir Nsock """
574 super(VCLThruHostStackBidirNsock, cls).setUpClass()
577 def tearDownClass(cls):
578 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
581 super(VCLThruHostStackBidirNsock, self).setUp()
583 self.thru_host_stack_setup()
584 self.client_bi_dir_nsock_timeout = 20
585 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
587 self.loop0.local_ip4,
589 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
590 self.loop0.local_ip4,
594 self.thru_host_stack_tear_down()
595 super(VCLThruHostStackBidirNsock, self).tearDown()
597 def show_commands_at_teardown(self):
598 self.logger.debug(self.vapi.cli("show session verbose 2"))
599 self.logger.debug(self.vapi.cli("show app mq"))
601 def test_vcl_thru_host_stack_bi_dir_nsock(self):
602 """ run VCL thru host stack bi-directional (multiple sockets) test """
604 self.timeout = self.client_bi_dir_nsock_timeout
605 self.thru_host_stack_test("vcl_test_server", self.server_args,
607 self.client_bi_dir_nsock_test_args)
610 class LDPThruHostStackBidirNsock(VCLTestCase):
611 """ LDP Thru Host Stack Bidir Nsock """
615 super(LDPThruHostStackBidirNsock, cls).setUpClass()
618 def tearDownClass(cls):
619 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
622 super(LDPThruHostStackBidirNsock, self).setUp()
624 self.thru_host_stack_setup()
625 self.client_bi_dir_nsock_timeout = 20
626 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
627 # OUCH! Host Stack Bug?
628 # Only fails when running
629 # 'make test TEST_JOBS=auto'
632 self.loop0.local_ip4,
636 self.thru_host_stack_tear_down()
637 super(LDPThruHostStackBidirNsock, self).tearDown()
639 def show_commands_at_teardown(self):
640 self.logger.debug(self.vapi.cli("show session verbose 2"))
641 self.logger.debug(self.vapi.cli("show app mq"))
643 def test_ldp_thru_host_stack_bi_dir_nsock(self):
644 """ run LDP thru host stack bi-directional (multiple sockets) test """
646 self.timeout = self.client_bi_dir_nsock_timeout
647 self.thru_host_stack_test("sock_test_server", self.server_args,
649 self.client_bi_dir_nsock_test_args)
652 class LDPThruHostStackNsock(VCLTestCase):
653 """ LDP Thru Host Stack Nsock """
657 super(LDPThruHostStackNsock, cls).setUpClass()
660 def tearDownClass(cls):
661 super(LDPThruHostStackNsock, cls).tearDownClass()
664 super(LDPThruHostStackNsock, self).setUp()
666 self.thru_host_stack_setup()
668 self.client_uni_dir_nsock_timeout = 20
669 self.numSockets = "2"
671 self.client_uni_dir_nsock_timeout = 20
672 self.numSockets = "5"
674 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
675 "-I", self.numSockets,
676 self.loop0.local_ip4,
680 self.thru_host_stack_tear_down()
681 super(LDPThruHostStackNsock, self).tearDown()
683 def test_ldp_thru_host_stack_uni_dir_nsock(self):
684 """ run LDP thru host stack uni-directional (multiple sockets) test """
686 self.timeout = self.client_uni_dir_nsock_timeout
687 self.thru_host_stack_test("sock_test_server", self.server_args,
689 self.client_uni_dir_nsock_test_args)
692 class VCLThruHostStackNsock(VCLTestCase):
693 """ VCL Thru Host Stack Nsock """
697 super(VCLThruHostStackNsock, cls).setUpClass()
700 def tearDownClass(cls):
701 super(VCLThruHostStackNsock, cls).tearDownClass()
704 super(VCLThruHostStackNsock, self).setUp()
706 self.thru_host_stack_setup()
708 self.client_uni_dir_nsock_timeout = 20
709 self.numSockets = "2"
711 self.client_uni_dir_nsock_timeout = 20
712 self.numSockets = "5"
714 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
715 "-I", self.numSockets,
716 self.loop0.local_ip4,
720 self.thru_host_stack_tear_down()
721 super(VCLThruHostStackNsock, self).tearDown()
723 def test_vcl_thru_host_stack_uni_dir_nsock(self):
724 """ run VCL thru host stack uni-directional (multiple sockets) test """
726 self.timeout = self.client_uni_dir_nsock_timeout
727 self.thru_host_stack_test("vcl_test_server", self.server_args,
729 self.client_uni_dir_nsock_test_args)
732 class LDPThruHostStackIperf(VCLTestCase):
733 """ LDP Thru Host Stack Iperf """
737 super(LDPThruHostStackIperf, cls).setUpClass()
740 def tearDownClass(cls):
741 super(LDPThruHostStackIperf, cls).tearDownClass()
744 super(LDPThruHostStackIperf, self).setUp()
746 self.thru_host_stack_setup()
747 self.client_iperf3_timeout = 20
748 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
749 self.server_iperf3_args = ["-4", "-s"]
752 self.thru_host_stack_tear_down()
753 super(LDPThruHostStackIperf, self).tearDown()
755 def show_commands_at_teardown(self):
756 self.logger.debug(self.vapi.cli("show session verbose 2"))
757 self.logger.debug(self.vapi.cli("show app mq"))
759 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
760 def test_ldp_thru_host_stack_iperf3(self):
761 """ run LDP thru host stack iperf3 test """
763 self.timeout = self.client_iperf3_timeout
764 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
765 iperf3, self.client_iperf3_args)
768 class LDPThruHostStackIperfUdp(VCLTestCase):
769 """ LDP Thru Host Stack Iperf UDP """
773 super(LDPThruHostStackIperfUdp, cls).setUpClass()
776 def tearDownClass(cls):
777 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
780 super(LDPThruHostStackIperfUdp, self).setUp()
782 self.thru_host_stack_setup()
783 self.client_iperf3_timeout = 20
784 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
785 "-c", self.loop0.local_ip4]
786 self.server_iperf3_args = ["-4", "-s"]
789 self.thru_host_stack_tear_down()
790 super(LDPThruHostStackIperfUdp, self).tearDown()
792 def show_commands_at_teardown(self):
793 self.logger.debug(self.vapi.cli("show session verbose 2"))
794 self.logger.debug(self.vapi.cli("show app mq"))
796 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
797 def test_ldp_thru_host_stack_iperf3_udp(self):
798 """ run LDP thru host stack iperf3 UDP test """
800 self.timeout = self.client_iperf3_timeout
801 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
802 iperf3, self.client_iperf3_args)
805 class LDPIpv6CutThruTestCase(VCLTestCase):
806 """ LDP IPv6 Cut Thru Tests """
810 super(LDPIpv6CutThruTestCase, cls).setUpClass()
813 def tearDownClass(cls):
814 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
816 def show_commands_at_teardown(self):
817 self.logger.debug(self.vapi.cli("show session verbose 2"))
818 self.logger.debug(self.vapi.cli("show app mq"))
821 super(LDPIpv6CutThruTestCase, self).setUp()
823 self.cut_thru_setup()
824 self.client_iperf3_timeout = 20
825 self.client_uni_dir_nsock_timeout = 20
826 self.client_bi_dir_nsock_timeout = 20
827 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
828 self.server_ipv6_addr,
830 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
831 self.server_ipv6_addr]
832 self.server_ipv6_iperf3_args = ["-6", "-s"]
833 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
836 self.server_ipv6_addr,
838 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
841 self.server_ipv6_addr,
845 super(LDPIpv6CutThruTestCase, self).tearDown()
846 self.cut_thru_tear_down()
848 def test_ldp_ipv6_cut_thru_echo(self):
849 """ run LDP IPv6 cut thru echo test """
851 self.cut_thru_test("sock_test_server",
852 self.server_ipv6_args,
854 self.client_ipv6_echo_test_args)
856 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
857 @unittest.skipUnless(running_extended_tests, "part of extended tests")
858 def test_ldp_ipv6_cut_thru_iperf3(self):
859 """ run LDP IPv6 cut thru iperf3 test """
861 self.timeout = self.client_iperf3_timeout
862 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
863 iperf3, self.client_ipv6_iperf3_args)
865 @unittest.skipUnless(running_extended_tests, "part of extended tests")
866 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
867 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
869 self.timeout = self.client_uni_dir_nsock_timeout
870 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
872 self.client_ipv6_uni_dir_nsock_test_args)
874 @unittest.skipUnless(running_extended_tests, "part of extended tests")
875 @unittest.skip("sock test apps need to be improved")
876 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
877 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
879 self.timeout = self.client_bi_dir_nsock_timeout
880 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
882 self.client_ipv6_bi_dir_nsock_test_args)
885 class VCLIpv6CutThruTestCase(VCLTestCase):
886 """ VCL IPv6 Cut Thru Tests """
890 super(VCLIpv6CutThruTestCase, cls).setUpClass()
893 def tearDownClass(cls):
894 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
896 def show_commands_at_teardown(self):
897 self.logger.debug(self.vapi.cli("show session verbose 2"))
898 self.logger.debug(self.vapi.cli("show app mq"))
901 super(VCLIpv6CutThruTestCase, self).setUp()
903 self.cut_thru_setup()
904 self.client_uni_dir_nsock_timeout = 20
905 self.client_bi_dir_nsock_timeout = 20
906 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
907 self.server_ipv6_addr,
909 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
912 self.server_ipv6_addr,
914 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
917 self.server_ipv6_addr,
921 super(VCLIpv6CutThruTestCase, self).tearDown()
922 self.cut_thru_tear_down()
924 def show_commands_at_teardown(self):
925 self.logger.debug(self.vapi.cli("show session verbose 2"))
926 self.logger.debug(self.vapi.cli("show app mq"))
928 def test_vcl_ipv6_cut_thru_echo(self):
929 """ run VCL IPv6 cut thru echo test """
931 self.cut_thru_test("vcl_test_server",
932 self.server_ipv6_args,
934 self.client_ipv6_echo_test_args)
936 @unittest.skipUnless(running_extended_tests, "part of extended tests")
937 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
938 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
940 self.timeout = self.client_uni_dir_nsock_timeout
941 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
943 self.client_ipv6_uni_dir_nsock_test_args)
945 @unittest.skipUnless(running_extended_tests, "part of extended tests")
946 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
947 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
949 self.timeout = self.client_bi_dir_nsock_timeout
950 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
952 self.client_ipv6_bi_dir_nsock_test_args)
955 class VCLIpv6ThruHostStackEcho(VCLTestCase):
956 """ VCL IPv6 Thru Host Stack Echo """
960 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
963 def tearDownClass(cls):
964 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
967 super(VCLIpv6ThruHostStackEcho, self).setUp()
969 self.thru_host_stack_ipv6_setup()
970 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
971 self.loop0.local_ip6,
975 self.thru_host_stack_ipv6_tear_down()
976 super(VCLIpv6ThruHostStackEcho, self).tearDown()
978 def test_vcl_ipv6_thru_host_stack_echo(self):
979 """ run VCL IPv6 thru host stack echo test """
981 self.thru_host_stack_test("vcl_test_server",
982 self.server_ipv6_args,
984 self.client_ipv6_echo_test_args)
987 if __name__ == '__main__':
988 unittest.main(testRunner=VppTestRunner)