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