Renato Botelho do Couto | ead1e53 | 2019-10-31 13:31:07 -0500 | [diff] [blame] | 1 | #!/usr/bin/env python3 |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 2 | """ Vpp VCL tests """ |
| 3 | |
| 4 | import unittest |
| 5 | import os |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 6 | import subprocess |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 7 | import signal |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 8 | import glob |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 9 | from framework import VppTestCase, VppTestRunner, running_extended_tests, \ |
Dave Wallace | 5c52091 | 2021-05-27 19:44:50 -0400 | [diff] [blame] | 10 | Worker |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 11 | from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath, FibPathProto |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 12 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 13 | iperf3 = '/usr/bin/iperf3' |
| 14 | |
| 15 | |
| 16 | def have_app(app): |
| 17 | try: |
| 18 | subprocess.check_output([app, '-v']) |
| 19 | except (subprocess.CalledProcessError, OSError): |
| 20 | return False |
| 21 | return True |
| 22 | |
| 23 | |
| 24 | _have_iperf3 = have_app(iperf3) |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 25 | |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 26 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 27 | class VCLAppWorker(Worker): |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 28 | """ VCL Test Application Worker """ |
| 29 | |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 30 | libname = "libvcl_ldpreload.so" |
| 31 | |
| 32 | class LibraryNotFound(Exception): |
| 33 | pass |
| 34 | |
Paul Vinciguerra | 48bdbcd | 2019-12-04 19:43:53 -0500 | [diff] [blame] | 35 | def __init__(self, build_dir, appname, executable_args, logger, env=None, |
Dave Wallace | 4ee17d8 | 2021-05-20 14:01:51 -0400 | [diff] [blame] | 36 | role=None, *args, **kwargs): |
| 37 | self.role = role |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 38 | vpp_install_path = os.getenv('VPP_INSTALL_PATH') |
| 39 | |
| 40 | vcl_ldpreload_glob = "{}/**/{}".format(vpp_install_path, self.libname) |
| 41 | vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True) |
| 42 | |
| 43 | if len(vcl_ldpreload_so) < 1: |
| 44 | raise LibraryNotFound("cannot locate library: {}".format( |
| 45 | self.libname)) |
| 46 | |
| 47 | vcl_ldpreload_so = vcl_ldpreload_so[0] |
| 48 | |
Paul Vinciguerra | 48bdbcd | 2019-12-04 19:43:53 -0500 | [diff] [blame] | 49 | if env is None: |
| 50 | env = {} |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 51 | if "iperf" in appname: |
| 52 | app = appname |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 53 | env.update({'LD_PRELOAD': vcl_ldpreload_so}) |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 54 | elif "sock" in appname: |
| 55 | app = "%s/vpp/bin/%s" % (build_dir, appname) |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 56 | env.update({'LD_PRELOAD': vcl_ldpreload_so}) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 57 | else: |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 58 | app = "%s/vpp/bin/%s" % (build_dir, appname) |
Paul Vinciguerra | 48bdbcd | 2019-12-04 19:43:53 -0500 | [diff] [blame] | 59 | self.args = [app] + executable_args |
| 60 | super(VCLAppWorker, self).__init__(self.args, logger, env, |
| 61 | *args, **kwargs) |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 62 | |
| 63 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 64 | class VCLTestCase(VppTestCase): |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 65 | """ VCL Test Class """ |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 66 | session_startup = ["poll-main"] |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 67 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 68 | @classmethod |
| 69 | def setUpClass(cls): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 70 | if cls.session_startup: |
| 71 | conf = "session {" + " ".join(cls.session_startup) + "}" |
| 72 | cls.extra_vpp_punt_config = [conf] |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 73 | super(VCLTestCase, cls).setUpClass() |
| 74 | |
| 75 | @classmethod |
| 76 | def tearDownClass(cls): |
| 77 | super(VCLTestCase, cls).tearDownClass() |
| 78 | |
| 79 | def setUp(self): |
Klement Sekera | b8c72a4 | 2018-11-08 11:21:39 +0100 | [diff] [blame] | 80 | var = "VPP_BUILD_DIR" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 81 | self.build_dir = os.getenv(var, None) |
| 82 | if self.build_dir is None: |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 83 | raise EnvironmentError("Environment variable `%s' not set" % var) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 84 | self.vppDebug = 'vpp_debug' in self.build_dir |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 85 | self.server_addr = "127.0.0.1" |
| 86 | self.server_port = "22000" |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 87 | self.server_args = [self.server_port] |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 88 | self.server_ipv6_addr = "::1" |
| 89 | self.server_ipv6_args = ["-6", self.server_port] |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 90 | self.timeout = 20 |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 91 | self.echo_phrase = "Hello, world! Jenny is a friend of mine." |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 92 | self.pre_test_sleep = 0.3 |
| 93 | self.post_test_sleep = 0.2 |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 94 | self.sapi_client_sock = "" |
| 95 | self.sapi_server_sock = "" |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 96 | |
| 97 | if os.path.isfile("/tmp/ldp_server_af_unix_socket"): |
| 98 | os.remove("/tmp/ldp_server_af_unix_socket") |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 99 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 100 | super(VCLTestCase, self).setUp() |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 101 | |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 102 | def update_vcl_app_env(self, ns_id, ns_secret, attach_sock): |
| 103 | if not ns_id: |
| 104 | if 'VCL_APP_NAMESPACE_ID' in self.vcl_app_env: |
| 105 | del self.vcl_app_env['VCL_APP_NAMESPACE_ID'] |
| 106 | else: |
| 107 | self.vcl_app_env['VCL_APP_NAMESPACE_ID'] = ns_id |
| 108 | |
| 109 | if not ns_secret: |
| 110 | if 'VCL_APP_NAMESPACE_SECRET' in self.vcl_app_env: |
| 111 | del self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] |
| 112 | else: |
| 113 | self.vcl_app_env['VCL_APP_NAMESPACE_SECRET'] = ns_secret |
| 114 | |
| 115 | if not attach_sock: |
| 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'] |
| 119 | else: |
| 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'] |
| 124 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 125 | def cut_thru_setup(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 126 | self.vapi.session_enable_disable(is_enable=1) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 127 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 128 | def cut_thru_tear_down(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 129 | self.vapi.session_enable_disable(is_enable=0) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 130 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 131 | def cut_thru_test(self, server_app, server_args, client_app, client_args): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 132 | self.vcl_app_env = {'VCL_APP_SCOPE_LOCAL': "true"} |
| 133 | |
| 134 | self.update_vcl_app_env("", "", self.sapi_server_sock) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 135 | worker_server = VCLAppWorker(self.build_dir, server_app, server_args, |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 136 | self.logger, self.vcl_app_env, "server") |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 137 | worker_server.start() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 138 | self.sleep(self.pre_test_sleep) |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 139 | |
| 140 | self.update_vcl_app_env("", "", self.sapi_client_sock) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 141 | worker_client = VCLAppWorker(self.build_dir, client_app, client_args, |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 142 | self.logger, self.vcl_app_env, "client") |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 143 | worker_client.start() |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 144 | worker_client.join(self.timeout) |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 145 | try: |
| 146 | self.validateResults(worker_client, worker_server, self.timeout) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 147 | except Exception as error: |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 148 | self.fail("Failed with %s" % error) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 149 | self.sleep(self.post_test_sleep) |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 150 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 151 | def thru_host_stack_setup(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 152 | self.vapi.session_enable_disable(is_enable=1) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 153 | self.create_loopback_interfaces(2) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 154 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 155 | table_id = 1 |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 156 | |
| 157 | for i in self.lo_interfaces: |
| 158 | i.admin_up() |
| 159 | |
| 160 | if table_id != 0: |
| 161 | tbl = VppIpTable(self, table_id) |
| 162 | tbl.add_vpp_config() |
| 163 | |
| 164 | i.set_table_ip4(table_id) |
| 165 | i.config_ip4() |
| 166 | table_id += 1 |
| 167 | |
| 168 | # Configure namespaces |
Jakub Grajciar | b4e5e50 | 2020-01-31 09:35:29 +0100 | [diff] [blame] | 169 | self.vapi.app_namespace_add_del(namespace_id="1", secret=1234, |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame] | 170 | sw_if_index=self.loop0.sw_if_index) |
Jakub Grajciar | b4e5e50 | 2020-01-31 09:35:29 +0100 | [diff] [blame] | 171 | self.vapi.app_namespace_add_del(namespace_id="2", secret=5678, |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame] | 172 | sw_if_index=self.loop1.sw_if_index) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 173 | |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 174 | # Add inter-table routes |
| 175 | ip_t01 = VppIpRoute(self, self.loop1.local_ip4, 32, |
| 176 | [VppRoutePath("0.0.0.0", |
| 177 | 0xffffffff, |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 178 | nh_table_id=2)], table_id=1) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 179 | ip_t10 = VppIpRoute(self, self.loop0.local_ip4, 32, |
| 180 | [VppRoutePath("0.0.0.0", |
| 181 | 0xffffffff, |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 182 | nh_table_id=1)], table_id=2) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 183 | ip_t01.add_vpp_config() |
| 184 | ip_t10.add_vpp_config() |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 185 | self.logger.debug(self.vapi.cli("show ip fib")) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 186 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 187 | def thru_host_stack_tear_down(self): |
| 188 | for i in self.lo_interfaces: |
| 189 | i.unconfig_ip4() |
| 190 | i.set_table_ip4(0) |
| 191 | i.admin_down() |
| 192 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 193 | def thru_host_stack_ipv6_setup(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 194 | self.vapi.session_enable_disable(is_enable=1) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 195 | self.create_loopback_interfaces(2) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 196 | |
| 197 | table_id = 1 |
| 198 | |
| 199 | for i in self.lo_interfaces: |
| 200 | i.admin_up() |
| 201 | |
| 202 | tbl = VppIpTable(self, table_id, is_ip6=1) |
| 203 | tbl.add_vpp_config() |
| 204 | |
| 205 | i.set_table_ip6(table_id) |
| 206 | i.config_ip6() |
| 207 | table_id += 1 |
| 208 | |
| 209 | # Configure namespaces |
Jakub Grajciar | b4e5e50 | 2020-01-31 09:35:29 +0100 | [diff] [blame] | 210 | self.vapi.app_namespace_add_del(namespace_id="1", secret=1234, |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame] | 211 | sw_if_index=self.loop0.sw_if_index) |
Jakub Grajciar | b4e5e50 | 2020-01-31 09:35:29 +0100 | [diff] [blame] | 212 | self.vapi.app_namespace_add_del(namespace_id="2", secret=5678, |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame] | 213 | sw_if_index=self.loop1.sw_if_index) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 214 | |
| 215 | # Add inter-table routes |
| 216 | ip_t01 = VppIpRoute(self, self.loop1.local_ip6, 128, |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 217 | [VppRoutePath("::0", 0xffffffff, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 218 | nh_table_id=2)], |
| 219 | table_id=1) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 220 | ip_t10 = VppIpRoute(self, self.loop0.local_ip6, 128, |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 221 | [VppRoutePath("::0", 0xffffffff, |
Neale Ranns | 097fa66 | 2018-05-01 05:17:55 -0700 | [diff] [blame] | 222 | nh_table_id=1)], |
| 223 | table_id=2) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 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")) |
| 228 | |
| 229 | def thru_host_stack_ipv6_tear_down(self): |
| 230 | for i in self.lo_interfaces: |
| 231 | i.unconfig_ip6() |
| 232 | i.set_table_ip6(0) |
| 233 | i.admin_down() |
| 234 | |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 235 | self.vapi.session_enable_disable(is_enable=0) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 236 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 237 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 238 | def thru_host_stack_test(self, server_app, server_args, |
| 239 | client_app, client_args): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 240 | self.vcl_app_env = {'VCL_APP_SCOPE_GLOBAL': "true"} |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 241 | |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 242 | self.update_vcl_app_env("1", "1234", self.sapi_server_sock) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 243 | worker_server = VCLAppWorker(self.build_dir, server_app, server_args, |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 244 | self.logger, self.vcl_app_env, "server") |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 245 | worker_server.start() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 246 | self.sleep(self.pre_test_sleep) |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 247 | |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 248 | self.update_vcl_app_env("2", "5678", self.sapi_client_sock) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 249 | worker_client = VCLAppWorker(self.build_dir, client_app, client_args, |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 250 | self.logger, self.vcl_app_env, "client") |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 251 | worker_client.start() |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 252 | worker_client.join(self.timeout) |
| 253 | |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 254 | try: |
| 255 | self.validateResults(worker_client, worker_server, self.timeout) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 256 | except Exception as error: |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 257 | self.fail("Failed with %s" % error) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 258 | self.sleep(self.post_test_sleep) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 259 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 260 | def validateResults(self, worker_client, worker_server, timeout): |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 261 | if worker_server.process is None: |
| 262 | raise RuntimeError('worker_server is not running.') |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 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) |
Dave Barach | ad64687 | 2019-05-06 10:49:41 -0400 | [diff] [blame] | 266 | os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 267 | worker_server.join() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 268 | self.logger.info("Client worker result is `%s'" % worker_client.result) |
| 269 | error = False |
| 270 | if worker_client.result is None: |
| 271 | try: |
| 272 | error = True |
| 273 | self.logger.error( |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 274 | "Timeout: %ss! Killing client worker process (pid %d)" % |
| 275 | (timeout, worker_client.process.pid)) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 276 | os.killpg(os.getpgid(worker_client.process.pid), |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 277 | signal.SIGKILL) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 278 | worker_client.join() |
Dave Wallace | 07c0a9d | 2019-05-13 19:21:24 -0400 | [diff] [blame] | 279 | except OSError: |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 280 | self.logger.debug( |
| 281 | "Couldn't kill client worker process") |
| 282 | raise |
| 283 | if error: |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 284 | raise RuntimeError( |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 285 | "Timeout! Client worker did not finish in %ss" % timeout) |
| 286 | self.assert_equal(worker_client.result, 0, "Binary test return code") |
| 287 | |
| 288 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 289 | class LDPCutThruTestCase(VCLTestCase): |
| 290 | """ LDP Cut Thru Tests """ |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 291 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 292 | @classmethod |
| 293 | def setUpClass(cls): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 294 | cls.session_startup = ["poll-main", "use-app-socket-api"] |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 295 | super(LDPCutThruTestCase, cls).setUpClass() |
| 296 | |
| 297 | @classmethod |
| 298 | def tearDownClass(cls): |
| 299 | super(LDPCutThruTestCase, cls).tearDownClass() |
| 300 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 301 | def setUp(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 302 | super(LDPCutThruTestCase, self).setUp() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 303 | |
| 304 | self.cut_thru_setup() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 305 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 306 | self.server_addr, self.server_port] |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 307 | self.client_iperf3_timeout = 20 |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 308 | self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr] |
| 309 | self.server_iperf3_args = ["-4", "-s"] |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 310 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 311 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 312 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 313 | self.server_addr, |
| 314 | self.server_port] |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 315 | self.client_bi_dir_nsock_timeout = 20 |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 316 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 317 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 318 | self.server_addr, |
| 319 | self.server_port] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 320 | self.sapi_client_sock = "default" |
| 321 | self.sapi_server_sock = "default" |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 322 | |
| 323 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 324 | super(LDPCutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 325 | self.cut_thru_tear_down() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 326 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 327 | def show_commands_at_teardown(self): |
| 328 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 329 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 330 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 331 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 332 | def test_ldp_cut_thru_echo(self): |
| 333 | """ run LDP cut thru echo test """ |
| 334 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 335 | self.cut_thru_test("sock_test_server", self.server_args, |
| 336 | "sock_test_client", self.client_echo_test_args) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 337 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 338 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 339 | def test_ldp_cut_thru_iperf3(self): |
| 340 | """ run LDP cut thru iperf3 test """ |
| 341 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 342 | self.timeout = self.client_iperf3_timeout |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 343 | self.cut_thru_test(iperf3, self.server_iperf3_args, |
| 344 | iperf3, self.client_iperf3_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 345 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 346 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 347 | def test_ldp_cut_thru_uni_dir_nsock(self): |
| 348 | """ run LDP cut thru uni-directional (multiple sockets) test """ |
| 349 | |
| 350 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 351 | self.cut_thru_test("sock_test_server", self.server_args, |
| 352 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 353 | self.client_uni_dir_nsock_test_args) |
| 354 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 355 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Florin Coras | 0f46e16 | 2019-07-02 19:33:15 -0700 | [diff] [blame] | 356 | @unittest.skip("sock test apps need to be improved") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 357 | def test_ldp_cut_thru_bi_dir_nsock(self): |
| 358 | """ run LDP cut thru bi-directional (multiple sockets) test """ |
| 359 | |
| 360 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 361 | self.cut_thru_test("sock_test_server", self.server_args, |
| 362 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 363 | self.client_bi_dir_nsock_test_args) |
| 364 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 365 | |
| 366 | class VCLCutThruTestCase(VCLTestCase): |
| 367 | """ VCL Cut Thru Tests """ |
| 368 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 369 | @classmethod |
| 370 | def setUpClass(cls): |
| 371 | super(VCLCutThruTestCase, cls).setUpClass() |
| 372 | |
| 373 | @classmethod |
| 374 | def tearDownClass(cls): |
| 375 | super(VCLCutThruTestCase, cls).tearDownClass() |
| 376 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 377 | def setUp(self): |
| 378 | super(VCLCutThruTestCase, self).setUp() |
| 379 | |
| 380 | self.cut_thru_setup() |
| 381 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 382 | self.server_addr, self.server_port] |
| 383 | |
| 384 | self.client_uni_dir_nsock_timeout = 20 |
| 385 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 386 | "-I", "2", |
| 387 | self.server_addr, |
| 388 | self.server_port] |
| 389 | self.client_bi_dir_nsock_timeout = 20 |
| 390 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 391 | "-I", "2", |
| 392 | self.server_addr, |
| 393 | self.server_port] |
| 394 | |
| 395 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 396 | super(VCLCutThruTestCase, self).tearDown() |
| 397 | |
Florin Coras | 317b8e0 | 2019-04-17 09:57:46 -0700 | [diff] [blame] | 398 | def show_commands_at_teardown(self): |
| 399 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 400 | self.logger.debug(self.vapi.cli("show app mq")) |
Florin Coras | 317b8e0 | 2019-04-17 09:57:46 -0700 | [diff] [blame] | 401 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 402 | def test_vcl_cut_thru_echo(self): |
| 403 | """ run VCL cut thru echo test """ |
| 404 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 405 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 406 | "vcl_test_client", self.client_echo_test_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 407 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 408 | def test_vcl_cut_thru_uni_dir_nsock(self): |
| 409 | """ run VCL cut thru uni-directional (multiple sockets) test """ |
| 410 | |
| 411 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 412 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 413 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 414 | self.client_uni_dir_nsock_test_args) |
| 415 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 416 | def test_vcl_cut_thru_bi_dir_nsock(self): |
| 417 | """ run VCL cut thru bi-directional (multiple sockets) test """ |
| 418 | |
| 419 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 420 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 421 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 422 | self.client_bi_dir_nsock_test_args) |
| 423 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 424 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 425 | class VCLThruHostStackEcho(VCLTestCase): |
| 426 | """ VCL Thru Host Stack Echo """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 427 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 428 | @classmethod |
| 429 | def setUpClass(cls): |
| 430 | super(VCLThruHostStackEcho, cls).setUpClass() |
| 431 | |
| 432 | @classmethod |
| 433 | def tearDownClass(cls): |
| 434 | super(VCLThruHostStackEcho, cls).tearDownClass() |
| 435 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 436 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 437 | super(VCLThruHostStackEcho, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 438 | |
| 439 | self.thru_host_stack_setup() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 440 | self.client_bi_dir_nsock_timeout = 20 |
| 441 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 442 | "-I", "2", |
| 443 | self.loop0.local_ip4, |
| 444 | self.server_port] |
| 445 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 446 | self.loop0.local_ip4, |
| 447 | self.server_port] |
| 448 | |
| 449 | def tearDown(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 450 | self.thru_host_stack_tear_down() |
| 451 | super(VCLThruHostStackEcho, self).tearDown() |
| 452 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 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")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 456 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 457 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 458 | |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 459 | class VCLThruHostStackTLS(VCLTestCase): |
| 460 | """ VCL Thru Host Stack TLS """ |
| 461 | |
| 462 | @classmethod |
| 463 | def setUpClass(cls): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 464 | cls.session_startup = ["poll-main", "use-app-socket-api"] |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 465 | super(VCLThruHostStackTLS, cls).setUpClass() |
| 466 | |
| 467 | @classmethod |
| 468 | def tearDownClass(cls): |
| 469 | super(VCLThruHostStackTLS, cls).tearDownClass() |
| 470 | |
| 471 | def setUp(self): |
| 472 | super(VCLThruHostStackTLS, self).setUp() |
| 473 | |
| 474 | self.thru_host_stack_setup() |
| 475 | self.client_uni_dir_tls_timeout = 20 |
Dave Wallace | 03dd90a | 2019-03-25 19:34:50 -0400 | [diff] [blame] | 476 | self.server_tls_args = ["-L", self.server_port] |
| 477 | self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-L", |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 478 | self.loop0.local_ip4, |
| 479 | self.server_port] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 480 | self.sapi_server_sock = "1" |
| 481 | self.sapi_client_sock = "2" |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 482 | |
| 483 | def test_vcl_thru_host_stack_tls_uni_dir(self): |
| 484 | """ run VCL thru host stack uni-directional TLS test """ |
| 485 | |
| 486 | self.timeout = self.client_uni_dir_tls_timeout |
| 487 | self.thru_host_stack_test("vcl_test_server", self.server_tls_args, |
| 488 | "vcl_test_client", |
| 489 | self.client_uni_dir_tls_test_args) |
| 490 | |
| 491 | def tearDown(self): |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 492 | self.thru_host_stack_tear_down() |
| 493 | super(VCLThruHostStackTLS, self).tearDown() |
| 494 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 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")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 498 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 499 | |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 500 | |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 501 | class VCLThruHostStackDTLS(VCLTestCase): |
| 502 | """ VCL Thru Host Stack DTLS """ |
| 503 | |
| 504 | @classmethod |
| 505 | def setUpClass(cls): |
| 506 | super(VCLThruHostStackDTLS, cls).setUpClass() |
| 507 | |
| 508 | @classmethod |
| 509 | def tearDownClass(cls): |
| 510 | super(VCLThruHostStackDTLS, cls).tearDownClass() |
| 511 | |
| 512 | def setUp(self): |
| 513 | super(VCLThruHostStackDTLS, self).setUp() |
| 514 | |
| 515 | self.thru_host_stack_setup() |
| 516 | self.client_uni_dir_dtls_timeout = 20 |
Florin Coras | fb50bc3 | 2021-05-18 00:28:59 -0700 | [diff] [blame] | 517 | self.server_dtls_args = ["-p", "dtls", self.server_port] |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 518 | self.client_uni_dir_dtls_test_args = ["-N", "1000", "-U", "-X", |
Florin Coras | fb50bc3 | 2021-05-18 00:28:59 -0700 | [diff] [blame] | 519 | "-p", "dtls", "-T 1400", |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 520 | self.loop0.local_ip4, |
| 521 | self.server_port] |
| 522 | |
| 523 | def test_vcl_thru_host_stack_dtls_uni_dir(self): |
| 524 | """ run VCL thru host stack uni-directional DTLS test """ |
| 525 | |
| 526 | self.timeout = self.client_uni_dir_dtls_timeout |
| 527 | self.thru_host_stack_test("vcl_test_server", self.server_dtls_args, |
| 528 | "vcl_test_client", |
| 529 | self.client_uni_dir_dtls_test_args) |
| 530 | |
| 531 | def tearDown(self): |
| 532 | self.thru_host_stack_tear_down() |
| 533 | super(VCLThruHostStackDTLS, self).tearDown() |
| 534 | |
| 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")) |
| 539 | |
| 540 | |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 541 | class VCLThruHostStackQUIC(VCLTestCase): |
| 542 | """ VCL Thru Host Stack QUIC """ |
| 543 | |
| 544 | @classmethod |
| 545 | def setUpClass(cls): |
| 546 | cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }") |
| 547 | super(VCLThruHostStackQUIC, cls).setUpClass() |
| 548 | |
| 549 | @classmethod |
| 550 | def tearDownClass(cls): |
| 551 | super(VCLThruHostStackQUIC, cls).tearDownClass() |
| 552 | |
| 553 | def setUp(self): |
| 554 | super(VCLThruHostStackQUIC, self).setUp() |
| 555 | |
| 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", |
| 560 | "-p", "quic", |
| 561 | self.loop0.local_ip4, |
| 562 | self.server_port] |
| 563 | |
| 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 """ |
| 567 | |
| 568 | self.timeout = self.client_uni_dir_quic_timeout |
| 569 | self.thru_host_stack_test("vcl_test_server", self.server_quic_args, |
| 570 | "vcl_test_client", |
| 571 | self.client_uni_dir_quic_test_args) |
| 572 | |
| 573 | def tearDown(self): |
| 574 | self.thru_host_stack_tear_down() |
| 575 | super(VCLThruHostStackQUIC, self).tearDown() |
| 576 | |
| 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")) |
| 581 | |
| 582 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 583 | class VCLThruHostStackBidirNsock(VCLTestCase): |
| 584 | """ VCL Thru Host Stack Bidir Nsock """ |
| 585 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 586 | @classmethod |
| 587 | def setUpClass(cls): |
| 588 | super(VCLThruHostStackBidirNsock, cls).setUpClass() |
| 589 | |
| 590 | @classmethod |
| 591 | def tearDownClass(cls): |
| 592 | super(VCLThruHostStackBidirNsock, cls).tearDownClass() |
| 593 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 594 | def setUp(self): |
| 595 | super(VCLThruHostStackBidirNsock, self).setUp() |
| 596 | |
| 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", |
| 600 | "-I", "2", |
| 601 | self.loop0.local_ip4, |
| 602 | self.server_port] |
| 603 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 604 | self.loop0.local_ip4, |
| 605 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 606 | |
| 607 | def tearDown(self): |
| 608 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 609 | super(VCLThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 610 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 611 | def show_commands_at_teardown(self): |
| 612 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 613 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 614 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 615 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 616 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 617 | |
| 618 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 619 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 620 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 621 | self.client_bi_dir_nsock_test_args) |
| 622 | |
| 623 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 624 | class LDPThruHostStackBidirNsock(VCLTestCase): |
| 625 | """ LDP Thru Host Stack Bidir Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 626 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 627 | @classmethod |
| 628 | def setUpClass(cls): |
| 629 | super(LDPThruHostStackBidirNsock, cls).setUpClass() |
| 630 | |
| 631 | @classmethod |
| 632 | def tearDownClass(cls): |
| 633 | super(LDPThruHostStackBidirNsock, cls).tearDownClass() |
| 634 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 635 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 636 | super(LDPThruHostStackBidirNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 637 | |
| 638 | self.thru_host_stack_setup() |
Dave Wallace | 3102c38 | 2020-04-03 19:48:48 -0400 | [diff] [blame] | 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' |
| 644 | # or TEST_JOBS > 1 |
| 645 | # "-I", "2", |
| 646 | self.loop0.local_ip4, |
| 647 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 648 | |
| 649 | def tearDown(self): |
| 650 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 651 | super(LDPThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 652 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 653 | def show_commands_at_teardown(self): |
| 654 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 655 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 656 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 657 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 658 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 659 | |
| 660 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 661 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 662 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 663 | self.client_bi_dir_nsock_test_args) |
| 664 | |
| 665 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 666 | class LDPThruHostStackNsock(VCLTestCase): |
| 667 | """ LDP Thru Host Stack Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 668 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 669 | @classmethod |
| 670 | def setUpClass(cls): |
| 671 | super(LDPThruHostStackNsock, cls).setUpClass() |
| 672 | |
| 673 | @classmethod |
| 674 | def tearDownClass(cls): |
| 675 | super(LDPThruHostStackNsock, cls).tearDownClass() |
| 676 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 677 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 678 | super(LDPThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 679 | |
| 680 | self.thru_host_stack_setup() |
| 681 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 682 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 683 | self.numSockets = "2" |
| 684 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 685 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 686 | self.numSockets = "5" |
| 687 | |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 688 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 689 | "-I", self.numSockets, |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 690 | self.loop0.local_ip4, |
| 691 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 692 | |
| 693 | def tearDown(self): |
| 694 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 695 | super(LDPThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 696 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 697 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
| 698 | """ run LDP thru host stack uni-directional (multiple sockets) test """ |
| 699 | |
| 700 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 701 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 702 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 703 | self.client_uni_dir_nsock_test_args) |
| 704 | |
| 705 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 706 | class VCLThruHostStackNsock(VCLTestCase): |
| 707 | """ VCL Thru Host Stack Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 708 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 709 | @classmethod |
| 710 | def setUpClass(cls): |
| 711 | super(VCLThruHostStackNsock, cls).setUpClass() |
| 712 | |
| 713 | @classmethod |
| 714 | def tearDownClass(cls): |
| 715 | super(VCLThruHostStackNsock, cls).tearDownClass() |
| 716 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 717 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 718 | super(VCLThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 719 | |
| 720 | self.thru_host_stack_setup() |
| 721 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 722 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 723 | self.numSockets = "2" |
| 724 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 725 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 726 | self.numSockets = "5" |
| 727 | |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 728 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 729 | "-I", self.numSockets, |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 730 | self.loop0.local_ip4, |
| 731 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 732 | |
| 733 | def tearDown(self): |
| 734 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 735 | super(VCLThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 736 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 737 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
| 738 | """ run VCL thru host stack uni-directional (multiple sockets) test """ |
| 739 | |
| 740 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 741 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 742 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 743 | self.client_uni_dir_nsock_test_args) |
| 744 | |
| 745 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 746 | class LDPThruHostStackIperf(VCLTestCase): |
| 747 | """ LDP Thru Host Stack Iperf """ |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 748 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 749 | @classmethod |
| 750 | def setUpClass(cls): |
| 751 | super(LDPThruHostStackIperf, cls).setUpClass() |
| 752 | |
| 753 | @classmethod |
| 754 | def tearDownClass(cls): |
| 755 | super(LDPThruHostStackIperf, cls).tearDownClass() |
| 756 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 757 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 758 | super(LDPThruHostStackIperf, self).setUp() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 759 | |
| 760 | self.thru_host_stack_setup() |
| 761 | self.client_iperf3_timeout = 20 |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 762 | self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4] |
| 763 | self.server_iperf3_args = ["-4", "-s"] |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 764 | |
| 765 | def tearDown(self): |
| 766 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 767 | super(LDPThruHostStackIperf, self).tearDown() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 768 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 769 | def show_commands_at_teardown(self): |
| 770 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 771 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 772 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 773 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 774 | def test_ldp_thru_host_stack_iperf3(self): |
| 775 | """ run LDP thru host stack iperf3 test """ |
| 776 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 777 | self.timeout = self.client_iperf3_timeout |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 778 | self.thru_host_stack_test(iperf3, self.server_iperf3_args, |
| 779 | iperf3, self.client_iperf3_args) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 780 | |
| 781 | |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 782 | class LDPThruHostStackIperfUdp(VCLTestCase): |
| 783 | """ LDP Thru Host Stack Iperf UDP """ |
| 784 | |
| 785 | @classmethod |
| 786 | def setUpClass(cls): |
| 787 | super(LDPThruHostStackIperfUdp, cls).setUpClass() |
| 788 | |
| 789 | @classmethod |
| 790 | def tearDownClass(cls): |
| 791 | super(LDPThruHostStackIperfUdp, cls).tearDownClass() |
| 792 | |
| 793 | def setUp(self): |
| 794 | super(LDPThruHostStackIperfUdp, self).setUp() |
| 795 | |
| 796 | self.thru_host_stack_setup() |
| 797 | self.client_iperf3_timeout = 20 |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 798 | self.client_iperf3_args = ["-4", "-t 2", "-u", "-l 1400", |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 799 | "-c", self.loop0.local_ip4] |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 800 | self.server_iperf3_args = ["-4", "-s"] |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 801 | |
| 802 | def tearDown(self): |
| 803 | self.thru_host_stack_tear_down() |
| 804 | super(LDPThruHostStackIperfUdp, self).tearDown() |
| 805 | |
| 806 | def show_commands_at_teardown(self): |
| 807 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 808 | self.logger.debug(self.vapi.cli("show app mq")) |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 809 | |
| 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 """ |
| 813 | |
| 814 | self.timeout = self.client_iperf3_timeout |
| 815 | self.thru_host_stack_test(iperf3, self.server_iperf3_args, |
| 816 | iperf3, self.client_iperf3_args) |
| 817 | |
| 818 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 819 | class LDPIpv6CutThruTestCase(VCLTestCase): |
| 820 | """ LDP IPv6 Cut Thru Tests """ |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 821 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 822 | @classmethod |
| 823 | def setUpClass(cls): |
| 824 | super(LDPIpv6CutThruTestCase, cls).setUpClass() |
| 825 | |
| 826 | @classmethod |
| 827 | def tearDownClass(cls): |
| 828 | super(LDPIpv6CutThruTestCase, cls).tearDownClass() |
| 829 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 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")) |
| 833 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 834 | def setUp(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 835 | super(LDPIpv6CutThruTestCase, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 836 | |
| 837 | self.cut_thru_setup() |
| 838 | self.client_iperf3_timeout = 20 |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 839 | self.client_uni_dir_nsock_timeout = 20 |
| 840 | self.client_bi_dir_nsock_timeout = 20 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 841 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 842 | self.server_ipv6_addr, |
| 843 | self.server_port] |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 844 | self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c", |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 845 | self.server_ipv6_addr] |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 846 | self.server_ipv6_iperf3_args = ["-6", "-s"] |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 847 | self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 848 | "-6", |
| 849 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 850 | self.server_ipv6_addr, |
| 851 | self.server_port] |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 852 | self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 853 | "-6", |
| 854 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 855 | self.server_ipv6_addr, |
| 856 | self.server_port] |
| 857 | |
| 858 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 859 | super(LDPIpv6CutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 860 | self.cut_thru_tear_down() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 861 | |
| 862 | def test_ldp_ipv6_cut_thru_echo(self): |
| 863 | """ run LDP IPv6 cut thru echo test """ |
| 864 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 865 | self.cut_thru_test("sock_test_server", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 866 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 867 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 868 | self.client_ipv6_echo_test_args) |
| 869 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 870 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 871 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 872 | def test_ldp_ipv6_cut_thru_iperf3(self): |
| 873 | """ run LDP IPv6 cut thru iperf3 test """ |
| 874 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 875 | self.timeout = self.client_iperf3_timeout |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 876 | self.cut_thru_test(iperf3, self.server_ipv6_iperf3_args, |
| 877 | iperf3, self.client_ipv6_iperf3_args) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 878 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 879 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 880 | def test_ldp_ipv6_cut_thru_uni_dir_nsock(self): |
| 881 | """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """ |
| 882 | |
| 883 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 884 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 885 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 886 | self.client_ipv6_uni_dir_nsock_test_args) |
| 887 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 888 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Florin Coras | 0f46e16 | 2019-07-02 19:33:15 -0700 | [diff] [blame] | 889 | @unittest.skip("sock test apps need to be improved") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 890 | def test_ldp_ipv6_cut_thru_bi_dir_nsock(self): |
| 891 | """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """ |
| 892 | |
| 893 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 894 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 895 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 896 | self.client_ipv6_bi_dir_nsock_test_args) |
| 897 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 898 | |
| 899 | class VCLIpv6CutThruTestCase(VCLTestCase): |
| 900 | """ VCL IPv6 Cut Thru Tests """ |
| 901 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 902 | @classmethod |
| 903 | def setUpClass(cls): |
| 904 | super(VCLIpv6CutThruTestCase, cls).setUpClass() |
| 905 | |
| 906 | @classmethod |
| 907 | def tearDownClass(cls): |
| 908 | super(VCLIpv6CutThruTestCase, cls).tearDownClass() |
| 909 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 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")) |
| 913 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 914 | def setUp(self): |
| 915 | super(VCLIpv6CutThruTestCase, self).setUp() |
| 916 | |
| 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, |
| 922 | self.server_port] |
| 923 | self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 924 | "-6", |
| 925 | "-I", "2", |
| 926 | self.server_ipv6_addr, |
| 927 | self.server_port] |
| 928 | self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 929 | "-6", |
| 930 | "-I", "2", |
| 931 | self.server_ipv6_addr, |
| 932 | self.server_port] |
| 933 | |
| 934 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 935 | super(VCLIpv6CutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 936 | self.cut_thru_tear_down() |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 937 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 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")) |
| 941 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 942 | def test_vcl_ipv6_cut_thru_echo(self): |
| 943 | """ run VCL IPv6 cut thru echo test """ |
| 944 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 945 | self.cut_thru_test("vcl_test_server", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 946 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 947 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 948 | self.client_ipv6_echo_test_args) |
| 949 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 950 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 951 | def test_vcl_ipv6_cut_thru_uni_dir_nsock(self): |
| 952 | """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """ |
| 953 | |
| 954 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 955 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 956 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 957 | self.client_ipv6_uni_dir_nsock_test_args) |
| 958 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 959 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 960 | def test_vcl_ipv6_cut_thru_bi_dir_nsock(self): |
| 961 | """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """ |
| 962 | |
| 963 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 964 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 965 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 966 | self.client_ipv6_bi_dir_nsock_test_args) |
| 967 | |
| 968 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 969 | class VCLIpv6ThruHostStackEcho(VCLTestCase): |
| 970 | """ VCL IPv6 Thru Host Stack Echo """ |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 971 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 972 | @classmethod |
| 973 | def setUpClass(cls): |
| 974 | super(VCLIpv6ThruHostStackEcho, cls).setUpClass() |
| 975 | |
| 976 | @classmethod |
| 977 | def tearDownClass(cls): |
| 978 | super(VCLIpv6ThruHostStackEcho, cls).tearDownClass() |
| 979 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 980 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 981 | super(VCLIpv6ThruHostStackEcho, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 982 | |
| 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, |
| 986 | self.server_port] |
| 987 | |
| 988 | def tearDown(self): |
| 989 | self.thru_host_stack_ipv6_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 990 | super(VCLIpv6ThruHostStackEcho, self).tearDown() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 991 | |
| 992 | def test_vcl_ipv6_thru_host_stack_echo(self): |
| 993 | """ run VCL IPv6 thru host stack echo test """ |
| 994 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 995 | self.thru_host_stack_test("vcl_test_server", |
Damjan Marion | 855e268 | 2018-08-24 13:37:45 +0200 | [diff] [blame] | 996 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 997 | "vcl_test_client", |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 998 | self.client_ipv6_echo_test_args) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 999 | |
| 1000 | |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 1001 | if __name__ == '__main__': |
| 1002 | unittest.main(testRunner=VppTestRunner) |