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