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