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) |
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 |
| 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 | |
| 320 | def test_ldp_thru_host_stack_echo(self): |
| 321 | """ run LDP thru host stack echo test """ |
| 322 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 323 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 324 | "sock_test_client", |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 325 | self.client_echo_test_args) |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 326 | # TBD: Remove these when VPP thru host teardown config bug is fixed. |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 327 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 328 | "vcl_test_client", |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 329 | self.client_echo_test_args) |
| 330 | |
| 331 | def test_vcl_thru_host_stack_echo(self): |
| 332 | """ run VCL thru host stack echo test """ |
| 333 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 334 | # TBD: Enable this when VPP thru host teardown config bug is fixed. |
Keith Burns (alagalah) | 410bcca | 2018-03-23 13:42:49 -0700 | [diff] [blame] | 335 | # self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 336 | # "vcl_test_client", |
| 337 | # self.client_echo_test_args) |
Dave Wallace | 9f11c01 | 2018-02-28 17:55:23 -0500 | [diff] [blame] | 338 | |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 339 | # TBD: Remove VCLThruHostStackExtended*TestCase classes and move |
| 340 | # tests here when VPP thru host teardown/setup config bug |
| 341 | # is fixed. |
| 342 | |
| 343 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 344 | class VCLThruHostStackExtendedATestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 345 | """ VCL Thru Host Stack Extended Tests """ |
| 346 | |
| 347 | def setUp(self): |
| 348 | super(VCLThruHostStackExtendedATestCase, self).setUp() |
| 349 | |
| 350 | self.thru_host_stack_setup() |
| 351 | if self.vppDebug: |
| 352 | self.client_bi_dir_nsock_timeout = 120 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 353 | self.client_bi_dir_nsock_test_args = ["-B", "-X", |
| 354 | self.loop0.local_ip4, |
| 355 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 356 | else: |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 357 | self.client_bi_dir_nsock_timeout = 90 |
| 358 | self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X", |
| 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 | |
| 365 | super(VCLThruHostStackExtendedATestCase, self).tearDown() |
| 366 | |
| 367 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 368 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 369 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 370 | |
| 371 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 372 | self.thru_host_stack_test("vcl_test_server", self.server_args, |
| 373 | "vcl_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 374 | self.client_bi_dir_nsock_test_args) |
| 375 | |
| 376 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 377 | class VCLThruHostStackExtendedBTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 378 | """ VCL Thru Host Stack Extended Tests """ |
| 379 | |
| 380 | def setUp(self): |
| 381 | super(VCLThruHostStackExtendedBTestCase, self).setUp() |
| 382 | |
| 383 | self.thru_host_stack_setup() |
| 384 | if self.vppDebug: |
| 385 | self.client_bi_dir_nsock_timeout = 120 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 386 | self.client_bi_dir_nsock_test_args = ["-B", "-X", |
| 387 | self.loop0.local_ip4, |
| 388 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 389 | else: |
| 390 | self.client_bi_dir_nsock_timeout = 60 |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 391 | self.client_bi_dir_nsock_test_args = ["-I", "2", "-B", "-X", |
| 392 | self.loop0.local_ip4, |
| 393 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 394 | |
| 395 | def tearDown(self): |
| 396 | self.thru_host_stack_tear_down() |
| 397 | |
| 398 | super(VCLThruHostStackExtendedBTestCase, self).tearDown() |
| 399 | |
| 400 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 401 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 402 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 403 | |
| 404 | self.timeout = self.client_bi_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 405 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 406 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 407 | self.client_bi_dir_nsock_test_args) |
| 408 | |
| 409 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 410 | class VCLThruHostStackExtendedCTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 411 | """ VCL Thru Host Stack Extended Tests """ |
| 412 | |
| 413 | def setUp(self): |
| 414 | super(VCLThruHostStackExtendedCTestCase, self).setUp() |
| 415 | |
| 416 | self.thru_host_stack_setup() |
| 417 | if self.vppDebug: |
| 418 | self.client_uni_dir_nsock_timeout = 120 |
| 419 | self.numSockets = "2" |
| 420 | else: |
| 421 | self.client_uni_dir_nsock_timeout = 120 |
| 422 | self.numSockets = "5" |
| 423 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 424 | self.client_uni_dir_nsock_test_args = ["-I", self.numSockets, |
| 425 | "-U", "-X", |
| 426 | self.loop0.local_ip4, |
| 427 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 428 | |
| 429 | def tearDown(self): |
| 430 | self.thru_host_stack_tear_down() |
| 431 | |
| 432 | super(VCLThruHostStackExtendedCTestCase, self).tearDown() |
| 433 | |
| 434 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 435 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
| 436 | """ run LDP thru host stack uni-directional (multiple sockets) test """ |
| 437 | |
| 438 | self.timeout = self.client_uni_dir_nsock_timeout |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 439 | self.thru_host_stack_test("sock_test_server", self.server_args, |
| 440 | "sock_test_client", |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 441 | self.client_uni_dir_nsock_test_args) |
| 442 | |
| 443 | |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [diff] [blame] | 444 | class VCLThruHostStackExtendedDTestCase(VCLTestCase): |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 445 | """ VCL Thru Host Stack Extended Tests """ |
| 446 | |
| 447 | def setUp(self): |
| 448 | super(VCLThruHostStackExtendedDTestCase, self).setUp() |
| 449 | |
| 450 | self.thru_host_stack_setup() |
| 451 | if self.vppDebug: |
| 452 | self.client_uni_dir_nsock_timeout = 120 |
| 453 | self.numSockets = "2" |
| 454 | else: |
| 455 | self.client_uni_dir_nsock_timeout = 120 |
| 456 | self.numSockets = "5" |
| 457 | |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 458 | self.client_uni_dir_nsock_test_args = ["-I", self.numSockets, |
| 459 | "-U", "-X", |
| 460 | self.loop0.local_ip4, |
| 461 | self.server_port] |
Dave Wallace | d85075e | 2018-03-02 13:19:30 -0500 | [diff] [blame] | 462 | |
| 463 | def tearDown(self): |
| 464 | self.thru_host_stack_tear_down() |
| 465 | |
| 466 | super(VCLThruHostStackExtendedDTestCase, self).tearDown() |
| 467 | |
| 468 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 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 |
Dave Wallace | 816833f | 2018-03-14 20:01:28 -0400 | [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 |
| 486 | self.client_iperf3_args = ["-V4d", "-c", self.loop0.local_ip4] |
| 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] |
| 523 | self.client_ipv6_iperf3_args = ["-V6d", "-c", self.server_ipv6_addr] |
| 524 | self.server_ipv6_iperf3_args = ["-V6d", "-s"] |
| 525 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", "-I", "5", |
| 526 | "-U", "-X", |
| 527 | self.server_ipv6_addr, |
| 528 | self.server_port] |
| 529 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2", |
| 530 | "-B", "-X", |
| 531 | self.server_ipv6_addr, |
| 532 | self.server_port] |
| 533 | |
| 534 | def tearDown(self): |
| 535 | self.cut_thru_tear_down() |
| 536 | |
| 537 | super(VCLIpv6CutThruTestCase, self).tearDown() |
| 538 | |
| 539 | def test_ldp_ipv6_cut_thru_echo(self): |
| 540 | """ run LDP IPv6 cut thru echo test """ |
| 541 | |
| 542 | self.cut_thru_test("sock_test_server", |
| 543 | self.server_ipv6_args, |
| 544 | "sock_test_client", |
| 545 | self.client_ipv6_echo_test_args) |
| 546 | |
| 547 | def test_ldp_ipv6_cut_thru_iperf3(self): |
| 548 | """ run LDP IPv6 cut thru iperf3 test """ |
| 549 | |
| 550 | try: |
| 551 | subprocess.check_output(['iperf3', '-v']) |
| 552 | except: |
| 553 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 554 | self.logger.error( |
| 555 | " 'test_ldp_ipv6_cut_thru_iperf3' not run!") |
| 556 | return |
| 557 | |
| 558 | self.timeout = self.client_iperf3_timeout |
| 559 | self.cut_thru_test("iperf3", self.server_ipv6_iperf3_args, |
| 560 | "iperf3", self.client_ipv6_iperf3_args) |
| 561 | |
| 562 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 563 | def test_ldp_ipv6_cut_thru_uni_dir_nsock(self): |
| 564 | """ run LDP IPv6 cut thru uni-directional (multiple sockets) test """ |
| 565 | |
| 566 | self.timeout = self.client_uni_dir_nsock_timeout |
| 567 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 568 | "sock_test_client", |
| 569 | self.client_ipv6_uni_dir_nsock_test_args) |
| 570 | |
| 571 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 572 | def test_ldp_ipv6_cut_thru_bi_dir_nsock(self): |
| 573 | """ run LDP IPv6 cut thru bi-directional (multiple sockets) test """ |
| 574 | |
| 575 | self.timeout = self.client_bi_dir_nsock_timeout |
| 576 | self.cut_thru_test("sock_test_server", self.server_ipv6_args, |
| 577 | "sock_test_client", |
| 578 | self.client_ipv6_bi_dir_nsock_test_args) |
| 579 | |
| 580 | def test_vcl_ipv6_cut_thru_echo(self): |
| 581 | """ run VCL IPv6 cut thru echo test """ |
| 582 | |
| 583 | self.cut_thru_test("vcl_test_server", |
| 584 | self.server_ipv6_args, |
| 585 | "vcl_test_client", |
| 586 | self.client_ipv6_echo_test_args) |
| 587 | |
| 588 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 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 |
| 593 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 594 | "vcl_test_client", |
| 595 | self.client_ipv6_uni_dir_nsock_test_args) |
| 596 | |
| 597 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 598 | def test_vcl_ipv6_cut_thru_bi_dir_nsock(self): |
| 599 | """ run VCL IPv6 cut thru bi-directional (multiple sockets) test """ |
| 600 | |
| 601 | self.timeout = self.client_bi_dir_nsock_timeout |
| 602 | self.cut_thru_test("vcl_test_server", self.server_ipv6_args, |
| 603 | "vcl_test_client", |
| 604 | self.client_ipv6_bi_dir_nsock_test_args) |
| 605 | |
| 606 | |
| 607 | class VCLIpv6ThruHostStackTestCase(VCLTestCase): |
| 608 | """ VCL IPv6 Thru Host Stack Tests """ |
| 609 | |
| 610 | def setUp(self): |
| 611 | super(VCLIpv6ThruHostStackTestCase, self).setUp() |
| 612 | |
| 613 | self.thru_host_stack_ipv6_setup() |
| 614 | self.client_ipv6_echo_test_args = ["-6", "-E", self.echo_phrase, "-X", |
| 615 | self.loop0.local_ip6, |
| 616 | self.server_port] |
| 617 | |
| 618 | def tearDown(self): |
| 619 | self.thru_host_stack_ipv6_tear_down() |
| 620 | |
| 621 | super(VCLIpv6ThruHostStackTestCase, self).tearDown() |
| 622 | |
| 623 | def test_ldp_ipv6_thru_host_stack_echo(self): |
| 624 | """ run LDP IPv6 thru host stack echo test """ |
| 625 | |
| 626 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 627 | "sock_test_client", |
| 628 | self.client_ipv6_echo_test_args) |
| 629 | # TBD: Remove these when VPP thru host teardown config bug is fixed. |
| 630 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 631 | "vcl_test_client", |
| 632 | self.client_ipv6_echo_test_args) |
| 633 | |
| 634 | def test_vcl_ipv6_thru_host_stack_echo(self): |
| 635 | """ run VCL IPv6 thru host stack echo test """ |
| 636 | |
Keith Burns (alagalah) | 410bcca | 2018-03-23 13:42:49 -0700 | [diff] [blame] | 637 | # self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 638 | # "vcl_test_client", |
| 639 | # self.client_ipv6_echo_test_args) |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 640 | |
| 641 | # TBD: Remove VCLIpv6ThruHostStackExtended*TestCase classes and move |
| 642 | # tests here when VPP thru host teardown/setup config bug |
| 643 | # is fixed. |
| 644 | |
| 645 | |
| 646 | class VCLIpv6ThruHostStackExtendedATestCase(VCLTestCase): |
| 647 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 648 | |
| 649 | def setUp(self): |
| 650 | super(VCLIpv6ThruHostStackExtendedATestCase, self).setUp() |
| 651 | |
| 652 | self.thru_host_stack_ipv6_setup() |
| 653 | if self.vppDebug: |
| 654 | self.client_bi_dir_nsock_timeout = 120 |
| 655 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X", |
| 656 | self.loop0.local_ip6, |
| 657 | self.server_port] |
| 658 | else: |
| 659 | self.client_bi_dir_nsock_timeout = 90 |
| 660 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", |
| 661 | "2", "-B", "-X", |
| 662 | self.loop0.local_ip6, |
| 663 | self.server_port] |
| 664 | |
| 665 | def tearDown(self): |
| 666 | self.thru_host_stack_ipv6_tear_down() |
| 667 | |
| 668 | super(VCLIpv6ThruHostStackExtendedATestCase, self).tearDown() |
| 669 | |
| 670 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 671 | def test_vcl_thru_host_stack_bi_dir_nsock(self): |
| 672 | """ run VCL thru host stack bi-directional (multiple sockets) test """ |
| 673 | |
| 674 | self.timeout = self.client_bi_dir_nsock_timeout |
| 675 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 676 | "vcl_test_client", |
| 677 | self.client_ipv6_bi_dir_nsock_test_args) |
| 678 | |
| 679 | |
| 680 | class VCLIpv6ThruHostStackExtendedBTestCase(VCLTestCase): |
| 681 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 682 | |
| 683 | def setUp(self): |
| 684 | super(VCLIpv6ThruHostStackExtendedBTestCase, self).setUp() |
| 685 | |
| 686 | self.thru_host_stack_ipv6_setup() |
| 687 | if self.vppDebug: |
| 688 | self.client_bi_dir_nsock_timeout = 120 |
| 689 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-B", "-X", |
| 690 | self.loop0.local_ip6, |
| 691 | self.server_port] |
| 692 | else: |
| 693 | self.client_bi_dir_nsock_timeout = 60 |
| 694 | self.client_ipv6_bi_dir_nsock_test_args = ["-6", "-I", "2", |
| 695 | "-B", "-X", |
| 696 | self.loop0.local_ip6, |
| 697 | self.server_port] |
| 698 | |
| 699 | def tearDown(self): |
| 700 | self.thru_host_stack_ipv6_tear_down() |
| 701 | |
| 702 | super(VCLIpv6ThruHostStackExtendedBTestCase, self).tearDown() |
| 703 | |
| 704 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 705 | def test_ldp_thru_host_stack_bi_dir_nsock(self): |
| 706 | """ run LDP thru host stack bi-directional (multiple sockets) test """ |
| 707 | |
| 708 | self.timeout = self.client_bi_dir_nsock_timeout |
| 709 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 710 | "sock_test_client", |
| 711 | self.client_ipv6_bi_dir_nsock_test_args) |
| 712 | |
| 713 | |
| 714 | class VCLIpv6ThruHostStackExtendedCTestCase(VCLTestCase): |
| 715 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 716 | |
| 717 | def setUp(self): |
| 718 | super(VCLIpv6ThruHostStackExtendedCTestCase, self).setUp() |
| 719 | |
| 720 | self.thru_host_stack_ipv6_setup() |
| 721 | if self.vppDebug: |
| 722 | self.client_uni_dir_nsock_timeout = 120 |
| 723 | self.numSockets = "2" |
| 724 | else: |
| 725 | self.client_uni_dir_nsock_timeout = 120 |
| 726 | self.numSockets = "5" |
| 727 | |
| 728 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", |
| 729 | "-I", self.numSockets, |
| 730 | "-U", "-X", |
| 731 | self.loop0.local_ip6, |
| 732 | self.server_port] |
| 733 | |
| 734 | def tearDown(self): |
| 735 | self.thru_host_stack_ipv6_tear_down() |
| 736 | |
| 737 | super(VCLIpv6ThruHostStackExtendedCTestCase, self).tearDown() |
| 738 | |
| 739 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 740 | def test_ldp_thru_host_stack_uni_dir_nsock(self): |
| 741 | """ run LDP thru host stack uni-directional (multiple sockets) test """ |
| 742 | |
| 743 | self.timeout = self.client_uni_dir_nsock_timeout |
| 744 | self.thru_host_stack_test("sock_test_server", self.server_ipv6_args, |
| 745 | "sock_test_client", |
| 746 | self.client_ipv6_uni_dir_nsock_test_args) |
| 747 | |
| 748 | |
| 749 | class VCLIpv6ThruHostStackExtendedDTestCase(VCLTestCase): |
| 750 | """ VCL IPv6 Thru Host Stack Extended Tests """ |
| 751 | |
| 752 | def setUp(self): |
| 753 | super(VCLIpv6ThruHostStackExtendedDTestCase, self).setUp() |
| 754 | |
| 755 | self.thru_host_stack_ipv6_setup() |
| 756 | if self.vppDebug: |
| 757 | self.client_uni_dir_nsock_timeout = 120 |
| 758 | self.numSockets = "2" |
| 759 | else: |
| 760 | self.client_uni_dir_nsock_timeout = 120 |
| 761 | self.numSockets = "5" |
| 762 | |
| 763 | self.client_ipv6_uni_dir_nsock_test_args = ["-6", |
| 764 | "-I", self.numSockets, |
| 765 | "-U", "-X", |
| 766 | self.loop0.local_ip6, |
| 767 | self.server_port] |
| 768 | |
| 769 | def tearDown(self): |
| 770 | self.thru_host_stack_ipv6_tear_down() |
| 771 | |
| 772 | super(VCLIpv6ThruHostStackExtendedDTestCase, self).tearDown() |
| 773 | |
| 774 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
| 775 | def test_vcl_thru_host_stack_uni_dir_nsock(self): |
| 776 | """ run VCL thru host stack uni-directional (multiple sockets) test """ |
| 777 | |
| 778 | self.timeout = self.client_uni_dir_nsock_timeout |
| 779 | self.thru_host_stack_test("vcl_test_server", self.server_ipv6_args, |
| 780 | "vcl_test_client", |
| 781 | self.client_ipv6_uni_dir_nsock_test_args) |
| 782 | |
| 783 | |
| 784 | class VCLIpv6ThruHostStackIperfTestCase(VCLTestCase): |
| 785 | """ VCL IPv6 Thru Host Stack Iperf Tests """ |
| 786 | |
| 787 | def setUp(self): |
| 788 | super(VCLIpv6ThruHostStackIperfTestCase, self).setUp() |
| 789 | |
| 790 | self.thru_host_stack_ipv6_setup() |
| 791 | self.client_iperf3_timeout = 20 |
| 792 | self.client_ipv6_iperf3_args = ["-V6d", "-c", self.loop0.local_ip6] |
| 793 | self.server_ipv6_iperf3_args = ["-V6d", "-s"] |
| 794 | |
| 795 | def tearDown(self): |
| 796 | self.thru_host_stack_ipv6_tear_down() |
| 797 | |
| 798 | super(VCLIpv6ThruHostStackIperfTestCase, self).tearDown() |
| 799 | |
Florin Coras | 56b39f6 | 2018-03-27 17:29:32 -0700 | [diff] [blame] | 800 | @unittest.skipUnless(running_extended_tests(), "part of extended tests") |
Dave Wallace | de91006 | 2018-03-20 09:22:13 -0400 | [diff] [blame] | 801 | def test_ldp_thru_host_stack_iperf3(self): |
| 802 | """ run LDP thru host stack iperf3 test """ |
| 803 | |
| 804 | try: |
| 805 | subprocess.check_output(['iperf3', '-v']) |
| 806 | except: |
| 807 | self.logger.error("WARNING: 'iperf3' is not installed,") |
| 808 | self.logger.error( |
| 809 | " 'test_ldp_thru_host_stack_iperf3' not run!") |
| 810 | return |
| 811 | |
| 812 | self.timeout = self.client_iperf3_timeout |
| 813 | self.thru_host_stack_test("iperf3", self.server_ipv6_iperf3_args, |
| 814 | "iperf3", self.client_ipv6_iperf3_args) |
| 815 | |
| 816 | |
Dave Wallace | cfcf2f4 | 2018-02-16 18:31:56 -0500 | [diff] [blame] | 817 | if __name__ == '__main__': |
| 818 | unittest.main(testRunner=VppTestRunner) |