8 from framework import VppTestCase, VppTestRunner, running_extended_tests, \
9 Worker, is_platform_aarch64
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 extra_vpp_punt_config = ["session", "{", "poll-main", "}"]
56 super(VCLTestCase, cls).setUpClass()
59 def tearDownClass(cls):
60 super(VCLTestCase, cls).tearDownClass()
64 self.build_dir = os.getenv(var, None)
65 if self.build_dir is None:
66 raise EnvironmentError("Environment variable `%s' not set" % var)
67 self.vppDebug = 'vpp_debug' in self.build_dir
68 self.server_addr = "127.0.0.1"
69 self.server_port = "22000"
70 self.server_args = [self.server_port]
71 self.server_ipv6_addr = "::1"
72 self.server_ipv6_args = ["-6", self.server_port]
74 self.echo_phrase = "Hello, world! Jenny is a friend of mine."
75 self.pre_test_sleep = 0.3
76 self.post_test_sleep = 0.2
78 if os.path.isfile("/tmp/ldp_server_af_unix_socket"):
79 os.remove("/tmp/ldp_server_af_unix_socket")
81 super(VCLTestCase, self).setUp()
83 def cut_thru_setup(self):
84 self.vapi.session_enable_disable(is_enable=1)
86 def cut_thru_tear_down(self):
87 self.vapi.session_enable_disable(is_enable=0)
89 def cut_thru_test(self, server_app, server_args, client_app, client_args):
90 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
91 'VCL_APP_SCOPE_LOCAL': "true"}
92 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
93 self.logger, self.env, "server")
95 self.sleep(self.pre_test_sleep)
96 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
97 self.logger, self.env, "client")
99 worker_client.join(self.timeout)
101 self.validateResults(worker_client, worker_server, self.timeout)
102 except Exception as error:
103 self.fail("Failed with %s" % error)
104 self.sleep(self.post_test_sleep)
106 def thru_host_stack_setup(self):
107 self.vapi.session_enable_disable(is_enable=1)
108 self.create_loopback_interfaces(2)
112 for i in self.lo_interfaces:
116 tbl = VppIpTable(self, table_id)
119 i.set_table_ip4(table_id)
123 # Configure namespaces
124 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
125 sw_if_index=self.loop0.sw_if_index)
126 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
127 sw_if_index=self.loop1.sw_if_index)
129 # Add inter-table routes
130 ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32,
131 [VppRoutePath("0.0.0.0",
133 nh_table_id=2)], table_id=1)
134 ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32,
135 [VppRoutePath("0.0.0.0",
137 nh_table_id=1)], table_id=2)
138 ip_t01.add_vpp_config()
139 ip_t10.add_vpp_config()
140 self.logger.debug(self.vapi.cli("show ip fib"))
142 def thru_host_stack_tear_down(self):
143 for i in self.lo_interfaces:
148 def thru_host_stack_ipv6_setup(self):
149 self.vapi.session_enable_disable(is_enable=1)
150 self.create_loopback_interfaces(2)
154 for i in self.lo_interfaces:
157 tbl = VppIpTable(self, table_id, is_ip6=1)
160 i.set_table_ip6(table_id)
164 # Configure namespaces
165 self.vapi.app_namespace_add_del(namespace_id="1", secret=1234,
166 sw_if_index=self.loop0.sw_if_index)
167 self.vapi.app_namespace_add_del(namespace_id="2", secret=5678,
168 sw_if_index=self.loop1.sw_if_index)
170 # Add inter-table routes
171 ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128,
172 [VppRoutePath("::0", 0xffffffff,
175 ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128,
176 [VppRoutePath("::0", 0xffffffff,
179 ip_t01.add_vpp_config()
180 ip_t10.add_vpp_config()
181 self.logger.debug(self.vapi.cli("show interface addr"))
182 self.logger.debug(self.vapi.cli("show ip6 fib"))
184 def thru_host_stack_ipv6_tear_down(self):
185 for i in self.lo_interfaces:
190 self.vapi.session_enable_disable(is_enable=0)
192 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
193 def thru_host_stack_test(self, server_app, server_args,
194 client_app, client_args):
195 self.env = {'VCL_VPP_API_SOCKET': self.get_api_sock_path(),
196 'VCL_APP_SCOPE_GLOBAL': "true",
197 'VCL_APP_NAMESPACE_ID': "1",
198 'VCL_APP_NAMESPACE_SECRET': "1234"}
200 worker_server = VCLAppWorker(self.build_dir, server_app, server_args,
201 self.logger, self.env, "server")
202 worker_server.start()
203 self.sleep(self.pre_test_sleep)
205 self.env.update({'VCL_APP_NAMESPACE_ID': "2",
206 'VCL_APP_NAMESPACE_SECRET': "5678"})
207 worker_client = VCLAppWorker(self.build_dir, client_app, client_args,
208 self.logger, self.env, "client")
209 worker_client.start()
210 worker_client.join(self.timeout)
213 self.validateResults(worker_client, worker_server, self.timeout)
214 except Exception as error:
215 self.fail("Failed with %s" % error)
216 self.sleep(self.post_test_sleep)
218 def validateResults(self, worker_client, worker_server, timeout):
219 if worker_server.process is None:
220 raise RuntimeError('worker_server is not running.')
221 if os.path.isdir('/proc/{}'.format(worker_server.process.pid)):
222 self.logger.info("Killing server worker process (pid %d)" %
223 worker_server.process.pid)
224 os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM)
226 self.logger.info("Client worker result is `%s'" % worker_client.result)
228 if worker_client.result is None:
232 "Timeout: %ss! Killing client worker process (pid %d)" %
233 (timeout, worker_client.process.pid))
234 os.killpg(os.getpgid(worker_client.process.pid),
239 "Couldn't kill client worker process")
243 "Timeout! Client worker did not finish in %ss" % timeout)
244 self.assert_equal(worker_client.result, 0, "Binary test return code")
247 class LDPCutThruTestCase(VCLTestCase):
248 """ LDP Cut Thru Tests """
252 super(LDPCutThruTestCase, cls).setUpClass()
255 def tearDownClass(cls):
256 super(LDPCutThruTestCase, cls).tearDownClass()
259 super(LDPCutThruTestCase, self).setUp()
261 self.cut_thru_setup()
262 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
263 self.server_addr, self.server_port]
264 self.client_iperf3_timeout = 20
265 self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr]
266 self.server_iperf3_args = ["-4", "-s"]
267 self.client_uni_dir_nsock_timeout = 20
268 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
272 self.client_bi_dir_nsock_timeout = 20
273 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
279 super(LDPCutThruTestCase, self).tearDown()
280 self.cut_thru_tear_down()
282 def show_commands_at_teardown(self):
283 self.logger.debug(self.vapi.cli("show session verbose 2"))
284 self.logger.debug(self.vapi.cli("show app mq"))
286 @unittest.skipUnless(running_extended_tests, "part of extended tests")
287 def test_ldp_cut_thru_echo(self):
288 """ run LDP cut thru echo test """
290 self.cut_thru_test("sock_test_server", self.server_args,
291 "sock_test_client", self.client_echo_test_args)
293 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
294 @unittest.skipIf(is_platform_aarch64,
295 "intermittently fails on AARCH64 CI jobs")
296 def test_ldp_cut_thru_iperf3(self):
297 """ run LDP cut thru iperf3 test """
299 self.timeout = self.client_iperf3_timeout
300 self.cut_thru_test(iperf3, self.server_iperf3_args,
301 iperf3, self.client_iperf3_args)
303 @unittest.skipUnless(running_extended_tests, "part of extended tests")
304 def test_ldp_cut_thru_uni_dir_nsock(self):
305 """ run LDP cut thru uni-directional (multiple sockets) test """
307 self.timeout = self.client_uni_dir_nsock_timeout
308 self.cut_thru_test("sock_test_server", self.server_args,
310 self.client_uni_dir_nsock_test_args)
312 @unittest.skipUnless(running_extended_tests, "part of extended tests")
313 @unittest.skip("sock test apps need to be improved")
314 def test_ldp_cut_thru_bi_dir_nsock(self):
315 """ run LDP cut thru bi-directional (multiple sockets) test """
317 self.timeout = self.client_bi_dir_nsock_timeout
318 self.cut_thru_test("sock_test_server", self.server_args,
320 self.client_bi_dir_nsock_test_args)
323 class VCLCutThruTestCase(VCLTestCase):
324 """ VCL Cut Thru Tests """
328 super(VCLCutThruTestCase, cls).setUpClass()
331 def tearDownClass(cls):
332 super(VCLCutThruTestCase, cls).tearDownClass()
335 super(VCLCutThruTestCase, self).setUp()
337 self.cut_thru_setup()
338 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
339 self.server_addr, self.server_port]
341 self.client_uni_dir_nsock_timeout = 20
342 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
346 self.client_bi_dir_nsock_timeout = 20
347 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
353 super(VCLCutThruTestCase, self).tearDown()
355 def show_commands_at_teardown(self):
356 self.logger.debug(self.vapi.cli("show session verbose 2"))
357 self.logger.debug(self.vapi.cli("show app mq"))
359 def test_vcl_cut_thru_echo(self):
360 """ run VCL cut thru echo test """
362 self.cut_thru_test("vcl_test_server", self.server_args,
363 "vcl_test_client", self.client_echo_test_args)
365 def test_vcl_cut_thru_uni_dir_nsock(self):
366 """ run VCL cut thru uni-directional (multiple sockets) test """
368 self.timeout = self.client_uni_dir_nsock_timeout
369 self.cut_thru_test("vcl_test_server", self.server_args,
371 self.client_uni_dir_nsock_test_args)
373 def test_vcl_cut_thru_bi_dir_nsock(self):
374 """ run VCL cut thru bi-directional (multiple sockets) test """
376 self.timeout = self.client_bi_dir_nsock_timeout
377 self.cut_thru_test("vcl_test_server", self.server_args,
379 self.client_bi_dir_nsock_test_args)
382 class VCLThruHostStackEcho(VCLTestCase):
383 """ VCL Thru Host Stack Echo """
387 super(VCLThruHostStackEcho, cls).setUpClass()
390 def tearDownClass(cls):
391 super(VCLThruHostStackEcho, cls).tearDownClass()
394 super(VCLThruHostStackEcho, self).setUp()
396 self.thru_host_stack_setup()
397 self.client_bi_dir_nsock_timeout = 20
398 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
400 self.loop0.local_ip4,
402 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
403 self.loop0.local_ip4,
407 self.thru_host_stack_tear_down()
408 super(VCLThruHostStackEcho, self).tearDown()
410 def show_commands_at_teardown(self):
411 self.logger.debug(self.vapi.cli("show app server"))
412 self.logger.debug(self.vapi.cli("show session verbose"))
413 self.logger.debug(self.vapi.cli("show app mq"))
416 class VCLThruHostStackTLS(VCLTestCase):
417 """ VCL Thru Host Stack TLS """
421 super(VCLThruHostStackTLS, cls).setUpClass()
424 def tearDownClass(cls):
425 super(VCLThruHostStackTLS, cls).tearDownClass()
428 super(VCLThruHostStackTLS, self).setUp()
430 self.thru_host_stack_setup()
431 self.client_uni_dir_tls_timeout = 20
432 self.server_tls_args = ["-L", self.server_port]
433 self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L",
434 self.loop0.local_ip4,
437 def test_vcl_thru_host_stack_tls_uni_dir(self):
438 """ run VCL thru host stack uni-directional TLS test """
440 self.timeout = self.client_uni_dir_tls_timeout
441 self.thru_host_stack_test("vcl_test_server", self.server_tls_args,
443 self.client_uni_dir_tls_test_args)
446 self.thru_host_stack_tear_down()
447 super(VCLThruHostStackTLS, self).tearDown()
449 def show_commands_at_teardown(self):
450 self.logger.debug(self.vapi.cli("show app server"))
451 self.logger.debug(self.vapi.cli("show session verbose 2"))
452 self.logger.debug(self.vapi.cli("show app mq"))
455 class VCLThruHostStackDTLS(VCLTestCase):
456 """ VCL Thru Host Stack DTLS """
460 super(VCLThruHostStackDTLS, cls).setUpClass()
463 def tearDownClass(cls):
464 super(VCLThruHostStackDTLS, cls).tearDownClass()
467 super(VCLThruHostStackDTLS, self).setUp()
469 self.thru_host_stack_setup()
470 self.client_uni_dir_dtls_timeout = 20
471 self.server_dtls_args = ["-p", "dtls", self.server_port]
472 self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X",
473 "-p", "dtls", "-T 1400",
474 self.loop0.local_ip4,
477 def test_vcl_thru_host_stack_dtls_uni_dir(self):
478 """ run VCL thru host stack uni-directional DTLS test """
480 self.timeout = self.client_uni_dir_dtls_timeout
481 self.thru_host_stack_test("vcl_test_server", self.server_dtls_args,
483 self.client_uni_dir_dtls_test_args)
486 self.thru_host_stack_tear_down()
487 super(VCLThruHostStackDTLS, self).tearDown()
489 def show_commands_at_teardown(self):
490 self.logger.debug(self.vapi.cli("show app server"))
491 self.logger.debug(self.vapi.cli("show session verbose 2"))
492 self.logger.debug(self.vapi.cli("show app mq"))
495 class VCLThruHostStackQUIC(VCLTestCase):
496 """ VCL Thru Host Stack QUIC """
500 cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }")
501 super(VCLThruHostStackQUIC, cls).setUpClass()
504 def tearDownClass(cls):
505 super(VCLThruHostStackQUIC, cls).tearDownClass()
508 super(VCLThruHostStackQUIC, self).setUp()
510 self.thru_host_stack_setup()
511 self.client_uni_dir_quic_timeout = 20
512 self.server_quic_args = ["-p", "quic", self.server_port]
513 self.client_uni_dir_quic_test_args = ["-N", "1000", "-U", "-X",
515 self.loop0.local_ip4,
518 @unittest.skipUnless(running_extended_tests, "part of extended tests")
519 def test_vcl_thru_host_stack_quic_uni_dir(self):
520 """ run VCL thru host stack uni-directional QUIC test """
522 self.timeout = self.client_uni_dir_quic_timeout
523 self.thru_host_stack_test("vcl_test_server", self.server_quic_args,
525 self.client_uni_dir_quic_test_args)
528 self.thru_host_stack_tear_down()
529 super(VCLThruHostStackQUIC, self).tearDown()
531 def show_commands_at_teardown(self):
532 self.logger.debug(self.vapi.cli("show app server"))
533 self.logger.debug(self.vapi.cli("show session verbose 2"))
534 self.logger.debug(self.vapi.cli("show app mq"))
537 class VCLThruHostStackBidirNsock(VCLTestCase):
538 """ VCL Thru Host Stack Bidir Nsock """
542 super(VCLThruHostStackBidirNsock, cls).setUpClass()
545 def tearDownClass(cls):
546 super(VCLThruHostStackBidirNsock, cls).tearDownClass()
549 super(VCLThruHostStackBidirNsock, self).setUp()
551 self.thru_host_stack_setup()
552 self.client_bi_dir_nsock_timeout = 20
553 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
555 self.loop0.local_ip4,
557 self.client_echo_test_args = ["-E", self.echo_phrase, "-X",
558 self.loop0.local_ip4,
562 self.thru_host_stack_tear_down()
563 super(VCLThruHostStackBidirNsock, self).tearDown()
565 def show_commands_at_teardown(self):
566 self.logger.debug(self.vapi.cli("show session verbose 2"))
567 self.logger.debug(self.vapi.cli("show app mq"))
569 def test_vcl_thru_host_stack_bi_dir_nsock(self):
570 """ run VCL thru host stack bi-directional (multiple sockets) test """
572 self.timeout = self.client_bi_dir_nsock_timeout
573 self.thru_host_stack_test("vcl_test_server", self.server_args,
575 self.client_bi_dir_nsock_test_args)
578 class LDPThruHostStackBidirNsock(VCLTestCase):
579 """ LDP Thru Host Stack Bidir Nsock """
583 super(LDPThruHostStackBidirNsock, cls).setUpClass()
586 def tearDownClass(cls):
587 super(LDPThruHostStackBidirNsock, cls).tearDownClass()
590 super(LDPThruHostStackBidirNsock, self).setUp()
592 self.thru_host_stack_setup()
593 self.client_bi_dir_nsock_timeout = 20
594 self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
595 # OUCH! Host Stack Bug?
596 # Only fails when running
597 # 'make test TEST_JOBS=auto'
600 self.loop0.local_ip4,
604 self.thru_host_stack_tear_down()
605 super(LDPThruHostStackBidirNsock, self).tearDown()
607 def show_commands_at_teardown(self):
608 self.logger.debug(self.vapi.cli("show session verbose 2"))
609 self.logger.debug(self.vapi.cli("show app mq"))
611 def test_ldp_thru_host_stack_bi_dir_nsock(self):
612 """ run LDP thru host stack bi-directional (multiple sockets) test """
614 self.timeout = self.client_bi_dir_nsock_timeout
615 self.thru_host_stack_test("sock_test_server", self.server_args,
617 self.client_bi_dir_nsock_test_args)
620 class LDPThruHostStackNsock(VCLTestCase):
621 """ LDP Thru Host Stack Nsock """
625 super(LDPThruHostStackNsock, cls).setUpClass()
628 def tearDownClass(cls):
629 super(LDPThruHostStackNsock, cls).tearDownClass()
632 super(LDPThruHostStackNsock, self).setUp()
634 self.thru_host_stack_setup()
636 self.client_uni_dir_nsock_timeout = 20
637 self.numSockets = "2"
639 self.client_uni_dir_nsock_timeout = 20
640 self.numSockets = "5"
642 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
643 "-I", self.numSockets,
644 self.loop0.local_ip4,
648 self.thru_host_stack_tear_down()
649 super(LDPThruHostStackNsock, self).tearDown()
651 def test_ldp_thru_host_stack_uni_dir_nsock(self):
652 """ run LDP thru host stack uni-directional (multiple sockets) test """
654 self.timeout = self.client_uni_dir_nsock_timeout
655 self.thru_host_stack_test("sock_test_server", self.server_args,
657 self.client_uni_dir_nsock_test_args)
660 class VCLThruHostStackNsock(VCLTestCase):
661 """ VCL Thru Host Stack Nsock """
665 super(VCLThruHostStackNsock, cls).setUpClass()
668 def tearDownClass(cls):
669 super(VCLThruHostStackNsock, cls).tearDownClass()
672 super(VCLThruHostStackNsock, self).setUp()
674 self.thru_host_stack_setup()
676 self.client_uni_dir_nsock_timeout = 20
677 self.numSockets = "2"
679 self.client_uni_dir_nsock_timeout = 20
680 self.numSockets = "5"
682 self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
683 "-I", self.numSockets,
684 self.loop0.local_ip4,
688 self.thru_host_stack_tear_down()
689 super(VCLThruHostStackNsock, self).tearDown()
691 def test_vcl_thru_host_stack_uni_dir_nsock(self):
692 """ run VCL thru host stack uni-directional (multiple sockets) test """
694 self.timeout = self.client_uni_dir_nsock_timeout
695 self.thru_host_stack_test("vcl_test_server", self.server_args,
697 self.client_uni_dir_nsock_test_args)
700 class LDPThruHostStackIperf(VCLTestCase):
701 """ LDP Thru Host Stack Iperf """
705 super(LDPThruHostStackIperf, cls).setUpClass()
708 def tearDownClass(cls):
709 super(LDPThruHostStackIperf, cls).tearDownClass()
712 super(LDPThruHostStackIperf, self).setUp()
714 self.thru_host_stack_setup()
715 self.client_iperf3_timeout = 20
716 self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4]
717 self.server_iperf3_args = ["-4", "-s"]
720 self.thru_host_stack_tear_down()
721 super(LDPThruHostStackIperf, self).tearDown()
723 def show_commands_at_teardown(self):
724 self.logger.debug(self.vapi.cli("show session verbose 2"))
725 self.logger.debug(self.vapi.cli("show app mq"))
727 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
728 def test_ldp_thru_host_stack_iperf3(self):
729 """ run LDP thru host stack iperf3 test """
731 self.timeout = self.client_iperf3_timeout
732 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
733 iperf3, self.client_iperf3_args)
736 class LDPThruHostStackIperfUdp(VCLTestCase):
737 """ LDP Thru Host Stack Iperf UDP """
741 super(LDPThruHostStackIperfUdp, cls).setUpClass()
744 def tearDownClass(cls):
745 super(LDPThruHostStackIperfUdp, cls).tearDownClass()
748 super(LDPThruHostStackIperfUdp, self).setUp()
750 self.thru_host_stack_setup()
751 self.client_iperf3_timeout = 20
752 self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400",
753 "-c", self.loop0.local_ip4]
754 self.server_iperf3_args = ["-4", "-s"]
757 self.thru_host_stack_tear_down()
758 super(LDPThruHostStackIperfUdp, self).tearDown()
760 def show_commands_at_teardown(self):
761 self.logger.debug(self.vapi.cli("show session verbose 2"))
762 self.logger.debug(self.vapi.cli("show app mq"))
764 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
765 def test_ldp_thru_host_stack_iperf3_udp(self):
766 """ run LDP thru host stack iperf3 UDP test """
768 self.timeout = self.client_iperf3_timeout
769 self.thru_host_stack_test(iperf3, self.server_iperf3_args,
770 iperf3, self.client_iperf3_args)
773 class LDPIpv6CutThruTestCase(VCLTestCase):
774 """ LDP IPv6 Cut Thru Tests """
778 super(LDPIpv6CutThruTestCase, cls).setUpClass()
781 def tearDownClass(cls):
782 super(LDPIpv6CutThruTestCase, cls).tearDownClass()
784 def show_commands_at_teardown(self):
785 self.logger.debug(self.vapi.cli("show session verbose 2"))
786 self.logger.debug(self.vapi.cli("show app mq"))
789 super(LDPIpv6CutThruTestCase, self).setUp()
791 self.cut_thru_setup()
792 self.client_iperf3_timeout = 20
793 self.client_uni_dir_nsock_timeout = 20
794 self.client_bi_dir_nsock_timeout = 20
795 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
796 self.server_ipv6_addr,
798 self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c",
799 self.server_ipv6_addr]
800 self.server_ipv6_iperf3_args = ["-6", "-s"]
801 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
804 self.server_ipv6_addr,
806 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
809 self.server_ipv6_addr,
813 super(LDPIpv6CutThruTestCase, self).tearDown()
814 self.cut_thru_tear_down()
816 def test_ldp_ipv6_cut_thru_echo(self):
817 """ run LDP IPv6 cut thru echo test """
819 self.cut_thru_test("sock_test_server",
820 self.server_ipv6_args,
822 self.client_ipv6_echo_test_args)
824 @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.")
825 @unittest.skipUnless(running_extended_tests, "part of extended tests")
826 def test_ldp_ipv6_cut_thru_iperf3(self):
827 """ run LDP IPv6 cut thru iperf3 test """
829 self.timeout = self.client_iperf3_timeout
830 self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args,
831 iperf3, self.client_ipv6_iperf3_args)
833 @unittest.skipUnless(running_extended_tests, "part of extended tests")
834 def test_ldp_ipv6_cut_thru_uni_dir_nsock(self):
835 """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """
837 self.timeout = self.client_uni_dir_nsock_timeout
838 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
840 self.client_ipv6_uni_dir_nsock_test_args)
842 @unittest.skipUnless(running_extended_tests, "part of extended tests")
843 @unittest.skip("sock test apps need to be improved")
844 def test_ldp_ipv6_cut_thru_bi_dir_nsock(self):
845 """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """
847 self.timeout = self.client_bi_dir_nsock_timeout
848 self.cut_thru_test("sock_test_server", self.server_ipv6_args,
850 self.client_ipv6_bi_dir_nsock_test_args)
853 class VCLIpv6CutThruTestCase(VCLTestCase):
854 """ VCL IPv6 Cut Thru Tests """
858 super(VCLIpv6CutThruTestCase, cls).setUpClass()
861 def tearDownClass(cls):
862 super(VCLIpv6CutThruTestCase, cls).tearDownClass()
864 def show_commands_at_teardown(self):
865 self.logger.debug(self.vapi.cli("show session verbose 2"))
866 self.logger.debug(self.vapi.cli("show app mq"))
869 super(VCLIpv6CutThruTestCase, self).setUp()
871 self.cut_thru_setup()
872 self.client_uni_dir_nsock_timeout = 20
873 self.client_bi_dir_nsock_timeout = 20
874 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
875 self.server_ipv6_addr,
877 self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X",
880 self.server_ipv6_addr,
882 self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X",
885 self.server_ipv6_addr,
889 super(VCLIpv6CutThruTestCase, self).tearDown()
890 self.cut_thru_tear_down()
892 def show_commands_at_teardown(self):
893 self.logger.debug(self.vapi.cli("show session verbose 2"))
894 self.logger.debug(self.vapi.cli("show app mq"))
896 def test_vcl_ipv6_cut_thru_echo(self):
897 """ run VCL IPv6 cut thru echo test """
899 self.cut_thru_test("vcl_test_server",
900 self.server_ipv6_args,
902 self.client_ipv6_echo_test_args)
904 @unittest.skipUnless(running_extended_tests, "part of extended tests")
905 def test_vcl_ipv6_cut_thru_uni_dir_nsock(self):
906 """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """
908 self.timeout = self.client_uni_dir_nsock_timeout
909 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
911 self.client_ipv6_uni_dir_nsock_test_args)
913 @unittest.skipUnless(running_extended_tests, "part of extended tests")
914 def test_vcl_ipv6_cut_thru_bi_dir_nsock(self):
915 """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """
917 self.timeout = self.client_bi_dir_nsock_timeout
918 self.cut_thru_test("vcl_test_server", self.server_ipv6_args,
920 self.client_ipv6_bi_dir_nsock_test_args)
923 class VCLIpv6ThruHostStackEcho(VCLTestCase):
924 """ VCL IPv6 Thru Host Stack Echo """
928 super(VCLIpv6ThruHostStackEcho, cls).setUpClass()
931 def tearDownClass(cls):
932 super(VCLIpv6ThruHostStackEcho, cls).tearDownClass()
935 super(VCLIpv6ThruHostStackEcho, self).setUp()
937 self.thru_host_stack_ipv6_setup()
938 self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X",
939 self.loop0.local_ip6,
943 self.thru_host_stack_ipv6_tear_down()
944 super(VCLIpv6ThruHostStackEcho, self).tearDown()
946 def test_vcl_ipv6_thru_host_stack_echo(self):
947 """ run VCL IPv6 thru host stack echo test """
949 self.thru_host_stack_test("vcl_test_server",
950 self.server_ipv6_args,
952 self.client_ipv6_echo_test_args)
955 if __name__ == '__main__':
956 unittest.main(testRunner=VppTestRunner)