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