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 |
Dave Wallace | 85ce931 | 2024-08-19 18:47:55 -0400 | [diff] [blame] | 10 | from asfframework import VppAsfTestCase, VppTestRunner, Worker, tag_fixme_ubuntu2404 |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 11 | from vpp_ip_route import VppIpTable, VppIpRoute, VppRoutePath |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 12 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 13 | iperf3 = "/usr/bin/iperf3" |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 14 | |
| 15 | |
| 16 | def have_app(app): |
| 17 | try: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 18 | subprocess.check_output([app, "-v"]) |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 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): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 28 | """VCL Test Application Worker""" |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 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 | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 35 | def __init__( |
| 36 | self, appname, executable_args, logger, env=None, role=None, *args, **kwargs |
| 37 | ): |
Dave Wallace | 4ee17d8 | 2021-05-20 14:01:51 -0400 | [diff] [blame] | 38 | self.role = role |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 39 | vcl_ldpreload_glob = f"{config.vpp_install_dir}/**/{self.libname}" |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 40 | vcl_ldpreload_so = glob.glob(vcl_ldpreload_glob, recursive=True) |
| 41 | |
| 42 | if len(vcl_ldpreload_so) < 1: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 43 | raise LibraryNotFound("cannot locate library: {}".format(self.libname)) |
Damjan Marion | 5546e43 | 2021-09-30 20:04:14 +0200 | [diff] [blame] | 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 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +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}" |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +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 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 58 | super(VCLAppWorker, self).__init__(self.args, logger, env, *args, **kwargs) |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 59 | |
| 60 | |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 61 | class VCLTestCase(VppAsfTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 62 | """VCL Test Class""" |
| 63 | |
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) + "}" |
Klement Sekera | d3e0d10 | 2023-01-26 12:35:35 +0100 | [diff] [blame] | 70 | cls.extra_vpp_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 | d9b0c6f | 2022-04-26 19:02:15 +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 |
Dave Wallace | 8800f73 | 2023-08-31 00:47:44 -0400 | [diff] [blame] | 87 | self.post_test_sleep = 1 |
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: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 98 | if "VCL_APP_NAMESPACE_ID" in self.vcl_app_env: |
| 99 | del self.vcl_app_env["VCL_APP_NAMESPACE_ID"] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 100 | else: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 101 | self.vcl_app_env["VCL_APP_NAMESPACE_ID"] = ns_id |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 102 | |
| 103 | if not ns_secret: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 104 | if "VCL_APP_NAMESPACE_SECRET" in self.vcl_app_env: |
| 105 | del self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 106 | else: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 107 | self.vcl_app_env["VCL_APP_NAMESPACE_SECRET"] = ns_secret |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 108 | |
| 109 | if not attach_sock: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 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"] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 113 | else: |
| 114 | sapi_sock = "%s/app_ns_sockets/%s" % (self.tempdir, attach_sock) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 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"] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 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): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 126 | self.vcl_app_env = {"VCL_APP_SCOPE_LOCAL": "true"} |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 127 | |
| 128 | self.update_vcl_app_env("", "", self.sapi_server_sock) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 129 | worker_server = VCLAppWorker( |
| 130 | server_app, server_args, self.logger, self.vcl_app_env, "server" |
| 131 | ) |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 132 | worker_server.start() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 133 | self.sleep(self.pre_test_sleep) |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 134 | |
| 135 | self.update_vcl_app_env("", "", self.sapi_client_sock) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 136 | worker_client = VCLAppWorker( |
| 137 | client_app, client_args, self.logger, self.vcl_app_env, "client" |
| 138 | ) |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 139 | worker_client.start() |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 140 | worker_client.join(self.timeout) |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 141 | try: |
| 142 | self.validateResults(worker_client, worker_server, self.timeout) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 143 | except Exception as error: |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 144 | self.fail("Failed with %s" % error) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 145 | self.sleep(self.post_test_sleep) |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 146 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 147 | def thru_host_stack_setup(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 148 | self.vapi.session_enable_disable(is_enable=1) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 149 | self.create_loopback_interfaces(2) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 150 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 151 | table_id = 1 |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 152 | |
| 153 | for i in self.lo_interfaces: |
| 154 | i.admin_up() |
| 155 | |
| 156 | if table_id != 0: |
| 157 | tbl = VppIpTable(self, table_id) |
| 158 | tbl.add_vpp_config() |
| 159 | |
| 160 | i.set_table_ip4(table_id) |
| 161 | i.config_ip4() |
| 162 | table_id += 1 |
| 163 | |
| 164 | # Configure namespaces |
Nathan Skrzypczak | 51f1b26 | 2023-04-27 12:43:46 +0200 | [diff] [blame] | 165 | self.vapi.app_namespace_add_del_v4( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 166 | namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index |
| 167 | ) |
Nathan Skrzypczak | 51f1b26 | 2023-04-27 12:43:46 +0200 | [diff] [blame] | 168 | self.vapi.app_namespace_add_del_v4( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 169 | namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index |
| 170 | ) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 171 | |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 172 | # Add inter-table routes |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 173 | ip_t01 = VppIpRoute( |
| 174 | self, |
| 175 | self.loop1.local_ip4, |
| 176 | 32, |
| 177 | [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=2)], |
| 178 | table_id=1, |
| 179 | ) |
| 180 | ip_t10 = VppIpRoute( |
| 181 | self, |
| 182 | self.loop0.local_ip4, |
| 183 | 32, |
| 184 | [VppRoutePath("0.0.0.0", 0xFFFFFFFF, nh_table_id=1)], |
| 185 | table_id=2, |
| 186 | ) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 187 | ip_t01.add_vpp_config() |
| 188 | ip_t10.add_vpp_config() |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 189 | self.logger.debug(self.vapi.cli("show ip fib")) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 190 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 191 | def thru_host_stack_tear_down(self): |
Steven Luong | 67bae20 | 2024-07-08 11:21:23 -0700 | [diff] [blame] | 192 | self.vapi.app_namespace_add_del_v4( |
| 193 | is_add=0, namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index |
| 194 | ) |
| 195 | self.vapi.app_namespace_add_del_v4( |
| 196 | is_add=0, namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index |
| 197 | ) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 198 | for i in self.lo_interfaces: |
| 199 | i.unconfig_ip4() |
| 200 | i.set_table_ip4(0) |
| 201 | i.admin_down() |
Liangxing Wang | 2211277 | 2022-05-13 04:24:19 +0000 | [diff] [blame] | 202 | i.remove_vpp_config() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 203 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 204 | def thru_host_stack_ipv6_setup(self): |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 205 | self.vapi.session_enable_disable(is_enable=1) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 206 | self.create_loopback_interfaces(2) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 207 | |
| 208 | table_id = 1 |
| 209 | |
| 210 | for i in self.lo_interfaces: |
| 211 | i.admin_up() |
| 212 | |
| 213 | tbl = VppIpTable(self, table_id, is_ip6=1) |
| 214 | tbl.add_vpp_config() |
| 215 | |
| 216 | i.set_table_ip6(table_id) |
| 217 | i.config_ip6() |
| 218 | table_id += 1 |
| 219 | |
| 220 | # Configure namespaces |
Nathan Skrzypczak | 51f1b26 | 2023-04-27 12:43:46 +0200 | [diff] [blame] | 221 | self.vapi.app_namespace_add_del_v4( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 222 | namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index |
| 223 | ) |
Nathan Skrzypczak | 51f1b26 | 2023-04-27 12:43:46 +0200 | [diff] [blame] | 224 | self.vapi.app_namespace_add_del_v4( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 225 | namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index |
| 226 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 227 | |
| 228 | # Add inter-table routes |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 229 | ip_t01 = VppIpRoute( |
| 230 | self, |
| 231 | self.loop1.local_ip6, |
| 232 | 128, |
| 233 | [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=2)], |
| 234 | table_id=1, |
| 235 | ) |
| 236 | ip_t10 = VppIpRoute( |
| 237 | self, |
| 238 | self.loop0.local_ip6, |
| 239 | 128, |
| 240 | [VppRoutePath("::0", 0xFFFFFFFF, nh_table_id=1)], |
| 241 | table_id=2, |
| 242 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 243 | ip_t01.add_vpp_config() |
| 244 | ip_t10.add_vpp_config() |
| 245 | self.logger.debug(self.vapi.cli("show interface addr")) |
| 246 | self.logger.debug(self.vapi.cli("show ip6 fib")) |
| 247 | |
| 248 | def thru_host_stack_ipv6_tear_down(self): |
Steven Luong | 67bae20 | 2024-07-08 11:21:23 -0700 | [diff] [blame] | 249 | self.vapi.app_namespace_add_del_v4( |
| 250 | is_add=0, namespace_id="1", secret=1234, sw_if_index=self.loop0.sw_if_index |
| 251 | ) |
| 252 | self.vapi.app_namespace_add_del_v4( |
| 253 | is_add=0, namespace_id="2", secret=5678, sw_if_index=self.loop1.sw_if_index |
| 254 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 255 | for i in self.lo_interfaces: |
| 256 | i.unconfig_ip6() |
| 257 | i.set_table_ip6(0) |
| 258 | i.admin_down() |
| 259 | |
Jakub Grajciar | 6a2794e | 2020-11-24 11:22:01 +0100 | [diff] [blame] | 260 | self.vapi.session_enable_disable(is_enable=0) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 261 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 262 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 263 | def thru_host_stack_test(self, server_app, server_args, client_app, client_args): |
| 264 | self.vcl_app_env = {"VCL_APP_SCOPE_GLOBAL": "true"} |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 265 | |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 266 | self.update_vcl_app_env("1", "1234", self.sapi_server_sock) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 267 | worker_server = VCLAppWorker( |
| 268 | server_app, server_args, self.logger, self.vcl_app_env, "server" |
| 269 | ) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 270 | worker_server.start() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 271 | self.sleep(self.pre_test_sleep) |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 272 | |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 273 | self.update_vcl_app_env("2", "5678", self.sapi_client_sock) |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 274 | worker_client = VCLAppWorker( |
| 275 | client_app, client_args, self.logger, self.vcl_app_env, "client" |
| 276 | ) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 277 | worker_client.start() |
Dave Wallace | 42996c0 | 2018-02-26 14:40:13 -0500 | [diff] [blame] | 278 | worker_client.join(self.timeout) |
| 279 | |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 280 | try: |
| 281 | self.validateResults(worker_client, worker_server, self.timeout) |
Klement Sekera | b9ef273 | 2018-06-24 22:49:33 +0200 | [diff] [blame] | 282 | except Exception as error: |
Dave Wallace | fef3f7b | 2018-03-09 12:04:10 -0500 | [diff] [blame] | 283 | self.fail("Failed with %s" % error) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 284 | self.sleep(self.post_test_sleep) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 285 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 286 | def validateResults(self, worker_client, worker_server, timeout): |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 287 | if worker_server.process is None: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 288 | raise RuntimeError("worker_server is not running.") |
| 289 | if os.path.isdir("/proc/{}".format(worker_server.process.pid)): |
| 290 | self.logger.info( |
| 291 | "Killing server worker process (pid %d)" % worker_server.process.pid |
| 292 | ) |
Dave Barach | ad64687 | 2019-05-06 10:49:41 -0400 | [diff] [blame] | 293 | os.killpg(os.getpgid(worker_server.process.pid), signal.SIGTERM) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 294 | worker_server.join() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 295 | self.logger.info("Client worker result is `%s'" % worker_client.result) |
| 296 | error = False |
| 297 | if worker_client.result is None: |
| 298 | try: |
| 299 | error = True |
| 300 | self.logger.error( |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 301 | "Timeout: %ss! Killing client worker process (pid %d)" |
| 302 | % (timeout, worker_client.process.pid) |
| 303 | ) |
| 304 | os.killpg(os.getpgid(worker_client.process.pid), signal.SIGKILL) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 305 | worker_client.join() |
Dave Wallace | 07c0a9d | 2019-05-13 19:21:24 -0400 | [diff] [blame] | 306 | except OSError: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 307 | self.logger.debug("Couldn't kill client worker process") |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 308 | raise |
| 309 | if error: |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 310 | raise RuntimeError("Timeout! Client worker did not finish in %ss" % timeout) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 311 | self.assert_equal(worker_client.result, 0, "Binary test return code") |
| 312 | |
| 313 | |
Dave Wallace | 85ce931 | 2024-08-19 18:47:55 -0400 | [diff] [blame] | 314 | @tag_fixme_ubuntu2404 |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 315 | class LDPCutThruTestCase(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 316 | """LDP Cut Thru Tests""" |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 317 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 318 | @classmethod |
| 319 | def setUpClass(cls): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 320 | cls.session_startup = ["poll-main", "use-app-socket-api"] |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 321 | super(LDPCutThruTestCase, cls).setUpClass() |
| 322 | |
| 323 | @classmethod |
| 324 | def tearDownClass(cls): |
| 325 | super(LDPCutThruTestCase, cls).tearDownClass() |
| 326 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 327 | def setUp(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 328 | super(LDPCutThruTestCase, self).setUp() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 329 | |
| 330 | self.cut_thru_setup() |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 331 | self.client_echo_test_args = [ |
| 332 | "-E", |
| 333 | self.echo_phrase, |
| 334 | "-X", |
| 335 | self.server_addr, |
| 336 | self.server_port, |
| 337 | ] |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 338 | self.client_iperf3_timeout = 20 |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 339 | self.client_iperf3_args = ["-4", "-t 2", "-c", self.server_addr] |
| 340 | self.server_iperf3_args = ["-4", "-s"] |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 341 | self.client_uni_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 342 | self.client_uni_dir_nsock_test_args = [ |
| 343 | "-N", |
| 344 | "1000", |
| 345 | "-U", |
| 346 | "-X", |
| 347 | "-I", |
| 348 | "2", |
| 349 | self.server_addr, |
| 350 | self.server_port, |
| 351 | ] |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 352 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 353 | self.client_bi_dir_nsock_test_args = [ |
| 354 | "-N", |
| 355 | "1000", |
| 356 | "-B", |
| 357 | "-X", |
| 358 | "-I", |
| 359 | "2", |
| 360 | self.server_addr, |
| 361 | self.server_port, |
| 362 | ] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 363 | self.sapi_client_sock = "default" |
| 364 | self.sapi_server_sock = "default" |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 365 | |
| 366 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 367 | super(LDPCutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 368 | self.cut_thru_tear_down() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 369 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 370 | def show_commands_at_teardown(self): |
| 371 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 372 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 373 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 374 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 375 | def test_ldp_cut_thru_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 376 | """run LDP cut thru echo test""" |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 377 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 378 | self.cut_thru_test( |
| 379 | "sock_test_server", |
| 380 | self.server_args, |
| 381 | "sock_test_client", |
| 382 | self.client_echo_test_args, |
| 383 | ) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 384 | |
| 385 | def test_ldp_cut_thru_iperf3(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 386 | """run LDP cut thru iperf3 test""" |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 387 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 388 | self.timeout = self.client_iperf3_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 389 | self.cut_thru_test( |
| 390 | iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args |
| 391 | ) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 392 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 393 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 394 | def test_ldp_cut_thru_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 395 | """run LDP cut thru uni-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 396 | |
| 397 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 398 | self.cut_thru_test( |
| 399 | "sock_test_server", |
| 400 | self.server_args, |
| 401 | "sock_test_client", |
| 402 | self.client_uni_dir_nsock_test_args, |
| 403 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 404 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 405 | @unittest.skipUnless(config.extended, "part of extended tests") |
Florin Coras | 0f46e16 | 2019-07-02 19:33:15 -0700 | [diff] [blame] | 406 | @unittest.skip("sock test apps need to be improved") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 407 | def test_ldp_cut_thru_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 408 | """run LDP cut thru bi-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 409 | |
| 410 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 411 | self.cut_thru_test( |
| 412 | "sock_test_server", |
| 413 | self.server_args, |
| 414 | "sock_test_client", |
| 415 | self.client_bi_dir_nsock_test_args, |
| 416 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 417 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 418 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 419 | @unittest.skipIf( |
| 420 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 421 | ) |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 422 | class VCLCutThruTestCase(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 423 | """VCL Cut Thru Tests""" |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 424 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 425 | @classmethod |
| 426 | def setUpClass(cls): |
| 427 | super(VCLCutThruTestCase, cls).setUpClass() |
| 428 | |
| 429 | @classmethod |
| 430 | def tearDownClass(cls): |
| 431 | super(VCLCutThruTestCase, cls).tearDownClass() |
| 432 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 433 | def setUp(self): |
| 434 | super(VCLCutThruTestCase, self).setUp() |
| 435 | |
| 436 | self.cut_thru_setup() |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 437 | self.client_echo_test_args = [ |
| 438 | "-E", |
| 439 | self.echo_phrase, |
| 440 | "-X", |
| 441 | self.server_addr, |
| 442 | self.server_port, |
| 443 | ] |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 444 | |
| 445 | self.client_uni_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 446 | self.client_uni_dir_nsock_test_args = [ |
| 447 | "-N", |
| 448 | "1000", |
| 449 | "-U", |
| 450 | "-X", |
| 451 | "-I", |
| 452 | "2", |
| 453 | self.server_addr, |
| 454 | self.server_port, |
| 455 | ] |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 456 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 457 | self.client_bi_dir_nsock_test_args = [ |
| 458 | "-N", |
| 459 | "1000", |
| 460 | "-B", |
| 461 | "-X", |
| 462 | "-I", |
| 463 | "2", |
| 464 | self.server_addr, |
| 465 | self.server_port, |
| 466 | ] |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 467 | |
| 468 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 469 | super(VCLCutThruTestCase, self).tearDown() |
| 470 | |
Florin Coras | 317b8e0 | 2019-04-17 09:57:46 -0700 | [diff] [blame] | 471 | def show_commands_at_teardown(self): |
| 472 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 473 | self.logger.debug(self.vapi.cli("show app mq")) |
Florin Coras | 317b8e0 | 2019-04-17 09:57:46 -0700 | [diff] [blame] | 474 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 475 | def test_vcl_cut_thru_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 476 | """run VCL cut thru echo test""" |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 477 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 478 | self.cut_thru_test( |
| 479 | "vcl_test_server", |
| 480 | self.server_args, |
| 481 | "vcl_test_client", |
| 482 | self.client_echo_test_args, |
| 483 | ) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 484 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 485 | def test_vcl_cut_thru_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 486 | """run VCL cut thru uni-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 487 | |
| 488 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 489 | self.cut_thru_test( |
| 490 | "vcl_test_server", |
| 491 | self.server_args, |
| 492 | "vcl_test_client", |
| 493 | self.client_uni_dir_nsock_test_args, |
| 494 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 495 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 496 | def test_vcl_cut_thru_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 497 | """run VCL cut thru bi-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 498 | |
| 499 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 500 | self.cut_thru_test( |
| 501 | "vcl_test_server", |
| 502 | self.server_args, |
| 503 | "vcl_test_client", |
| 504 | self.client_bi_dir_nsock_test_args, |
| 505 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 506 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 507 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 508 | @unittest.skipIf( |
| 509 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 510 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 511 | class VCLThruHostStackEcho(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 512 | """VCL Thru Host Stack Echo""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 513 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 514 | @classmethod |
| 515 | def setUpClass(cls): |
| 516 | super(VCLThruHostStackEcho, cls).setUpClass() |
| 517 | |
| 518 | @classmethod |
| 519 | def tearDownClass(cls): |
| 520 | super(VCLThruHostStackEcho, cls).tearDownClass() |
| 521 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 522 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 523 | super(VCLThruHostStackEcho, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 524 | |
| 525 | self.thru_host_stack_setup() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 526 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 527 | self.client_bi_dir_nsock_test_args = [ |
| 528 | "-N", |
| 529 | "1000", |
| 530 | "-B", |
| 531 | "-X", |
| 532 | "-I", |
| 533 | "2", |
| 534 | self.loop0.local_ip4, |
| 535 | self.server_port, |
| 536 | ] |
| 537 | self.client_echo_test_args = [ |
| 538 | "-E", |
| 539 | self.echo_phrase, |
| 540 | "-X", |
| 541 | self.loop0.local_ip4, |
| 542 | self.server_port, |
| 543 | ] |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 544 | |
| 545 | def tearDown(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 546 | self.thru_host_stack_tear_down() |
| 547 | super(VCLThruHostStackEcho, self).tearDown() |
| 548 | |
Filip Tehlar | 48bdf24 | 2022-02-08 09:40:00 +0000 | [diff] [blame] | 549 | def test_vcl_thru_host_stack_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 550 | """run VCL IPv4 thru host stack echo test""" |
Filip Tehlar | 48bdf24 | 2022-02-08 09:40:00 +0000 | [diff] [blame] | 551 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 552 | self.thru_host_stack_test( |
| 553 | "vcl_test_server", |
| 554 | self.server_args, |
| 555 | "vcl_test_client", |
| 556 | self.client_echo_test_args, |
| 557 | ) |
Filip Tehlar | 48bdf24 | 2022-02-08 09:40:00 +0000 | [diff] [blame] | 558 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 559 | def show_commands_at_teardown(self): |
| 560 | self.logger.debug(self.vapi.cli("show app server")) |
| 561 | self.logger.debug(self.vapi.cli("show session verbose")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 562 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 563 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 564 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 565 | @unittest.skipIf( |
| 566 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 567 | ) |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 568 | class VCLThruHostStackTLS(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 569 | """VCL Thru Host Stack TLS""" |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 570 | |
| 571 | @classmethod |
| 572 | def setUpClass(cls): |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 573 | cls.session_startup = ["poll-main", "use-app-socket-api"] |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 574 | super(VCLThruHostStackTLS, cls).setUpClass() |
| 575 | |
| 576 | @classmethod |
| 577 | def tearDownClass(cls): |
| 578 | super(VCLThruHostStackTLS, cls).tearDownClass() |
| 579 | |
| 580 | def setUp(self): |
| 581 | super(VCLThruHostStackTLS, self).setUp() |
| 582 | |
| 583 | self.thru_host_stack_setup() |
| 584 | self.client_uni_dir_tls_timeout = 20 |
Dave Wallace | 03dd90a | 2019-03-25 19:34:50 -0400 | [diff] [blame] | 585 | self.server_tls_args = ["-L", self.server_port] |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 586 | self.client_uni_dir_tls_test_args = [ |
| 587 | "-N", |
| 588 | "1000", |
| 589 | "-U", |
| 590 | "-X", |
| 591 | "-L", |
| 592 | self.loop0.local_ip4, |
| 593 | self.server_port, |
| 594 | ] |
Florin Coras | 4c45d6f | 2021-08-12 08:38:02 -0700 | [diff] [blame] | 595 | self.sapi_server_sock = "1" |
| 596 | self.sapi_client_sock = "2" |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 597 | |
| 598 | def test_vcl_thru_host_stack_tls_uni_dir(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 599 | """run VCL thru host stack uni-directional TLS test""" |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 600 | |
| 601 | self.timeout = self.client_uni_dir_tls_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 602 | self.thru_host_stack_test( |
| 603 | "vcl_test_server", |
| 604 | self.server_tls_args, |
| 605 | "vcl_test_client", |
| 606 | self.client_uni_dir_tls_test_args, |
| 607 | ) |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 608 | |
| 609 | def tearDown(self): |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 610 | self.thru_host_stack_tear_down() |
| 611 | super(VCLThruHostStackTLS, self).tearDown() |
| 612 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 613 | def show_commands_at_teardown(self): |
| 614 | self.logger.debug(self.vapi.cli("show app server")) |
| 615 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 616 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 617 | |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 618 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 619 | @unittest.skipIf( |
| 620 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 621 | ) |
Filip Tehlar | 99a66f4 | 2022-11-11 11:56:54 +0100 | [diff] [blame] | 622 | class VCLThruHostStackEchoInterruptMode(VCLThruHostStackEcho): |
| 623 | """VCL Thru Host Stack Echo interrupt mode""" |
| 624 | |
| 625 | @classmethod |
| 626 | def setUpClass(cls): |
| 627 | cls.session_startup = ["use-private-rx-mqs", "use-app-socket-api"] |
| 628 | super(VCLThruHostStackEcho, cls).setUpClass() |
| 629 | |
| 630 | def test_vcl_thru_host_stack_echo(self): |
| 631 | """run VCL IPv4 thru host stack echo test interrupt mode""" |
| 632 | |
| 633 | self.sapi_server_sock = "1" |
| 634 | self.sapi_client_sock = "2" |
| 635 | |
| 636 | self.thru_host_stack_test( |
| 637 | "vcl_test_server", |
| 638 | self.server_args, |
| 639 | "vcl_test_client", |
| 640 | self.client_echo_test_args, |
| 641 | ) |
| 642 | |
| 643 | |
Filip Tehlar | d82c39e | 2022-02-14 15:39:26 +0000 | [diff] [blame] | 644 | class VCLThruHostStackTLSInterruptMode(VCLThruHostStackTLS): |
| 645 | """VCL Thru Host Stack TLS interrupt mode""" |
| 646 | |
| 647 | @classmethod |
| 648 | def setUpClass(cls): |
| 649 | cls.session_startup = ["poll-main", "use-app-socket-api", "use-private-rx-mqs"] |
| 650 | super(VCLThruHostStackTLS, cls).setUpClass() |
| 651 | |
| 652 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 653 | @unittest.skipIf( |
| 654 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 655 | ) |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 656 | class VCLThruHostStackDTLS(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 657 | """VCL Thru Host Stack DTLS""" |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 658 | |
| 659 | @classmethod |
| 660 | def setUpClass(cls): |
| 661 | super(VCLThruHostStackDTLS, cls).setUpClass() |
| 662 | |
| 663 | @classmethod |
| 664 | def tearDownClass(cls): |
| 665 | super(VCLThruHostStackDTLS, cls).tearDownClass() |
| 666 | |
| 667 | def setUp(self): |
| 668 | super(VCLThruHostStackDTLS, self).setUp() |
| 669 | |
| 670 | self.thru_host_stack_setup() |
| 671 | self.client_uni_dir_dtls_timeout = 20 |
Florin Coras | fb50bc3 | 2021-05-18 00:28:59 -0700 | [diff] [blame] | 672 | self.server_dtls_args = ["-p", "dtls", self.server_port] |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 673 | self.client_uni_dir_dtls_test_args = [ |
| 674 | "-N", |
| 675 | "1000", |
| 676 | "-U", |
| 677 | "-X", |
| 678 | "-p", |
| 679 | "dtls", |
| 680 | "-T 1400", |
| 681 | self.loop0.local_ip4, |
| 682 | self.server_port, |
| 683 | ] |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 684 | |
| 685 | def test_vcl_thru_host_stack_dtls_uni_dir(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 686 | """run VCL thru host stack uni-directional DTLS test""" |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 687 | |
| 688 | self.timeout = self.client_uni_dir_dtls_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 689 | self.thru_host_stack_test( |
| 690 | "vcl_test_server", |
| 691 | self.server_dtls_args, |
| 692 | "vcl_test_client", |
| 693 | self.client_uni_dir_dtls_test_args, |
| 694 | ) |
Florin Coras | cec1b27 | 2021-05-06 12:46:04 -0700 | [diff] [blame] | 695 | |
| 696 | def tearDown(self): |
| 697 | self.thru_host_stack_tear_down() |
| 698 | super(VCLThruHostStackDTLS, self).tearDown() |
| 699 | |
| 700 | def show_commands_at_teardown(self): |
| 701 | self.logger.debug(self.vapi.cli("show app server")) |
| 702 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
| 703 | self.logger.debug(self.vapi.cli("show app mq")) |
| 704 | |
| 705 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 706 | @unittest.skipIf( |
| 707 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 708 | ) |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 709 | class VCLThruHostStackQUIC(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 710 | """VCL Thru Host Stack QUIC""" |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 711 | |
| 712 | @classmethod |
| 713 | def setUpClass(cls): |
| 714 | cls.extra_vpp_plugin_config.append("plugin quic_plugin.so { enable }") |
| 715 | super(VCLThruHostStackQUIC, cls).setUpClass() |
| 716 | |
| 717 | @classmethod |
| 718 | def tearDownClass(cls): |
| 719 | super(VCLThruHostStackQUIC, cls).tearDownClass() |
| 720 | |
| 721 | def setUp(self): |
| 722 | super(VCLThruHostStackQUIC, self).setUp() |
| 723 | |
| 724 | self.thru_host_stack_setup() |
| 725 | self.client_uni_dir_quic_timeout = 20 |
| 726 | self.server_quic_args = ["-p", "quic", self.server_port] |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 727 | self.client_uni_dir_quic_test_args = [ |
| 728 | "-N", |
| 729 | "1000", |
| 730 | "-U", |
| 731 | "-X", |
| 732 | "-p", |
| 733 | "quic", |
| 734 | self.loop0.local_ip4, |
| 735 | self.server_port, |
| 736 | ] |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 737 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 738 | @unittest.skipUnless(config.extended, "part of extended tests") |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 739 | def test_vcl_thru_host_stack_quic_uni_dir(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 740 | """run VCL thru host stack uni-directional QUIC test""" |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 741 | |
| 742 | self.timeout = self.client_uni_dir_quic_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 743 | self.thru_host_stack_test( |
| 744 | "vcl_test_server", |
| 745 | self.server_quic_args, |
| 746 | "vcl_test_client", |
| 747 | self.client_uni_dir_quic_test_args, |
| 748 | ) |
Florin Coras | debb352 | 2021-05-18 00:35:50 -0700 | [diff] [blame] | 749 | |
| 750 | def tearDown(self): |
| 751 | self.thru_host_stack_tear_down() |
| 752 | super(VCLThruHostStackQUIC, self).tearDown() |
| 753 | |
| 754 | def show_commands_at_teardown(self): |
| 755 | self.logger.debug(self.vapi.cli("show app server")) |
| 756 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
| 757 | self.logger.debug(self.vapi.cli("show app mq")) |
| 758 | |
| 759 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 760 | @unittest.skipIf( |
| 761 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 762 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 763 | class VCLThruHostStackBidirNsock(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 764 | """VCL Thru Host Stack Bidir Nsock""" |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 765 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 766 | @classmethod |
| 767 | def setUpClass(cls): |
| 768 | super(VCLThruHostStackBidirNsock, cls).setUpClass() |
| 769 | |
| 770 | @classmethod |
| 771 | def tearDownClass(cls): |
| 772 | super(VCLThruHostStackBidirNsock, cls).tearDownClass() |
| 773 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 774 | def setUp(self): |
| 775 | super(VCLThruHostStackBidirNsock, self).setUp() |
| 776 | |
| 777 | self.thru_host_stack_setup() |
| 778 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 779 | self.client_bi_dir_nsock_test_args = [ |
| 780 | "-N", |
| 781 | "1000", |
| 782 | "-B", |
| 783 | "-X", |
| 784 | "-I", |
| 785 | "2", |
| 786 | self.loop0.local_ip4, |
| 787 | self.server_port, |
| 788 | ] |
| 789 | self.client_echo_test_args = [ |
| 790 | "-E", |
| 791 | self.echo_phrase, |
| 792 | "-X", |
| 793 | self.loop0.local_ip4, |
| 794 | self.server_port, |
| 795 | ] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 796 | |
| 797 | def tearDown(self): |
| 798 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 799 | super(VCLThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 800 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 801 | def show_commands_at_teardown(self): |
| 802 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 803 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 804 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 805 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 806 | """run VCL thru host stack bi-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 807 | |
| 808 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 809 | self.thru_host_stack_test( |
| 810 | "vcl_test_server", |
| 811 | self.server_args, |
| 812 | "vcl_test_client", |
| 813 | self.client_bi_dir_nsock_test_args, |
| 814 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 815 | |
| 816 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 817 | @unittest.skipIf( |
| 818 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 819 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 820 | class LDPThruHostStackBidirNsock(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 821 | """LDP Thru Host Stack Bidir Nsock""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 822 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 823 | @classmethod |
| 824 | def setUpClass(cls): |
| 825 | super(LDPThruHostStackBidirNsock, cls).setUpClass() |
| 826 | |
| 827 | @classmethod |
| 828 | def tearDownClass(cls): |
| 829 | super(LDPThruHostStackBidirNsock, cls).tearDownClass() |
| 830 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 831 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 832 | super(LDPThruHostStackBidirNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 833 | |
| 834 | self.thru_host_stack_setup() |
Dave Wallace | 3102c38 | 2020-04-03 19:48:48 -0400 | [diff] [blame] | 835 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 836 | self.client_bi_dir_nsock_test_args = [ |
| 837 | "-N", |
| 838 | "1000", |
| 839 | "-B", |
| 840 | "-X", |
| 841 | # OUCH! Host Stack Bug? |
| 842 | # Only fails when running |
| 843 | # 'make test TEST_JOBS=auto' |
| 844 | # or TEST_JOBS > 1 |
| 845 | # "-I", "2", |
| 846 | self.loop0.local_ip4, |
| 847 | self.server_port, |
| 848 | ] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 849 | |
| 850 | def tearDown(self): |
| 851 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 852 | super(LDPThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 853 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 854 | def show_commands_at_teardown(self): |
| 855 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 856 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 857 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 858 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 859 | """run LDP thru host stack bi-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 860 | |
| 861 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 862 | self.thru_host_stack_test( |
| 863 | "sock_test_server", |
| 864 | self.server_args, |
| 865 | "sock_test_client", |
| 866 | self.client_bi_dir_nsock_test_args, |
| 867 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 868 | |
| 869 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 870 | @unittest.skipIf( |
| 871 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 872 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 873 | class LDPThruHostStackNsock(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 874 | """LDP Thru Host Stack Nsock""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 875 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 876 | @classmethod |
| 877 | def setUpClass(cls): |
| 878 | super(LDPThruHostStackNsock, cls).setUpClass() |
| 879 | |
| 880 | @classmethod |
| 881 | def tearDownClass(cls): |
| 882 | super(LDPThruHostStackNsock, cls).tearDownClass() |
| 883 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 884 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 885 | super(LDPThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 886 | |
| 887 | self.thru_host_stack_setup() |
| 888 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 889 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 890 | self.numSockets = "2" |
| 891 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 892 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 893 | self.numSockets = "5" |
| 894 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 895 | self.client_uni_dir_nsock_test_args = [ |
| 896 | "-N", |
| 897 | "1000", |
| 898 | "-U", |
| 899 | "-X", |
| 900 | "-I", |
| 901 | self.numSockets, |
| 902 | self.loop0.local_ip4, |
| 903 | self.server_port, |
| 904 | ] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 905 | |
| 906 | def tearDown(self): |
| 907 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 908 | super(LDPThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 909 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 910 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 911 | """run LDP thru host stack uni-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 912 | |
| 913 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 914 | self.thru_host_stack_test( |
| 915 | "sock_test_server", |
| 916 | self.server_args, |
| 917 | "sock_test_client", |
| 918 | self.client_uni_dir_nsock_test_args, |
| 919 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 920 | |
| 921 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 922 | @unittest.skipIf( |
| 923 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 924 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 925 | class VCLThruHostStackNsock(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 926 | """VCL Thru Host Stack Nsock""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 927 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 928 | @classmethod |
| 929 | def setUpClass(cls): |
| 930 | super(VCLThruHostStackNsock, cls).setUpClass() |
| 931 | |
| 932 | @classmethod |
| 933 | def tearDownClass(cls): |
| 934 | super(VCLThruHostStackNsock, cls).tearDownClass() |
| 935 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 936 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 937 | super(VCLThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 938 | |
| 939 | self.thru_host_stack_setup() |
| 940 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 941 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 942 | self.numSockets = "2" |
| 943 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 944 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 945 | self.numSockets = "5" |
| 946 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 947 | self.client_uni_dir_nsock_test_args = [ |
| 948 | "-N", |
| 949 | "1000", |
| 950 | "-U", |
| 951 | "-X", |
| 952 | "-I", |
| 953 | self.numSockets, |
| 954 | self.loop0.local_ip4, |
| 955 | self.server_port, |
| 956 | ] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 957 | |
| 958 | def tearDown(self): |
| 959 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 960 | super(VCLThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 961 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 962 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 963 | """run VCL thru host stack uni-directional (multiple sockets) test""" |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 964 | |
| 965 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 966 | self.thru_host_stack_test( |
| 967 | "vcl_test_server", |
| 968 | self.server_args, |
| 969 | "vcl_test_client", |
| 970 | self.client_uni_dir_nsock_test_args, |
| 971 | ) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 972 | |
| 973 | |
Dave Wallace | 85ce931 | 2024-08-19 18:47:55 -0400 | [diff] [blame] | 974 | @tag_fixme_ubuntu2404 |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 975 | class LDPThruHostStackIperf(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 976 | """LDP Thru Host Stack Iperf""" |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 977 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 978 | @classmethod |
| 979 | def setUpClass(cls): |
| 980 | super(LDPThruHostStackIperf, cls).setUpClass() |
| 981 | |
| 982 | @classmethod |
| 983 | def tearDownClass(cls): |
| 984 | super(LDPThruHostStackIperf, cls).tearDownClass() |
| 985 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 986 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 987 | super(LDPThruHostStackIperf, self).setUp() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 988 | |
| 989 | self.thru_host_stack_setup() |
| 990 | self.client_iperf3_timeout = 20 |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 991 | self.client_iperf3_args = ["-4", "-t 2", "-c", self.loop0.local_ip4] |
| 992 | self.server_iperf3_args = ["-4", "-s"] |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 993 | |
| 994 | def tearDown(self): |
| 995 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 996 | super(LDPThruHostStackIperf, self).tearDown() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 997 | |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 998 | def show_commands_at_teardown(self): |
| 999 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 1000 | self.logger.debug(self.vapi.cli("show app mq")) |
Paul Vinciguerra | 90cf21b | 2019-03-13 09:23:05 -0700 | [diff] [blame] | 1001 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 1002 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 1003 | def test_ldp_thru_host_stack_iperf3(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1004 | """run LDP thru host stack iperf3 test""" |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 1005 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 1006 | self.timeout = self.client_iperf3_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1007 | self.thru_host_stack_test( |
| 1008 | iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args |
| 1009 | ) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 1010 | |
Liangxing Wang | 2211277 | 2022-05-13 04:24:19 +0000 | [diff] [blame] | 1011 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
| 1012 | def test_ldp_thru_host_stack_iperf3_mss(self): |
| 1013 | """run LDP thru host stack iperf3 test with mss option""" |
| 1014 | |
| 1015 | self.timeout = self.client_iperf3_timeout |
| 1016 | self.client_iperf3_args.append("-M 1000") |
| 1017 | self.thru_host_stack_test( |
| 1018 | iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args |
| 1019 | ) |
| 1020 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 1021 | |
Dave Wallace | 85ce931 | 2024-08-19 18:47:55 -0400 | [diff] [blame] | 1022 | @tag_fixme_ubuntu2404 |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1023 | class LDPThruHostStackIperfUdp(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1024 | """LDP Thru Host Stack Iperf UDP""" |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1025 | |
| 1026 | @classmethod |
| 1027 | def setUpClass(cls): |
| 1028 | super(LDPThruHostStackIperfUdp, cls).setUpClass() |
| 1029 | |
| 1030 | @classmethod |
| 1031 | def tearDownClass(cls): |
| 1032 | super(LDPThruHostStackIperfUdp, cls).tearDownClass() |
| 1033 | |
| 1034 | def setUp(self): |
| 1035 | super(LDPThruHostStackIperfUdp, self).setUp() |
| 1036 | |
| 1037 | self.thru_host_stack_setup() |
| 1038 | self.client_iperf3_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1039 | self.client_iperf3_args = [ |
| 1040 | "-4", |
| 1041 | "-t 2", |
| 1042 | "-u", |
| 1043 | "-l 1400", |
Florin Coras | d921b89 | 2023-05-25 12:04:53 -0700 | [diff] [blame] | 1044 | "-P 2", |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1045 | "-c", |
| 1046 | self.loop0.local_ip4, |
| 1047 | ] |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 1048 | self.server_iperf3_args = ["-4", "-s"] |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1049 | |
| 1050 | def tearDown(self): |
| 1051 | self.thru_host_stack_tear_down() |
| 1052 | super(LDPThruHostStackIperfUdp, self).tearDown() |
| 1053 | |
| 1054 | def show_commands_at_teardown(self): |
| 1055 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 1056 | self.logger.debug(self.vapi.cli("show app mq")) |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1057 | |
| 1058 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
| 1059 | def test_ldp_thru_host_stack_iperf3_udp(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1060 | """run LDP thru host stack iperf3 UDP test""" |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1061 | |
| 1062 | self.timeout = self.client_iperf3_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1063 | self.thru_host_stack_test( |
| 1064 | iperf3, self.server_iperf3_args, iperf3, self.client_iperf3_args |
| 1065 | ) |
Florin Coras | 57a5a2d | 2020-04-01 23:16:11 +0000 | [diff] [blame] | 1066 | |
| 1067 | |
Dave Wallace | 85ce931 | 2024-08-19 18:47:55 -0400 | [diff] [blame] | 1068 | @tag_fixme_ubuntu2404 |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1069 | class LDPIpv6CutThruTestCase(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1070 | """LDP IPv6 Cut Thru Tests""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1071 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 1072 | @classmethod |
| 1073 | def setUpClass(cls): |
| 1074 | super(LDPIpv6CutThruTestCase, cls).setUpClass() |
| 1075 | |
| 1076 | @classmethod |
| 1077 | def tearDownClass(cls): |
| 1078 | super(LDPIpv6CutThruTestCase, cls).tearDownClass() |
| 1079 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 1080 | def show_commands_at_teardown(self): |
| 1081 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
| 1082 | self.logger.debug(self.vapi.cli("show app mq")) |
| 1083 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1084 | def setUp(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1085 | super(LDPIpv6CutThruTestCase, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1086 | |
| 1087 | self.cut_thru_setup() |
| 1088 | self.client_iperf3_timeout = 20 |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 1089 | self.client_uni_dir_nsock_timeout = 20 |
| 1090 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1091 | self.client_ipv6_echo_test_args = [ |
| 1092 | "-6", |
| 1093 | "-E", |
| 1094 | self.echo_phrase, |
| 1095 | "-X", |
| 1096 | self.server_ipv6_addr, |
| 1097 | self.server_port, |
| 1098 | ] |
| 1099 | self.client_ipv6_iperf3_args = ["-6", "-t 2", "-c", self.server_ipv6_addr] |
Florin Coras | 1d87914 | 2021-05-06 00:08:18 -0700 | [diff] [blame] | 1100 | self.server_ipv6_iperf3_args = ["-6", "-s"] |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1101 | self.client_ipv6_uni_dir_nsock_test_args = [ |
| 1102 | "-N", |
| 1103 | "1000", |
| 1104 | "-U", |
| 1105 | "-X", |
| 1106 | "-6", |
| 1107 | "-I", |
| 1108 | "2", |
| 1109 | self.server_ipv6_addr, |
| 1110 | self.server_port, |
| 1111 | ] |
| 1112 | self.client_ipv6_bi_dir_nsock_test_args = [ |
| 1113 | "-N", |
| 1114 | "1000", |
| 1115 | "-B", |
| 1116 | "-X", |
| 1117 | "-6", |
| 1118 | "-I", |
| 1119 | "2", |
| 1120 | self.server_ipv6_addr, |
| 1121 | self.server_port, |
| 1122 | ] |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1123 | |
| 1124 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1125 | super(LDPIpv6CutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 1126 | self.cut_thru_tear_down() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1127 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 1128 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1129 | def test_ldp_ipv6_cut_thru_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1130 | """run LDP IPv6 cut thru echo test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1131 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1132 | self.cut_thru_test( |
| 1133 | "sock_test_server", |
| 1134 | self.server_ipv6_args, |
| 1135 | "sock_test_client", |
| 1136 | self.client_ipv6_echo_test_args, |
| 1137 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1138 | |
Paul Vinciguerra | 063366e | 2019-06-30 15:38:55 -0400 | [diff] [blame] | 1139 | @unittest.skipUnless(_have_iperf3, "'%s' not found, Skipping.") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1140 | def test_ldp_ipv6_cut_thru_iperf3(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1141 | """run LDP IPv6 cut thru iperf3 test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1142 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1143 | self.timeout = self.client_iperf3_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1144 | self.cut_thru_test( |
| 1145 | iperf3, self.server_ipv6_iperf3_args, iperf3, self.client_ipv6_iperf3_args |
| 1146 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1147 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 1148 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1149 | def test_ldp_ipv6_cut_thru_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1150 | """run LDP IPv6 cut thru uni-directional (multiple sockets) test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1151 | |
| 1152 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1153 | self.cut_thru_test( |
| 1154 | "sock_test_server", |
| 1155 | self.server_ipv6_args, |
| 1156 | "sock_test_client", |
| 1157 | self.client_ipv6_uni_dir_nsock_test_args, |
| 1158 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1159 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 1160 | @unittest.skipUnless(config.extended, "part of extended tests") |
Florin Coras | 0f46e16 | 2019-07-02 19:33:15 -0700 | [diff] [blame] | 1161 | @unittest.skip("sock test apps need to be improved") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1162 | def test_ldp_ipv6_cut_thru_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1163 | """run LDP IPv6 cut thru bi-directional (multiple sockets) test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1164 | |
| 1165 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1166 | self.cut_thru_test( |
| 1167 | "sock_test_server", |
| 1168 | self.server_ipv6_args, |
| 1169 | "sock_test_client", |
| 1170 | self.client_ipv6_bi_dir_nsock_test_args, |
| 1171 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1172 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1173 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 1174 | @unittest.skipIf( |
| 1175 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 1176 | ) |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1177 | class VCLIpv6CutThruTestCase(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1178 | """VCL IPv6 Cut Thru Tests""" |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1179 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 1180 | @classmethod |
| 1181 | def setUpClass(cls): |
| 1182 | super(VCLIpv6CutThruTestCase, cls).setUpClass() |
| 1183 | |
| 1184 | @classmethod |
| 1185 | def tearDownClass(cls): |
| 1186 | super(VCLIpv6CutThruTestCase, cls).tearDownClass() |
| 1187 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 1188 | def show_commands_at_teardown(self): |
| 1189 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
| 1190 | self.logger.debug(self.vapi.cli("show app mq")) |
| 1191 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1192 | def setUp(self): |
| 1193 | super(VCLIpv6CutThruTestCase, self).setUp() |
| 1194 | |
| 1195 | self.cut_thru_setup() |
| 1196 | self.client_uni_dir_nsock_timeout = 20 |
| 1197 | self.client_bi_dir_nsock_timeout = 20 |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1198 | self.client_ipv6_echo_test_args = [ |
| 1199 | "-6", |
| 1200 | "-E", |
| 1201 | self.echo_phrase, |
| 1202 | "-X", |
| 1203 | self.server_ipv6_addr, |
| 1204 | self.server_port, |
| 1205 | ] |
| 1206 | self.client_ipv6_uni_dir_nsock_test_args = [ |
| 1207 | "-N", |
| 1208 | "1000", |
| 1209 | "-U", |
| 1210 | "-X", |
| 1211 | "-6", |
| 1212 | "-I", |
| 1213 | "2", |
| 1214 | self.server_ipv6_addr, |
| 1215 | self.server_port, |
| 1216 | ] |
| 1217 | self.client_ipv6_bi_dir_nsock_test_args = [ |
| 1218 | "-N", |
| 1219 | "1000", |
| 1220 | "-B", |
| 1221 | "-X", |
| 1222 | "-6", |
| 1223 | "-I", |
| 1224 | "2", |
| 1225 | self.server_ipv6_addr, |
| 1226 | self.server_port, |
| 1227 | ] |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1228 | |
| 1229 | def tearDown(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1230 | super(VCLIpv6CutThruTestCase, self).tearDown() |
Paul Vinciguerra | 9673e3e | 2019-05-10 20:41:08 -0400 | [diff] [blame] | 1231 | self.cut_thru_tear_down() |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 1232 | |
Florin Coras | 41d5f54 | 2021-01-15 13:49:33 -0800 | [diff] [blame] | 1233 | def show_commands_at_teardown(self): |
| 1234 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
| 1235 | self.logger.debug(self.vapi.cli("show app mq")) |
| 1236 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1237 | def test_vcl_ipv6_cut_thru_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1238 | """run VCL IPv6 cut thru echo test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1239 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1240 | self.cut_thru_test( |
| 1241 | "vcl_test_server", |
| 1242 | self.server_ipv6_args, |
| 1243 | "vcl_test_client", |
| 1244 | self.client_ipv6_echo_test_args, |
| 1245 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1246 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 1247 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1248 | def test_vcl_ipv6_cut_thru_uni_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1249 | """run VCL IPv6 cut thru uni-directional (multiple sockets) test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1250 | |
| 1251 | self.timeout = self.client_uni_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1252 | self.cut_thru_test( |
| 1253 | "vcl_test_server", |
| 1254 | self.server_ipv6_args, |
| 1255 | "vcl_test_client", |
| 1256 | self.client_ipv6_uni_dir_nsock_test_args, |
| 1257 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1258 | |
Klement Sekera | b23ffd7 | 2021-05-31 16:08:53 +0200 | [diff] [blame] | 1259 | @unittest.skipUnless(config.extended, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1260 | def test_vcl_ipv6_cut_thru_bi_dir_nsock(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1261 | """run VCL IPv6 cut thru bi-directional (multiple sockets) test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1262 | |
| 1263 | self.timeout = self.client_bi_dir_nsock_timeout |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1264 | self.cut_thru_test( |
| 1265 | "vcl_test_server", |
| 1266 | self.server_ipv6_args, |
| 1267 | "vcl_test_client", |
| 1268 | self.client_ipv6_bi_dir_nsock_test_args, |
| 1269 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1270 | |
| 1271 | |
Dmitry Valter | 34fa0ce | 2024-03-11 10:38:46 +0000 | [diff] [blame] | 1272 | @unittest.skipIf( |
| 1273 | "hs_apps" in config.excluded_plugins, "Exclude tests requiring hs_apps plugin" |
| 1274 | ) |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 1275 | class VCLIpv6ThruHostStackEcho(VCLTestCase): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1276 | """VCL IPv6 Thru Host Stack Echo""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1277 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 1278 | @classmethod |
| 1279 | def setUpClass(cls): |
| 1280 | super(VCLIpv6ThruHostStackEcho, cls).setUpClass() |
| 1281 | |
| 1282 | @classmethod |
| 1283 | def tearDownClass(cls): |
| 1284 | super(VCLIpv6ThruHostStackEcho, cls).tearDownClass() |
| 1285 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1286 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 1287 | super(VCLIpv6ThruHostStackEcho, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1288 | |
| 1289 | self.thru_host_stack_ipv6_setup() |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1290 | self.client_ipv6_echo_test_args = [ |
| 1291 | "-6", |
| 1292 | "-E", |
| 1293 | self.echo_phrase, |
| 1294 | "-X", |
| 1295 | self.loop0.local_ip6, |
| 1296 | self.server_port, |
| 1297 | ] |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1298 | |
| 1299 | def tearDown(self): |
| 1300 | self.thru_host_stack_ipv6_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 1301 | super(VCLIpv6ThruHostStackEcho, self).tearDown() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1302 | |
| 1303 | def test_vcl_ipv6_thru_host_stack_echo(self): |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1304 | """run VCL IPv6 thru host stack echo test""" |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1305 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1306 | self.thru_host_stack_test( |
| 1307 | "vcl_test_server", |
| 1308 | self.server_ipv6_args, |
| 1309 | "vcl_test_client", |
| 1310 | self.client_ipv6_echo_test_args, |
| 1311 | ) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 1312 | |
| 1313 | |
Klement Sekera | d9b0c6f | 2022-04-26 19:02:15 +0200 | [diff] [blame] | 1314 | if __name__ == "__main__": |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 1315 | unittest.main(testRunner=VppTestRunner) |