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