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