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