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