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={}): |
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 | |
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) |
| 120 | self.create_loopback_interfaces(range(2)) |
| 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) |
| 185 | except Exception, error: |
| 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 |
| 225 | self.client_iperf3_args = ["-V4d", "-c", self.server_addr] |
| 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 | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 228 | self.client_uni_dir_nsock_test_args = ["-I", "5", "-U", "-X", |
| 229 | self.server_addr, |
| 230 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 231 | self.client_bi_dir_nsock_timeout = 120 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 232 | self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X", |
| 233 | self.server_addr, |
| 234 | self.server_port] |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 235 | |
| 236 | def tearDown(self): |
| 237 | self.cut_thru_tear_down() |
| 238 | |
| 239 | super(VCLCutThruTestCase, self).tearDown() |
| 240 | |
| 241 | def test_ldp_cut_thru_echo(self): |
| 242 | """ run LDP cut thru echo test """ |
| 243 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 244 | self.cut_thru_test("sock_test_server", self.server_args, |
| 245 | "sock_test_client", self.client_echo_test_args) |
| 246 | |
| 247 | def test_ldp_cut_thru_iperf3(self): |
| 248 | """ run LDP cut thru iperf3 test """ |
| 249 | |
| 250 | try: |
| 251 | subprocess.check_output(['iperf3', '-v']) |
| 252 | except: |
| 253 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 254 | self.logger.error(" 'test_ldp_cut_thru_iperf3' not run!") |
| 255 | return |
| 256 | |
| 257 | self.timeout = self.client_iperf3_timeout |
| 258 | self.cut_thru_test("iperf3", self.server_iperf3_args, |
| 259 | "iperf3", self.client_iperf3_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 260 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 261 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 262 | def test_ldp_cut_thru_uni_dir_nsock(self): |
| 263 | """ run LDP cut thru uni-directional (multiple sockets) test """ |
| 264 | |
| 265 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 266 | self.cut_thru_test("sock_test_server", self.server_args, |
| 267 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 268 | self.client_uni_dir_nsock_test_args) |
| 269 | |
| 270 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 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 |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [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 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [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 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 286 | def test_vcl_cut_thru_uni_dir_nsock(self): |
| 287 | """ run VCL cut thru uni-directional (multiple sockets) test """ |
| 288 | |
| 289 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 290 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 291 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 292 | self.client_uni_dir_nsock_test_args) |
| 293 | |
| 294 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 295 | def test_vcl_cut_thru_bi_dir_nsock(self): |
| 296 | """ run VCL cut thru bi-directional (multiple sockets) test """ |
| 297 | |
| 298 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 299 | self.cut_thru_test("vcl_test_server", self.server_args, |
| 300 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 301 | self.client_bi_dir_nsock_test_args) |
| 302 | |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 303 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 304 | class VCLThruHostStackTestCase(VCLTestCase): |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 305 | """ VCL Thru Host Stack Tests """ |
| 306 | |
| 307 | def setUp(self): |
| 308 | super(VCLThruHostStackTestCase, self).setUp() |
| 309 | |
| 310 | self.thru_host_stack_setup() |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 311 | self.client_echo_test_args = ["-E", self.echo_phrase, "-X", |
| 312 | self.loop0.local_ip4, |
| 313 | self.server_port] |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 314 | |
| 315 | def tearDown(self): |
| 316 | self.thru_host_stack_tear_down() |
| 317 | |
| 318 | super(VCLThruHostStackTestCase, self).tearDown() |
| 319 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 320 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 321 | def test_ldp_thru_host_stack_echo(self): |
| 322 | """ run LDP thru host stack echo test """ |
| 323 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 324 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 325 | "sock_test_client", |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 326 | self.client_echo_test_args) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 327 | # TBD: Remove these when VPP thru host teardown config bug is fixed. |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 328 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 329 | "vcl_test_client", |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 330 | self.client_echo_test_args) |
| 331 | |
| 332 | def test_vcl_thru_host_stack_echo(self): |
| 333 | """ run VCL thru host stack echo test """ |
| 334 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 335 | # TBD: Enable this when VPP thru host teardown config bug is fixed. |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 336 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 337 | "vcl_test_client", |
| 338 | self.client_echo_test_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 339 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 340 | # TBD: Remove VCLThruHostStackExtended*TestCase classes and move |
| 341 | # tests here when VPP thru host teardown/setup config bug |
| 342 | # is fixed. |
| 343 | |
| 344 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 345 | class VCLThruHostStackExtendedATestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 346 | """ VCL Thru Host Stack Extended Tests """ |
| 347 | |
| 348 | def setUp(self): |
| 349 | super(VCLThruHostStackExtendedATestCase, self).setUp() |
| 350 | |
| 351 | self.thru_host_stack_setup() |
| 352 | if self.vppDebug: |
| 353 | self.client_bi_dir_nsock_timeout = 120 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 354 | self.client_bi_dir_nsock_test_args = ["-B", "-X", |
| 355 | self.loop0.local_ip4, |
| 356 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 357 | else: |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 358 | self.client_bi_dir_nsock_timeout = 90 |
| 359 | self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X", |
| 360 | self.loop0.local_ip4, |
| 361 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 362 | |
| 363 | def tearDown(self): |
| 364 | self.thru_host_stack_tear_down() |
| 365 | |
| 366 | super(VCLThruHostStackExtendedATestCase, self).tearDown() |
| 367 | |
| 368 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 369 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 370 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 371 | |
| 372 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 373 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 374 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 375 | self.client_bi_dir_nsock_test_args) |
| 376 | |
| 377 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 378 | class VCLThruHostStackExtendedBTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 379 | """ VCL Thru Host Stack Extended Tests """ |
| 380 | |
| 381 | def setUp(self): |
| 382 | super(VCLThruHostStackExtendedBTestCase, self).setUp() |
| 383 | |
| 384 | self.thru_host_stack_setup() |
| 385 | if self.vppDebug: |
| 386 | self.client_bi_dir_nsock_timeout = 120 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 387 | self.client_bi_dir_nsock_test_args = ["-B", "-X", |
| 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 | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 392 | self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X", |
| 393 | self.loop0.local_ip4, |
| 394 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 395 | |
| 396 | def tearDown(self): |
| 397 | self.thru_host_stack_tear_down() |
| 398 | |
| 399 | super(VCLThruHostStackExtendedBTestCase, self).tearDown() |
| 400 | |
| 401 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 402 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 403 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 404 | |
| 405 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 406 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 407 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 408 | self.client_bi_dir_nsock_test_args) |
| 409 | |
| 410 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 411 | class VCLThruHostStackExtendedCTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 412 | """ VCL Thru Host Stack Extended Tests """ |
| 413 | |
| 414 | def setUp(self): |
| 415 | super(VCLThruHostStackExtendedCTestCase, self).setUp() |
| 416 | |
| 417 | self.thru_host_stack_setup() |
| 418 | if self.vppDebug: |
| 419 | self.client_uni_dir_nsock_timeout = 120 |
| 420 | self.numSockets = "2" |
| 421 | else: |
| 422 | self.client_uni_dir_nsock_timeout = 120 |
| 423 | self.numSockets = "5" |
| 424 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 425 | self.client_uni_dir_nsock_test_args = ["-I", self.numSockets, |
| 426 | "-U", "-X", |
| 427 | self.loop0.local_ip4, |
| 428 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 429 | |
| 430 | def tearDown(self): |
| 431 | self.thru_host_stack_tear_down() |
| 432 | |
| 433 | super(VCLThruHostStackExtendedCTestCase, self).tearDown() |
| 434 | |
| 435 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 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 | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 445 | class VCLThruHostStackExtendedDTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 446 | """ VCL Thru Host Stack Extended Tests """ |
| 447 | |
| 448 | def setUp(self): |
| 449 | super(VCLThruHostStackExtendedDTestCase, self).setUp() |
| 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 | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 459 | self.client_uni_dir_nsock_test_args = ["-I", self.numSockets, |
| 460 | "-U", "-X", |
| 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 | |
| 467 | super(VCLThruHostStackExtendedDTestCase, self).tearDown() |
| 468 | |
| 469 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 470 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
| 471 | """ run VCL thru host stack uni-directional (multiple sockets) test """ |
| 472 | |
| 473 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 474 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 475 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 476 | self.client_uni_dir_nsock_test_args) |
| 477 | |
| 478 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 479 | class VCLThruHostStackIperfTestCase(VCLTestCase): |
| 480 | """ VCL Thru Host Stack Iperf Tests """ |
| 481 | |
| 482 | def setUp(self): |
| 483 | super(VCLThruHostStackIperfTestCase, self).setUp() |
| 484 | |
| 485 | self.thru_host_stack_setup() |
| 486 | self.client_iperf3_timeout = 20 |
| 487 | self.client_iperf3_args = ["-V4d", "-c", self.loop0.local_ip4] |
| 488 | self.server_iperf3_args = ["-V4d", "-s"] |
| 489 | |
| 490 | def tearDown(self): |
| 491 | self.thru_host_stack_tear_down() |
| 492 | |
| 493 | super(VCLThruHostStackIperfTestCase, self).tearDown() |
| 494 | |
| 495 | def test_ldp_thru_host_stack_iperf3(self): |
| 496 | """ run LDP thru host stack iperf3 test """ |
| 497 | |
| 498 | try: |
| 499 | subprocess.check_output(['iperf3', '-v']) |
| 500 | except: |
| 501 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 502 | self.logger.error( |
| 503 | " 'test_ldp_thru_host_stack_iperf3' not run!") |
| 504 | return |
| 505 | |
| 506 | self.timeout = self.client_iperf3_timeout |
| 507 | self.thru_host_stack_test("iperf3", self.server_iperf3_args, |
| 508 | "iperf3", self.client_iperf3_args) |
| 509 | |
| 510 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 511 | class VCLIpv6CutThruTestCase(VCLTestCase): |
| 512 | """ VCL IPv6 Cut Thru Tests """ |
| 513 | |
| 514 | def setUp(self): |
| 515 | super(VCLIpv6CutThruTestCase, self).setUp() |
| 516 | |
| 517 | self.cut_thru_setup() |
| 518 | self.client_iperf3_timeout = 20 |
| 519 | self.client_uni_dir_nsock_timeout = 60 |
| 520 | self.client_bi_dir_nsock_timeout = 120 |
| 521 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 522 | self.server_ipv6_addr, |
| 523 | self.server_port] |
| 524 | self.client_ipv6_iperf3_args = ["-V6d", "-c", self.server_ipv6_addr] |
| 525 | self.server_ipv6_iperf3_args = ["-V6d", "-s"] |
| 526 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", "-I", "5", |
| 527 | "-U", "-X", |
| 528 | self.server_ipv6_addr, |
| 529 | self.server_port] |
| 530 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2", |
| 531 | "-B", "-X", |
| 532 | self.server_ipv6_addr, |
| 533 | self.server_port] |
| 534 | |
| 535 | def tearDown(self): |
| 536 | self.cut_thru_tear_down() |
| 537 | |
| 538 | super(VCLIpv6CutThruTestCase, self).tearDown() |
| 539 | |
| 540 | def test_ldp_ipv6_cut_thru_echo(self): |
| 541 | """ run LDP IPv6 cut thru echo test """ |
| 542 | |
| 543 | self.cut_thru_test("sock_test_server", |
| 544 | self.server_ipv6_args, |
| 545 | "sock_test_client", |
| 546 | self.client_ipv6_echo_test_args) |
| 547 | |
| 548 | def test_ldp_ipv6_cut_thru_iperf3(self): |
| 549 | """ run LDP IPv6 cut thru iperf3 test """ |
| 550 | |
| 551 | try: |
| 552 | subprocess.check_output(['iperf3', '-v']) |
| 553 | except: |
| 554 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 555 | self.logger.error( |
| 556 | " 'test_ldp_ipv6_cut_thru_iperf3' not run!") |
| 557 | return |
| 558 | |
| 559 | self.timeout = self.client_iperf3_timeout |
| 560 | self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args, |
| 561 | "iperf3", self.client_ipv6_iperf3_args) |
| 562 | |
| 563 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 564 | def test_ldp_ipv6_cut_thru_uni_dir_nsock(self): |
| 565 | """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """ |
| 566 | |
| 567 | self.timeout = self.client_uni_dir_nsock_timeout |
| 568 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 569 | "sock_test_client", |
| 570 | self.client_ipv6_uni_dir_nsock_test_args) |
| 571 | |
| 572 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 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 |
| 577 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 578 | "sock_test_client", |
| 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 | |
| 584 | self.cut_thru_test("vcl_test_server", |
| 585 | self.server_ipv6_args, |
| 586 | "vcl_test_client", |
| 587 | self.client_ipv6_echo_test_args) |
| 588 | |
| 589 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 590 | def test_vcl_ipv6_cut_thru_uni_dir_nsock(self): |
| 591 | """ run VCL IPv6 cut thru uni-directional (multiple sockets) test """ |
| 592 | |
| 593 | self.timeout = self.client_uni_dir_nsock_timeout |
| 594 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 595 | "vcl_test_client", |
| 596 | self.client_ipv6_uni_dir_nsock_test_args) |
| 597 | |
| 598 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 599 | def test_vcl_ipv6_cut_thru_bi_dir_nsock(self): |
| 600 | """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """ |
| 601 | |
| 602 | self.timeout = self.client_bi_dir_nsock_timeout |
| 603 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 604 | "vcl_test_client", |
| 605 | self.client_ipv6_bi_dir_nsock_test_args) |
| 606 | |
| 607 | |
| 608 | class VCLIpv6ThruHostStackTestCase(VCLTestCase): |
| 609 | """ VCL IPv6 Thru Host Stack Tests """ |
| 610 | |
| 611 | def setUp(self): |
| 612 | super(VCLIpv6ThruHostStackTestCase, self).setUp() |
| 613 | |
| 614 | self.thru_host_stack_ipv6_setup() |
| 615 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 616 | self.loop0.local_ip6, |
| 617 | self.server_port] |
| 618 | |
| 619 | def tearDown(self): |
| 620 | self.thru_host_stack_ipv6_tear_down() |
| 621 | |
| 622 | super(VCLIpv6ThruHostStackTestCase, self).tearDown() |
| 623 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 624 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 625 | def test_ldp_ipv6_thru_host_stack_echo(self): |
| 626 | """ run LDP IPv6 thru host stack echo test """ |
| 627 | |
| 628 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 629 | "sock_test_client", |
| 630 | self.client_ipv6_echo_test_args) |
| 631 | # TBD: Remove these when VPP thru host teardown config bug is fixed. |
| 632 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 633 | "vcl_test_client", |
| 634 | self.client_ipv6_echo_test_args) |
| 635 | |
| 636 | def test_vcl_ipv6_thru_host_stack_echo(self): |
| 637 | """ run VCL IPv6 thru host stack echo test """ |
| 638 | |
Florin Coras | f3a3bad | 2018-03-28 02:18:29 -0700 | [diff] [blame] | 639 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 640 | "vcl_test_client", |
| 641 | self.client_ipv6_echo_test_args) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 642 | |
| 643 | # TBD: Remove VCLIpv6ThruHostStackExtended*TestCase classes and move |
| 644 | # tests here when VPP thru host teardown/setup config bug |
| 645 | # is fixed. |
| 646 | |
| 647 | |
| 648 | class VCLIpv6ThruHostStackExtendedATestCase(VCLTestCase): |
| 649 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 650 | |
| 651 | def setUp(self): |
| 652 | super(VCLIpv6ThruHostStackExtendedATestCase, self).setUp() |
| 653 | |
| 654 | self.thru_host_stack_ipv6_setup() |
| 655 | if self.vppDebug: |
| 656 | self.client_bi_dir_nsock_timeout = 120 |
| 657 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X", |
| 658 | self.loop0.local_ip6, |
| 659 | self.server_port] |
| 660 | else: |
| 661 | self.client_bi_dir_nsock_timeout = 90 |
| 662 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", |
| 663 | "2", "-B", "-X", |
| 664 | self.loop0.local_ip6, |
| 665 | self.server_port] |
| 666 | |
| 667 | def tearDown(self): |
| 668 | self.thru_host_stack_ipv6_tear_down() |
| 669 | |
| 670 | super(VCLIpv6ThruHostStackExtendedATestCase, self).tearDown() |
| 671 | |
| 672 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 673 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 674 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 675 | |
| 676 | self.timeout = self.client_bi_dir_nsock_timeout |
| 677 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 678 | "vcl_test_client", |
| 679 | self.client_ipv6_bi_dir_nsock_test_args) |
| 680 | |
| 681 | |
| 682 | class VCLIpv6ThruHostStackExtendedBTestCase(VCLTestCase): |
| 683 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 684 | |
| 685 | def setUp(self): |
| 686 | super(VCLIpv6ThruHostStackExtendedBTestCase, self).setUp() |
| 687 | |
| 688 | self.thru_host_stack_ipv6_setup() |
| 689 | if self.vppDebug: |
| 690 | self.client_bi_dir_nsock_timeout = 120 |
| 691 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X", |
| 692 | self.loop0.local_ip6, |
| 693 | self.server_port] |
| 694 | else: |
| 695 | self.client_bi_dir_nsock_timeout = 60 |
| 696 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2", |
| 697 | "-B", "-X", |
| 698 | self.loop0.local_ip6, |
| 699 | self.server_port] |
| 700 | |
| 701 | def tearDown(self): |
| 702 | self.thru_host_stack_ipv6_tear_down() |
| 703 | |
| 704 | super(VCLIpv6ThruHostStackExtendedBTestCase, self).tearDown() |
| 705 | |
| 706 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 707 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 708 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 709 | |
| 710 | self.timeout = self.client_bi_dir_nsock_timeout |
| 711 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 712 | "sock_test_client", |
| 713 | self.client_ipv6_bi_dir_nsock_test_args) |
| 714 | |
| 715 | |
| 716 | class VCLIpv6ThruHostStackExtendedCTestCase(VCLTestCase): |
| 717 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 718 | |
| 719 | def setUp(self): |
| 720 | super(VCLIpv6ThruHostStackExtendedCTestCase, self).setUp() |
| 721 | |
| 722 | self.thru_host_stack_ipv6_setup() |
| 723 | if self.vppDebug: |
| 724 | self.client_uni_dir_nsock_timeout = 120 |
| 725 | self.numSockets = "2" |
| 726 | else: |
| 727 | self.client_uni_dir_nsock_timeout = 120 |
| 728 | self.numSockets = "5" |
| 729 | |
| 730 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", |
| 731 | "-I", self.numSockets, |
| 732 | "-U", "-X", |
| 733 | self.loop0.local_ip6, |
| 734 | self.server_port] |
| 735 | |
| 736 | def tearDown(self): |
| 737 | self.thru_host_stack_ipv6_tear_down() |
| 738 | |
| 739 | super(VCLIpv6ThruHostStackExtendedCTestCase, self).tearDown() |
| 740 | |
| 741 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 742 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
| 743 | """ run LDP thru host stack uni-directional (multiple sockets) test """ |
| 744 | |
| 745 | self.timeout = self.client_uni_dir_nsock_timeout |
| 746 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 747 | "sock_test_client", |
| 748 | self.client_ipv6_uni_dir_nsock_test_args) |
| 749 | |
| 750 | |
| 751 | class VCLIpv6ThruHostStackExtendedDTestCase(VCLTestCase): |
| 752 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 753 | |
| 754 | def setUp(self): |
| 755 | super(VCLIpv6ThruHostStackExtendedDTestCase, self).setUp() |
| 756 | |
| 757 | self.thru_host_stack_ipv6_setup() |
| 758 | if self.vppDebug: |
| 759 | self.client_uni_dir_nsock_timeout = 120 |
| 760 | self.numSockets = "2" |
| 761 | else: |
| 762 | self.client_uni_dir_nsock_timeout = 120 |
| 763 | self.numSockets = "5" |
| 764 | |
| 765 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", |
| 766 | "-I", self.numSockets, |
| 767 | "-U", "-X", |
| 768 | self.loop0.local_ip6, |
| 769 | self.server_port] |
| 770 | |
| 771 | def tearDown(self): |
| 772 | self.thru_host_stack_ipv6_tear_down() |
| 773 | |
| 774 | super(VCLIpv6ThruHostStackExtendedDTestCase, self).tearDown() |
| 775 | |
| 776 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 777 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
| 778 | """ run VCL thru host stack uni-directional (multiple sockets) test """ |
| 779 | |
| 780 | self.timeout = self.client_uni_dir_nsock_timeout |
| 781 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 782 | "vcl_test_client", |
| 783 | self.client_ipv6_uni_dir_nsock_test_args) |
| 784 | |
| 785 | |
| 786 | class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase): |
| 787 | """ VCL IPv6 Thru Host Stack Iperf Tests """ |
| 788 | |
| 789 | def setUp(self): |
| 790 | super(VCLIpv6ThruHostStackIperfTestCase, self).setUp() |
| 791 | |
| 792 | self.thru_host_stack_ipv6_setup() |
| 793 | self.client_iperf3_timeout = 20 |
| 794 | self.client_ipv6_iperf3_args = ["-V6d", "-c", self.loop0.local_ip6] |
| 795 | self.server_ipv6_iperf3_args = ["-V6d", "-s"] |
| 796 | |
| 797 | def tearDown(self): |
| 798 | self.thru_host_stack_ipv6_tear_down() |
| 799 | |
| 800 | super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown() |
| 801 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 802 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 803 | def test_ldp_thru_host_stack_iperf3(self): |
| 804 | """ run LDP thru host stack iperf3 test """ |
| 805 | |
| 806 | try: |
| 807 | subprocess.check_output(['iperf3', '-v']) |
| 808 | except: |
| 809 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 810 | self.logger.error( |
| 811 | " 'test_ldp_thru_host_stack_iperf3' not run!") |
| 812 | return |
| 813 | |
| 814 | self.timeout = self.client_iperf3_timeout |
| 815 | self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args, |
| 816 | "iperf3", self.client_ipv6_iperf3_args) |
| 817 | |
| 818 | |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 819 | if __name__ == '__main__': |
| 820 | unittest.main(testRunner=VppTestRunner) |