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 |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame^] | 106 | self.vapi.app_namespace_add_del(namespace_id="1", secret=1234, |
| 107 | sw_if_index=self.loop0.sw_if_index) |
| 108 | self.vapi.app_namespace_add_del(namespace_id="2", secret=5678, |
| 109 | sw_if_index=self.loop1.sw_if_index) |
Dave Wallace | a67a03e | 2018-02-20 12:39:37 -0500 | [diff] [blame] | 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 |
Ole Troan | e1ade68 | 2019-03-04 23:55:43 +0100 | [diff] [blame^] | 149 | self.vapi.app_namespace_add_del(namespace_id="1", secret=1234, |
| 150 | sw_if_index=self.loop0.sw_if_index) |
| 151 | self.vapi.app_namespace_add_del(namespace_id="2", secret=5678, |
| 152 | sw_if_index=self.loop1.sw_if_index) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 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: |
Paul Vinciguerra | 38a4ec7 | 2018-11-28 11:34:21 -0800 | [diff] [blame] | 279 | self.logger.error( |
| 280 | "WARNING: Subprocess returned non-0 running 'iperf3 -v") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 281 | self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!") |
| 282 | return |
Paul Vinciguerra | 38a4ec7 | 2018-11-28 11:34:21 -0800 | [diff] [blame] | 283 | except OSError as e: |
| 284 | self.logger.error( |
| 285 | "WARNING: Subprocess returned with OS error (%s) %s\n" |
| 286 | " 'iperf3' is likely not installed,", |
| 287 | e.errno, e.strerror) |
| 288 | self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!") |
| 289 | return |
| 290 | except Exception: |
| 291 | self.logger.exception( |
| 292 | "Subprocess returned non-0 running 'iperf3 -v") |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 293 | |
| 294 | self.timeout = self.client_iperf3_timeout |
| 295 | self.cut_thru_test("iperf3", self.server_iperf3_args, |
| 296 | "iperf3", self.client_iperf3_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 297 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 298 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 299 | def test_ldp_cut_thru_uni_dir_nsock(self): |
| 300 | """ run LDP cut thru uni-directional (multiple sockets) test """ |
| 301 | |
| 302 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 303 | self.cut_thru_test("sock_test_server", self.server_args, |
| 304 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 305 | self.client_uni_dir_nsock_test_args) |
| 306 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 307 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 308 | def test_ldp_cut_thru_bi_dir_nsock(self): |
| 309 | """ run LDP cut thru bi-directional (multiple sockets) test """ |
| 310 | |
| 311 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 312 | self.cut_thru_test("sock_test_server", self.server_args, |
| 313 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 314 | self.client_bi_dir_nsock_test_args) |
| 315 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 316 | |
| 317 | class VCLCutThruTestCase(VCLTestCase): |
| 318 | """ VCL Cut Thru Tests """ |
| 319 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 320 | @classmethod |
| 321 | def setUpClass(cls): |
| 322 | super(VCLCutThruTestCase, cls).setUpClass() |
| 323 | |
| 324 | @classmethod |
| 325 | def tearDownClass(cls): |
| 326 | super(VCLCutThruTestCase, cls).tearDownClass() |
| 327 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 328 | def setUp(self): |
| 329 | super(VCLCutThruTestCase, self).setUp() |
| 330 | |
| 331 | self.cut_thru_setup() |
| 332 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 333 | self.server_addr, self.server_port] |
| 334 | |
| 335 | self.client_uni_dir_nsock_timeout = 20 |
| 336 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 337 | "-I", "2", |
| 338 | self.server_addr, |
| 339 | self.server_port] |
| 340 | self.client_bi_dir_nsock_timeout = 20 |
| 341 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 342 | "-I", "2", |
| 343 | self.server_addr, |
| 344 | self.server_port] |
| 345 | |
| 346 | def tearDown(self): |
| 347 | self.cut_thru_tear_down() |
| 348 | |
| 349 | super(VCLCutThruTestCase, self).tearDown() |
| 350 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 351 | def test_vcl_cut_thru_echo(self): |
| 352 | """ run VCL cut thru echo test """ |
| 353 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 354 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 355 | "vcl_test_client", self.client_echo_test_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 356 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 357 | def test_vcl_cut_thru_uni_dir_nsock(self): |
| 358 | """ run VCL cut thru uni-directional (multiple sockets) test """ |
| 359 | |
| 360 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 361 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 362 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 363 | self.client_uni_dir_nsock_test_args) |
| 364 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 365 | def test_vcl_cut_thru_bi_dir_nsock(self): |
| 366 | """ run VCL cut thru bi-directional (multiple sockets) test """ |
| 367 | |
| 368 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 369 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 370 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 371 | self.client_bi_dir_nsock_test_args) |
| 372 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 373 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 374 | class LDPThruHostStackEcho(VCLTestCase): |
| 375 | """ LDP Thru Host Stack Echo """ |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 376 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 377 | @classmethod |
| 378 | def setUpClass(cls): |
| 379 | super(LDPThruHostStackEcho, cls).setUpClass() |
| 380 | |
| 381 | @classmethod |
| 382 | def tearDownClass(cls): |
| 383 | super(LDPThruHostStackEcho, cls).tearDownClass() |
| 384 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 385 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 386 | super(LDPThruHostStackEcho, self).setUp() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 387 | |
| 388 | self.thru_host_stack_setup() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 389 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 390 | self.loop0.local_ip4, |
| 391 | self.server_port] |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 392 | |
| 393 | def tearDown(self): |
| 394 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 395 | super(LDPThruHostStackEcho, self).tearDown() |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 396 | |
| 397 | def test_ldp_thru_host_stack_echo(self): |
| 398 | """ run LDP thru host stack echo test """ |
| 399 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 400 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 401 | "sock_test_client", |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 402 | self.client_echo_test_args) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 403 | |
| 404 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 405 | class VCLThruHostStackEcho(VCLTestCase): |
| 406 | """ VCL Thru Host Stack Echo """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 407 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 408 | @classmethod |
| 409 | def setUpClass(cls): |
| 410 | super(VCLThruHostStackEcho, cls).setUpClass() |
| 411 | |
| 412 | @classmethod |
| 413 | def tearDownClass(cls): |
| 414 | super(VCLThruHostStackEcho, cls).tearDownClass() |
| 415 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 416 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 417 | super(VCLThruHostStackEcho, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 418 | |
| 419 | self.thru_host_stack_setup() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 420 | self.client_bi_dir_nsock_timeout = 20 |
| 421 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 422 | "-I", "2", |
| 423 | self.loop0.local_ip4, |
| 424 | self.server_port] |
| 425 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 426 | self.loop0.local_ip4, |
| 427 | self.server_port] |
| 428 | |
| 429 | def tearDown(self): |
| 430 | self.logger.debug(self.vapi.cli("show app server")) |
| 431 | self.logger.debug(self.vapi.cli("show session verbose")) |
| 432 | self.thru_host_stack_tear_down() |
| 433 | super(VCLThruHostStackEcho, self).tearDown() |
| 434 | |
| 435 | |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 436 | class VCLThruHostStackTLS(VCLTestCase): |
| 437 | """ VCL Thru Host Stack TLS """ |
| 438 | |
| 439 | @classmethod |
| 440 | def setUpClass(cls): |
| 441 | super(VCLThruHostStackTLS, cls).setUpClass() |
| 442 | |
| 443 | @classmethod |
| 444 | def tearDownClass(cls): |
| 445 | super(VCLThruHostStackTLS, cls).tearDownClass() |
| 446 | |
| 447 | def setUp(self): |
| 448 | super(VCLThruHostStackTLS, self).setUp() |
| 449 | |
| 450 | self.thru_host_stack_setup() |
| 451 | self.client_uni_dir_tls_timeout = 20 |
| 452 | self.server_tls_args = ["-S", self.server_port] |
| 453 | self.client_uni_dir_tls_test_args = ["-N", "1000", "-U", "-X", "-S", |
| 454 | self.loop0.local_ip4, |
| 455 | self.server_port] |
| 456 | |
| 457 | def test_vcl_thru_host_stack_tls_uni_dir(self): |
| 458 | """ run VCL thru host stack uni-directional TLS test """ |
| 459 | |
| 460 | self.timeout = self.client_uni_dir_tls_timeout |
| 461 | self.thru_host_stack_test("vcl_test_server", self.server_tls_args, |
| 462 | "vcl_test_client", |
| 463 | self.client_uni_dir_tls_test_args) |
| 464 | |
| 465 | def tearDown(self): |
| 466 | self.logger.debug(self.vapi.cli("show app server")) |
Florin Coras | 51a423d | 2019-02-19 20:57:06 -0800 | [diff] [blame] | 467 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Florin Coras | 8a14061 | 2019-02-18 22:39:39 -0800 | [diff] [blame] | 468 | self.thru_host_stack_tear_down() |
| 469 | super(VCLThruHostStackTLS, self).tearDown() |
| 470 | |
| 471 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 472 | class VCLThruHostStackBidirNsock(VCLTestCase): |
| 473 | """ VCL Thru Host Stack Bidir Nsock """ |
| 474 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 475 | @classmethod |
| 476 | def setUpClass(cls): |
| 477 | super(VCLThruHostStackBidirNsock, cls).setUpClass() |
| 478 | |
| 479 | @classmethod |
| 480 | def tearDownClass(cls): |
| 481 | super(VCLThruHostStackBidirNsock, cls).tearDownClass() |
| 482 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 483 | def setUp(self): |
| 484 | super(VCLThruHostStackBidirNsock, self).setUp() |
| 485 | |
| 486 | self.thru_host_stack_setup() |
| 487 | self.client_bi_dir_nsock_timeout = 20 |
| 488 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 489 | "-I", "2", |
| 490 | self.loop0.local_ip4, |
| 491 | self.server_port] |
| 492 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 493 | self.loop0.local_ip4, |
| 494 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 495 | |
| 496 | def tearDown(self): |
| 497 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 498 | super(VCLThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 499 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 500 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 501 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 502 | |
| 503 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 504 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 505 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 506 | self.client_bi_dir_nsock_test_args) |
| 507 | |
| 508 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 509 | class LDPThruHostStackBidirNsock(VCLTestCase): |
| 510 | """ LDP Thru Host Stack Bidir Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 511 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 512 | @classmethod |
| 513 | def setUpClass(cls): |
| 514 | super(LDPThruHostStackBidirNsock, cls).setUpClass() |
| 515 | |
| 516 | @classmethod |
| 517 | def tearDownClass(cls): |
| 518 | super(LDPThruHostStackBidirNsock, cls).tearDownClass() |
| 519 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 520 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 521 | super(LDPThruHostStackBidirNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 522 | |
| 523 | self.thru_host_stack_setup() |
| 524 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 525 | self.client_bi_dir_nsock_timeout = 20 |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 526 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 527 | # OUCH! Host Stack Bug? |
| 528 | # "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 529 | self.loop0.local_ip4, |
| 530 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 531 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 532 | self.client_bi_dir_nsock_timeout = 20 |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 533 | self.client_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 534 | # OUCH! Host Stack Bug? |
| 535 | # "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 536 | self.loop0.local_ip4, |
| 537 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 538 | |
| 539 | def tearDown(self): |
| 540 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 541 | super(LDPThruHostStackBidirNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 542 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 543 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 544 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 545 | |
| 546 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 547 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 548 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 549 | self.client_bi_dir_nsock_test_args) |
| 550 | |
| 551 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 552 | class LDPThruHostStackNsock(VCLTestCase): |
| 553 | """ LDP Thru Host Stack Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 554 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 555 | @classmethod |
| 556 | def setUpClass(cls): |
| 557 | super(LDPThruHostStackNsock, cls).setUpClass() |
| 558 | |
| 559 | @classmethod |
| 560 | def tearDownClass(cls): |
| 561 | super(LDPThruHostStackNsock, cls).tearDownClass() |
| 562 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 563 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 564 | super(LDPThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 565 | |
| 566 | self.thru_host_stack_setup() |
| 567 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 568 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 569 | self.numSockets = "2" |
| 570 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 571 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 572 | self.numSockets = "5" |
| 573 | |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 574 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 575 | "-I", self.numSockets, |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 576 | self.loop0.local_ip4, |
| 577 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 578 | |
| 579 | def tearDown(self): |
| 580 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 581 | super(LDPThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 582 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 583 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
| 584 | """ run LDP thru host stack uni-directional (multiple sockets) test """ |
| 585 | |
| 586 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 587 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 588 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 589 | self.client_uni_dir_nsock_test_args) |
| 590 | |
| 591 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 592 | class VCLThruHostStackNsock(VCLTestCase): |
| 593 | """ VCL Thru Host Stack Nsock """ |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 594 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 595 | @classmethod |
| 596 | def setUpClass(cls): |
| 597 | super(VCLThruHostStackNsock, cls).setUpClass() |
| 598 | |
| 599 | @classmethod |
| 600 | def tearDownClass(cls): |
| 601 | super(VCLThruHostStackNsock, cls).tearDownClass() |
| 602 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 603 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 604 | super(VCLThruHostStackNsock, self).setUp() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 605 | |
| 606 | self.thru_host_stack_setup() |
| 607 | if self.vppDebug: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 608 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 609 | self.numSockets = "2" |
| 610 | else: |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 611 | self.client_uni_dir_nsock_timeout = 20 |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 612 | self.numSockets = "5" |
| 613 | |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 614 | self.client_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 615 | "-I", self.numSockets, |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 616 | self.loop0.local_ip4, |
| 617 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 618 | |
| 619 | def tearDown(self): |
| 620 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 621 | super(VCLThruHostStackNsock, self).tearDown() |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 622 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 623 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
| 624 | """ run VCL thru host stack uni-directional (multiple sockets) test """ |
| 625 | |
| 626 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 627 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 628 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 629 | self.client_uni_dir_nsock_test_args) |
| 630 | |
| 631 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 632 | class LDPThruHostStackIperf(VCLTestCase): |
| 633 | """ LDP Thru Host Stack Iperf """ |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 634 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 635 | @classmethod |
| 636 | def setUpClass(cls): |
| 637 | super(LDPThruHostStackIperf, cls).setUpClass() |
| 638 | |
| 639 | @classmethod |
| 640 | def tearDownClass(cls): |
| 641 | super(LDPThruHostStackIperf, cls).tearDownClass() |
| 642 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 643 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 644 | super(LDPThruHostStackIperf, self).setUp() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 645 | |
| 646 | self.thru_host_stack_setup() |
| 647 | self.client_iperf3_timeout = 20 |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 648 | self.client_iperf3_args = ["-V4d", "-t 2", "-c", self.loop0.local_ip4] |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 649 | self.server_iperf3_args = ["-V4d", "-s"] |
| 650 | |
| 651 | def tearDown(self): |
Florin Coras | 51a423d | 2019-02-19 20:57:06 -0800 | [diff] [blame] | 652 | self.logger.debug(self.vapi.cli("show session verbose 2")) |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 653 | self.thru_host_stack_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 654 | super(LDPThruHostStackIperf, self).tearDown() |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 655 | |
| 656 | def test_ldp_thru_host_stack_iperf3(self): |
| 657 | """ run LDP thru host stack iperf3 test """ |
| 658 | |
| 659 | try: |
| 660 | subprocess.check_output(['iperf3', '-v']) |
Paul Vinciguerra | 61e63bf | 2018-11-24 21:19:38 -0800 | [diff] [blame] | 661 | except subprocess.CalledProcessError: |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 662 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 663 | self.logger.error( |
| 664 | " 'test_ldp_thru_host_stack_iperf3' not run!") |
| 665 | return |
Paul Vinciguerra | 38a4ec7 | 2018-11-28 11:34:21 -0800 | [diff] [blame] | 666 | except OSError as e: |
| 667 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 668 | self.logger.error(" 'test' not run!") |
| 669 | return |
| 670 | except Exception as e: |
| 671 | self.logger.error("WARNING: 'iperf3' unexpected error,") |
| 672 | self.logger.error(" 'test' not run!") |
| 673 | return |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 674 | |
| 675 | self.timeout = self.client_iperf3_timeout |
| 676 | self.thru_host_stack_test("iperf3", self.server_iperf3_args, |
| 677 | "iperf3", self.client_iperf3_args) |
| 678 | |
| 679 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 680 | class LDPIpv6CutThruTestCase(VCLTestCase): |
| 681 | """ LDP IPv6 Cut Thru Tests """ |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 682 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 683 | @classmethod |
| 684 | def setUpClass(cls): |
| 685 | super(LDPIpv6CutThruTestCase, cls).setUpClass() |
| 686 | |
| 687 | @classmethod |
| 688 | def tearDownClass(cls): |
| 689 | super(LDPIpv6CutThruTestCase, cls).tearDownClass() |
| 690 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 691 | def setUp(self): |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 692 | super(LDPIpv6CutThruTestCase, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 693 | |
| 694 | self.cut_thru_setup() |
| 695 | self.client_iperf3_timeout = 20 |
Florin Coras | 2eb42e7 | 2018-11-29 00:39:53 -0800 | [diff] [blame] | 696 | self.client_uni_dir_nsock_timeout = 20 |
| 697 | self.client_bi_dir_nsock_timeout = 20 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 698 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 699 | self.server_ipv6_addr, |
| 700 | self.server_port] |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 701 | self.client_ipv6_iperf3_args = ["-V6d", "-t 2", "-c", |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 702 | self.server_ipv6_addr] |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 703 | self.server_ipv6_iperf3_args = ["-V6d", "-s"] |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 704 | self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 705 | "-6", |
| 706 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 707 | self.server_ipv6_addr, |
| 708 | self.server_port] |
Dave Wallace | 45cd3a3 | 2018-06-26 01:14:04 -0400 | [diff] [blame] | 709 | self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 710 | "-6", |
| 711 | "-I", "2", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 712 | self.server_ipv6_addr, |
| 713 | self.server_port] |
| 714 | |
| 715 | def tearDown(self): |
| 716 | self.cut_thru_tear_down() |
| 717 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 718 | super(LDPIpv6CutThruTestCase, self).tearDown() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 719 | |
| 720 | def test_ldp_ipv6_cut_thru_echo(self): |
| 721 | """ run LDP IPv6 cut thru echo test """ |
| 722 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 723 | self.cut_thru_test("sock_test_server", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 724 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 725 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 726 | self.client_ipv6_echo_test_args) |
| 727 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 728 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 729 | def test_ldp_ipv6_cut_thru_iperf3(self): |
| 730 | """ run LDP IPv6 cut thru iperf3 test """ |
| 731 | |
| 732 | try: |
| 733 | subprocess.check_output(['iperf3', '-v']) |
| 734 | except: |
| 735 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 736 | self.logger.error( |
| 737 | " 'test_ldp_ipv6_cut_thru_iperf3' not run!") |
| 738 | return |
| 739 | |
| 740 | self.timeout = self.client_iperf3_timeout |
| 741 | self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args, |
| 742 | "iperf3", self.client_ipv6_iperf3_args) |
| 743 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 744 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 745 | def test_ldp_ipv6_cut_thru_uni_dir_nsock(self): |
| 746 | """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """ |
| 747 | |
| 748 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 749 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 750 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 751 | self.client_ipv6_uni_dir_nsock_test_args) |
| 752 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 753 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 754 | def test_ldp_ipv6_cut_thru_bi_dir_nsock(self): |
| 755 | """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """ |
| 756 | |
| 757 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 758 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 759 | "sock_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 760 | self.client_ipv6_bi_dir_nsock_test_args) |
| 761 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 762 | |
| 763 | class VCLIpv6CutThruTestCase(VCLTestCase): |
| 764 | """ VCL IPv6 Cut Thru Tests """ |
| 765 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 766 | @classmethod |
| 767 | def setUpClass(cls): |
| 768 | super(VCLIpv6CutThruTestCase, cls).setUpClass() |
| 769 | |
| 770 | @classmethod |
| 771 | def tearDownClass(cls): |
| 772 | super(VCLIpv6CutThruTestCase, cls).tearDownClass() |
| 773 | |
Florin Coras | 0ae445e | 2018-11-29 18:22:10 -0800 | [diff] [blame] | 774 | def setUp(self): |
| 775 | super(VCLIpv6CutThruTestCase, self).setUp() |
| 776 | |
| 777 | self.cut_thru_setup() |
| 778 | self.client_uni_dir_nsock_timeout = 20 |
| 779 | self.client_bi_dir_nsock_timeout = 20 |
| 780 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 781 | self.server_ipv6_addr, |
| 782 | self.server_port] |
| 783 | self.client_ipv6_uni_dir_nsock_test_args = ["-N", "1000", "-U", "-X", |
| 784 | "-6", |
| 785 | "-I", "2", |
| 786 | self.server_ipv6_addr, |
| 787 | self.server_port] |
| 788 | self.client_ipv6_bi_dir_nsock_test_args = ["-N", "1000", "-B", "-X", |
| 789 | "-6", |
| 790 | "-I", "2", |
| 791 | self.server_ipv6_addr, |
| 792 | self.server_port] |
| 793 | |
| 794 | def tearDown(self): |
| 795 | self.cut_thru_tear_down() |
| 796 | |
| 797 | super(VCLIpv6CutThruTestCase, self).tearDown() |
| 798 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 799 | def test_vcl_ipv6_cut_thru_echo(self): |
| 800 | """ run VCL IPv6 cut thru echo test """ |
| 801 | |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 802 | self.cut_thru_test("vcl_test_server", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 803 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 804 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 805 | self.client_ipv6_echo_test_args) |
| 806 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 807 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 808 | def test_vcl_ipv6_cut_thru_uni_dir_nsock(self): |
| 809 | """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """ |
| 810 | |
| 811 | self.timeout = self.client_uni_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 812 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 813 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 814 | self.client_ipv6_uni_dir_nsock_test_args) |
| 815 | |
Paul Vinciguerra | defde0f | 2018-12-06 07:46:13 -0800 | [diff] [blame] | 816 | @unittest.skipUnless(running_extended_tests, "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 817 | def test_vcl_ipv6_cut_thru_bi_dir_nsock(self): |
| 818 | """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """ |
| 819 | |
| 820 | self.timeout = self.client_bi_dir_nsock_timeout |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 821 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 822 | "vcl_test_client", |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 823 | self.client_ipv6_bi_dir_nsock_test_args) |
| 824 | |
| 825 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 826 | class VCLIpv6ThruHostStackEcho(VCLTestCase): |
| 827 | """ VCL IPv6 Thru Host Stack Echo """ |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 828 | |
Paul Vinciguerra | 8d991d9 | 2019-01-25 14:05:48 -0800 | [diff] [blame] | 829 | @classmethod |
| 830 | def setUpClass(cls): |
| 831 | super(VCLIpv6ThruHostStackEcho, cls).setUpClass() |
| 832 | |
| 833 | @classmethod |
| 834 | def tearDownClass(cls): |
| 835 | super(VCLIpv6ThruHostStackEcho, cls).tearDownClass() |
| 836 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 837 | def setUp(self): |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 838 | super(VCLIpv6ThruHostStackEcho, self).setUp() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 839 | |
| 840 | self.thru_host_stack_ipv6_setup() |
| 841 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 842 | self.loop0.local_ip6, |
| 843 | self.server_port] |
| 844 | |
| 845 | def tearDown(self): |
| 846 | self.thru_host_stack_ipv6_tear_down() |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 847 | super(VCLIpv6ThruHostStackEcho, self).tearDown() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 848 | |
| 849 | def test_vcl_ipv6_thru_host_stack_echo(self): |
| 850 | """ run VCL IPv6 thru host stack echo test """ |
| 851 | |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 852 | self.thru_host_stack_test("vcl_test_server", |
Damjan Marion | 855e268 | 2018-08-24 13:37:45 +0200 | [diff] [blame] | 853 | self.server_ipv6_args, |
Florin Coras | ab2f6db | 2018-08-31 14:31:41 -0700 | [diff] [blame] | 854 | "vcl_test_client", |
Florin Coras | dc2e251 | 2018-12-03 17:47:26 -0800 | [diff] [blame] | 855 | self.client_ipv6_echo_test_args) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 856 | |
| 857 | |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 858 | if __name__ == '__main__': |
| 859 | unittest.main(testRunner=VppTestRunner) |